# HG changeset patch # User alistair # Date 1442863952 14400 # Node ID fa1b4fa5b4f844686440fa24b5444d77954c854d # Parent 72dc19d750ad34ef1eff21070314c273cd04b4e1 ADDED: Table for person/codex/witness constraint boxes, reset button (currently leaves previous constraints in the text box) FIXED: Text constraints are not applied if array left empty diff -r 72dc19d750ad -r fa1b4fa5b4f8 popoto/ismi.html --- a/popoto/ismi.html Mon Sep 07 23:51:47 2015 -0400 +++ b/popoto/ismi.html Mon Sep 21 15:32:32 2015 -0400 @@ -13,18 +13,66 @@
-
+
Graph search
- - -
- - + + + + + + + + + + + + + + + + +
Person ConstraintsCodex ConstraintsWitness Constraints
+ + + + + +
+ + + + + +
+ + + +
diff -r 72dc19d750ad -r fa1b4fa5b4f8 popoto/js/app-ismi.js --- a/popoto/js/app-ismi.js Mon Sep 07 23:51:47 2015 -0400 +++ b/popoto/js/app-ismi.js Mon Sep 21 15:32:32 2015 -0400 @@ -24,12 +24,34 @@ * * Uses the text box implementation currently */ - // TODO: finish textbox implementation as backup and add in dropdown menu implementation + // TODO: finish textbox implementation as backup + // have single filter button which on click sets constraints equal to d3.select("#constraintNUMBS)[0][0].value + // for a bunch of spots in the array + // will have to create only 1 d3.select + // the d3.select will need to know what constraints to pull from input boxes based on ids related to whether they + // are person/codex/witness/etc attributes and put them into the corresponding arrays + // personPredefinedConstraints codexPreDef var personPredefinedConstraints = []; +var codexPredefinedConstraints = []; +var witnessPredefinedConstraints = []; d3.select("#filter-button").on("click", function (d) { - var constraint = d3.select("#constraint")[0][0].value; + var person1 = d3.select("#person-constraint")[0][0].value; + var person2 = d3.select("#person-constraint2")[0][0].value; + + var codex1 = d3.select("#codex-constraint")[0][0].value; + var codex2 = d3.select("#codex-constraint2")[0][0].value; + + var witness1 = d3.select("#witness-constraint")[0][0].value; + var witness2 = d3.select("#witness-constraint2")[0][0].value; - personPredefinedConstraints = [constraint]; + if (person1.substring(person1.indexOf('"')+1,person1.lastIndexOf('"'))) personPredefinedConstraints.push(person1); + if (person2.substring(person2.indexOf('"')+1,person2.lastIndexOf('"'))) personPredefinedConstraints.push(person2); + + if (codex1.substring(codex1.indexOf('"')+1,codex1.lastIndexOf('"'))) codexPredefinedConstraints.push(codex1); + if (codex2.substring(codex2.indexOf('"')+1,codex2.lastIndexOf('"'))) codexPredefinedConstraints.push(codex2); + + if (witness1.substring(witness1.indexOf('"')+1,witness1.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness1); + if (witness2.substring(witness2.indexOf('"')+1,witness2.lastIndexOf('"'))) witnessPredefinedConstraints.push(witness2); // Recreate taxonomies panel d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); @@ -38,10 +60,10 @@ popoto.tools.reset(); }); -d3.select("#filter-button2").on("click", function (d) { - var constraint = d3.select("#constraint2")[0][0].value; - - personPredefinedConstraints = [constraint]; +d3.select("#clear-button").on("click", function (d) { + personPredefinedConstraints = []; + codexPredefinedConstraints = []; + witnessPredefinedConstraints = []; // Recreate taxonomies panel d3.select("#" + popoto.taxonomy.containerId).selectAll("ul").data([]).exit().remove(); @@ -51,7 +73,6 @@ }); - /** * Define the Label provider you need for your application. * This configuration is mandatory and should contain at least all the labels you could find in your graph model. @@ -67,22 +88,22 @@ "CODEX": { "returnAttributes": ["label", "ismi_id", "identifier"], "displayAttribute": "label", - //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; - //}, + "getPredefinedConstraints": function (node) { + return codexPredefinedConstraints; + }, }, "WITNESS": { "returnAttributes": ["label", "ismi_id", "folios"], "displayAttribute": "label", - //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; - //}, + "getPredefinedConstraints": function (node) { + return witnessPredefinedConstraints; + }, }, "TEXT": { "returnAttributes": ["label", "full_title", "ismi_id"], "displayAttribute": "label", //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return textPredefinedConstraints; //}, }, "PERSON": { @@ -96,13 +117,13 @@ "returnAttributes": ["label", "ismi_id"], "displayAttribute": "label", //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return repositoryPredefinedConstraints; //}, }, "FLORUIT_DATE": { - "isSearchable": false + "isSearchable": false, //"getPredefinedConstraints": function (node) { - // return personPredefinedConstraints; + // return floruitPredefinedConstraints; //}, } };