diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.coffee | 34 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.js | 39 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait.html | 16 |
3 files changed, 42 insertions, 47 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee index e22f1c21..29489fb9 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee @@ -178,7 +178,8 @@ $ -> for own key, attribute_info of js_data.attribute_names sample_attributes[attribute_info.name] = attribute_info.distinct_values console.log("[visa] attributes is:", sample_attributes) - selected_attribute = $('#exclude_menu').val() + selected_attribute = $('#exclude_menu').val().replace("_", " ") + console.log("selected_attribute is:", selected_attribute) for value in sample_attributes[selected_attribute] $(create_value_dropdown(value)) .appendTo($('#attribute_values')) @@ -191,20 +192,27 @@ $ -> ##Block Samples By Attribute Value Code block_by_attribute_value = -> - console.log("in beginning of bbav code") attribute_name = $('#exclude_menu').val() - console.log("attribute_name is:", attribute_name) exclude_by_value = $('#attribute_values').val() - console.log("exclude_by_value is:", exclude_by_value) - sample_lists = js_data['sample_lists'] - console.log("sample_lists is:", sample_lists) - for sample_list in sample_lists - for sample in sample_list - console.log("sample is:", sample) - if sample.extra_attributes[attribute_name] == exclude_by_value - console.log("is exclude_by_value") - sample_row = $('') - + + cell_class = ".column_name-#{attribute_name}" + $(cell_class).each (index, element)=> + if $.trim($(element).text()) == exclude_by_value + row = $(element).parent('tr') + $(row).find(".trait_value_input").val("x") + + #sample_lists = js_data['sample_lists'] + #console.log("sample_lists is:", sample_lists) + #for sample_list in sample_lists + # for sample in sample_list + # console.log("sample is:", sample) + # if sample.extra_attributes[attribute_name] == exclude_by_value + # console.log("is exclude_by_value") + # console.log("sample.name is:", sample.name) + # attr_cell = $('td:contains('+sample.name+')').parent().find('td.column_name-'+ attribute_name) + # console.log("attr_cell is:", attr_cell) + # value_cell = attr_cell.parent().find('td.column_name-Value') + # value_cell.children('input').val("x") $('#exclude_group').click(block_by_attribute_value) diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 65440427..a5582519 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -211,7 +211,8 @@ sample_attributes[attribute_info.name] = attribute_info.distinct_values; } console.log("[visa] attributes is:", sample_attributes); - selected_attribute = $('#exclude_menu').val(); + selected_attribute = $('#exclude_menu').val().replace("_", " "); + console.log("selected_attribute is:", selected_attribute); _ref1 = sample_attributes[selected_attribute]; _results = []; for (_i = 0, _len = _ref1.length; _i < _len; _i++) { @@ -223,34 +224,18 @@ populate_sample_attributes_values_dropdown(); $('#exclude_menu').change(populate_sample_attributes_values_dropdown); block_by_attribute_value = function() { - var attribute_name, exclude_by_value, sample, sample_list, sample_lists, sample_row, _i, _len, _results; - console.log("in beginning of bbav code"); + var attribute_name, cell_class, exclude_by_value, + _this = this; attribute_name = $('#exclude_menu').val(); - console.log("attribute_name is:", attribute_name); exclude_by_value = $('#attribute_values').val(); - console.log("exclude_by_value is:", exclude_by_value); - sample_lists = js_data['sample_lists']; - console.log("sample_lists is:", sample_lists); - _results = []; - for (_i = 0, _len = sample_lists.length; _i < _len; _i++) { - sample_list = sample_lists[_i]; - _results.push((function() { - var _j, _len1, _results1; - _results1 = []; - for (_j = 0, _len1 = sample_list.length; _j < _len1; _j++) { - sample = sample_list[_j]; - console.log("sample is:", sample); - if (sample.extra_attributes[attribute_name] === exclude_by_value) { - console.log("is exclude_by_value"); - _results1.push(sample_row = $('')); - } else { - _results1.push(void 0); - } - } - return _results1; - })()); - } - return _results; + cell_class = ".column_name-" + attribute_name; + return $(cell_class).each(function(index, element) { + var row; + if ($.trim($(element).text()) === exclude_by_value) { + row = $(element).parent('tr'); + return $(row).find(".trait_value_input").val("x"); + } + }); }; $('#exclude_group').click(block_by_attribute_value); console.log("before registering show_hide_outliers"); diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 0ef86685..f85cf98e 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -1229,10 +1229,11 @@ <br> {% if sample_groups[0].attributes %} - <strong> Block samples by index: </strong> + <strong> Block samples by group: </strong> <select id="exclude_menu" size=1> {% for attribute in sample_groups[0].attributes %} - <option value="{{ sample_groups[0].attributes[attribute].name }}">{{ sample_groups[0].attributes[attribute].name }}</option> + <option value="{{ sample_groups[0].attributes[attribute].name.replace(' ', '_') }}"> + {{ sample_groups[0].attributes[attribute].name }}</option> {% endfor %} </select> <select id="attribute_values" size=1> @@ -1293,21 +1294,21 @@ {% for sample in sample_type.sample_list %} <tr class="{{ sample.class_outlier }} value_se" id="{{ sample.this_id }}"> - <td class="std_cell" data-column_name="Index" align="right" width="45"> + <td class="std_cell column_name-Index" align="right" width="45"> {{ loop.index }} <input type="checkbox" name="selectCheck" class="checkbox edit_sample_checkbox" value="{{ sample.name }}" checked="checked"> </td> - <td class="std_cell" data-column_name="Sample" align="right" width="100"> + <td class="std_cell column_name-Sample" align="right" width="100"> <span class="fs14 fwn ffl edit_sample_sample_name"> {{ sample.name }} </span> </td> {# Todo: Add IDs #} - <td class="std_cell" data-column_name="Value" align="right" width="70"> + <td class="std_cell column_name-Value" align="right" width="70"> <input type="text" name="{{ sample.name }}" class="trait_value_input edit_sample_value" value="{{ sample.display_value }}" size="8" maxlength="8" @@ -1320,7 +1321,7 @@ </td> {# Todo: Add IDs #} - <td class="std_cell" data-column_name="SE" align="right" width="80"> + <td class="std_cell column_name-SE" align="right" width="80"> <input type="text" name=""{{ 'V' + sample.name}}" class="trait_value_input edit_sample_se" value="{{ sample.display_variance }}" @@ -1330,7 +1331,8 @@ {# Loop through each attribute type and input value #} {% for attribute in sample_type.attributes|sort() %} - <td class="std_cell" data-column_name="{{ sample_type.attributes[attribute].name }}" align="right" width="80"> + <td class="std_cell column_name-{{ sample_type.attributes[attribute].name.replace(' ', '_') }}" + align="right" width="80"> {{ sample.extra_attributes[sample_type.attributes[attribute].name] }} </td> {% endfor %} |