diff --git a/js/menus/DNAExportMenuView.js b/js/menus/DNAExportMenuView.js index 2581d0dd49c13e895f14b9f88b5691cdad49ee00..a30bd0671e29d85b6d141df518fbe0fca7870119 100644 --- a/js/menus/DNAExportMenuView.js +++ b/js/menus/DNAExportMenuView.js @@ -3,18 +3,20 @@ */ -define(['jquery', 'underscore', 'menuParent', 'dnaExport', 'text!menus/templates/DNAExportMenuView.html'], - function($, _, MenuParentView, dnaExport, template){ +define(['jquery', 'underscore', 'menuParent', 'dnaExport', 'lattice', 'text!menus/templates/DNAExportMenuView.html'], + function($, _, MenuParentView, dnaExport, lattice, template){ return MenuParentView.extend({ events: { - "click #saveSequences": "_saveToFile" + "click #saveSequences": "_saveToFile", + "click #calcSequences": "_calcSequences" }, _initialize: function(){ + this.listenTo(dnaExport, "change", this.render); }, _saveToFile: function(e){ @@ -22,8 +24,13 @@ define(['jquery', 'underscore', 'menuParent', 'dnaExport', 'text!menus/templates dnaExport.save(); }, + _calcSequences: function(e){ + e.preventDefault(); + dnaExport.generateSequences(); + }, + _makeTemplateJSON: function(){ - return dnaExport.toJSON(); + return _.extend(dnaExport.toJSON(), lattice.toJSON()); }, template: _.template(template) diff --git a/js/menus/templates/DNAExportMenuView.html b/js/menus/templates/DNAExportMenuView.html index eca849755b48ec224c5879033542df191cf3bdcd..0c4ad7110b976d818968e4a9412fce03867f2dc0 100644 --- a/js/menus/templates/DNAExportMenuView.html +++ b/js/menus/templates/DNAExportMenuView.html @@ -1,3 +1,8 @@ +<% if(sequence32.length + sequence16.length != numCells){ %> + <div class="inlineWarning"> + The number of sequences calculated does not match the number of cells in your assembly. Switch to part type "DNA" and then hit "Re-Calc Sequences" to fix this. + </div> +<% } %> <% if(sequence32.length > 0){ %> 32bp sequences:<br/> <div class="sequenceOutput"> @@ -18,4 +23,5 @@ <% } else { %> no 16bp sequences<br/> <% } %><br/> +<a href="#" id="calcSequences" class="btn btn-block btn-lg btn-default">(Re)-Calc Sequences</a><br/> <a href="#" id="saveSequences" class="btn btn-block btn-lg btn-success">Save to File</a><br/>