From ce3364aad83938f1d84234aef6f4a19277637116 Mon Sep 17 00:00:00 2001 From: Sam Ockman Date: Sat, 21 Jul 2012 19:39:31 -0400 Subject: checkpoint --- wqflask/wqflask/show_trait/DataEditingPage.py | 12 ++++++--- .../new/javascript/trait_data_and_analysis.coffee | 20 +++++++++------ .../new/javascript/trait_data_and_analysis.js | 29 ++++++++++++++++------ 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/wqflask/wqflask/show_trait/DataEditingPage.py b/wqflask/wqflask/show_trait/DataEditingPage.py index 610124ae..68de5ae4 100755 --- a/wqflask/wqflask/show_trait/DataEditingPage.py +++ b/wqflask/wqflask/show_trait/DataEditingPage.py @@ -227,9 +227,15 @@ class DataEditingPage(templatePage): # """) self.basic_table['columns'] = yaml.load(""" - - All Cases - - BXD Only - - Non-BXD Only + - + n: All Cases + t: all + - + n: BXD Only + t: primary + - + n: Non-BXD Only + t: other """) print(pf(self.basic_table)) diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee index 2c912f05..1f59788c 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.coffee @@ -58,8 +58,9 @@ $ -> make_table = -> header = " " for column in basic_table['columns'] - the_id = process_id("column_" + column) - header += """#{ column }""" + console.log("column:", column) + the_id = process_id("column", column.t) + header += """#{ column.n }""" header += "" rows = [ @@ -90,7 +91,7 @@ $ -> row_line += """#{ row.pretty }""" for column in basic_table['columns'] console.log("apple:", column) - the_id = process_id(column + "_" + row.vn) + the_id = process_id(column.t, row.vn) console.log("the_id:", the_id) row_line += """ """ row_line += """""" @@ -103,11 +104,16 @@ $ -> - process_id = (value) -> + process_id = (values...) -> ### Make an id or a class valid javascript by, for example, eliminating spaces ### - console.log("value:", value) - value = value.replace(" ", "_") - return value + processed = "" + for value in values + console.log("value:", value) + value = value.replace(" ", "_") + if processed.length + processed += ":" + processed += value + return processed $('#primary').change(edit_data_change) console.log("loaded") diff --git a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js index c288f11f..e9a141a3 100644 --- a/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js +++ b/wqflask/wqflask/static/new/javascript/trait_data_and_analysis.js @@ -1,6 +1,7 @@ // Generated by CoffeeScript 1.3.3 (function() { - var isNumber; + var isNumber, + __slice = [].slice; console.log("start_b"); @@ -73,8 +74,9 @@ _ref = basic_table['columns']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { column = _ref[_i]; - the_id = process_id("column_" + column); - header += "" + column + ""; + console.log("column:", column); + the_id = process_id("column", column.t); + header += "" + column.n + ""; } header += ""; rows = [ @@ -104,7 +106,7 @@ for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) { column = _ref1[_k]; console.log("apple:", column); - the_id = process_id(column + "_" + row.vn); + the_id = process_id(column.t, row.vn); console.log("the_id:", the_id); row_line += " "; } @@ -117,12 +119,23 @@ console.log("table is:", table); return $("#stats_table").append(table); }; - process_id = function(value) { + process_id = function() { + var processed, value, values, _i, _len; + values = 1 <= arguments.length ? __slice.call(arguments, 0) : []; /* Make an id or a class valid javascript by, for example, eliminating spaces */ - console.log("value:", value); - value = value.replace(" ", "_"); - return value; + + processed = ""; + for (_i = 0, _len = values.length; _i < _len; _i++) { + value = values[_i]; + console.log("value:", value); + value = value.replace(" ", "_"); + if (processed.length) { + processed += ":"; + } + processed += value; + } + return processed; }; $('#primary').change(edit_data_change); console.log("loaded"); -- cgit v1.2.3