galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
February 2015
- 2 participants
- 305 discussions
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/cd41c43e857f/
Changeset: cd41c43e857f
User: guerler
Date: 2015-02-10 22:09:13+00:00
Summary: Ui: Update options
Affected #: 3 files
diff -r 82f66cc8b9dc6e68174a23513191c1218299a76a -r cd41c43e857f7db0d21a093f0d59ce8bf82a049e client/galaxy/scripts/mvc/ui/ui-options.js
--- a/client/galaxy/scripts/mvc/ui/ui-options.js
+++ b/client/galaxy/scripts/mvc/ui/ui-options.js
@@ -94,9 +94,6 @@
self._change();
});
- // refresh
- this._refresh();
-
// set previous value
this.value(current);
},
@@ -120,6 +117,9 @@
};
}
+ // refresh
+ this._refresh();
+
// get and return value
return this._getValue();
},
@@ -163,13 +163,13 @@
if (this._size() == 0) {
this._messageShow(this.options.wait_text, 'info');
this.$options.hide();
+ this.$menu.hide();
}
},
/** Hide wait message
*/
unwait: function() {
- this._messageHide();
this._refresh();
},
@@ -179,6 +179,22 @@
if (this.options.onchange) {
this.options.onchange(this._getValue());
}
+ },
+
+ /** Refresh options view
+ */
+ _refresh: function() {
+ // show/hide messages
+ if (this._size() == 0) {
+ this._messageShow(this.options.error_text, 'danger');
+ this.$options.hide();
+ this.$menu.hide();
+ } else {
+ this._messageHide();
+ this.$options.css('display', 'inline-block');
+ this.$menu.show();
+ }
+ // refresh select/unselect button
if (this.select_button) {
var total = this._size();
var value = this._getValue();
@@ -194,20 +210,6 @@
}
},
- /** Refresh options view
- */
- _refresh: function() {
- if (this._size() == 0) {
- this._messageShow(this.options.error_text, 'danger');
- this.$options.hide();
- this.$menu.hide();
- } else {
- this._messageHide();
- this.$options.css('display', 'inline-block');
- this.$menu.show();
- }
- },
-
/** Return current selection
*/
_getValue: function() {
diff -r 82f66cc8b9dc6e68174a23513191c1218299a76a -r cd41c43e857f7db0d21a093f0d59ce8bf82a049e static/scripts/mvc/ui/ui-options.js
--- a/static/scripts/mvc/ui/ui-options.js
+++ b/static/scripts/mvc/ui/ui-options.js
@@ -94,9 +94,6 @@
self._change();
});
- // refresh
- this._refresh();
-
// set previous value
this.value(current);
},
@@ -120,6 +117,9 @@
};
}
+ // refresh
+ this._refresh();
+
// get and return value
return this._getValue();
},
@@ -163,13 +163,13 @@
if (this._size() == 0) {
this._messageShow(this.options.wait_text, 'info');
this.$options.hide();
+ this.$menu.hide();
}
},
/** Hide wait message
*/
unwait: function() {
- this._messageHide();
this._refresh();
},
@@ -179,6 +179,22 @@
if (this.options.onchange) {
this.options.onchange(this._getValue());
}
+ },
+
+ /** Refresh options view
+ */
+ _refresh: function() {
+ // show/hide messages
+ if (this._size() == 0) {
+ this._messageShow(this.options.error_text, 'danger');
+ this.$options.hide();
+ this.$menu.hide();
+ } else {
+ this._messageHide();
+ this.$options.css('display', 'inline-block');
+ this.$menu.show();
+ }
+ // refresh select/unselect button
if (this.select_button) {
var total = this._size();
var value = this._getValue();
@@ -194,20 +210,6 @@
}
},
- /** Refresh options view
- */
- _refresh: function() {
- if (this._size() == 0) {
- this._messageShow(this.options.error_text, 'danger');
- this.$options.hide();
- this.$menu.hide();
- } else {
- this._messageHide();
- this.$options.css('display', 'inline-block');
- this.$menu.show();
- }
- },
-
/** Return current selection
*/
_getValue: function() {
diff -r 82f66cc8b9dc6e68174a23513191c1218299a76a -r cd41c43e857f7db0d21a093f0d59ce8bf82a049e static/scripts/packed/mvc/ui/ui-options.js
--- a/static/scripts/packed/mvc/ui/ui-options.js
+++ b/static/scripts/packed/mvc/ui/ui-options.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-button-check"],function(c,e){var b=Backbone.View.extend({initialize:function(i){this.optionsDefault={visible:true,data:[],id:c.uuid(),error_text:"No data available.",wait_text:"Please wait...",multiple:false};this.options=c.merge(i,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(i));this.$menu=$('<div class="ui-options-menu"/>');this.$el.append(this.$message);this.$el.append(this.$menu);this.$el.append(this.$options);if(this.options.multiple){this.select_button=new e({onclick:function(){h.$("input").prop("checked",h.select_button.value()!==0);h._change()}});this.$menu.addClass("ui-margin-bottom");this.$menu.append(this.select_button.$el);this.$menu.append("Select/Unselect all")}if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var h=this;this.on("change",function(){h._change()})},update:function(i){var l=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(i))}else{for(var j in i){var k=$(this._templateOption(i[j]));k.addClass("ui-option");k.tooltip({title:i[j].tooltip,placement:"bottom"});this.$options.append(k)}}var h=this;this.$("input").on("change",function(){h.value(h._getValue());h._change()});this._refresh();this.value(l)},value:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}this.$("input").prop("checked",false);for(var h in j){this.$('input[value="'+j[h]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}for(var h in j){if(this.$('input[value="'+j[h]+'"]').length>0){return true}}}return false},first:function(){var h=this.$("input");if(h.length>0){return h.val()}else{return undefined}},validate:function(){return c.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}if(this.select_button){var h=this._size();var i=this._getValue();if(!(i instanceof Array)){this.select_button.value(0)}else{if(i.length!==h){this.select_button.value(1)}else{this.select_button.value(2)}}}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide();this.$menu.hide()}else{this._messageHide();this.$options.css("display","inline-block");this.$menu.show()}},_getValue:function(){var i=this.$(":checked");if(i.length==0){return"__null__"}if(this.options.multiple){var h=[];i.each(function(){h.push($(this).val())});return h}else{return i.val()}},_size:function(){return this.$(".ui-option").length},_messageShow:function(i,h){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+h);this.$message.html(i)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-list"/>'}});var a=b.extend({_templateOption:function(h){var i=c.uuid();return'<div class="ui-option"><input id="'+i+'" type="'+this.options.type+'" name="'+this.options.id+'" value="'+h.value+'"/><label class="ui-options-label" for="'+i+'">'+h.label+"</label></div>"}});var f={};f.View=a.extend({initialize:function(h){h.type="radio";a.prototype.initialize.call(this,h)}});var d={};d.View=a.extend({initialize:function(h){h.multiple=true;h.type="checkbox";a.prototype.initialize.call(this,h)}});var g={};g.View=b.extend({initialize:function(h){b.prototype.initialize.call(this,h)},value:function(h){if(h!==undefined){this.$("input").prop("checked",false);this.$("label").removeClass("active");this.$('[value="'+h+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(j){var h="fa "+j.icon;if(!j.label){h+=" no-padding"}var i='<label class="btn btn-default">';if(j.icon){i+='<i class="'+h+'"/>'}i+='<input type="radio" name="'+this.options.id+'" value="'+j.value+'"/>';if(j.label){i+=j.label}i+="</label>";return i},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:b,BaseIcons:a,Radio:f,RadioButton:g,Checkbox:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-button-check"],function(c,e){var b=Backbone.View.extend({initialize:function(i){this.optionsDefault={visible:true,data:[],id:c.uuid(),error_text:"No data available.",wait_text:"Please wait...",multiple:false};this.options=c.merge(i,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(i));this.$menu=$('<div class="ui-options-menu"/>');this.$el.append(this.$message);this.$el.append(this.$menu);this.$el.append(this.$options);if(this.options.multiple){this.select_button=new e({onclick:function(){h.$("input").prop("checked",h.select_button.value()!==0);h._change()}});this.$menu.addClass("ui-margin-bottom");this.$menu.append(this.select_button.$el);this.$menu.append("Select/Unselect all")}if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var h=this;this.on("change",function(){h._change()})},update:function(i){var l=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(i))}else{for(var j in i){var k=$(this._templateOption(i[j]));k.addClass("ui-option");k.tooltip({title:i[j].tooltip,placement:"bottom"});this.$options.append(k)}}var h=this;this.$("input").on("change",function(){h.value(h._getValue());h._change()});this.value(l)},value:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}this.$("input").prop("checked",false);for(var h in j){this.$('input[value="'+j[h]+'"]').first().prop("checked",true)}}this._refresh();return this._getValue()},exists:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}for(var h in j){if(this.$('input[value="'+j[h]+'"]').length>0){return true}}}return false},first:function(){var h=this.$("input");if(h.length>0){return h.val()}else{return undefined}},validate:function(){return c.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide();this.$menu.hide()}},unwait:function(){this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide();this.$menu.hide()}else{this._messageHide();this.$options.css("display","inline-block");this.$menu.show()}if(this.select_button){var h=this._size();var i=this._getValue();if(!(i instanceof Array)){this.select_button.value(0)}else{if(i.length!==h){this.select_button.value(1)}else{this.select_button.value(2)}}}},_getValue:function(){var i=this.$(":checked");if(i.length==0){return"__null__"}if(this.options.multiple){var h=[];i.each(function(){h.push($(this).val())});return h}else{return i.val()}},_size:function(){return this.$(".ui-option").length},_messageShow:function(i,h){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+h);this.$message.html(i)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-list"/>'}});var a=b.extend({_templateOption:function(h){var i=c.uuid();return'<div class="ui-option"><input id="'+i+'" type="'+this.options.type+'" name="'+this.options.id+'" value="'+h.value+'"/><label class="ui-options-label" for="'+i+'">'+h.label+"</label></div>"}});var f={};f.View=a.extend({initialize:function(h){h.type="radio";a.prototype.initialize.call(this,h)}});var d={};d.View=a.extend({initialize:function(h){h.multiple=true;h.type="checkbox";a.prototype.initialize.call(this,h)}});var g={};g.View=b.extend({initialize:function(h){b.prototype.initialize.call(this,h)},value:function(h){if(h!==undefined){this.$("input").prop("checked",false);this.$("label").removeClass("active");this.$('[value="'+h+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(j){var h="fa "+j.icon;if(!j.label){h+=" no-padding"}var i='<label class="btn btn-default">';if(j.icon){i+='<i class="'+h+'"/>'}i+='<input type="radio" name="'+this.options.id+'" value="'+j.value+'"/>';if(j.label){i+=j.label}i+="</label>";return i},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:b,BaseIcons:a,Radio:f,RadioButton:g,Checkbox:d}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Remove unused variable
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/82f66cc8b9dc/
Changeset: 82f66cc8b9dc
User: guerler
Date: 2015-02-10 21:36:35+00:00
Summary: ToolForm: Remove unused variable
Affected #: 3 files
diff -r 16593d9d24fe952789835895c532ad246df4346b -r 82f66cc8b9dc6e68174a23513191c1218299a76a client/galaxy/scripts/mvc/ui/ui-options.js
--- a/client/galaxy/scripts/mvc/ui/ui-options.js
+++ b/client/galaxy/scripts/mvc/ui/ui-options.js
@@ -176,9 +176,8 @@
/** Trigger custom onchange callback function
*/
_change: function() {
- var current = this._getValue();
if (this.options.onchange) {
- this.options.onchange(current);
+ this.options.onchange(this._getValue());
}
if (this.select_button) {
var total = this._size();
diff -r 16593d9d24fe952789835895c532ad246df4346b -r 82f66cc8b9dc6e68174a23513191c1218299a76a static/scripts/mvc/ui/ui-options.js
--- a/static/scripts/mvc/ui/ui-options.js
+++ b/static/scripts/mvc/ui/ui-options.js
@@ -176,9 +176,8 @@
/** Trigger custom onchange callback function
*/
_change: function() {
- var current = this._getValue();
if (this.options.onchange) {
- this.options.onchange(current);
+ this.options.onchange(this._getValue());
}
if (this.select_button) {
var total = this._size();
diff -r 16593d9d24fe952789835895c532ad246df4346b -r 82f66cc8b9dc6e68174a23513191c1218299a76a static/scripts/packed/mvc/ui/ui-options.js
--- a/static/scripts/packed/mvc/ui/ui-options.js
+++ b/static/scripts/packed/mvc/ui/ui-options.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-button-check"],function(c,e){var b=Backbone.View.extend({initialize:function(i){this.optionsDefault={visible:true,data:[],id:c.uuid(),error_text:"No data available.",wait_text:"Please wait...",multiple:false};this.options=c.merge(i,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(i));this.$menu=$('<div class="ui-options-menu"/>');this.$el.append(this.$message);this.$el.append(this.$menu);this.$el.append(this.$options);if(this.options.multiple){this.select_button=new e({onclick:function(){h.$("input").prop("checked",h.select_button.value()!==0);h._change()}});this.$menu.addClass("ui-margin-bottom");this.$menu.append(this.select_button.$el);this.$menu.append("Select/Unselect all")}if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var h=this;this.on("change",function(){h._change()})},update:function(i){var l=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(i))}else{for(var j in i){var k=$(this._templateOption(i[j]));k.addClass("ui-option");k.tooltip({title:i[j].tooltip,placement:"bottom"});this.$options.append(k)}}var h=this;this.$("input").on("change",function(){h.value(h._getValue());h._change()});this._refresh();this.value(l)},value:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}this.$("input").prop("checked",false);for(var h in j){this.$('input[value="'+j[h]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}for(var h in j){if(this.$('input[value="'+j[h]+'"]').length>0){return true}}}return false},first:function(){var h=this.$("input");if(h.length>0){return h.val()}else{return undefined}},validate:function(){return c.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){var j=this._getValue();if(this.options.onchange){this.options.onchange(j)}if(this.select_button){var h=this._size();var i=this._getValue();if(!(i instanceof Array)){this.select_button.value(0)}else{if(i.length!==h){this.select_button.value(1)}else{this.select_button.value(2)}}}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide();this.$menu.hide()}else{this._messageHide();this.$options.css("display","inline-block");this.$menu.show()}},_getValue:function(){var i=this.$(":checked");if(i.length==0){return"__null__"}if(this.options.multiple){var h=[];i.each(function(){h.push($(this).val())});return h}else{return i.val()}},_size:function(){return this.$(".ui-option").length},_messageShow:function(i,h){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+h);this.$message.html(i)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-list"/>'}});var a=b.extend({_templateOption:function(h){var i=c.uuid();return'<div class="ui-option"><input id="'+i+'" type="'+this.options.type+'" name="'+this.options.id+'" value="'+h.value+'"/><label class="ui-options-label" for="'+i+'">'+h.label+"</label></div>"}});var f={};f.View=a.extend({initialize:function(h){h.type="radio";a.prototype.initialize.call(this,h)}});var d={};d.View=a.extend({initialize:function(h){h.multiple=true;h.type="checkbox";a.prototype.initialize.call(this,h)}});var g={};g.View=b.extend({initialize:function(h){b.prototype.initialize.call(this,h)},value:function(h){if(h!==undefined){this.$("input").prop("checked",false);this.$("label").removeClass("active");this.$('[value="'+h+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(j){var h="fa "+j.icon;if(!j.label){h+=" no-padding"}var i='<label class="btn btn-default">';if(j.icon){i+='<i class="'+h+'"/>'}i+='<input type="radio" name="'+this.options.id+'" value="'+j.value+'"/>';if(j.label){i+=j.label}i+="</label>";return i},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:b,BaseIcons:a,Radio:f,RadioButton:g,Checkbox:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-button-check"],function(c,e){var b=Backbone.View.extend({initialize:function(i){this.optionsDefault={visible:true,data:[],id:c.uuid(),error_text:"No data available.",wait_text:"Please wait...",multiple:false};this.options=c.merge(i,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(i));this.$menu=$('<div class="ui-options-menu"/>');this.$el.append(this.$message);this.$el.append(this.$menu);this.$el.append(this.$options);if(this.options.multiple){this.select_button=new e({onclick:function(){h.$("input").prop("checked",h.select_button.value()!==0);h._change()}});this.$menu.addClass("ui-margin-bottom");this.$menu.append(this.select_button.$el);this.$menu.append("Select/Unselect all")}if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var h=this;this.on("change",function(){h._change()})},update:function(i){var l=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(i))}else{for(var j in i){var k=$(this._templateOption(i[j]));k.addClass("ui-option");k.tooltip({title:i[j].tooltip,placement:"bottom"});this.$options.append(k)}}var h=this;this.$("input").on("change",function(){h.value(h._getValue());h._change()});this._refresh();this.value(l)},value:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}this.$("input").prop("checked",false);for(var h in j){this.$('input[value="'+j[h]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}for(var h in j){if(this.$('input[value="'+j[h]+'"]').length>0){return true}}}return false},first:function(){var h=this.$("input");if(h.length>0){return h.val()}else{return undefined}},validate:function(){return c.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}if(this.select_button){var h=this._size();var i=this._getValue();if(!(i instanceof Array)){this.select_button.value(0)}else{if(i.length!==h){this.select_button.value(1)}else{this.select_button.value(2)}}}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide();this.$menu.hide()}else{this._messageHide();this.$options.css("display","inline-block");this.$menu.show()}},_getValue:function(){var i=this.$(":checked");if(i.length==0){return"__null__"}if(this.options.multiple){var h=[];i.each(function(){h.push($(this).val())});return h}else{return i.val()}},_size:function(){return this.$(".ui-option").length},_messageShow:function(i,h){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+h);this.$message.html(i)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-list"/>'}});var a=b.extend({_templateOption:function(h){var i=c.uuid();return'<div class="ui-option"><input id="'+i+'" type="'+this.options.type+'" name="'+this.options.id+'" value="'+h.value+'"/><label class="ui-options-label" for="'+i+'">'+h.label+"</label></div>"}});var f={};f.View=a.extend({initialize:function(h){h.type="radio";a.prototype.initialize.call(this,h)}});var d={};d.View=a.extend({initialize:function(h){h.multiple=true;h.type="checkbox";a.prototype.initialize.call(this,h)}});var g={};g.View=b.extend({initialize:function(h){b.prototype.initialize.call(this,h)},value:function(h){if(h!==undefined){this.$("input").prop("checked",false);this.$("label").removeClass("active");this.$('[value="'+h+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(j){var h="fa "+j.icon;if(!j.label){h+=" no-padding"}var i='<label class="btn btn-default">';if(j.icon){i+='<i class="'+h+'"/>'}i+='<input type="radio" name="'+this.options.id+'" value="'+j.value+'"/>';if(j.label){i+=j.label}i+="</label>";return i},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:b,BaseIcons:a,Radio:f,RadioButton:g,Checkbox:d}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Add select/unselect fields, update styles
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/16593d9d24fe/
Changeset: 16593d9d24fe
User: guerler
Date: 2015-02-10 21:32:59+00:00
Summary: ToolForm: Add select/unselect fields, update styles
Affected #: 14 files
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b client/galaxy/scripts/mvc/ui/ui-button-check.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/ui/ui-button-check.js
@@ -0,0 +1,45 @@
+// dependencies
+define(['utils/utils'], function(Utils) {
+
+// plugin
+return Backbone.View.extend({
+
+ // default options
+ optionsDefault: {
+ icons : ['fa fa-square-o', 'fa fa-minus-square-o', 'fa fa-check-square-o'],
+ value : 0
+ },
+
+ // initialize
+ initialize : function(options) {
+ // configure options
+ this.options = Utils.merge(options, this.optionsDefault);
+
+ // create new element
+ this.setElement($('<div/>'));
+
+ // set initial value
+ this.value(this.options.value);
+
+ // add event handler
+ var self = this;
+ this.$el.on('click', function() {
+ self.current = (!self.current && 2) || 0;
+ self.value(self.current);
+ self.options.onclick && self.options.onclick();
+ });
+ },
+
+ // value
+ value : function (new_val) {
+ if (new_val !== undefined) {
+ this.current = new_val;
+ this.$el.removeClass()
+ .addClass('ui-checkbutton')
+ .addClass(this.options.icons[new_val]);
+ this.options.onchange && this.options.onchange(new_val);
+ }
+ return this.current;
+ }
+});
+});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b client/galaxy/scripts/mvc/ui/ui-drilldown.js
--- a/client/galaxy/scripts/mvc/ui/ui-drilldown.js
+++ b/client/galaxy/scripts/mvc/ui/ui-drilldown.js
@@ -4,28 +4,19 @@
/**
* This class creates/wraps a drill down element.
*/
-var View = Options.Base.extend({
+var View = Options.BaseIcons.extend({
// initialize
initialize: function(options) {
- this.display = options.display || 'checkbox';
- options.multiple = (this.display == 'checkbox');
- Options.Base.prototype.initialize.call(this, options);
+ options.type = options.display || 'checkbox';
+ options.multiple = (options.display == 'checkbox');
+ Options.BaseIcons.prototype.initialize.call(this, options);
},
-
- /** Template for input field
- */
- _templateOption: function(name, value, selected) {
- return '<div>' +
- '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + name +
- '<div/>';
- },
-
+
/** Template to create options tree
*/
_templateOptions: function(options) {
// link this
var self = this;
-
// attach show/hide event
function attachEvents($button, $subgroup) {
function setVisibility (visible) {
@@ -45,52 +36,58 @@
setVisibility(!$button.is_expanded);
});
}
-
+
// recursive function which iterates through options
function iterate ($tmpl, options) {
for (i in options) {
// current option level in hierarchy
var level = options[i];
-
+
// check for options
var has_options = level.options.length > 0;
-
+
// build template
var $group = $('<div/>');
if (has_options) {
// create button and add flag
- var $button = $('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');
-
+ var $button = $('<span class="ui-drilldown-button form-toggle icon-button toggle-expand"/>');
+
// add expand group
var $buttongroup = $('<div/>');
$buttongroup.append($button);
- $buttongroup.append(self._templateOption(level.name, level.value));
+ $buttongroup.append(self._templateOption({
+ label: level.name,
+ value: level.value
+ }));
$group.append($buttongroup);
-
+
// add sub group
var $subgroup = $('<div style="display: none; margin-left: 25px;"/>');
iterate($subgroup, level.options);
$group.append($subgroup);
-
+
// attach click event to collapse/expand hierarchy
attachEvents($button, $subgroup);
} else {
- $group.append(self._templateOption(level.name, level.value));
+ $group.append(self._templateOption({
+ label: level.name,
+ value: level.value
+ }));
}
$tmpl.append($group);
}
}
-
+
// iterate through options and create dom
var $tmpl = $('<div/>');
iterate($tmpl, options);
return $tmpl;
},
-
+
/** Template for drill down view
*/
_template: function(options) {
- return '<div class="ui-options-input drilldown-container" id="' + options.id + '"/>';
+ return '<div class="ui-options-list drilldown-container" id="' + options.id + '"/>';
}
});
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b client/galaxy/scripts/mvc/ui/ui-misc.js
--- a/client/galaxy/scripts/mvc/ui/ui-misc.js
+++ b/client/galaxy/scripts/mvc/ui/ui-misc.js
@@ -1,6 +1,13 @@
// dependencies
-define(['utils/utils', 'mvc/ui/ui-select-default', 'mvc/ui/ui-slider', 'mvc/ui/ui-options', 'mvc/ui/ui-drilldown', 'mvc/ui/ui-button-menu', 'mvc/ui/ui-modal'],
- function(Utils, Select, Slider, Options, Drilldown, ButtonMenu, Modal) {
+define(['utils/utils',
+ 'mvc/ui/ui-select-default',
+ 'mvc/ui/ui-slider',
+ 'mvc/ui/ui-options',
+ 'mvc/ui/ui-drilldown',
+ 'mvc/ui/ui-button-menu',
+ 'mvc/ui/ui-button-check',
+ 'mvc/ui/ui-modal'],
+ function(Utils, Select, Slider, Options, Drilldown, ButtonMenu, ButtonCheck, Modal) {
/**
* This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.
@@ -448,59 +455,12 @@
}
});
-// plugin
-var CheckButton = Backbone.View.extend({
-
- // default options
- optionsDefault: {
- class_add : 'fa fa-square-o',
- class_remove : 'fa fa-check-square-o',
- class_partial : 'fa fa-minus-square-o',
- value : false
- },
-
- // initialize
- initialize : function(options) {
- // configure options
- this.options = Utils.merge(options, this.optionsDefault);
-
- // create new element
- this.setElement($('<div/>'));
-
- // set initial value
- this.value(Boolean(this.options.value));
-
- // add event handler
- var self = this;
- this.$el.on('click', function() {
- self.value(!self.current);
- });
- },
-
- // value
- value : function (new_val) {
- if (new_val !== undefined) {
- this.current = new_val;
- if (new_val) {
- this.$el.removeClass()
- .addClass('ui-checkbutton')
- .addClass(this.options.class_remove);
- } else {
- this.$el.removeClass()
- .addClass('ui-checkbutton')
- .addClass(this.options.class_add);
- }
- this.options.onchange && this.options.onchange(new_val);
- }
- return this.current;
- }
-});
-
// return
return {
Anchor : Anchor,
Button : Button,
ButtonIcon : ButtonIcon,
+ ButtonCheck : ButtonCheck,
ButtonMenu : ButtonMenu,
Icon : Icon,
Image : Image,
@@ -511,7 +471,6 @@
RadioButton : Options.RadioButton,
Checkbox : Options.Checkbox,
Radio : Options.Radio,
- CheckButton : CheckButton,
Searchbox : Searchbox,
Select : Select,
Hidden : Hidden,
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b client/galaxy/scripts/mvc/ui/ui-options.js
--- a/client/galaxy/scripts/mvc/ui/ui-options.js
+++ b/client/galaxy/scripts/mvc/ui/ui-options.js
@@ -1,5 +1,5 @@
// dependencies
-define(['utils/utils'], function(Utils) {
+define(['utils/utils', 'mvc/ui/ui-button-check'], function(Utils, ButtonCheck) {
/** Base class for options based ui elements **/
var Base = Backbone.View.extend({
@@ -11,7 +11,8 @@
data : [],
id : Utils.uuid(),
error_text : 'No data available.',
- wait_text : 'Please wait...'
+ wait_text : 'Please wait...',
+ multiple : false
};
// configure options
@@ -21,13 +22,28 @@
this.setElement('<div class="ui-options"/>');
// create elements
- this.$message = $('<div/>');
- this.$options = $(this._template(options));
+ this.$message = $('<div/>');
+ this.$options = $(this._template(options));
+ this.$menu = $('<div class="ui-options-menu"/>');
// append
this.$el.append(this.$message);
+ this.$el.append(this.$menu);
this.$el.append(this.$options);
+ // add select/unselect all button
+ if (this.options.multiple) {
+ this.select_button = new ButtonCheck({
+ onclick: function() {
+ self.$('input').prop('checked', self.select_button.value() !== 0);
+ self._change();
+ }
+ });
+ this.$menu.addClass('ui-margin-bottom');
+ this.$menu.append(this.select_button.$el);
+ this.$menu.append('Select/Unselect all');
+ }
+
// hide input field
if (!this.options.visible) {
this.$el.hide();
@@ -73,7 +89,7 @@
// add change events
var self = this;
- this.$el.find('input').on('change', function() {
+ this.$('input').on('change', function() {
self.value(self._getValue());
self._change();
});
@@ -96,11 +112,11 @@
}
// reset selection
- this.$el.find('input').prop('checked', false);
+ this.$('input').prop('checked', false);
// update to new selection
for (var i in new_value) {
- this.$el.find('input[value="' + new_value[i] + '"]').first().prop('checked', true);
+ this.$('input[value="' + new_value[i] + '"]').first().prop('checked', true);
};
}
@@ -116,7 +132,7 @@
value = [value];
}
for (var i in value) {
- if (this.$el.find('input[value="' + value[i] + '"]').length > 0) {
+ if (this.$('input[value="' + value[i] + '"]').length > 0) {
return true;
}
}
@@ -127,7 +143,7 @@
/** Return first available option
*/
first: function() {
- var options = this.$el.find('input');
+ var options = this.$('input');
if (options.length > 0) {
return options.val();
} else {
@@ -160,8 +176,22 @@
/** Trigger custom onchange callback function
*/
_change: function() {
+ var current = this._getValue();
if (this.options.onchange) {
- this.options.onchange(this._getValue());
+ this.options.onchange(current);
+ }
+ if (this.select_button) {
+ var total = this._size();
+ var value = this._getValue();
+ if (!(value instanceof Array)) {
+ this.select_button.value(0);
+ } else {
+ if (value.length !== total) {
+ this.select_button.value(1);
+ } else {
+ this.select_button.value(2);
+ }
+ }
}
},
@@ -171,9 +201,11 @@
if (this._size() == 0) {
this._messageShow(this.options.error_text, 'danger');
this.$options.hide();
+ this.$menu.hide();
} else {
this._messageHide();
this.$options.css('display', 'inline-block');
+ this.$menu.show();
}
},
@@ -181,7 +213,7 @@
*/
_getValue: function() {
// get selected values
- var selected = this.$el.find(':checked');
+ var selected = this.$(':checked');
if (selected.length == 0) {
return '__null__';
}
@@ -201,7 +233,7 @@
/** Returns the number of options
*/
_size: function() {
- return this.$el.find('.ui-option').length;
+ return this.$('.ui-option').length;
},
/** Show message instead if options
@@ -222,42 +254,37 @@
/** Main template function
*/
_template: function() {
- return '<div class="ui-options-input"/>';
+ return '<div class="ui-options-list"/>';
+ }
+});
+
+/** Iconized **/
+var BaseIcons = Base.extend({
+ _templateOption: function(pair) {
+ var id = Utils.uuid();
+ return '<div class="ui-option">' +
+ '<input id="' + id + '" type="' + this.options.type + '" name="' + this.options.id + '" value="' + pair.value + '"/>' +
+ '<label class="ui-options-label" for="' + id + '">' + pair.label + '</label>' +
+ '</div>';
}
});
/** Radio button field **/
var Radio = {};
-Radio.View = Base.extend({
- // initialize
+Radio.View = BaseIcons.extend({
initialize: function(options) {
- Base.prototype.initialize.call(this, options);
- },
-
- /** Template for a single option
- */
- _templateOption: function(pair) {
- return '<div>' +
- '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '"/>' + pair.label + '<br>' +
- '</div>';
+ options.type = 'radio';
+ BaseIcons.prototype.initialize.call(this, options);
}
});
/** Checkbox options field **/
var Checkbox = {};
-Checkbox.View = Base.extend({
- // initialize
+Checkbox.View = BaseIcons.extend({
initialize: function(options) {
options.multiple = true;
- Base.prototype.initialize.call(this, options);
- },
-
- /** Template for a single option
- */
- _templateOption: function(pair) {
- return '<div>' +
- '<input type="checkbox" name="' + this.options.id + '" value="' + pair.value + '"/>' + pair.label + '<br>' +
- '</div>';
+ options.type = 'checkbox';
+ BaseIcons.prototype.initialize.call(this, options);
}
});
@@ -274,9 +301,9 @@
value: function (new_value) {
// set new value
if (new_value !== undefined) {
- this.$el.find('input').prop('checked', false);
- this.$el.find('label').removeClass('active');
- this.$el.find('[value="' + new_value + '"]').prop('checked', true).closest('label').addClass('active');
+ this.$('input').prop('checked', false);
+ this.$('label').removeClass('active');
+ this.$('[value="' + new_value + '"]').prop('checked', true).closest('label').addClass('active');
}
// get and return value
@@ -294,7 +321,7 @@
if (pair.icon) {
tmpl += '<i class="' + cls + '"/>';
}
- tmpl += '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '">';
+ tmpl += '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '"/>';
if (pair.label) {
tmpl += pair.label;
}
@@ -311,6 +338,7 @@
return {
Base : Base,
+ BaseIcons : BaseIcons,
Radio : Radio,
RadioButton : RadioButton,
Checkbox : Checkbox
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/mvc/ui/ui-button-check.js
--- /dev/null
+++ b/static/scripts/mvc/ui/ui-button-check.js
@@ -0,0 +1,45 @@
+// dependencies
+define(['utils/utils'], function(Utils) {
+
+// plugin
+return Backbone.View.extend({
+
+ // default options
+ optionsDefault: {
+ icons : ['fa fa-square-o', 'fa fa-minus-square-o', 'fa fa-check-square-o'],
+ value : 0
+ },
+
+ // initialize
+ initialize : function(options) {
+ // configure options
+ this.options = Utils.merge(options, this.optionsDefault);
+
+ // create new element
+ this.setElement($('<div/>'));
+
+ // set initial value
+ this.value(this.options.value);
+
+ // add event handler
+ var self = this;
+ this.$el.on('click', function() {
+ self.current = (!self.current && 2) || 0;
+ self.value(self.current);
+ self.options.onclick && self.options.onclick();
+ });
+ },
+
+ // value
+ value : function (new_val) {
+ if (new_val !== undefined) {
+ this.current = new_val;
+ this.$el.removeClass()
+ .addClass('ui-checkbutton')
+ .addClass(this.options.icons[new_val]);
+ this.options.onchange && this.options.onchange(new_val);
+ }
+ return this.current;
+ }
+});
+});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/mvc/ui/ui-drilldown.js
--- a/static/scripts/mvc/ui/ui-drilldown.js
+++ b/static/scripts/mvc/ui/ui-drilldown.js
@@ -4,28 +4,19 @@
/**
* This class creates/wraps a drill down element.
*/
-var View = Options.Base.extend({
+var View = Options.BaseIcons.extend({
// initialize
initialize: function(options) {
- this.display = options.display || 'checkbox';
- options.multiple = (this.display == 'checkbox');
- Options.Base.prototype.initialize.call(this, options);
+ options.type = options.display || 'checkbox';
+ options.multiple = (options.display == 'checkbox');
+ Options.BaseIcons.prototype.initialize.call(this, options);
},
-
- /** Template for input field
- */
- _templateOption: function(name, value, selected) {
- return '<div>' +
- '<input name="' + this.options.id + '" class="ui-option" type="' + this.display + '" value="' + value + '">' + name +
- '<div/>';
- },
-
+
/** Template to create options tree
*/
_templateOptions: function(options) {
// link this
var self = this;
-
// attach show/hide event
function attachEvents($button, $subgroup) {
function setVisibility (visible) {
@@ -45,52 +36,58 @@
setVisibility(!$button.is_expanded);
});
}
-
+
// recursive function which iterates through options
function iterate ($tmpl, options) {
for (i in options) {
// current option level in hierarchy
var level = options[i];
-
+
// check for options
var has_options = level.options.length > 0;
-
+
// build template
var $group = $('<div/>');
if (has_options) {
// create button and add flag
- var $button = $('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');
-
+ var $button = $('<span class="ui-drilldown-button form-toggle icon-button toggle-expand"/>');
+
// add expand group
var $buttongroup = $('<div/>');
$buttongroup.append($button);
- $buttongroup.append(self._templateOption(level.name, level.value));
+ $buttongroup.append(self._templateOption({
+ label: level.name,
+ value: level.value
+ }));
$group.append($buttongroup);
-
+
// add sub group
var $subgroup = $('<div style="display: none; margin-left: 25px;"/>');
iterate($subgroup, level.options);
$group.append($subgroup);
-
+
// attach click event to collapse/expand hierarchy
attachEvents($button, $subgroup);
} else {
- $group.append(self._templateOption(level.name, level.value));
+ $group.append(self._templateOption({
+ label: level.name,
+ value: level.value
+ }));
}
$tmpl.append($group);
}
}
-
+
// iterate through options and create dom
var $tmpl = $('<div/>');
iterate($tmpl, options);
return $tmpl;
},
-
+
/** Template for drill down view
*/
_template: function(options) {
- return '<div class="ui-options-input drilldown-container" id="' + options.id + '"/>';
+ return '<div class="ui-options-list drilldown-container" id="' + options.id + '"/>';
}
});
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/mvc/ui/ui-misc.js
--- a/static/scripts/mvc/ui/ui-misc.js
+++ b/static/scripts/mvc/ui/ui-misc.js
@@ -1,6 +1,13 @@
// dependencies
-define(['utils/utils', 'mvc/ui/ui-select-default', 'mvc/ui/ui-slider', 'mvc/ui/ui-options', 'mvc/ui/ui-drilldown', 'mvc/ui/ui-button-menu', 'mvc/ui/ui-modal'],
- function(Utils, Select, Slider, Options, Drilldown, ButtonMenu, Modal) {
+define(['utils/utils',
+ 'mvc/ui/ui-select-default',
+ 'mvc/ui/ui-slider',
+ 'mvc/ui/ui-options',
+ 'mvc/ui/ui-drilldown',
+ 'mvc/ui/ui-button-menu',
+ 'mvc/ui/ui-button-check',
+ 'mvc/ui/ui-modal'],
+ function(Utils, Select, Slider, Options, Drilldown, ButtonMenu, ButtonCheck, Modal) {
/**
* This class contains backbone wrappers for basic ui elements such as Images, Labels, Buttons, Input fields etc.
@@ -448,59 +455,12 @@
}
});
-// plugin
-var CheckButton = Backbone.View.extend({
-
- // default options
- optionsDefault: {
- class_add : 'fa fa-square-o',
- class_remove : 'fa fa-check-square-o',
- class_partial : 'fa fa-minus-square-o',
- value : false
- },
-
- // initialize
- initialize : function(options) {
- // configure options
- this.options = Utils.merge(options, this.optionsDefault);
-
- // create new element
- this.setElement($('<div/>'));
-
- // set initial value
- this.value(Boolean(this.options.value));
-
- // add event handler
- var self = this;
- this.$el.on('click', function() {
- self.value(!self.current);
- });
- },
-
- // value
- value : function (new_val) {
- if (new_val !== undefined) {
- this.current = new_val;
- if (new_val) {
- this.$el.removeClass()
- .addClass('ui-checkbutton')
- .addClass(this.options.class_remove);
- } else {
- this.$el.removeClass()
- .addClass('ui-checkbutton')
- .addClass(this.options.class_add);
- }
- this.options.onchange && this.options.onchange(new_val);
- }
- return this.current;
- }
-});
-
// return
return {
Anchor : Anchor,
Button : Button,
ButtonIcon : ButtonIcon,
+ ButtonCheck : ButtonCheck,
ButtonMenu : ButtonMenu,
Icon : Icon,
Image : Image,
@@ -511,7 +471,6 @@
RadioButton : Options.RadioButton,
Checkbox : Options.Checkbox,
Radio : Options.Radio,
- CheckButton : CheckButton,
Searchbox : Searchbox,
Select : Select,
Hidden : Hidden,
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/mvc/ui/ui-options.js
--- a/static/scripts/mvc/ui/ui-options.js
+++ b/static/scripts/mvc/ui/ui-options.js
@@ -1,5 +1,5 @@
// dependencies
-define(['utils/utils'], function(Utils) {
+define(['utils/utils', 'mvc/ui/ui-button-check'], function(Utils, ButtonCheck) {
/** Base class for options based ui elements **/
var Base = Backbone.View.extend({
@@ -11,7 +11,8 @@
data : [],
id : Utils.uuid(),
error_text : 'No data available.',
- wait_text : 'Please wait...'
+ wait_text : 'Please wait...',
+ multiple : false
};
// configure options
@@ -21,13 +22,28 @@
this.setElement('<div class="ui-options"/>');
// create elements
- this.$message = $('<div/>');
- this.$options = $(this._template(options));
+ this.$message = $('<div/>');
+ this.$options = $(this._template(options));
+ this.$menu = $('<div class="ui-options-menu"/>');
// append
this.$el.append(this.$message);
+ this.$el.append(this.$menu);
this.$el.append(this.$options);
+ // add select/unselect all button
+ if (this.options.multiple) {
+ this.select_button = new ButtonCheck({
+ onclick: function() {
+ self.$('input').prop('checked', self.select_button.value() !== 0);
+ self._change();
+ }
+ });
+ this.$menu.addClass('ui-margin-bottom');
+ this.$menu.append(this.select_button.$el);
+ this.$menu.append('Select/Unselect all');
+ }
+
// hide input field
if (!this.options.visible) {
this.$el.hide();
@@ -73,7 +89,7 @@
// add change events
var self = this;
- this.$el.find('input').on('change', function() {
+ this.$('input').on('change', function() {
self.value(self._getValue());
self._change();
});
@@ -96,11 +112,11 @@
}
// reset selection
- this.$el.find('input').prop('checked', false);
+ this.$('input').prop('checked', false);
// update to new selection
for (var i in new_value) {
- this.$el.find('input[value="' + new_value[i] + '"]').first().prop('checked', true);
+ this.$('input[value="' + new_value[i] + '"]').first().prop('checked', true);
};
}
@@ -116,7 +132,7 @@
value = [value];
}
for (var i in value) {
- if (this.$el.find('input[value="' + value[i] + '"]').length > 0) {
+ if (this.$('input[value="' + value[i] + '"]').length > 0) {
return true;
}
}
@@ -127,7 +143,7 @@
/** Return first available option
*/
first: function() {
- var options = this.$el.find('input');
+ var options = this.$('input');
if (options.length > 0) {
return options.val();
} else {
@@ -160,8 +176,22 @@
/** Trigger custom onchange callback function
*/
_change: function() {
+ var current = this._getValue();
if (this.options.onchange) {
- this.options.onchange(this._getValue());
+ this.options.onchange(current);
+ }
+ if (this.select_button) {
+ var total = this._size();
+ var value = this._getValue();
+ if (!(value instanceof Array)) {
+ this.select_button.value(0);
+ } else {
+ if (value.length !== total) {
+ this.select_button.value(1);
+ } else {
+ this.select_button.value(2);
+ }
+ }
}
},
@@ -171,9 +201,11 @@
if (this._size() == 0) {
this._messageShow(this.options.error_text, 'danger');
this.$options.hide();
+ this.$menu.hide();
} else {
this._messageHide();
this.$options.css('display', 'inline-block');
+ this.$menu.show();
}
},
@@ -181,7 +213,7 @@
*/
_getValue: function() {
// get selected values
- var selected = this.$el.find(':checked');
+ var selected = this.$(':checked');
if (selected.length == 0) {
return '__null__';
}
@@ -201,7 +233,7 @@
/** Returns the number of options
*/
_size: function() {
- return this.$el.find('.ui-option').length;
+ return this.$('.ui-option').length;
},
/** Show message instead if options
@@ -222,42 +254,37 @@
/** Main template function
*/
_template: function() {
- return '<div class="ui-options-input"/>';
+ return '<div class="ui-options-list"/>';
+ }
+});
+
+/** Iconized **/
+var BaseIcons = Base.extend({
+ _templateOption: function(pair) {
+ var id = Utils.uuid();
+ return '<div class="ui-option">' +
+ '<input id="' + id + '" type="' + this.options.type + '" name="' + this.options.id + '" value="' + pair.value + '"/>' +
+ '<label class="ui-options-label" for="' + id + '">' + pair.label + '</label>' +
+ '</div>';
}
});
/** Radio button field **/
var Radio = {};
-Radio.View = Base.extend({
- // initialize
+Radio.View = BaseIcons.extend({
initialize: function(options) {
- Base.prototype.initialize.call(this, options);
- },
-
- /** Template for a single option
- */
- _templateOption: function(pair) {
- return '<div>' +
- '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '"/>' + pair.label + '<br>' +
- '</div>';
+ options.type = 'radio';
+ BaseIcons.prototype.initialize.call(this, options);
}
});
/** Checkbox options field **/
var Checkbox = {};
-Checkbox.View = Base.extend({
- // initialize
+Checkbox.View = BaseIcons.extend({
initialize: function(options) {
options.multiple = true;
- Base.prototype.initialize.call(this, options);
- },
-
- /** Template for a single option
- */
- _templateOption: function(pair) {
- return '<div>' +
- '<input type="checkbox" name="' + this.options.id + '" value="' + pair.value + '"/>' + pair.label + '<br>' +
- '</div>';
+ options.type = 'checkbox';
+ BaseIcons.prototype.initialize.call(this, options);
}
});
@@ -274,9 +301,9 @@
value: function (new_value) {
// set new value
if (new_value !== undefined) {
- this.$el.find('input').prop('checked', false);
- this.$el.find('label').removeClass('active');
- this.$el.find('[value="' + new_value + '"]').prop('checked', true).closest('label').addClass('active');
+ this.$('input').prop('checked', false);
+ this.$('label').removeClass('active');
+ this.$('[value="' + new_value + '"]').prop('checked', true).closest('label').addClass('active');
}
// get and return value
@@ -294,7 +321,7 @@
if (pair.icon) {
tmpl += '<i class="' + cls + '"/>';
}
- tmpl += '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '">';
+ tmpl += '<input type="radio" name="' + this.options.id + '" value="' + pair.value + '"/>';
if (pair.label) {
tmpl += pair.label;
}
@@ -311,6 +338,7 @@
return {
Base : Base,
+ BaseIcons : BaseIcons,
Radio : Radio,
RadioButton : RadioButton,
Checkbox : Checkbox
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/packed/mvc/ui/ui-button-check.js
--- /dev/null
+++ b/static/scripts/packed/mvc/ui/ui-button-check.js
@@ -0,0 +1,1 @@
+define(["utils/utils"],function(a){return Backbone.View.extend({optionsDefault:{icons:["fa fa-square-o","fa fa-minus-square-o","fa fa-check-square-o"],value:0},initialize:function(c){this.options=a.merge(c,this.optionsDefault);this.setElement($("<div/>"));this.value(this.options.value);var b=this;this.$el.on("click",function(){b.current=(!b.current&&2)||0;b.value(b.current);b.options.onclick&&b.options.onclick()})},value:function(b){if(b!==undefined){this.current=b;this.$el.removeClass().addClass("ui-checkbutton").addClass(this.options.icons[b]);this.options.onchange&&this.options.onchange(b)}return this.current}})});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/packed/mvc/ui/ui-drilldown.js
--- a/static/scripts/packed/mvc/ui/ui-drilldown.js
+++ b/static/scripts/packed/mvc/ui/ui-drilldown.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.Base.extend({initialize:function(d){this.display=d.display||"checkbox";d.multiple=(this.display=="checkbox");a.Base.prototype.initialize.call(this,d)},_templateOption:function(d,f,e){return'<div><input name="'+this.options.id+'" class="ui-option" type="'+this.display+'" value="'+f+'">'+d+"<div/>"},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand" style="position: relative; top: 2px;"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption(q.name,q.value));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption(q.name,q.value))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options-input drilldown-container" id="'+d.id+'"/>'}});return{View:c}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.BaseIcons.extend({initialize:function(d){d.type=d.display||"checkbox";d.multiple=(d.display=="checkbox");a.BaseIcons.prototype.initialize.call(this,d)},_templateOptions:function(f){var e=this;function g(k,l){function j(m){if(m){l.fadeIn("fast");k.removeClass("toggle-expand");k.addClass("toggle");k.is_expanded=true}else{l.hide();k.removeClass("toggle");k.addClass("toggle-expand");k.is_expanded=false}}k.on("click",function(){j(!k.is_expanded)})}function d(p,k){for(i in k){var q=k[i];var m=q.options.length>0;var l=$("<div/>");if(m){var n=$('<span class="ui-drilldown-button form-toggle icon-button toggle-expand"/>');var j=$("<div/>");j.append(n);j.append(e._templateOption({label:q.name,value:q.value}));l.append(j);var o=$('<div style="display: none; margin-left: 25px;"/>');d(o,q.options);l.append(o);g(n,o)}else{l.append(e._templateOption({label:q.name,value:q.value}))}p.append(l)}}var h=$("<div/>");d(h,f);return h},_template:function(d){return'<div class="ui-options-list drilldown-container" id="'+d.id+'"/>'}});return{View:c}});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/packed/mvc/ui/ui-misc.js
--- a/static/scripts/packed/mvc/ui/ui-misc.js
+++ b/static/scripts/packed/mvc/ui/ui-misc.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-modal"],function(d,g,h,l,k,r,b){var p=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(s){return'<img class="ui-image '+s.cls+'" src="'+s.url+'"/>'}});var i=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},title:function(s){this.$el.html(s)},_template:function(s){return'<label class="ui-label '+s.cls+'">'+s.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){return'<div><span class="fa '+s.icon+'" class="ui-icon"/> '+s.title+"</div>"}});var f=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",function(){$(".tooltip").hide();if(s.onclick){s.onclick()}});$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){var t='<button id="'+s.id+'" type="submit" style="float: '+s.floating+';" type="button" class="'+s.cls+'">';if(s.icon){t+='<i class="icon fa '+s.icon+'"></i> '}t+=s.title+"</button>";return t}});var n=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=d.merge(t,this.optionsDefault);this.setElement(this._template(this.options));this.$button=this.$el.find(".button");var s=this;$(this.el).on("click",function(){$(".tooltip").hide();if(t.onclick&&!s.disabled){t.onclick()}});$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled");this.disabled=true},enable:function(){this.$button.removeClass("disabled");this.disabled=false},setIcon:function(s){this.$("i").removeClass(this.options.icon).addClass(s);this.options.icon=s},_template:function(s){var t="";if(s.title){t="width: auto;"}var u='<div id="'+s.id+'" style="float: '+s.floating+"; "+t+'" class="'+s.cls+'">';if(s.title){u+='<div class="button"><i class="icon fa '+s.icon+'"/> <span class="title">'+s.title+"</span></div>"}else{u+='<i class="icon fa '+s.icon+'"/>'}u+="</div>";return u}});var o=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",s.onclick)},_template:function(s){return'<div><a href="javascript:void(0)" class="ui-anchor '+s.cls+'">'+s.title+"</a></div>"}});var a=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:false},initialize:function(s){this.options=d.merge(s,this.optionsDefault);this.setElement("<div></div>");if(this.options.message){this.update(this.options)}},update:function(t){this.options=d.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(t.message);this.$el.fadeIn();if(this.timeout){window.clearTimeout(this.timeout)}if(!t.persistent){var s=this;this.timeout=window.setTimeout(function(){if(s.$el.is(":visible")){s.$el.fadeOut()}else{s.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(s){return'<div class="ui-message alert alert-'+s.status+'"/>'}});var e=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=d.merge(t,this.optionsDefault);this.setElement(this._template(this.options));var s=this;if(this.options.onclick){this.$el.on("submit",function(v){var u=s.$el.find("#search");s.options.onclick(u.val())})}},_template:function(s){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+s.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var m=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(t){this.options=d.merge(t,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var s=this;this.$el.on("input",function(){if(s.options.onchange){s.options.onchange(s.$el.val())}})},value:function(s){if(s!==undefined){this.$el.val(s)}return this.$el.val()},_template:function(s){if(s.area){return'<textarea id="'+s.id+'" class="ui-textarea '+s.cls+'"></textarea>'}else{return'<input id="'+s.id+'" type="'+s.type+'" value="'+s.value+'" placeholder="'+s.placeholder+'" class="ui-input '+s.cls+'">'}}});var j=Backbone.View.extend({initialize:function(s){this.options=s;this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}},value:function(s){if(s!==undefined){this.$("hidden").val(s)}return this.$("hidden").val()},_template:function(t){var s='<div id="'+t.id+'" >';if(t.info){s+="<label>"+t.info+"</label>"}s+='<hidden value="'+t.value+'"/></div>';return s}});var q=Backbone.View.extend({optionsDefault:{class_add:"fa fa-square-o",class_remove:"fa fa-check-square-o",class_partial:"fa fa-minus-square-o",value:false},initialize:function(t){this.options=d.merge(t,this.optionsDefault);this.setElement($("<div/>"));this.value(Boolean(this.options.value));var s=this;this.$el.on("click",function(){s.value(!s.current)})},value:function(s){if(s!==undefined){this.current=s;if(s){this.$el.removeClass().addClass("ui-checkbutton").addClass(this.options.class_remove)}else{this.$el.removeClass().addClass("ui-checkbutton").addClass(this.options.class_add)}this.options.onchange&&this.options.onchange(s)}return this.current}});return{Anchor:o,Button:f,ButtonIcon:n,ButtonMenu:r,Icon:c,Image:p,Input:m,Label:i,Message:a,Modal:b,RadioButton:l.RadioButton,Checkbox:l.Checkbox,Radio:l.Radio,CheckButton:q,Searchbox:e,Select:g,Hidden:j,Slider:h,Drilldown:k}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-select-default","mvc/ui/ui-slider","mvc/ui/ui-options","mvc/ui/ui-drilldown","mvc/ui/ui-button-menu","mvc/ui/ui-button-check","mvc/ui/ui-modal"],function(e,h,i,m,l,r,d,b){var q=Backbone.View.extend({optionsDefault:{url:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},_template:function(s){return'<img class="ui-image '+s.cls+'" src="'+s.url+'"/>'}});var j=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options))},title:function(s){this.$el.html(s)},_template:function(s){return'<label class="ui-label '+s.cls+'">'+s.title+"</label>"},value:function(){return options.title}});var c=Backbone.View.extend({optionsDefault:{floating:"right",icon:"",tooltip:"",placement:"bottom",title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){return'<div><span class="fa '+s.icon+'" class="ui-icon"/> '+s.title+"</div>"}});var g=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button btn btn-default",icon:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",function(){$(".tooltip").hide();if(s.onclick){s.onclick()}});$(this.el).tooltip({title:s.tooltip,placement:"bottom"})},_template:function(s){var t='<button id="'+s.id+'" type="submit" style="float: '+s.floating+';" type="button" class="'+s.cls+'">';if(s.icon){t+='<i class="icon fa '+s.icon+'"></i> '}t+=s.title+"</button>";return t}});var o=Backbone.View.extend({optionsDefault:{id:null,title:"",floating:"right",cls:"ui-button-icon",icon:"",tooltip:"",onclick:null},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));this.$button=this.$el.find(".button");var s=this;$(this.el).on("click",function(){$(".tooltip").hide();if(t.onclick&&!s.disabled){t.onclick()}});$(this.el).tooltip({title:t.tooltip,placement:"bottom"})},disable:function(){this.$button.addClass("disabled");this.disabled=true},enable:function(){this.$button.removeClass("disabled");this.disabled=false},setIcon:function(s){this.$("i").removeClass(this.options.icon).addClass(s);this.options.icon=s},_template:function(s){var t="";if(s.title){t="width: auto;"}var u='<div id="'+s.id+'" style="float: '+s.floating+"; "+t+'" class="'+s.cls+'">';if(s.title){u+='<div class="button"><i class="icon fa '+s.icon+'"/> <span class="title">'+s.title+"</span></div>"}else{u+='<i class="icon fa '+s.icon+'"/>'}u+="</div>";return u}});var p=Backbone.View.extend({optionsDefault:{title:"",cls:""},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement(this._template(this.options));$(this.el).on("click",s.onclick)},_template:function(s){return'<div><a href="javascript:void(0)" class="ui-anchor '+s.cls+'">'+s.title+"</a></div>"}});var a=Backbone.View.extend({optionsDefault:{message:null,status:"info",persistent:false},initialize:function(s){this.options=e.merge(s,this.optionsDefault);this.setElement("<div></div>");if(this.options.message){this.update(this.options)}},update:function(t){this.options=e.merge(t,this.optionsDefault);if(t.message!=""){this.$el.html(this._template(this.options));this.$el.find(".alert").append(t.message);this.$el.fadeIn();if(this.timeout){window.clearTimeout(this.timeout)}if(!t.persistent){var s=this;this.timeout=window.setTimeout(function(){if(s.$el.is(":visible")){s.$el.fadeOut()}else{s.$el.hide()}},3000)}}else{this.$el.fadeOut()}},_template:function(s){return'<div class="ui-message alert alert-'+s.status+'"/>'}});var f=Backbone.View.extend({optionsDefault:{onclick:null,searchword:""},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));var s=this;if(this.options.onclick){this.$el.on("submit",function(v){var u=s.$el.find("#search");s.options.onclick(u.val())})}},_template:function(s){return'<div class="ui-search"><form onsubmit="return false;"><input id="search" class="form-control input-sm" type="text" name="search" placeholder="Search..." value="'+s.searchword+'"><button type="submit" class="btn search-btn"><i class="fa fa-search"></i></button></form></div>'}});var n=Backbone.View.extend({optionsDefault:{type:"text",placeholder:"",disabled:false,visible:true,cls:"",area:false},initialize:function(t){this.options=e.merge(t,this.optionsDefault);this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}if(this.options.disabled){this.$el.prop("disabled",true)}if(!this.options.visible){this.$el.hide()}var s=this;this.$el.on("input",function(){if(s.options.onchange){s.options.onchange(s.$el.val())}})},value:function(s){if(s!==undefined){this.$el.val(s)}return this.$el.val()},_template:function(s){if(s.area){return'<textarea id="'+s.id+'" class="ui-textarea '+s.cls+'"></textarea>'}else{return'<input id="'+s.id+'" type="'+s.type+'" value="'+s.value+'" placeholder="'+s.placeholder+'" class="ui-input '+s.cls+'">'}}});var k=Backbone.View.extend({initialize:function(s){this.options=s;this.setElement(this._template(this.options));if(this.options.value!==undefined){this.value(this.options.value)}},value:function(s){if(s!==undefined){this.$("hidden").val(s)}return this.$("hidden").val()},_template:function(t){var s='<div id="'+t.id+'" >';if(t.info){s+="<label>"+t.info+"</label>"}s+='<hidden value="'+t.value+'"/></div>';return s}});return{Anchor:p,Button:g,ButtonIcon:o,ButtonCheck:d,ButtonMenu:r,Icon:c,Image:q,Input:n,Label:j,Message:a,Modal:b,RadioButton:m.RadioButton,Checkbox:m.Checkbox,Radio:m.Radio,Searchbox:f,Select:h,Hidden:k,Slider:i,Drilldown:l}});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/scripts/packed/mvc/ui/ui-options.js
--- a/static/scripts/packed/mvc/ui/ui-options.js
+++ b/static/scripts/packed/mvc/ui/ui-options.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(b){var a=Backbone.View.extend({initialize:function(g){this.optionsDefault={visible:true,data:[],id:b.uuid(),error_text:"No data available.",wait_text:"Please wait..."};this.options=b.merge(g,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(g));this.$el.append(this.$message);this.$el.append(this.$options);if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var f=this;this.on("change",function(){f._change()})},update:function(g){var j=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(g))}else{for(var h in g){var i=$(this._templateOption(g[h]));i.addClass("ui-option");i.tooltip({title:g[h].tooltip,placement:"bottom"});this.$options.append(i)}}var f=this;this.$el.find("input").on("change",function(){f.value(f._getValue());f._change()});this._refresh();this.value(j)},value:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}this.$el.find("input").prop("checked",false);for(var f in g){this.$el.find('input[value="'+g[f]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(g){if(g!==undefined){if(!(g instanceof Array)){g=[g]}for(var f in g){if(this.$el.find('input[value="'+g[f]+'"]').length>0){return true}}}return false},first:function(){var f=this.$el.find("input");if(f.length>0){return f.val()}else{return undefined}},validate:function(){return b.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){if(this.options.onchange){this.options.onchange(this._getValue())}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide()}else{this._messageHide();this.$options.css("display","inline-block")}},_getValue:function(){var g=this.$el.find(":checked");if(g.length==0){return"__null__"}if(this.options.multiple){var f=[];g.each(function(){f.push($(this).val())});return f}else{return g.val()}},_size:function(){return this.$el.find(".ui-option").length},_messageShow:function(g,f){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+f);this.$message.html(g)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-input"/>'}});var d={};d.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="radio" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var c={};c.View=a.extend({initialize:function(f){f.multiple=true;a.prototype.initialize.call(this,f)},_templateOption:function(f){return'<div><input type="checkbox" name="'+this.options.id+'" value="'+f.value+'"/>'+f.label+"<br></div>"}});var e={};e.View=a.extend({initialize:function(f){a.prototype.initialize.call(this,f)},value:function(f){if(f!==undefined){this.$el.find("input").prop("checked",false);this.$el.find("label").removeClass("active");this.$el.find('[value="'+f+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(h){var f="fa "+h.icon;if(!h.label){f+=" no-padding"}var g='<label class="btn btn-default">';if(h.icon){g+='<i class="'+f+'"/>'}g+='<input type="radio" name="'+this.options.id+'" value="'+h.value+'">';if(h.label){g+=h.label}g+="</label>";return g},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:a,Radio:d,RadioButton:e,Checkbox:c}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-button-check"],function(c,e){var b=Backbone.View.extend({initialize:function(i){this.optionsDefault={visible:true,data:[],id:c.uuid(),error_text:"No data available.",wait_text:"Please wait...",multiple:false};this.options=c.merge(i,this.optionsDefault);this.setElement('<div class="ui-options"/>');this.$message=$("<div/>");this.$options=$(this._template(i));this.$menu=$('<div class="ui-options-menu"/>');this.$el.append(this.$message);this.$el.append(this.$menu);this.$el.append(this.$options);if(this.options.multiple){this.select_button=new e({onclick:function(){h.$("input").prop("checked",h.select_button.value()!==0);h._change()}});this.$menu.addClass("ui-margin-bottom");this.$menu.append(this.select_button.$el);this.$menu.append("Select/Unselect all")}if(!this.options.visible){this.$el.hide()}this.update(this.options.data);if(this.options.value!==undefined){this.value(this.options.value)}var h=this;this.on("change",function(){h._change()})},update:function(i){var l=this._getValue();this.$options.empty();if(this._templateOptions){this.$options.append(this._templateOptions(i))}else{for(var j in i){var k=$(this._templateOption(i[j]));k.addClass("ui-option");k.tooltip({title:i[j].tooltip,placement:"bottom"});this.$options.append(k)}}var h=this;this.$("input").on("change",function(){h.value(h._getValue());h._change()});this._refresh();this.value(l)},value:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}this.$("input").prop("checked",false);for(var h in j){this.$('input[value="'+j[h]+'"]').first().prop("checked",true)}}return this._getValue()},exists:function(j){if(j!==undefined){if(!(j instanceof Array)){j=[j]}for(var h in j){if(this.$('input[value="'+j[h]+'"]').length>0){return true}}}return false},first:function(){var h=this.$("input");if(h.length>0){return h.val()}else{return undefined}},validate:function(){return c.validate(this.value())},wait:function(){if(this._size()==0){this._messageShow(this.options.wait_text,"info");this.$options.hide()}},unwait:function(){this._messageHide();this._refresh()},_change:function(){var j=this._getValue();if(this.options.onchange){this.options.onchange(j)}if(this.select_button){var h=this._size();var i=this._getValue();if(!(i instanceof Array)){this.select_button.value(0)}else{if(i.length!==h){this.select_button.value(1)}else{this.select_button.value(2)}}}},_refresh:function(){if(this._size()==0){this._messageShow(this.options.error_text,"danger");this.$options.hide();this.$menu.hide()}else{this._messageHide();this.$options.css("display","inline-block");this.$menu.show()}},_getValue:function(){var i=this.$(":checked");if(i.length==0){return"__null__"}if(this.options.multiple){var h=[];i.each(function(){h.push($(this).val())});return h}else{return i.val()}},_size:function(){return this.$(".ui-option").length},_messageShow:function(i,h){this.$message.show();this.$message.removeClass();this.$message.addClass("ui-message alert alert-"+h);this.$message.html(i)},_messageHide:function(){this.$message.hide()},_template:function(){return'<div class="ui-options-list"/>'}});var a=b.extend({_templateOption:function(h){var i=c.uuid();return'<div class="ui-option"><input id="'+i+'" type="'+this.options.type+'" name="'+this.options.id+'" value="'+h.value+'"/><label class="ui-options-label" for="'+i+'">'+h.label+"</label></div>"}});var f={};f.View=a.extend({initialize:function(h){h.type="radio";a.prototype.initialize.call(this,h)}});var d={};d.View=a.extend({initialize:function(h){h.multiple=true;h.type="checkbox";a.prototype.initialize.call(this,h)}});var g={};g.View=b.extend({initialize:function(h){b.prototype.initialize.call(this,h)},value:function(h){if(h!==undefined){this.$("input").prop("checked",false);this.$("label").removeClass("active");this.$('[value="'+h+'"]').prop("checked",true).closest("label").addClass("active")}return this._getValue()},_templateOption:function(j){var h="fa "+j.icon;if(!j.label){h+=" no-padding"}var i='<label class="btn btn-default">';if(j.icon){i+='<i class="'+h+'"/>'}i+='<input type="radio" name="'+this.options.id+'" value="'+j.value+'"/>';if(j.label){i+=j.label}i+="</label>";return i},_template:function(){return'<div class="btn-group ui-radiobutton" data-toggle="buttons"/>'}});return{Base:b,BaseIcons:a,Radio:f,RadioButton:g,Checkbox:d}});
\ No newline at end of file
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -148,7 +148,7 @@
.form-control::-moz-placeholder{color:#999}
.form-control:-ms-input-placeholder{color:#999}
.form-control::-webkit-input-placeholder{color:#999}
-.form-control,.ui-input,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{display:block;width:100%;height:27px;padding:4px 10px;font-size:12px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #aaa;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6)}
+.form-control,.ui-input,.ui-textarea,.ui-options .ui-options-list,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{display:block;width:100%;height:27px;padding:4px 10px;font-size:12px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #aaa;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6)}
.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}
textarea.form-control{height:auto}
.form-group{margin-bottom:15px}
@@ -1435,9 +1435,15 @@
.ui-portlet-limited,.ui-portlet-narrow,.ui-portlet-narrow{max-width:900px}
.ui-popover{max-width:700px;display:none}.ui-popover .popover-close{position:absolute;right:10px;top:7px;font-size:1.2em;cursor:pointer}
.ui-popover .popover-title{padding:4px 10px}
-.ui-input,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple,.ui-textarea,.ui-options .ui-options-input,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{background:transparent}
+.ui-input,.ui-textarea,.ui-options .ui-options-list,.ui-form-slider .ui-form-slider-text,.ui-select-multiple,.ui-textarea,.ui-options .ui-options-list,.ui-form-slider .ui-form-slider-text,.ui-select-multiple{background:transparent}
.ui-textarea{height:100px !important}
-.ui-options .ui-options-input{height:100% !important}
+.ui-options .ui-options-list{height:100% !important}.ui-options .ui-options-list input[type=checkbox],.ui-options .ui-options-list input[type=radio]{display:none}
+.ui-options .ui-options-list label{margin:0px;cursor:pointer}
+.ui-options .ui-options-list .ui-drilldown-button{position:relative;top:2px;left:-3px;margin-right:3px;cursor:pointer}
+.ui-options .ui-options-list input[type=checkbox]+label:before{font-family:FontAwesome;display:inline-block;font-style:normal;font-size:1.2em;margin-right:5px;position:relative;top:1px;width:10px;content:"\f096"}
+.ui-options .ui-options-list input[type=checkbox]:checked+label:before{content:"\f046"}
+.ui-options .ui-options-list input[type=radio]+label:before{font-family:FontAwesome;display:inline-block;font-style:normal;font-size:1.2em;margin-right:5px;position:relative;top:1px;width:10px;content:"\f1db"}
+.ui-options .ui-options-list input[type=radio]:checked+label:before{content:"\f192"}
.ui-form-slider{display:inline-block;width:100%}.ui-form-slider .ui-form-slider-text{width:100px;float:left}
.ui-form-slider .ui-form-slider-element{width:calc(100% - 110px);float:left;top:8px;left:10px}
.ui-radiobutton{width:100%}.ui-radiobutton label{height:23px;line-height:1em}
diff -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 -r 16593d9d24fe952789835895c532ad246df4346b static/style/src/less/ui.less
--- a/static/style/src/less/ui.less
+++ b/static/style/src/less/ui.less
@@ -321,9 +321,51 @@
}
.ui-options {
- .ui-options-input {
+ .ui-options-list {
&:extend(.ui-input);
height: 100% !important;
+ input[type=checkbox], input[type=radio] {
+ display: none;
+ }
+ label {
+ margin: 0px;
+ cursor: pointer;
+ }
+ .ui-drilldown-button {
+ position: relative;
+ top: 2px;
+ left: -3px;
+ margin-right: 3px;
+ cursor: pointer;
+ }
+ input[type=checkbox] + label:before {
+ font-family: FontAwesome;
+ display: inline-block;
+ font-style: normal;
+ font-size: 1.2em;
+ margin-right: 5px;
+ position: relative;
+ top: 1px;
+ width: 10px;
+ content: "\f096";
+ }
+ input[type=checkbox]:checked + label:before {
+ content: "\f046";
+ }
+ input[type=radio] + label:before {
+ font-family: FontAwesome;
+ display: inline-block;
+ font-style: normal;
+ font-size: 1.2em;
+ margin-right: 5px;
+ position: relative;
+ top: 1px;
+ width: 10px;
+ content: "\f1db";
+ }
+ input[type=radio]:checked + label:before {
+ content: "\f192";
+ }
}
}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Fix to 109da69: remove debugging from index.mako
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7ba09a5bbe9d/
Changeset: 7ba09a5bbe9d
User: carlfeberhard
Date: 2015-02-10 20:12:46+00:00
Summary: Fix to 109da69: remove debugging from index.mako
Affected #: 1 file
diff -r 374318d710755d92b8cea81f34c226ecd60741a5 -r 7ba09a5bbe9d88ca035b44f2178d7d32442cf2e1 templates/webapps/galaxy/root/index.mako
--- a/templates/webapps/galaxy/root/index.mako
+++ b/templates/webapps/galaxy/root/index.mako
@@ -152,12 +152,6 @@
currPanel.connectToQuotaMeter( Galaxy.quotaMeter );
currPanel.loadCurrentHistory();
Galaxy.currHistoryPanel = currPanel;
-
-currPanel.once( 'rendered', function(){
- currPanel.showSelectors();
- currPanel.selectAll();
- _.last( currPanel.actionsPopup.options ).func();
-});
});
});
</script>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Add reminder for why imports are done this way in s3objectstore for the next time I forget.
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/374318d71075/
Changeset: 374318d71075
User: dannon
Date: 2015-02-10 20:06:12+00:00
Summary: Add reminder for why imports are done this way in s3objectstore for the next time I forget.
Affected #: 1 file
diff -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 -r 374318d710755d92b8cea81f34c226ecd60741a5 lib/galaxy/objectstore/s3.py
--- a/lib/galaxy/objectstore/s3.py
+++ b/lib/galaxy/objectstore/s3.py
@@ -20,6 +20,7 @@
from ..objectstore import ObjectStore, convert_bytes
try:
+ # Imports are done this way to allow objectstore code to be used outside of Galaxy.
import boto
from boto.s3.key import Key
from boto.s3.connection import S3Connection
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c0b08d727159/
Changeset: c0b08d727159
User: dannon
Date: 2015-02-10 19:38:01+00:00
Summary: Style standardization in s3objectstore, a couple fixes.
Affected #: 1 file
diff -r 23df5eac97f7c05da1e06fb63a0385b1c416d535 -r c0b08d72715952fd255ff548d20d8fe8f9b00451 lib/galaxy/objectstore/s3.py
--- a/lib/galaxy/objectstore/s3.py
+++ b/lib/galaxy/objectstore/s3.py
@@ -13,8 +13,7 @@
from datetime import datetime
from galaxy.exceptions import ObjectNotFound
-from galaxy.util import umask_fix_perms, string_as_bool
-from galaxy.util import string_as_bool
+from galaxy.util import string_as_bool, umask_fix_perms
from galaxy.util.directory_hash import directory_hash_id
from galaxy.util.sleeper import Sleeper
from .s3_multipart_upload import multipart_upload
@@ -28,7 +27,8 @@
except ImportError:
boto = None
-NO_BOTO_ERROR_MESSAGE = "S3/Swift object store configured, but no boto dependency available. Please install and properly configure boto or modify object store configuration."
+NO_BOTO_ERROR_MESSAGE = ("S3/Swift object store configured, but no boto dependency available."
+ "Please install and properly configure boto or modify object store configuration.")
log = logging.getLogger( __name__ )
logging.getLogger('boto').setLevel(logging.INFO) # Otherwise boto is quite noisy
@@ -91,8 +91,6 @@
self.conn_path = cn_xml.get('conn_path', '/')
c_xml = config_xml.findall('cache')[0]
self.cache_size = float(c_xml.get('size', -1))
- self.cache_path = c_xml.get('path')
-
# for multipart upload
self.s3server = {'access_key': self.access_key,
'secret_key': self.secret_key,
@@ -102,8 +100,6 @@
'port': self.port,
'use_rr': self.use_rr,
'conn_path': self.conn_path}
-
-
except Exception:
# Toss it back up after logging, we can't continue loading at this point.
log.exception("Malformed ObjectStore Configuration XML -- unable to continue")
@@ -115,23 +111,23 @@
total_size = 0
# Is this going to be too expensive of an operation to be done frequently?
file_list = []
- for dirpath, dirnames, filenames in os.walk(self.staging_path):
- for f in filenames:
- fp = os.path.join(dirpath, f)
- file_size = os.path.getsize(fp)
+ for dirpath, _, filenames in os.walk(self.staging_path):
+ for filename in filenames:
+ filepath = os.path.join(dirpath, filename)
+ file_size = os.path.getsize(filepath)
total_size += file_size
# Get the time given file was last accessed
- last_access_time = time.localtime(os.stat(fp)[7])
+ last_access_time = time.localtime(os.stat(filepath)[7])
# Compose a tuple of the access time and the file path
- file_tuple = last_access_time, fp, file_size
+ file_tuple = last_access_time, filepath, file_size
file_list.append(file_tuple)
# Sort the file list (based on access time)
file_list.sort()
# Initiate cleaning once within 10% of the defined cache size?
cache_limit = self.cache_size * 0.9
if total_size > cache_limit:
- log.info("Initiating cache cleaning: current cache size: %s; clean until smaller than: %s"
- % (convert_bytes(total_size), convert_bytes(cache_limit)))
+ log.info("Initiating cache cleaning: current cache size: %s; clean until smaller than: %s",
+ convert_bytes(total_size), convert_bytes(cache_limit))
# How much to delete? If simply deleting up to the cache-10% limit,
# is likely to be deleting frequently and may run the risk of hitting
# the limit - maybe delete additional #%?
@@ -159,10 +155,10 @@
# exceed delete_this_much; start deleting from the front of the file list,
# which assumes the oldest files come first on the list.
deleted_amount = 0
- for i, f in enumerate(file_list):
+ for entry in enumerate(file_list):
if deleted_amount < delete_this_much:
- deleted_amount += f[2]
- os.remove(f[1])
+ deleted_amount += entry[2]
+ os.remove(entry[1])
# Debugging code for printing deleted files' stats
# folder, file_name = os.path.split(f[1])
# file_date = time.strftime("%m/%d/%y %H:%M:%S", f[0])
@@ -170,7 +166,7 @@
# % (i, file_name, convert_bytes(f[2]), file_date, \
# convert_bytes(deleted_amount), convert_bytes(delete_this_much)))
else:
- log.debug("Cache cleaning done. Total space freed: %s" % convert_bytes(deleted_amount))
+ log.debug("Cache cleaning done. Total space freed: %s", convert_bytes(deleted_amount))
return
def _get_bucket(self, bucket_name):
@@ -179,14 +175,14 @@
for i in range(5):
try:
bucket = self.conn.get_bucket(bucket_name)
- log.debug("Using cloud object store with bucket '%s'" % bucket.name)
+ log.debug("Using cloud object store with bucket '%s'", bucket.name)
return bucket
except S3ResponseError:
try:
- log.debug("Bucket not found, creating s3 bucket with handle '%s'" % bucket_name)
+ log.debug("Bucket not found, creating s3 bucket with handle '%s'", bucket_name)
self.conn.create_bucket(bucket_name)
except S3ResponseError:
- log.exception("Could not get bucket '%s', attempt %s/5" % (bucket_name, i + 1))
+ log.exception("Could not get bucket '%s', attempt %s/5", bucket_name, i + 1)
time.sleep(2)
# All the attempts have been exhausted and connection was not established,
# raise error
@@ -194,10 +190,10 @@
def _fix_permissions(self, rel_path):
""" Set permissions on rel_path"""
- for basedir, dirs, files in os.walk(rel_path):
+ for basedir, _, files in os.walk(rel_path):
umask_fix_perms(basedir, self.config.umask, 0777, self.config.gid)
- for f in files:
- path = os.path.join(basedir, f)
+ for filename in files:
+ path = os.path.join(basedir, filename)
# Ignore symlinks
if os.path.islink(path):
continue
@@ -228,10 +224,8 @@
if key:
return key.size
except S3ResponseError, ex:
- log.error("Could not get size of key '%s' from S3: %s" % (rel_path, ex))
- except Exception, ex:
- log.error("Could not get reference to the key object '%s'; returning -1 for key size: %s" % (rel_path, ex))
- return -1
+ log.error("Could not get size of key '%s' from S3: %s", rel_path, ex)
+ return -1
def _key_exists(self, rel_path):
exists = False
@@ -239,8 +233,8 @@
# A hackish way of testing if the rel_path is a folder vs a file
is_dir = rel_path[-1] == '/'
if is_dir:
- rs = self.bucket.get_all_keys(prefix=rel_path)
- if len(rs) > 0:
+ keyresult = self.bucket.get_all_keys(prefix=rel_path)
+ if len(keyresult) > 0:
exists = True
else:
exists = False
@@ -248,7 +242,7 @@
key = Key(self.bucket, rel_path)
exists = key.exists()
except S3ResponseError, ex:
- log.error("Trouble checking existence of S3 key '%s': %s" % (rel_path, ex))
+ log.error("Trouble checking existence of S3 key '%s': %s", rel_path, ex)
return False
if rel_path[0] == '/':
raise
@@ -289,36 +283,36 @@
if not os.path.exists(self._get_cache_path(rel_path_dir)):
os.makedirs(self._get_cache_path(rel_path_dir))
# Now pull in the file
- ok = self._download(rel_path)
+ file_ok = self._download(rel_path)
self._fix_permissions(self._get_cache_path(rel_path_dir))
- return ok
+ return file_ok
def _transfer_cb(self, complete, total):
self.transfer_progress += 10
def _download(self, rel_path):
try:
- log.debug("Pulling key '%s' into cache to %s" % (rel_path, self._get_cache_path(rel_path)))
+ log.debug("Pulling key '%s' into cache to %s", rel_path, self._get_cache_path(rel_path))
key = self.bucket.get_key(rel_path)
# Test if cache is large enough to hold the new file
if self.cache_size > 0 and key.size > self.cache_size:
- log.critical("File %s is larger (%s) than the cache size (%s). Cannot download."
- % (rel_path, key.size, self.cache_size))
+ log.critical("File %s is larger (%s) than the cache size (%s). Cannot download.",
+ rel_path, key.size, self.cache_size)
return False
if self.use_axel:
- log.debug("Parallel pulled key '%s' into cache to %s" % (rel_path, self._get_cache_path(rel_path)))
+ log.debug("Parallel pulled key '%s' into cache to %s", rel_path, self._get_cache_path(rel_path))
ncores = multiprocessing.cpu_count()
url = key.generate_url(7200)
ret_code = subprocess.call("axel -a -n %s '%s'" % (ncores, url))
if ret_code == 0:
return True
else:
- log.debug("Pulled key '%s' into cache to %s" % (rel_path, self._get_cache_path(rel_path)))
+ log.debug("Pulled key '%s' into cache to %s", rel_path, self._get_cache_path(rel_path))
self.transfer_progress = 0 # Reset transfer progress counter
key.get_contents_to_filename(self._get_cache_path(rel_path), cb=self._transfer_cb, num_cb=10)
return True
- except S3ResponseError, ex:
- log.error("Problem downloading key '%s' from S3 bucket '%s': %s" % (rel_path, self.bucket.name, ex))
+ except S3ResponseError:
+ log.exception("Problem downloading key '%s' from S3 bucket '%s'", rel_path, self.bucket.name)
return False
def _push_to_os(self, rel_path, source_file=None, from_string=None):
@@ -334,14 +328,14 @@
if os.path.exists(source_file):
key = Key(self.bucket, rel_path)
if os.path.getsize(source_file) == 0 and key.exists():
- log.debug("Wanted to push file '%s' to S3 key '%s' but its size is 0; skipping." % (source_file, rel_path))
+ log.debug("Wanted to push file '%s' to S3 key '%s' but its size is 0; skipping.", source_file, rel_path)
return True
if from_string:
key.set_contents_from_string(from_string, reduced_redundancy=self.use_rr)
- log.debug("Pushed data from string '%s' to key '%s'" % (from_string, rel_path))
+ log.debug("Pushed data from string '%s' to key '%s'", from_string, rel_path)
else:
start_time = datetime.now()
- log.debug("Pushing cache file '%s' of size %s bytes to key '%s'" % (source_file, os.path.getsize(source_file), rel_path))
+ log.debug("Pushing cache file '%s' of size %s bytes to key '%s'", source_file, os.path.getsize(source_file), rel_path)
mb_size = os.path.getsize(source_file) / 1e6
if mb_size < 10 or (not self.multipart):
self.transfer_progress = 0 # Reset transfer progress counter
@@ -352,13 +346,14 @@
else:
multipart_upload(self.s3server, self.bucket, key.name, source_file, mb_size)
end_time = datetime.now()
- log.debug("Pushed cache file '%s' to key '%s' (%s bytes transfered in %s sec)" % (source_file, rel_path, os.path.getsize(source_file), end_time - start_time))
+ log.debug("Pushed cache file '%s' to key '%s' (%s bytes transfered in %s sec)",
+ source_file, rel_path, os.path.getsize(source_file), end_time - start_time)
return True
else:
- log.error("Tried updating key '%s' from source file '%s', but source file does not exist."
- % (rel_path, source_file))
- except S3ResponseError, ex:
- log.error("Trouble pushing S3 key '%s' from file '%s': %s" % (rel_path, source_file, ex))
+ log.error("Tried updating key '%s' from source file '%s', but source file does not exist.",
+ rel_path, source_file)
+ except S3ResponseError:
+ log.exception("Trouble pushing S3 key '%s' from file '%s'", rel_path, source_file)
return False
def file_ready(self, obj, **kwargs):
@@ -371,8 +366,8 @@
if self._in_cache(rel_path):
if os.path.getsize(self._get_cache_path(rel_path)) == self._get_size_in_s3(rel_path):
return True
- log.debug("Waiting for dataset {0} to transfer from OS: {1}/{2}".format(rel_path,
- os.path.getsize(self._get_cache_path(rel_path)), self._get_size_in_s3(rel_path)))
+ log.debug("Waiting for dataset %s to transfer from OS: %s/%s", rel_path,
+ os.path.getsize(self._get_cache_path(rel_path)), self._get_size_in_s3(rel_path))
return False
def exists(self, obj, **kwargs):
@@ -444,10 +439,10 @@
try:
return os.path.getsize(self._get_cache_path(rel_path))
except OSError, ex:
- log.info("Could not get size of file '%s' in local cache, will try S3. Error: %s" % (rel_path, ex))
+ log.info("Could not get size of file '%s' in local cache, will try S3. Error: %s", rel_path, ex)
elif self.exists(obj, **kwargs):
return self._get_size_in_s3(rel_path)
- log.warning("Did not find dataset '%s', returning 0 for size" % rel_path)
+ log.warning("Did not find dataset '%s', returning 0 for size", rel_path)
return 0
def delete(self, obj, entire_dir=False, **kwargs):
@@ -460,9 +455,9 @@
# but requires iterating through each individual key in S3 and deleing it.
if entire_dir and extra_dir:
shutil.rmtree(self._get_cache_path(rel_path))
- rs = self.bucket.get_all_keys(prefix=rel_path)
- for key in rs:
- log.debug("Deleting key %s" % key.name)
+ results = self.bucket.get_all_keys(prefix=rel_path)
+ for key in results:
+ log.debug("Deleting key %s", key.name)
key.delete()
return True
else:
@@ -470,14 +465,14 @@
os.unlink(self._get_cache_path(rel_path))
# Delete from S3 as well
if self._key_exists(rel_path):
- key = Key(self.bucket, rel_path)
- log.debug("Deleting key %s" % key.name)
- key.delete()
- return True
+ key = Key(self.bucket, rel_path)
+ log.debug("Deleting key %s", key.name)
+ key.delete()
+ return True
except S3ResponseError, ex:
- log.error("Could not delete key '%s' from S3: %s" % (rel_path, ex))
+ log.error("Could not delete key '%s' from S3: %s", rel_path, ex)
except OSError, ex:
- log.error('%s delete error %s' % (self._get_filename(obj, **kwargs), ex))
+ log.error('%s delete error %s', self._get_filename(obj, **kwargs), ex)
return False
def get_data(self, obj, start=0, count=-1, **kwargs):
@@ -538,7 +533,7 @@
shutil.copy2(source_file, cache_file)
self._fix_permissions(cache_file)
except OSError, ex:
- log.error("Trouble copying source file '%s' to cache '%s': %s" % (source_file, cache_file, ex))
+ log.error("Trouble copying source file '%s' to cache '%s': %s", source_file, cache_file, ex)
else:
source_file = self._get_cache_path(rel_path)
# Update the file on S3
@@ -553,8 +548,8 @@
try:
key = Key(self.bucket, rel_path)
return key.generate_url(expires_in=86400) # 24hrs
- except S3ResponseError, ex:
- log.warning("Trouble generating URL for dataset '%s': %s" % (rel_path, ex))
+ except S3ResponseError:
+ log.exception("Trouble generating URL for dataset '%s'", rel_path)
return None
def get_store_usage_percent(self):
https://bitbucket.org/galaxy/galaxy-central/commits/6ac0193e7fcd/
Changeset: 6ac0193e7fcd
User: dannon
Date: 2015-02-10 19:38:58+00:00
Summary: Correct old reference to the wrong get_filename in s3objectstore.
Affected #: 1 file
diff -r c0b08d72715952fd255ff548d20d8fe8f9b00451 -r 6ac0193e7fcdff4d4e928842c88661cff8ceec0f lib/galaxy/objectstore/s3.py
--- a/lib/galaxy/objectstore/s3.py
+++ b/lib/galaxy/objectstore/s3.py
@@ -472,7 +472,7 @@
except S3ResponseError, ex:
log.error("Could not delete key '%s' from S3: %s", rel_path, ex)
except OSError, ex:
- log.error('%s delete error %s', self._get_filename(obj, **kwargs), ex)
+ log.error('%s delete error %s', self.get_filename(obj, **kwargs), ex)
return False
def get_data(self, obj, start=0, count=-1, **kwargs):
https://bitbucket.org/galaxy/galaxy-central/commits/e9b02440691e/
Changeset: e9b02440691e
User: dannon
Date: 2015-02-10 19:42:02+00:00
Summary: Correctly use log.exception where appropriate in s3objectstore
Affected #: 1 file
diff -r 6ac0193e7fcdff4d4e928842c88661cff8ceec0f -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 lib/galaxy/objectstore/s3.py
--- a/lib/galaxy/objectstore/s3.py
+++ b/lib/galaxy/objectstore/s3.py
@@ -223,8 +223,8 @@
key = self.bucket.get_key(rel_path)
if key:
return key.size
- except S3ResponseError, ex:
- log.error("Could not get size of key '%s' from S3: %s", rel_path, ex)
+ except S3ResponseError:
+ log.exception("Could not get size of key '%s' from S3", rel_path)
return -1
def _key_exists(self, rel_path):
@@ -241,8 +241,8 @@
else:
key = Key(self.bucket, rel_path)
exists = key.exists()
- except S3ResponseError, ex:
- log.error("Trouble checking existence of S3 key '%s': %s", rel_path, ex)
+ except S3ResponseError:
+ log.exception("Trouble checking existence of S3 key '%s'", rel_path)
return False
if rel_path[0] == '/':
raise
@@ -469,10 +469,10 @@
log.debug("Deleting key %s", key.name)
key.delete()
return True
- except S3ResponseError, ex:
- log.error("Could not delete key '%s' from S3: %s", rel_path, ex)
- except OSError, ex:
- log.error('%s delete error %s', self.get_filename(obj, **kwargs), ex)
+ except S3ResponseError:
+ log.exception("Could not delete key '%s' from S3", rel_path)
+ except OSError:
+ log.exception('%s delete error', self.get_filename(obj, **kwargs))
return False
def get_data(self, obj, start=0, count=-1, **kwargs):
@@ -532,8 +532,8 @@
# FIXME? Should this be a `move`?
shutil.copy2(source_file, cache_file)
self._fix_permissions(cache_file)
- except OSError, ex:
- log.error("Trouble copying source file '%s' to cache '%s': %s", source_file, cache_file, ex)
+ except OSError:
+ log.exception("Trouble copying source file '%s' to cache '%s'", source_file, cache_file)
else:
source_file = self._get_cache_path(rel_path)
# Update the file on S3
https://bitbucket.org/galaxy/galaxy-central/commits/2f67cc204911/
Changeset: 2f67cc204911
User: dannon
Date: 2015-02-10 19:42:26+00:00
Summary: Merge.
Affected #: 20 files
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 client/galaxy/scripts/galaxy.base.js
--- a/client/galaxy/scripts/galaxy.base.js
+++ b/client/galaxy/scripts/galaxy.base.js
@@ -207,33 +207,6 @@
});
}
-// Alphanumeric/natural sort fn
-function naturalSort(a, b) {
- // setup temp-scope variables for comparison evauluation
- var re = /(-?[0-9\.]+)/g,
- x = a.toString().toLowerCase() || '',
- y = b.toString().toLowerCase() || '',
- nC = String.fromCharCode(0),
- xN = x.replace( re, nC + '$1' + nC ).split(nC),
- yN = y.replace( re, nC + '$1' + nC ).split(nC),
- xD = (new Date(x)).getTime(),
- yD = xD ? (new Date(y)).getTime() : null;
- // natural sorting of dates
- if ( yD ) {
- if ( xD < yD ) { return -1; }
- else if ( xD > yD ) { return 1; }
- }
- // natural sorting through split numeric strings and default strings
- var oFxNcL, oFyNcL;
- for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
- oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
- oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
- if (oFxNcL < oFyNcL) { return -1; }
- else if (oFxNcL > oFyNcL) { return 1; }
- }
- return 0;
-}
-
$.fn.refresh_select2 = function() {
var select_elt = $(this);
var options = { placeholder:'Click to select',
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 client/galaxy/scripts/mvc/collection/paired-collection-creator.js
--- a/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
+++ b/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
@@ -1,8 +1,9 @@
define([
"utils/levenshtein",
+ "utils/natural-sort",
"mvc/base-mvc",
"utils/localization"
-], function( levelshteinDistance, baseMVC, _l ){
+], function( levelshteinDistance, naturalSort, baseMVC, _l ){
/* ============================================================================
TODO:
_adjPairedOnScrollBar
@@ -236,14 +237,16 @@
_splitByFilters : function( filters ){
var fwd = [],
rev = [];
- this.unpaired.forEach( function( unpaired ){
+
+ function _addToFwdOrRev( unpaired ){
if( this._filterFwdFn( unpaired ) ){
fwd.push( unpaired );
}
if( this._filterRevFn( unpaired ) ){
rev.push( unpaired );
}
- }.bind( this ) );
+ }
+ this.unpaired.forEach( _.bind( _addToFwdOrRev, this ) );
return [ fwd, rev ];
},
@@ -603,7 +606,7 @@
/** create the collection via the API
* @returns {jQuery.xhr Object} the jquery ajax request
*/
- createList : function(){
+ createList : function( name ){
var creator = this,
url;
if( creator.historyId ){
@@ -616,10 +619,11 @@
var ajaxData = {
type : 'dataset_collection',
collection_type : 'list:paired',
- name : _.escape( creator.$( '.collection-name' ).val() ),
+ name : _.escape( name || creator.$( '.collection-name' ).val() ),
element_identifiers : creator.paired.map( function( pair ){
return creator._pairToJSON( pair );
})
+
};
//this.debug( JSON.stringify( ajaxData ) );
return jQuery.ajax( url, {
@@ -1732,6 +1736,8 @@
//=============================================================================
/** a modal version of the paired collection creator */
var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){
+ console.log( datasets );
+
options = _.defaults( options || {}, {
datasets : datasets,
oncancel : function(){ Galaxy.modal.hide(); },
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 client/galaxy/scripts/utils/natural-sort.js
--- /dev/null
+++ b/client/galaxy/scripts/utils/natural-sort.js
@@ -0,0 +1,30 @@
+define([], function(){
+// Alphanumeric/natural sort fn
+function naturalSort(a, b) {
+ // setup temp-scope variables for comparison evauluation
+ var re = /(-?[0-9\.]+)/g,
+ x = a.toString().toLowerCase() || '',
+ y = b.toString().toLowerCase() || '',
+ nC = String.fromCharCode(0),
+ xN = x.replace( re, nC + '$1' + nC ).split(nC),
+ yN = y.replace( re, nC + '$1' + nC ).split(nC),
+ xD = (new Date(x)).getTime(),
+ yD = xD ? (new Date(y)).getTime() : null;
+ // natural sorting of dates
+ if ( yD ) {
+ if ( xD < yD ) { return -1; }
+ else if ( xD > yD ) { return 1; }
+ }
+ // natural sorting through split numeric strings and default strings
+ var oFxNcL, oFyNcL;
+ for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
+ oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
+ oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
+ if (oFxNcL < oFyNcL) { return -1; }
+ else if (oFxNcL > oFyNcL) { return 1; }
+ }
+ return 0;
+}
+
+return naturalSort;
+})
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -19,7 +19,7 @@
from galaxy.util import string_as_bool
from galaxy.util.dbkeys import GenomeBuilds
from galaxy.web.formatting import expand_pretty_datetime_format
-
+from .version import VERSION_MAJOR
log = logging.getLogger( __name__ )
@@ -63,6 +63,7 @@
# This is not a uwsgi process, or something went horribly wrong.
pass
+ self.version_major = VERSION_MAJOR
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root )
self.database_connection = kwargs.get( "database_connection", False )
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 lib/galaxy/util/pastescript/serve.py
--- a/lib/galaxy/util/pastescript/serve.py
+++ b/lib/galaxy/util/pastescript/serve.py
@@ -559,11 +559,11 @@
if cmd == 'restart' or cmd == 'stop':
result = self.stop_daemon()
if result:
- if cmd == 'restart':
- print "Could not stop daemon; aborting"
- else:
- print "Could not stop daemon"
- return result
+ print "Could not stop daemon"
+ # It's ok to continue trying to restart if stop_daemon returns
+ # a 1, otherwise shortcut and return.
+ if cmd == 'restart' and result != 1:
+ return result
if cmd == 'stop':
return result
self.options.daemon = True
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 lib/galaxy/version.py
--- /dev/null
+++ b/lib/galaxy/version.py
@@ -0,0 +1,1 @@
+VERSION_MAJOR = "15.03"
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 lib/galaxy/webapps/galaxy/api/configuration.py
--- a/lib/galaxy/webapps/galaxy/api/configuration.py
+++ b/lib/galaxy/webapps/galaxy/api/configuration.py
@@ -31,6 +31,10 @@
serialization_params = self._parse_serialization_params( kwd, 'all' )
return self.get_config_dict( trans, is_admin, **serialization_params )
+ @expose_api_anonymous
+ def version( self, trans, **kwds ):
+ return {"version_major": self.app.config.version_major }
+
def get_config_dict( self, trans, return_admin=False, view=None, keys=None, default_view='all' ):
"""
Return a dictionary with (a subset of) current Galaxy settings.
@@ -97,6 +101,7 @@
'nginx_upload_path' : _defaults_to( self.url_for( controller='api', action='tools' ) ),
'ftp_upload_dir' : _defaults_to( None ),
'ftp_upload_site' : _defaults_to( None ),
+ 'version_major' : _defaults_to( None ),
}
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -222,6 +222,9 @@
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.connect( '/api/histories/{history_id}/citations', action='citations', controller="histories" )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
+ webapp.mapper.connect( "configuration_version",
+ "/api/version", controller="configuration",
+ action="version", conditions=dict( method=[ "GET" ] ) )
webapp.mapper.resource( 'datatype',
'datatypes',
path_prefix='/api',
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js
+++ b/static/scripts/galaxy.base.js
@@ -207,33 +207,6 @@
});
}
-// Alphanumeric/natural sort fn
-function naturalSort(a, b) {
- // setup temp-scope variables for comparison evauluation
- var re = /(-?[0-9\.]+)/g,
- x = a.toString().toLowerCase() || '',
- y = b.toString().toLowerCase() || '',
- nC = String.fromCharCode(0),
- xN = x.replace( re, nC + '$1' + nC ).split(nC),
- yN = y.replace( re, nC + '$1' + nC ).split(nC),
- xD = (new Date(x)).getTime(),
- yD = xD ? (new Date(y)).getTime() : null;
- // natural sorting of dates
- if ( yD ) {
- if ( xD < yD ) { return -1; }
- else if ( xD > yD ) { return 1; }
- }
- // natural sorting through split numeric strings and default strings
- var oFxNcL, oFyNcL;
- for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
- oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
- oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
- if (oFxNcL < oFyNcL) { return -1; }
- else if (oFxNcL > oFyNcL) { return 1; }
- }
- return 0;
-}
-
$.fn.refresh_select2 = function() {
var select_elt = $(this);
var options = { placeholder:'Click to select',
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/mvc/collection/paired-collection-creator.js
--- a/static/scripts/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/mvc/collection/paired-collection-creator.js
@@ -1,8 +1,9 @@
define([
"utils/levenshtein",
+ "utils/natural-sort",
"mvc/base-mvc",
"utils/localization"
-], function( levelshteinDistance, baseMVC, _l ){
+], function( levelshteinDistance, naturalSort, baseMVC, _l ){
/* ============================================================================
TODO:
_adjPairedOnScrollBar
@@ -236,14 +237,16 @@
_splitByFilters : function( filters ){
var fwd = [],
rev = [];
- this.unpaired.forEach( function( unpaired ){
+
+ function _addToFwdOrRev( unpaired ){
if( this._filterFwdFn( unpaired ) ){
fwd.push( unpaired );
}
if( this._filterRevFn( unpaired ) ){
rev.push( unpaired );
}
- }.bind( this ) );
+ }
+ this.unpaired.forEach( _.bind( _addToFwdOrRev, this ) );
return [ fwd, rev ];
},
@@ -603,7 +606,7 @@
/** create the collection via the API
* @returns {jQuery.xhr Object} the jquery ajax request
*/
- createList : function(){
+ createList : function( name ){
var creator = this,
url;
if( creator.historyId ){
@@ -616,10 +619,11 @@
var ajaxData = {
type : 'dataset_collection',
collection_type : 'list:paired',
- name : _.escape( creator.$( '.collection-name' ).val() ),
+ name : _.escape( name || creator.$( '.collection-name' ).val() ),
element_identifiers : creator.paired.map( function( pair ){
return creator._pairToJSON( pair );
})
+
};
//this.debug( JSON.stringify( ajaxData ) );
return jQuery.ajax( url, {
@@ -1732,6 +1736,8 @@
//=============================================================================
/** a modal version of the paired collection creator */
var pairedCollectionCreatorModal = function _pairedCollectionCreatorModal( datasets, options ){
+ console.log( datasets );
+
options = _.defaults( options || {}, {
datasets : datasets,
oncancel : function(){ Galaxy.modal.hide(); },
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/packed/galaxy.base.js
--- a/static/scripts/packed/galaxy.base.js
+++ b/static/scripts/packed/galaxy.base.js
@@ -1,1 +1,1 @@
-(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){var l=i.action||i;g.append($("<li></li>").append($("<a>").attr("href",i.url).html(j).click(l)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]={url:f,action:function(){if(!e||confirm(e)){if(h){window.open(f,h);return false}else{g.click()}}}}}});var c=$(a).find("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}$.fn.refresh_select2=function(){var b=$(this);var a={placeholder:"Click to select",closeOnSelect:!b.is("[MULTIPLE]"),dropdownAutoWidth:true,containerCssClass:"select2-minwidth"};return b.select2(a)};function replace_big_select_inputs(a,c,b){if(!jQuery.fn.select2){return}if(a===undefined){a=20}if(c===undefined){c=3000}b=b||$("select");b.each(function(){var e=$(this).not("[multiple]");var d=e.find("option").length;if((d<a)||(d>c)){return}if(e.hasClass("no-autocomplete")){return}e.refresh_select2()})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=("cur_text" in g?g.cur_text:a.text()),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}m.stopPropagation()})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).click(function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!=="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};function init_refresh_on_change(){$("select[refresh_on_change='true']").off("change").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").off("click").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").off("click").click(function(){return confirm($(this).attr("confirm"))})}jQuery.fn.preventDoubleSubmission=function(){$(this).on("submit",function(b){var a=$(this);if(a.data("submitted")===true){b.preventDefault()}else{a.data("submitted",true)}});return this};$(document).ready(function(){init_refresh_on_change();if($.fn.tooltip){$(".unified-panel-header [title]").tooltip({placement:"bottom"});$("[title]").tooltip()}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
+(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){var l=i.action||i;g.append($("<li></li>").append($("<a>").attr("href",i.url).html(j).click(l)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]={url:f,action:function(){if(!e||confirm(e)){if(h){window.open(f,h);return false}else{g.click()}}}}}});var c=$(a).find("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}$.fn.refresh_select2=function(){var b=$(this);var a={placeholder:"Click to select",closeOnSelect:!b.is("[MULTIPLE]"),dropdownAutoWidth:true,containerCssClass:"select2-minwidth"};return b.select2(a)};function replace_big_select_inputs(a,c,b){if(!jQuery.fn.select2){return}if(a===undefined){a=20}if(c===undefined){c=3000}b=b||$("select");b.each(function(){var e=$(this).not("[multiple]");var d=e.find("option").length;if((d<a)||(d>c)){return}if(e.hasClass("no-autocomplete")){return}e.refresh_select2()})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=("cur_text" in g?g.cur_text:a.text()),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}m.stopPropagation()})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).click(function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!=="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};function init_refresh_on_change(){$("select[refresh_on_change='true']").off("change").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").off("click").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").off("click").click(function(){return confirm($(this).attr("confirm"))})}jQuery.fn.preventDoubleSubmission=function(){$(this).on("submit",function(b){var a=$(this);if(a.data("submitted")===true){b.preventDefault()}else{a.data("submitted",true)}});return this};$(document).ready(function(){init_refresh_on_change();if($.fn.tooltip){$(".unified-panel-header [title]").tooltip({placement:"bottom"});$("[title]").tooltip()}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/packed/mvc/collection/paired-collection-creator.js
--- a/static/scripts/packed/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/packed/mvc/collection/paired-collection-creator.js
@@ -1,1 +1,1 @@
-define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},template:_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join("")),render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(this.template({pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.autoscrollDist=h.autoscrollDist||24;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._setUpBehaviors();this._dataSetUp()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair();this.once("rendered:initial",function(){this.trigger("autopair")})}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(j){var i=[],h=[];this.unpaired.forEach(function(k){if(this._filterFwdFn(k)){i.push(k)}if(this._filterRevFn(k)){h.push(k)}}.bind(this));return[i,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(i){i=i||this.strategy;var h=this.simpleAutoPair();h=h.concat(this[i].call(this));return h},simpleAutoPair:function(){var o=0,m,s=this._splitByFilters(),h=s[0],r=s[1],q,u,k=false,t=[];while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");k=false;for(m=0;m<r.length;m++){var p=r[m];u=p.name.replace(this.filters[1],"");if(n!==p&&q===u){k=true;var l=this._pair(h.splice(o,1)[0],r.splice(m,1)[0],{silent:true});t.push(l);break}}if(!k){o+=1}}return t},autoPairLevenshtein:function(){var p=0,n,u=this._splitByFilters(),h=u[0],s=u[1],r,x,k,t,l,v=[];while(p<h.length){var o=h[p];r=o.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(n=0;n<s.length;n++){var q=s[n];x=q.name.replace(this.filters[1],"");if(o!==q){if(r===x){t=n;l=0;break}k=levenshteinDistance(r,x);if(k<l){t=n;l=k}}}var w=1-(l/(Math.max(r.length,x.length)));if(w>=this.matchPercentage){var m=this._pair(h.splice(p,1)[0],s.splice(t,1)[0],{silent:true});v.push(m);if(h.length<=0||s.length<=0){return v}}else{p+=1}}return v},autoPairLCSs:function(){var n=0,l,u=this._splitByFilters(),h=u[0],s=u[1],r,y,x,t,p,v=[];if(!h.length||!s.length){return v}while(n<h.length){var m=h[n];r=m.name.replace(this.filters[0],"");p=0;for(l=0;l<s.length;l++){var q=s[l];y=q.name.replace(this.filters[1],"");if(m!==q){if(r===y){t=l;p=r.length;break}var o=this._naiveStartingAndEndingLCS(r,y);x=o.length;if(x>p){t=l;p=x}}}var w=p/(Math.min(r.length,y.length));if(w>=this.matchPercentage){var k=this._pair(h.splice(n,1)[0],s.splice(t,1)[0],{silent:true});v.push(k);if(h.length<=0||s.length<=0){return v}}else{n+=1}}return v},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(){var j=this,i;if(j.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j.$(".collection-name").val()),element_identifiers:j.paired.map(function(k){return j._pairToJSON(k)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(m,k,l){j._ajaxErrHandler(m,k,l)}).done(function(k,l,m){j.trigger("collection:created",k,l,m);if(typeof j.oncreate==="function"){j.oncreate.call(this,k,l,m)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();this.trigger("rendered",this);return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""))({}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.once("rendered",function(){this.trigger("rendered:initial",this)});this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired();this.$(".collection-name").focus()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(h){this.autoPair();this.trigger("autopair")},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(k){k.stopPropagation();var m=$(k.currentTarget),j=m.parent().parent(),i=j.index(".dataset.paired"),l=this.paired[i],h=prompt("Enter a new name for the pair:",l.name);if(h){l.name=h;l.customizedName=true;m.text(l.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index(".unpair-btn"));this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets");this._checkForAutoscroll(i,k.originalEvent.clientY);var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_checkForAutoscroll:function(h,n){var l=2;var m=h.offset(),k=h.scrollTop(),i=n-m.top,j=(m.top+h.outerHeight())-n;if(i>=0&&i<this.autoscrollDist){h.scrollTop(k-l)}else{if(j>=0&&j<this.autoscrollDist){h.scrollTop(k+l)}}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(h){if(h.keyCode===13){this._clickCreate()}},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
+define(["utils/levenshtein","utils/natural-sort","mvc/base-mvc","utils/localization"],function(h,g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(i){this.pair=i.pair||{}},template:_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join("")),render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(this.template({pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(i){i.currentTarget.style.opacity="0.4";if(i.originalEvent){i=i.originalEvent}i.dataTransfer.effectAllowed="move";i.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(i){i.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(i){this.$el.parent().trigger(i)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(i){i=_.defaults(i,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=i.datasets;this.historyId=i.historyId;this.filters=this.commonFilters[i.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(i.filters)){this.filters=i.filters}this.automaticallyPair=i.automaticallyPair;this.matchPercentage=i.matchPercentage;this.strategy=this.strategies[i.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(i.strategy)){this.strategy=i.strategy}this.removeExtensions=true;this.oncancel=i.oncancel;this.oncreate=i.oncreate;this.autoscrollDist=i.autoscrollDist||24;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._setUpBehaviors();this._dataSetUp()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair();this.once("rendered:initial",function(){this.trigger("autopair")})}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(i){i.sort(function(k,j){return g(k.name,j.name)});return i},_ensureIds:function(){this.initialList.forEach(function(i){if(!i.hasOwnProperty("id")){i.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(l){var k=[],i=[];function j(m){if(this._filterFwdFn(m)){k.push(m)}if(this._filterRevFn(m)){i.push(m)}}this.unpaired.forEach(_.bind(j,this));return[k,i]},_filterFwdFn:function(j){var i=new RegExp(this.filters[0]);return i.test(j.name)},_filterRevFn:function(j){var i=new RegExp(this.filters[1]);return i.test(j.name)},_addToUnpaired:function(j){var i=function(k,m){if(k===m){return k}var l=Math.floor((m-k)/2)+k,n=g(j.name,this.unpaired[l].name);if(n<0){return i(k,l)}else{if(n>0){return i(l+1,m)}}while(this.unpaired[l]&&this.unpaired[l].name===j.name){l++}return l}.bind(this);this.unpaired.splice(i(0,this.unpaired.length),0,j)},autoPair:function(j){j=j||this.strategy;var i=this.simpleAutoPair();i=i.concat(this[j].call(this));return i},simpleAutoPair:function(){var p=0,n,t=this._splitByFilters(),k=t[0],s=t[1],r,v,l=false,u=[];while(p<k.length){var o=k[p];r=o.name.replace(this.filters[0],"");l=false;for(n=0;n<s.length;n++){var q=s[n];v=q.name.replace(this.filters[1],"");if(o!==q&&r===v){l=true;var m=this._pair(k.splice(p,1)[0],s.splice(n,1)[0],{silent:true});u.push(m);break}}if(!l){p+=1}}return u},autoPairLevenshtein:function(){var q=0,o,v=this._splitByFilters(),k=v[0],t=v[1],s,y,l,u,m,w=[];while(q<k.length){var p=k[q];s=p.name.replace(this.filters[0],"");m=Number.MAX_VALUE;for(o=0;o<t.length;o++){var r=t[o];y=r.name.replace(this.filters[1],"");if(p!==r){if(s===y){u=o;m=0;break}l=levenshteinDistance(s,y);if(l<m){u=o;m=l}}}var x=1-(m/(Math.max(s.length,y.length)));if(x>=this.matchPercentage){var n=this._pair(k.splice(q,1)[0],t.splice(u,1)[0],{silent:true});w.push(n);if(k.length<=0||t.length<=0){return w}}else{q+=1}}return w},autoPairLCSs:function(){var o=0,m,v=this._splitByFilters(),k=v[0],t=v[1],s,z,y,u,q,w=[];if(!k.length||!t.length){return w}while(o<k.length){var n=k[o];s=n.name.replace(this.filters[0],"");q=0;for(m=0;m<t.length;m++){var r=t[m];z=r.name.replace(this.filters[1],"");if(n!==r){if(s===z){u=m;q=s.length;break}var p=this._naiveStartingAndEndingLCS(s,z);y=p.length;if(y>q){u=m;q=y}}}var x=q/(Math.min(s.length,z.length));if(x>=this.matchPercentage){var l=this._pair(k.splice(o,1)[0],t.splice(u,1)[0],{silent:true});w.push(l);if(k.length<=0||t.length<=0){return w}}else{o+=1}}return w},_naiveStartingAndEndingLCS:function(n,l){var o="",p="",m=0,k=0;while(m<n.length&&m<l.length){if(n[m]!==l[m]){break}o+=n[m];m+=1}if(m===n.length){return n}if(m===l.length){return l}m=(n.length-1);k=(l.length-1);while(m>=0&&k>=0){if(n[m]!==l[k]){break}p=[n[m],p].join("");m-=1;k-=1}return o+p},_pair:function(k,i,j){j=j||{};var l=this._createPair(k,i,j.name);this.paired.push(l);this.unpaired=_.without(this.unpaired,k,i);if(!j.silent){this.trigger("pair:new",l)}return l},_createPair:function(k,i,j){if(!(k&&i)||(k===i)){throw new Error("Bad pairing: "+[JSON.stringify(k),JSON.stringify(i)])}j=j||this._guessNameForPair(k,i);return{forward:k,name:j,reverse:i}},_guessNameForPair:function(k,i,l){l=(l!==undefined)?(l):(this.removeExtensions);var j=this._naiveStartingAndEndingLCS(k.name.replace(this.filters[0],""),i.name.replace(this.filters[1],""));if(l){var m=j.lastIndexOf(".");if(m>0){j=j.slice(0,m)}}return j||(k.name+" & "+i.name)},_unpair:function(j,i){i=i||{};if(!j){throw new Error("Bad pair: "+JSON.stringify(j))}this.paired=_.without(this.paired,j);this._addToUnpaired(j.forward);this._addToUnpaired(j.reverse);if(!i.silent){this.trigger("pair:unpair",[j])}return j},unpairAll:function(){var i=[];while(this.paired.length){i.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",i)},_pairToJSON:function(i){return{collection_type:"paired",src:"new_collection",name:i.name,element_identifiers:[{name:"forward",id:i.forward.id,src:"hda"},{name:"reverse",id:i.reverse.id,src:"hda"}]}},createList:function(k){var l=this,j;if(l.historyId){j="/api/histories/"+this.historyId+"/contents/dataset_collections"}var i={type:"dataset_collection",collection_type:"list:paired",name:_.escape(k||l.$(".collection-name").val()),element_identifiers:l.paired.map(function(m){return l._pairToJSON(m)})};return jQuery.ajax(j,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(i)}).fail(function(o,m,n){l._ajaxErrHandler(o,m,n)}).done(function(m,n,o){l.trigger("collection:created",m,n,o);if(typeof l.oncreate==="function"){l.oncreate.call(this,m,n,o)}})},_ajaxErrHandler:function(l,i,k){this.error(l,i,k);var j=d("An error occurred while creating this collection");if(l){if(l.readyState===0&&l.status===0){j+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(l.responseJSON){j+="<br /><pre>"+JSON.stringify(l.responseJSON)+"</pre>"}else{j+=": "+k}}}creator._showAlert(j,"alert-danger")},render:function(i,j){this.$el.empty().html(e.templates.main());this._renderHeader(i);this._renderMiddle(i);this._renderFooter(i);this._addPluginComponents();this.trigger("rendered",this);return this},_renderHeader:function(j,k){var i=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return i},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(j,k){var i=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return i},_renderUnpaired:function(n,o){var l=this,m,j,i=[],k=this._splitByFilters();this.$(".forward-column .title").text([k[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-k[0].length));this.$(".reverse-column .title").text([k[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-k[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}j=k[1].map(function(q,p){if((k[0][p]!==undefined)&&(k[0][p]!==q)){i.push(l._renderPairButton())}return l._renderUnpairedDataset(q)});m=k[0].map(function(p){return l._renderUnpairedDataset(p)});if(!m.length&&!j.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(m).add(this.$(".unpaired-columns .paired-column .column-datasets").append(i)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(j));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(i){return["(",i," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(i){return $("<li/>").attr("id","dataset-"+i.id).addClass("dataset unpaired").attr("draggable",true).addClass(i.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(i.name)).data("dataset",i)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var i=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(i);return i},_renderUnpairedNotShown:function(){var i=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(i);return i},_adjUnpairedOnScrollbar:function(){var l=this.$(".unpaired-columns").last(),m=this.$(".unpaired-columns .reverse-column .dataset").first();if(!m.size()){return}var i=l.offset().left+l.outerWidth(),k=m.offset().left+m.outerWidth(),j=Math.floor(i)-Math.floor(k);this.$(".unpaired-columns .forward-column").css("margin-left",(j>0)?j:0)},_renderPaired:function(j,k){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var i=this;this.paired.forEach(function(n,l){var m=new f({pair:n});i.$(".paired-columns .column-datasets").append(m.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var i=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(i);return i},_renderFooter:function(j,k){var i=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return i},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(i){function j(m,l){return['<button class="filter-choice btn" ','data-forward="',m,'" data-reverse="',l,'">',d("Forward"),": ",m,", ",d("Reverse"),": ",l,"</button>"].join("")}var k=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",j("_1","_2"),j("_R1","_R2"),"</div>"].join(""))({}));return this.$(i).popover({container:".collection-creator",placement:"bottom",html:true,content:k})},_validationWarning:function(j,i){var k="validation-warning";if(j==="name"){j=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(i){j=j||this.$("."+k);j.removeClass(k)}else{j.addClass(k)}},_setUpBehaviors:function(){this.once("rendered",function(){this.trigger("rendered:initial",this)});this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(i){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var i,j=null;if(this.paired.length){j="alert-success";i=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){i+=": "+d("all datasets have been successfully paired");this.hideUnpaired();this.$(".collection-name").focus()}}else{i=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(i,j)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(i){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(i){$(i.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(i){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(i){$(i.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(i){this.toggleExtensions()},"change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(i){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(i){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(i){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(j,i){i=i||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(i).show().find(".alert-message").html(j)},_hideAlert:function(i){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(i){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(i){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(i,j){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(i,j)},hidePaired:function(i,j){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(i,j)},splitView:function(i,j){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(i,j);return this},_clickUnpairAll:function(i){this.unpairAll()},_clickAutopair:function(i){this.autoPair();this.trigger("autopair")},_clickFilterChoice:function(j){var i=$(j.currentTarget);this.$(".forward-unpaired-filter input").val(i.data("forward"));this.$(".reverse-unpaired-filter input").val(i.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(i){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(i){i.stopPropagation();return this.toggleSelectUnpaired($(i.currentTarget))},toggleSelectUnpaired:function(k,j){j=j||{};var l=k.data("dataset"),i=j.force!==undefined?j.force:!k.hasClass("selected");if(!k.size()||l===undefined){return k}if(i){k.addClass("selected");if(!j.waitToPair){this.pairAllSelected()}}else{k.removeClass("selected")}return k},pairAllSelected:function(j){j=j||{};var k=this,l=[],i=[],m=[];k.$(".unpaired-columns .forward-column .dataset.selected").each(function(){l.push($(this).data("dataset"))});k.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){i.push($(this).data("dataset"))});l.length=i.length=Math.min(l.length,i.length);l.forEach(function(o,n){try{m.push(k._pair(o,i[n],{silent:true}))}catch(p){k.error(p)}});if(m.length&&!j.silent){this.trigger("pair:new",m)}return m},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(k){if(k.shiftKey){var j=this,i=$(k.target).addClass("selected"),l=function(m){j.$(m.target).filter(".dataset").addClass("selected")};i.parent().on("mousemove",l);$(document).one("mouseup",function(m){i.parent().off("mousemove",l);j.pairAllSelected()})}},_clickPairRow:function(k){var l=$(k.currentTarget).index(),j=$(".unpaired-columns .forward-column .dataset").eq(l).data("dataset"),i=$(".unpaired-columns .reverse-column .dataset").eq(l).data("dataset");this._pair(j,i)},_startPartitionDrag:function(j){var i=this,m=j.pageY;$("body").css("cursor","ns-resize");i.$(".flexible-partition-drag").css("color","black");function l(n){i.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",k)}function k(n){var o=n.pageY-m;if(!i.adjPartition(o)){$("body").trigger("mouseup")}i._adjUnpairedOnScrollbar();m+=o}$("body").mousemove(k);$("body").one("mouseup",l)},adjPartition:function(j){var i=this.$(".unpaired-columns"),k=this.$(".paired-columns"),l=parseInt(i.css("height"),10),m=parseInt(k.css("height"),10);l=Math.max(10,l+j);m=m-j;var n=j<0;if(n){if(this.unpairedPanelHidden){return false}else{if(l<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){i.show();this.unpairedPanelHidden=false}}if(!n){if(this.pairedPanelHidden){return false}else{if(m<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){k.show();this.pairedPanelHidden=false}}i.css({height:l+"px",flex:"0 0 auto"});return true},selectPair:function(i){i.stopPropagation();$(i.currentTarget).toggleClass("selected")},clearSelectedPaired:function(i){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(l){l.stopPropagation();var n=$(l.currentTarget),k=n.parent().parent(),j=k.index(".dataset.paired"),m=this.paired[j],i=prompt("Enter a new name for the pair:",m.name);if(i){m.name=i;m.customizedName=true;n.text(m.name)}},_clickUnpair:function(j){var i=Math.floor($(j.currentTarget).index(".unpair-btn"));this._unpair(this.paired[i])},_dragoverPairedColumns:function(l){l.preventDefault();var j=this.$(".paired-columns .column-datasets");this._checkForAutoscroll(j,l.originalEvent.clientY);var k=this._getNearestPairedDatasetLi(l.originalEvent.clientY);$(".paired-drop-placeholder").remove();var i=$('<div class="paired-drop-placeholder"></div>');if(!k.size()){j.append(i)}else{k.before(i)}},_checkForAutoscroll:function(i,o){var m=2;var n=i.offset(),l=i.scrollTop(),j=o-n.top,k=(n.top+i.outerHeight())-o;if(j>=0&&j<this.autoscrollDist){i.scrollTop(l-m)}else{if(k>=0&&k<this.autoscrollDist){i.scrollTop(l+m)}}},_getNearestPairedDatasetLi:function(p){var m=4,k=this.$(".paired-columns .column-datasets li").toArray();for(var l=0;l<k.length;l++){var o=$(k[l]),n=o.offset().top,j=Math.floor(o.outerHeight()/2)+m;if(n+j>p&&n-j<p){return o}}return $()},_dropPairedColumns:function(j){j.preventDefault();j.dataTransfer.dropEffect="move";var i=this._getNearestPairedDatasetLi(j.originalEvent.clientY);if(i.size()){this.$dragging.insertBefore(i)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var i=[];this.$(".paired-columns .dataset.paired").each(function(){i.push($(this).data("pair"))});this.paired=i;this._renderPaired()},_pairDragstart:function(j,k){k.$el.addClass("selected");var i=this.$(".paired-columns .dataset.selected");this.$dragging=i},_pairDragend:function(i,j){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(j){var i=this;i.removeExtensions=(j!==undefined)?(j):(!i.removeExtensions);_.each(i.paired,function(k){if(k.customizedName){return}k.name=i._guessNameForPair(k.forward,k.reverse)});i._renderPaired();i._renderFooter()},_changeName:function(i){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(i){if(i.keyCode===13){this._clickCreate()}},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(j){var i=this._getName();if(!i){this._validationWarning("name")}else{this.createList()}},_printList:function(j){var i=this;_.each(j,function(k){if(j===i.paired){i._printPair(k)}else{}})},_printPair:function(i){this.debug(i.forward.name,i.reverse.name,": ->",i.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function i(k,j){k=k||"body";if(!this.size()){return this}$(this).each(function(){var m=$(this),l=m.data("target");if(l){m.mouseover(function(n){$(l,k).css({background:j})}).mouseout(function(n){$(l).css({background:""})})}});return this}})}());var b=function c(k,i){console.log(k);i=_.defaults(i||{},{datasets:k,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var j=new e(i).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:j.$el,width:"80%",height:"800px",closing_events:true});window.PCC=j;return j};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/packed/utils/natural-sort.js
--- /dev/null
+++ b/static/scripts/packed/utils/natural-sort.js
@@ -0,0 +1,1 @@
+define([],function(){function a(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}return a});
\ No newline at end of file
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 static/scripts/utils/natural-sort.js
--- /dev/null
+++ b/static/scripts/utils/natural-sort.js
@@ -0,0 +1,30 @@
+define([], function(){
+// Alphanumeric/natural sort fn
+function naturalSort(a, b) {
+ // setup temp-scope variables for comparison evauluation
+ var re = /(-?[0-9\.]+)/g,
+ x = a.toString().toLowerCase() || '',
+ y = b.toString().toLowerCase() || '',
+ nC = String.fromCharCode(0),
+ xN = x.replace( re, nC + '$1' + nC ).split(nC),
+ yN = y.replace( re, nC + '$1' + nC ).split(nC),
+ xD = (new Date(x)).getTime(),
+ yD = xD ? (new Date(y)).getTime() : null;
+ // natural sorting of dates
+ if ( yD ) {
+ if ( xD < yD ) { return -1; }
+ else if ( xD > yD ) { return 1; }
+ }
+ // natural sorting through split numeric strings and default strings
+ var oFxNcL, oFyNcL;
+ for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
+ oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
+ oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
+ if (oFxNcL < oFyNcL) { return -1; }
+ else if (oFxNcL > oFyNcL) { return 1; }
+ }
+ return 0;
+}
+
+return naturalSort;
+})
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 templates/webapps/galaxy/root/index.mako
--- a/templates/webapps/galaxy/root/index.mako
+++ b/templates/webapps/galaxy/root/index.mako
@@ -152,6 +152,12 @@
currPanel.connectToQuotaMeter( Galaxy.quotaMeter );
currPanel.loadCurrentHistory();
Galaxy.currHistoryPanel = currPanel;
+
+currPanel.once( 'rendered', function(){
+ currPanel.showSelectors();
+ currPanel.selectAll();
+ _.last( currPanel.actionsPopup.options ).func();
+});
});
});
</script>
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 test/qunit/test-common.js
--- a/test/qunit/test-common.js
+++ b/test/qunit/test-common.js
@@ -72,7 +72,6 @@
});
-
function bridge_phantomjs( QUnit ) {
// Needed because the grunt task will attempt to inject this bridge assuming
// QUnit is loaded directly - not using require.js.
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 test/qunit/test-data/paired-collection-creator.data.js
--- /dev/null
+++ b/test/qunit/test-data/paired-collection-creator.data.js
@@ -0,0 +1,153 @@
+define([], function(){
+// ============================================================================
+// plain 3 step job chain
+var datasets1 = [
+ { name: 'SET1-01_1.fastq' },
+ { name: 'SET1-01_2.fastq' },
+ { name: 'SET1-02_1.fastq' },
+ { name: 'SET1-02_2.fastq' },
+ { name: 'SET1-03_1.fastq' },
+ { name: 'SET1-03_2.fastq' },
+ { name: 'SET1-04_1.fastq' },
+ { name: 'SET1-04_2.fastq' },
+ { name: 'SET1-05_1.fastq' },
+ { name: 'SET1-05_2.fastq' },
+ { name: 'SET1-06_1.fastq' },
+ { name: 'SET1-06_2.fastq' },
+ { name: 'SET1-07_1.fastq' },
+ { name: 'SET1-07_2.fastq' }
+];
+
+var datasets1CreateRequestJSON = {
+ "type": "dataset_collection",
+ "collection_type": "list:paired",
+ "name": "Heres a collection",
+ "element_identifiers": [
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-07",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "2",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "3",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-06",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "4",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "5",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-05",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "6",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "7",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-04",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "8",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "9",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-03",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "10",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "11",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-02",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "12",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "13",
+ "src": "hda"
+ }
+ ]
+ },
+ {
+ "collection_type": "paired",
+ "src": "new_collection",
+ "name": "SET1-01",
+ "element_identifiers": [
+ {
+ "name": "forward",
+ "id": "14",
+ "src": "hda"
+ },
+ {
+ "name": "reverse",
+ "id": "15",
+ "src": "hda"
+ }
+ ]
+ }
+ ]
+};
+
+// ============================================================================
+ return {
+ _1 : datasets1,
+ _1requestJSON : datasets1CreateRequestJSON
+ };
+});
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 test/qunit/tests/graph.js
--- a/test/qunit/tests/graph.js
+++ b/test/qunit/tests/graph.js
@@ -1,11 +1,8 @@
-// This file isn't really testing anything useful yet, it is just testing
-// (or demonstrating) qunit+backbone interactions.
define([
"utils/graph",
"jquery",
"sinon-qunit"
], function( GRAPH, $, sinon ){
- console.debug( '' );
/*globals equal ok, test module expect deepEqual strictEqual */
"use strict";
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 test/qunit/tests/paired-collection-creator.html
--- /dev/null
+++ b/test/qunit/tests/paired-collection-creator.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<!-- Minimal outline test page for a requirejs+qunit testing setup,
+ test environment is bootstrapped in test-common.js -->
+<html>
+ <head>
+ <script data-main="../test-common" src="../scripts/libs/require.js"></script>
+ </head>
+ <body>
+ </body>
+</html>
diff -r e9b02440691ebe3b1e22e973e61fc10bdfbc0990 -r 2f67cc2049113ace6bccb701c545fd1ec35fb013 test/qunit/tests/paired-collection-creator.js
--- /dev/null
+++ b/test/qunit/tests/paired-collection-creator.js
@@ -0,0 +1,78 @@
+define([
+ "mvc/collection/paired-collection-creator",
+ "test-data/paired-collection-creator.data",
+ "jquery",
+ "sinon-qunit"
+], function(
+ PAIRED_COLLECTION_CREATOR,
+ // why am I yelling?
+ DATA,
+ $,
+ sinon
+){
+ /*globals equal test module expect deepEqual strictEqual throws ok */
+ "use strict";
+ var PCC = PAIRED_COLLECTION_CREATOR.PairedCollectionCreator;
+
+ module( "Galaxy client app tests" );
+
+ test( "Creator base/empty construction/initializiation defaults", function() {
+ var pcc = new PCC([]);
+ ok( pcc instanceof PCC );
+ ok( pcc.hasOwnProperty( 'options' ) && typeof pcc.options === 'object' );
+ deepEqual( pcc.options.filters, pcc.DEFAULT_FILTERS );
+ ok( pcc.options.automaticallyPair );
+ equal( pcc.options.matchPercentage, 1.0 );
+ equal( pcc.options.strategy, 'lcs' );
+ });
+
+ test( "Creator construction/initializiation with datasets", function() {
+ var pcc = new PCC({
+ datasets : DATA._1
+ });
+ //pcc.initialList.forEach( function( dataset, i ){
+ // console.log( i + ':\n' + JSON.stringify( dataset ) );
+ //});
+ // pcc maintains the original list - which, in this case, is already sorted
+ deepEqual( pcc.initialList, DATA._1 );
+ // datasets 1 has no ids, so the pcc will create them
+ ok( _.every( pcc.initialList, function( dataset ){
+ return dataset.id;
+ }));
+ // datasets 1 is very easy to auto pair
+ equal( pcc.unpaired.length, 0 );
+ equal( pcc.paired.length, pcc.initialList.length / 2 );
+ });
+
+ //TODO:
+ // filters: clearing, setting via popover, regex
+ // partition: maximize paired, maximize unpaired, split evenly
+ // pairing: manually pairing and unpairing
+ // misc: renaming pairs, removing file extensions
+
+ test( "Collection creation", function() {
+ var pcc = new PCC({
+ datasets : DATA._1,
+ historyId : 'fakeHistoryId'
+ }),
+ server = sinon.fakeServer.create();
+
+ var requestJSON;
+ server.respondWith( 'POST', '/api/histories/fakeHistoryId/contents/dataset_collections', function( request ){
+ requestJSON = JSON.parse( request.requestBody );
+ request.respond(
+ 200,
+ { "Content-Type": "application/json" },
+ JSON.stringify({
+ fakeResponse: 'yes'
+ })
+ );
+ });
+
+ console.debug( 'requestBody:', JSON.stringify( requestJSON, null, ' ' ) );
+ pcc.createList( 'Heres a collection' );
+ server.respond();
+ deepEqual( requestJSON, DATA._1requestJSON );
+ });
+
+});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Followup to PR https://bitbucket.org/galaxy/galaxy-central/pull-request/658/, only continue restarting in the case of a 1 return code from stop_daemon
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/463c8b50dd5a/
Changeset: 463c8b50dd5a
User: dannon
Date: 2015-02-10 19:07:01+00:00
Summary: Followup to PR https://bitbucket.org/galaxy/galaxy-central/pull-request/658/, only continue restarting in the case of a 1 return code from stop_daemon
Affected #: 1 file
diff -r c58911f54093a4b5d963fa70393908d9e701aeaa -r 463c8b50dd5adabbe7c6c594ca367923905a7439 lib/galaxy/util/pastescript/serve.py
--- a/lib/galaxy/util/pastescript/serve.py
+++ b/lib/galaxy/util/pastescript/serve.py
@@ -560,6 +560,10 @@
result = self.stop_daemon()
if result:
print "Could not stop daemon"
+ # It's ok to continue trying to restart if stop_daemon returns
+ # a 1, otherwise shortcut and return.
+ if cmd == 'restart' and result != 1:
+ return result
if cmd == 'stop':
return result
self.options.daemon = True
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Merged in jmchilton/galaxy-central-fork-1 (pull request #665)
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c58911f54093/
Changeset: c58911f54093
User: dannon
Date: 2015-02-10 18:46:38+00:00
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #665)
Add major version to Galaxy, expose via API.
Affected #: 4 files
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -19,7 +19,7 @@
from galaxy.util import string_as_bool
from galaxy.util.dbkeys import GenomeBuilds
from galaxy.web.formatting import expand_pretty_datetime_format
-
+from .version import VERSION_MAJOR
log = logging.getLogger( __name__ )
@@ -63,6 +63,7 @@
# This is not a uwsgi process, or something went horribly wrong.
pass
+ self.version_major = VERSION_MAJOR
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root )
self.database_connection = kwargs.get( "database_connection", False )
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/version.py
--- /dev/null
+++ b/lib/galaxy/version.py
@@ -0,0 +1,1 @@
+VERSION_MAJOR = "15.03"
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/webapps/galaxy/api/configuration.py
--- a/lib/galaxy/webapps/galaxy/api/configuration.py
+++ b/lib/galaxy/webapps/galaxy/api/configuration.py
@@ -31,6 +31,10 @@
serialization_params = self._parse_serialization_params( kwd, 'all' )
return self.get_config_dict( trans, is_admin, **serialization_params )
+ @expose_api_anonymous
+ def version( self, trans, **kwds ):
+ return {"version_major": self.app.config.version_major }
+
def get_config_dict( self, trans, return_admin=False, view=None, keys=None, default_view='all' ):
"""
Return a dictionary with (a subset of) current Galaxy settings.
@@ -97,6 +101,7 @@
'nginx_upload_path' : _defaults_to( self.url_for( controller='api', action='tools' ) ),
'ftp_upload_dir' : _defaults_to( None ),
'ftp_upload_site' : _defaults_to( None ),
+ 'version_major' : _defaults_to( None ),
}
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -222,6 +222,9 @@
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.connect( '/api/histories/{history_id}/citations', action='citations', controller="histories" )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
+ webapp.mapper.connect( "configuration_version",
+ "/api/version", controller="configuration",
+ action="version", conditions=dict( method=[ "GET" ] ) )
webapp.mapper.resource( 'datatype',
'datatypes',
path_prefix='/api',
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c459517ff47e/
Changeset: c459517ff47e
User: jmchilton
Date: 2015-02-10 14:50:13+00:00
Summary: Add major version to Galaxy, expose via API.
I suspect there are better ways to do this - but I thought I would put something out there we can argue about and hopefully get something in before the next release.
Affected #: 4 files
diff -r 40ab1d00a1b6ef6749998d70cdd5bf7d8e19befa -r c459517ff47e53666d490ff2be3cc679bcc8ea9f lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -19,7 +19,7 @@
from galaxy.util import string_as_bool
from galaxy.util.dbkeys import GenomeBuilds
from galaxy.web.formatting import expand_pretty_datetime_format
-
+from .version import VERSION_MAJOR
log = logging.getLogger( __name__ )
@@ -63,6 +63,7 @@
# This is not a uwsgi process, or something went horribly wrong.
pass
+ self.version_major = VERSION_MAJOR
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root )
self.database_connection = kwargs.get( "database_connection", False )
diff -r 40ab1d00a1b6ef6749998d70cdd5bf7d8e19befa -r c459517ff47e53666d490ff2be3cc679bcc8ea9f lib/galaxy/version.py
--- /dev/null
+++ b/lib/galaxy/version.py
@@ -0,0 +1,1 @@
+VERSION_MAJOR = "2015.03"
diff -r 40ab1d00a1b6ef6749998d70cdd5bf7d8e19befa -r c459517ff47e53666d490ff2be3cc679bcc8ea9f lib/galaxy/webapps/galaxy/api/configuration.py
--- a/lib/galaxy/webapps/galaxy/api/configuration.py
+++ b/lib/galaxy/webapps/galaxy/api/configuration.py
@@ -31,6 +31,10 @@
serialization_params = self._parse_serialization_params( kwd, 'all' )
return self.get_config_dict( trans, is_admin, **serialization_params )
+ @expose_api_anonymous
+ def version( self, trans, **kwds ):
+ return {"version_major": self.app.config.version_major }
+
def get_config_dict( self, trans, return_admin=False, view=None, keys=None, default_view='all' ):
"""
Return a dictionary with (a subset of) current Galaxy settings.
@@ -97,6 +101,7 @@
'nginx_upload_path' : _defaults_to( self.url_for( controller='api', action='tools' ) ),
'ftp_upload_dir' : _defaults_to( None ),
'ftp_upload_site' : _defaults_to( None ),
+ 'version_major' : _defaults_to( None ),
}
diff -r 40ab1d00a1b6ef6749998d70cdd5bf7d8e19befa -r c459517ff47e53666d490ff2be3cc679bcc8ea9f lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -222,6 +222,9 @@
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.connect( '/api/histories/{history_id}/citations', action='citations', controller="histories" )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
+ webapp.mapper.connect( "configuration_version",
+ "/api/version", controller="configuration",
+ action="version", conditions=dict( method=[ "GET" ] ) )
webapp.mapper.resource( 'datatype',
'datatypes',
path_prefix='/api',
https://bitbucket.org/galaxy/galaxy-central/commits/866296df94bf/
Changeset: 866296df94bf
User: jmchilton
Date: 2015-02-10 15:04:19+00:00
Summary: Change version format to YY.MM.
Affected #: 1 file
diff -r c459517ff47e53666d490ff2be3cc679bcc8ea9f -r 866296df94bf79132e81389b26f91847891025c8 lib/galaxy/version.py
--- a/lib/galaxy/version.py
+++ b/lib/galaxy/version.py
@@ -1,1 +1,1 @@
-VERSION_MAJOR = "2015.03"
+VERSION_MAJOR = "15.03"
https://bitbucket.org/galaxy/galaxy-central/commits/c58911f54093/
Changeset: c58911f54093
User: dannon
Date: 2015-02-10 18:46:38+00:00
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #665)
Add major version to Galaxy, expose via API.
Affected #: 4 files
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/config.py
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -19,7 +19,7 @@
from galaxy.util import string_as_bool
from galaxy.util.dbkeys import GenomeBuilds
from galaxy.web.formatting import expand_pretty_datetime_format
-
+from .version import VERSION_MAJOR
log = logging.getLogger( __name__ )
@@ -63,6 +63,7 @@
# This is not a uwsgi process, or something went horribly wrong.
pass
+ self.version_major = VERSION_MAJOR
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/universe.sqlite" ), self.root )
self.database_connection = kwargs.get( "database_connection", False )
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/version.py
--- /dev/null
+++ b/lib/galaxy/version.py
@@ -0,0 +1,1 @@
+VERSION_MAJOR = "15.03"
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/webapps/galaxy/api/configuration.py
--- a/lib/galaxy/webapps/galaxy/api/configuration.py
+++ b/lib/galaxy/webapps/galaxy/api/configuration.py
@@ -31,6 +31,10 @@
serialization_params = self._parse_serialization_params( kwd, 'all' )
return self.get_config_dict( trans, is_admin, **serialization_params )
+ @expose_api_anonymous
+ def version( self, trans, **kwds ):
+ return {"version_major": self.app.config.version_major }
+
def get_config_dict( self, trans, return_admin=False, view=None, keys=None, default_view='all' ):
"""
Return a dictionary with (a subset of) current Galaxy settings.
@@ -97,6 +101,7 @@
'nginx_upload_path' : _defaults_to( self.url_for( controller='api', action='tools' ) ),
'ftp_upload_dir' : _defaults_to( None ),
'ftp_upload_site' : _defaults_to( None ),
+ 'version_major' : _defaults_to( None ),
}
diff -r 38529c8600696278d2c4299c03e9be38aa32e146 -r c58911f54093a4b5d963fa70393908d9e701aeaa lib/galaxy/webapps/galaxy/buildapp.py
--- a/lib/galaxy/webapps/galaxy/buildapp.py
+++ b/lib/galaxy/webapps/galaxy/buildapp.py
@@ -222,6 +222,9 @@
webapp.mapper.resource_with_deleted( 'history', 'histories', path_prefix='/api' )
webapp.mapper.connect( '/api/histories/{history_id}/citations', action='citations', controller="histories" )
webapp.mapper.resource( 'configuration', 'configuration', path_prefix='/api' )
+ webapp.mapper.connect( "configuration_version",
+ "/api/version", controller="configuration",
+ action="version", conditions=dict( method=[ "GET" ] ) )
webapp.mapper.resource( 'datatype',
'datatypes',
path_prefix='/api',
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: UI, utils: modularize (AMD) naturalSort and move to utils
by commits-noreply@bitbucket.org 10 Feb '15
by commits-noreply@bitbucket.org 10 Feb '15
10 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/38529c860069/
Changeset: 38529c860069
User: carlfeberhard
Date: 2015-02-10 18:42:59+00:00
Summary: UI, utils: modularize (AMD) naturalSort and move to utils
Affected #: 10 files
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 client/galaxy/scripts/galaxy.base.js
--- a/client/galaxy/scripts/galaxy.base.js
+++ b/client/galaxy/scripts/galaxy.base.js
@@ -207,33 +207,6 @@
});
}
-// Alphanumeric/natural sort fn
-function naturalSort(a, b) {
- // setup temp-scope variables for comparison evauluation
- var re = /(-?[0-9\.]+)/g,
- x = a.toString().toLowerCase() || '',
- y = b.toString().toLowerCase() || '',
- nC = String.fromCharCode(0),
- xN = x.replace( re, nC + '$1' + nC ).split(nC),
- yN = y.replace( re, nC + '$1' + nC ).split(nC),
- xD = (new Date(x)).getTime(),
- yD = xD ? (new Date(y)).getTime() : null;
- // natural sorting of dates
- if ( yD ) {
- if ( xD < yD ) { return -1; }
- else if ( xD > yD ) { return 1; }
- }
- // natural sorting through split numeric strings and default strings
- var oFxNcL, oFyNcL;
- for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
- oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
- oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
- if (oFxNcL < oFyNcL) { return -1; }
- else if (oFxNcL > oFyNcL) { return 1; }
- }
- return 0;
-}
-
$.fn.refresh_select2 = function() {
var select_elt = $(this);
var options = { placeholder:'Click to select',
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 client/galaxy/scripts/mvc/collection/paired-collection-creator.js
--- a/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
+++ b/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
@@ -1,8 +1,9 @@
define([
"utils/levenshtein",
+ "utils/natural-sort",
"mvc/base-mvc",
"utils/localization"
-], function( levelshteinDistance, baseMVC, _l ){
+], function( levelshteinDistance, naturalSort, baseMVC, _l ){
/* ============================================================================
TODO:
_adjPairedOnScrollBar
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 client/galaxy/scripts/utils/natural-sort.js
--- /dev/null
+++ b/client/galaxy/scripts/utils/natural-sort.js
@@ -0,0 +1,30 @@
+define([], function(){
+// Alphanumeric/natural sort fn
+function naturalSort(a, b) {
+ // setup temp-scope variables for comparison evauluation
+ var re = /(-?[0-9\.]+)/g,
+ x = a.toString().toLowerCase() || '',
+ y = b.toString().toLowerCase() || '',
+ nC = String.fromCharCode(0),
+ xN = x.replace( re, nC + '$1' + nC ).split(nC),
+ yN = y.replace( re, nC + '$1' + nC ).split(nC),
+ xD = (new Date(x)).getTime(),
+ yD = xD ? (new Date(y)).getTime() : null;
+ // natural sorting of dates
+ if ( yD ) {
+ if ( xD < yD ) { return -1; }
+ else if ( xD > yD ) { return 1; }
+ }
+ // natural sorting through split numeric strings and default strings
+ var oFxNcL, oFyNcL;
+ for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
+ oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
+ oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
+ if (oFxNcL < oFyNcL) { return -1; }
+ else if (oFxNcL > oFyNcL) { return 1; }
+ }
+ return 0;
+}
+
+return naturalSort;
+})
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js
+++ b/static/scripts/galaxy.base.js
@@ -207,33 +207,6 @@
});
}
-// Alphanumeric/natural sort fn
-function naturalSort(a, b) {
- // setup temp-scope variables for comparison evauluation
- var re = /(-?[0-9\.]+)/g,
- x = a.toString().toLowerCase() || '',
- y = b.toString().toLowerCase() || '',
- nC = String.fromCharCode(0),
- xN = x.replace( re, nC + '$1' + nC ).split(nC),
- yN = y.replace( re, nC + '$1' + nC ).split(nC),
- xD = (new Date(x)).getTime(),
- yD = xD ? (new Date(y)).getTime() : null;
- // natural sorting of dates
- if ( yD ) {
- if ( xD < yD ) { return -1; }
- else if ( xD > yD ) { return 1; }
- }
- // natural sorting through split numeric strings and default strings
- var oFxNcL, oFyNcL;
- for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
- oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
- oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
- if (oFxNcL < oFyNcL) { return -1; }
- else if (oFxNcL > oFyNcL) { return 1; }
- }
- return 0;
-}
-
$.fn.refresh_select2 = function() {
var select_elt = $(this);
var options = { placeholder:'Click to select',
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/mvc/collection/paired-collection-creator.js
--- a/static/scripts/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/mvc/collection/paired-collection-creator.js
@@ -1,8 +1,9 @@
define([
"utils/levenshtein",
+ "utils/natural-sort",
"mvc/base-mvc",
"utils/localization"
-], function( levelshteinDistance, baseMVC, _l ){
+], function( levelshteinDistance, naturalSort, baseMVC, _l ){
/* ============================================================================
TODO:
_adjPairedOnScrollBar
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/packed/galaxy.base.js
--- a/static/scripts/packed/galaxy.base.js
+++ b/static/scripts/packed/galaxy.base.js
@@ -1,1 +1,1 @@
-(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){var l=i.action||i;g.append($("<li></li>").append($("<a>").attr("href",i.url).html(j).click(l)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]={url:f,action:function(){if(!e||confirm(e)){if(h){window.open(f,h);return false}else{g.click()}}}}}});var c=$(a).find("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}$.fn.refresh_select2=function(){var b=$(this);var a={placeholder:"Click to select",closeOnSelect:!b.is("[MULTIPLE]"),dropdownAutoWidth:true,containerCssClass:"select2-minwidth"};return b.select2(a)};function replace_big_select_inputs(a,c,b){if(!jQuery.fn.select2){return}if(a===undefined){a=20}if(c===undefined){c=3000}b=b||$("select");b.each(function(){var e=$(this).not("[multiple]");var d=e.find("option").length;if((d<a)||(d>c)){return}if(e.hasClass("no-autocomplete")){return}e.refresh_select2()})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=("cur_text" in g?g.cur_text:a.text()),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}m.stopPropagation()})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).click(function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!=="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};function init_refresh_on_change(){$("select[refresh_on_change='true']").off("change").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").off("click").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").off("click").click(function(){return confirm($(this).attr("confirm"))})}jQuery.fn.preventDoubleSubmission=function(){$(this).on("submit",function(b){var a=$(this);if(a.data("submitted")===true){b.preventDefault()}else{a.data("submitted",true)}});return this};$(document).ready(function(){init_refresh_on_change();if($.fn.tooltip){$(".unified-panel-header [title]").tooltip({placement:"bottom"});$("[title]").tooltip()}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
+(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function make_popupmenu(b,c){var a=(b.data("menu_options"));b.data("menu_options",c);if(a){return}b.bind("click.show_popup",function(d){$(".popmenu-wrapper").remove();setTimeout(function(){var g=$("<ul class='dropdown-menu' id='"+b.attr("id")+"-menu'></ul>");var f=b.data("menu_options");if(obj_length(f)<=0){$("<li>No Options.</li>").appendTo(g)}$.each(f,function(j,i){if(i){var l=i.action||i;g.append($("<li></li>").append($("<a>").attr("href",i.url).html(j).click(l)))}else{g.append($("<li></li>").addClass("head").append($("<a href='#'></a>").html(j)))}});var h=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'></div>").append(g).appendTo("body");var e=d.pageX-h.width()/2;e=Math.min(e,$(document).scrollLeft()+$(window).width()-$(h).width()-5);e=Math.max(e,$(document).scrollLeft()+5);h.css({top:d.pageY,left:e})},10);setTimeout(function(){var f=function(h){$(h).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();h.unbind("click.close_popup")})};f($(window.document));f($(window.top.document));for(var e=window.top.frames.length;e--;){var g=$(window.top.frames[e].document);f(g)}},50);return false})}function make_popup_menus(a){a=a||document;$(a).find("div[popupmenu]").each(function(){var b={};var d=$(this);d.find("a").each(function(){var g=$(this),i=g.get(0),e=i.getAttribute("confirm"),f=i.getAttribute("href"),h=i.getAttribute("target");if(!f){b[g.text()]=null}else{b[g.text()]={url:f,action:function(){if(!e||confirm(e)){if(h){window.open(f,h);return false}else{g.click()}}}}}});var c=$(a).find("#"+d.attr("popupmenu"));c.find("a").bind("click",function(f){f.stopPropagation();return true});make_popupmenu(c,b);c.addClass("popup");d.remove()})}$.fn.refresh_select2=function(){var b=$(this);var a={placeholder:"Click to select",closeOnSelect:!b.is("[MULTIPLE]"),dropdownAutoWidth:true,containerCssClass:"select2-minwidth"};return b.select2(a)};function replace_big_select_inputs(a,c,b){if(!jQuery.fn.select2){return}if(a===undefined){a=20}if(c===undefined){c=3000}b=b||$("select");b.each(function(){var e=$(this).not("[multiple]");var d=e.find("option").length;if((d<a)||(d>c)){return}if(e.hasClass("no-autocomplete")){return}e.refresh_select2()})}$.fn.make_text_editable=function(g){var d=("num_cols" in g?g.num_cols:30),c=("num_rows" in g?g.num_rows:4),e=("use_textarea" in g?g.use_textarea:false),b=("on_finish" in g?g.on_finish:null),f=("help_text" in g?g.help_text:null);var a=$(this);a.addClass("editable-text").click(function(l){if($(this).children(":input").length>0){return}a.removeClass("editable-text");var i=function(m){a.find(":input").remove();if(m!==""){a.text(m)}else{a.html("<br>")}a.addClass("editable-text");if(b){b(m)}};var h=("cur_text" in g?g.cur_text:a.text()),k,j;if(e){k=$("<textarea/>").attr({rows:c,cols:d}).text($.trim(h)).keyup(function(m){if(m.keyCode===27){i(h)}});j=$("<button/>").text("Done").click(function(){i(k.val());return false})}else{k=$("<input type='text'/>").attr({value:$.trim(h),size:d}).blur(function(){i(h)}).keyup(function(m){if(m.keyCode===27){$(this).trigger("blur")}else{if(m.keyCode===13){i($(this).val())}}m.stopPropagation()})}a.text("");a.append(k);if(j){a.append(j)}k.focus();k.select();l.stopPropagation()});if(f){a.attr("title",f).tooltip()}return a};function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).click(function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!=="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};function init_refresh_on_change(){$("select[refresh_on_change='true']").off("change").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$(":checkbox[refresh_on_change='true']").off("click").click(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").off("click").click(function(){return confirm($(this).attr("confirm"))})}jQuery.fn.preventDoubleSubmission=function(){$(this).on("submit",function(b){var a=$(this);if(a.data("submitted")===true){b.preventDefault()}else{a.data("submitted",true)}});return this};$(document).ready(function(){init_refresh_on_change();if($.fn.tooltip){$(".unified-panel-header [title]").tooltip({placement:"bottom"});$("[title]").tooltip()}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/packed/mvc/collection/paired-collection-creator.js
--- a/static/scripts/packed/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/packed/mvc/collection/paired-collection-creator.js
@@ -1,1 +1,1 @@
-define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},template:_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join("")),render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(this.template({pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.autoscrollDist=h.autoscrollDist||24;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._setUpBehaviors();this._dataSetUp()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair();this.once("rendered:initial",function(){this.trigger("autopair")})}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(k){var j=[],h=[];function i(l){if(this._filterFwdFn(l)){j.push(l)}if(this._filterRevFn(l)){h.push(l)}}this.unpaired.forEach(_.bind(i,this));return[j,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(i){i=i||this.strategy;var h=this.simpleAutoPair();h=h.concat(this[i].call(this));return h},simpleAutoPair:function(){var o=0,m,s=this._splitByFilters(),h=s[0],r=s[1],q,u,k=false,t=[];while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");k=false;for(m=0;m<r.length;m++){var p=r[m];u=p.name.replace(this.filters[1],"");if(n!==p&&q===u){k=true;var l=this._pair(h.splice(o,1)[0],r.splice(m,1)[0],{silent:true});t.push(l);break}}if(!k){o+=1}}return t},autoPairLevenshtein:function(){var p=0,n,u=this._splitByFilters(),h=u[0],s=u[1],r,x,k,t,l,v=[];while(p<h.length){var o=h[p];r=o.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(n=0;n<s.length;n++){var q=s[n];x=q.name.replace(this.filters[1],"");if(o!==q){if(r===x){t=n;l=0;break}k=levenshteinDistance(r,x);if(k<l){t=n;l=k}}}var w=1-(l/(Math.max(r.length,x.length)));if(w>=this.matchPercentage){var m=this._pair(h.splice(p,1)[0],s.splice(t,1)[0],{silent:true});v.push(m);if(h.length<=0||s.length<=0){return v}}else{p+=1}}return v},autoPairLCSs:function(){var n=0,l,u=this._splitByFilters(),h=u[0],s=u[1],r,y,x,t,p,v=[];if(!h.length||!s.length){return v}while(n<h.length){var m=h[n];r=m.name.replace(this.filters[0],"");p=0;for(l=0;l<s.length;l++){var q=s[l];y=q.name.replace(this.filters[1],"");if(m!==q){if(r===y){t=l;p=r.length;break}var o=this._naiveStartingAndEndingLCS(r,y);x=o.length;if(x>p){t=l;p=x}}}var w=p/(Math.min(r.length,y.length));if(w>=this.matchPercentage){var k=this._pair(h.splice(n,1)[0],s.splice(t,1)[0],{silent:true});v.push(k);if(h.length<=0||s.length<=0){return v}}else{n+=1}}return v},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(j){var k=this,i;if(k.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j||k.$(".collection-name").val()),element_identifiers:k.paired.map(function(l){return k._pairToJSON(l)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(n,l,m){k._ajaxErrHandler(n,l,m)}).done(function(l,m,n){k.trigger("collection:created",l,m,n);if(typeof k.oncreate==="function"){k.oncreate.call(this,l,m,n)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();this.trigger("rendered",this);return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""))({}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.once("rendered",function(){this.trigger("rendered:initial",this)});this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired();this.$(".collection-name").focus()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(h){this.autoPair();this.trigger("autopair")},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(k){k.stopPropagation();var m=$(k.currentTarget),j=m.parent().parent(),i=j.index(".dataset.paired"),l=this.paired[i],h=prompt("Enter a new name for the pair:",l.name);if(h){l.name=h;l.customizedName=true;m.text(l.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index(".unpair-btn"));this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets");this._checkForAutoscroll(i,k.originalEvent.clientY);var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_checkForAutoscroll:function(h,n){var l=2;var m=h.offset(),k=h.scrollTop(),i=n-m.top,j=(m.top+h.outerHeight())-n;if(i>=0&&i<this.autoscrollDist){h.scrollTop(k-l)}else{if(j>=0&&j<this.autoscrollDist){h.scrollTop(k+l)}}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(h){if(h.keyCode===13){this._clickCreate()}},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){console.log(j);h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
+define(["utils/levenshtein","utils/natural-sort","mvc/base-mvc","utils/localization"],function(h,g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(i){this.pair=i.pair||{}},template:_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join("")),render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(this.template({pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(i){i.currentTarget.style.opacity="0.4";if(i.originalEvent){i=i.originalEvent}i.dataTransfer.effectAllowed="move";i.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(i){i.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(i){this.$el.parent().trigger(i)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(i){i=_.defaults(i,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=i.datasets;this.historyId=i.historyId;this.filters=this.commonFilters[i.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(i.filters)){this.filters=i.filters}this.automaticallyPair=i.automaticallyPair;this.matchPercentage=i.matchPercentage;this.strategy=this.strategies[i.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(i.strategy)){this.strategy=i.strategy}this.removeExtensions=true;this.oncancel=i.oncancel;this.oncreate=i.oncreate;this.autoscrollDist=i.autoscrollDist||24;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._setUpBehaviors();this._dataSetUp()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair();this.once("rendered:initial",function(){this.trigger("autopair")})}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(i){i.sort(function(k,j){return g(k.name,j.name)});return i},_ensureIds:function(){this.initialList.forEach(function(i){if(!i.hasOwnProperty("id")){i.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(l){var k=[],i=[];function j(m){if(this._filterFwdFn(m)){k.push(m)}if(this._filterRevFn(m)){i.push(m)}}this.unpaired.forEach(_.bind(j,this));return[k,i]},_filterFwdFn:function(j){var i=new RegExp(this.filters[0]);return i.test(j.name)},_filterRevFn:function(j){var i=new RegExp(this.filters[1]);return i.test(j.name)},_addToUnpaired:function(j){var i=function(k,m){if(k===m){return k}var l=Math.floor((m-k)/2)+k,n=g(j.name,this.unpaired[l].name);if(n<0){return i(k,l)}else{if(n>0){return i(l+1,m)}}while(this.unpaired[l]&&this.unpaired[l].name===j.name){l++}return l}.bind(this);this.unpaired.splice(i(0,this.unpaired.length),0,j)},autoPair:function(j){j=j||this.strategy;var i=this.simpleAutoPair();i=i.concat(this[j].call(this));return i},simpleAutoPair:function(){var p=0,n,t=this._splitByFilters(),k=t[0],s=t[1],r,v,l=false,u=[];while(p<k.length){var o=k[p];r=o.name.replace(this.filters[0],"");l=false;for(n=0;n<s.length;n++){var q=s[n];v=q.name.replace(this.filters[1],"");if(o!==q&&r===v){l=true;var m=this._pair(k.splice(p,1)[0],s.splice(n,1)[0],{silent:true});u.push(m);break}}if(!l){p+=1}}return u},autoPairLevenshtein:function(){var q=0,o,v=this._splitByFilters(),k=v[0],t=v[1],s,y,l,u,m,w=[];while(q<k.length){var p=k[q];s=p.name.replace(this.filters[0],"");m=Number.MAX_VALUE;for(o=0;o<t.length;o++){var r=t[o];y=r.name.replace(this.filters[1],"");if(p!==r){if(s===y){u=o;m=0;break}l=levenshteinDistance(s,y);if(l<m){u=o;m=l}}}var x=1-(m/(Math.max(s.length,y.length)));if(x>=this.matchPercentage){var n=this._pair(k.splice(q,1)[0],t.splice(u,1)[0],{silent:true});w.push(n);if(k.length<=0||t.length<=0){return w}}else{q+=1}}return w},autoPairLCSs:function(){var o=0,m,v=this._splitByFilters(),k=v[0],t=v[1],s,z,y,u,q,w=[];if(!k.length||!t.length){return w}while(o<k.length){var n=k[o];s=n.name.replace(this.filters[0],"");q=0;for(m=0;m<t.length;m++){var r=t[m];z=r.name.replace(this.filters[1],"");if(n!==r){if(s===z){u=m;q=s.length;break}var p=this._naiveStartingAndEndingLCS(s,z);y=p.length;if(y>q){u=m;q=y}}}var x=q/(Math.min(s.length,z.length));if(x>=this.matchPercentage){var l=this._pair(k.splice(o,1)[0],t.splice(u,1)[0],{silent:true});w.push(l);if(k.length<=0||t.length<=0){return w}}else{o+=1}}return w},_naiveStartingAndEndingLCS:function(n,l){var o="",p="",m=0,k=0;while(m<n.length&&m<l.length){if(n[m]!==l[m]){break}o+=n[m];m+=1}if(m===n.length){return n}if(m===l.length){return l}m=(n.length-1);k=(l.length-1);while(m>=0&&k>=0){if(n[m]!==l[k]){break}p=[n[m],p].join("");m-=1;k-=1}return o+p},_pair:function(k,i,j){j=j||{};var l=this._createPair(k,i,j.name);this.paired.push(l);this.unpaired=_.without(this.unpaired,k,i);if(!j.silent){this.trigger("pair:new",l)}return l},_createPair:function(k,i,j){if(!(k&&i)||(k===i)){throw new Error("Bad pairing: "+[JSON.stringify(k),JSON.stringify(i)])}j=j||this._guessNameForPair(k,i);return{forward:k,name:j,reverse:i}},_guessNameForPair:function(k,i,l){l=(l!==undefined)?(l):(this.removeExtensions);var j=this._naiveStartingAndEndingLCS(k.name.replace(this.filters[0],""),i.name.replace(this.filters[1],""));if(l){var m=j.lastIndexOf(".");if(m>0){j=j.slice(0,m)}}return j||(k.name+" & "+i.name)},_unpair:function(j,i){i=i||{};if(!j){throw new Error("Bad pair: "+JSON.stringify(j))}this.paired=_.without(this.paired,j);this._addToUnpaired(j.forward);this._addToUnpaired(j.reverse);if(!i.silent){this.trigger("pair:unpair",[j])}return j},unpairAll:function(){var i=[];while(this.paired.length){i.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",i)},_pairToJSON:function(i){return{collection_type:"paired",src:"new_collection",name:i.name,element_identifiers:[{name:"forward",id:i.forward.id,src:"hda"},{name:"reverse",id:i.reverse.id,src:"hda"}]}},createList:function(k){var l=this,j;if(l.historyId){j="/api/histories/"+this.historyId+"/contents/dataset_collections"}var i={type:"dataset_collection",collection_type:"list:paired",name:_.escape(k||l.$(".collection-name").val()),element_identifiers:l.paired.map(function(m){return l._pairToJSON(m)})};return jQuery.ajax(j,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(i)}).fail(function(o,m,n){l._ajaxErrHandler(o,m,n)}).done(function(m,n,o){l.trigger("collection:created",m,n,o);if(typeof l.oncreate==="function"){l.oncreate.call(this,m,n,o)}})},_ajaxErrHandler:function(l,i,k){this.error(l,i,k);var j=d("An error occurred while creating this collection");if(l){if(l.readyState===0&&l.status===0){j+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(l.responseJSON){j+="<br /><pre>"+JSON.stringify(l.responseJSON)+"</pre>"}else{j+=": "+k}}}creator._showAlert(j,"alert-danger")},render:function(i,j){this.$el.empty().html(e.templates.main());this._renderHeader(i);this._renderMiddle(i);this._renderFooter(i);this._addPluginComponents();this.trigger("rendered",this);return this},_renderHeader:function(j,k){var i=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return i},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(j,k){var i=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return i},_renderUnpaired:function(n,o){var l=this,m,j,i=[],k=this._splitByFilters();this.$(".forward-column .title").text([k[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-k[0].length));this.$(".reverse-column .title").text([k[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-k[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}j=k[1].map(function(q,p){if((k[0][p]!==undefined)&&(k[0][p]!==q)){i.push(l._renderPairButton())}return l._renderUnpairedDataset(q)});m=k[0].map(function(p){return l._renderUnpairedDataset(p)});if(!m.length&&!j.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(m).add(this.$(".unpaired-columns .paired-column .column-datasets").append(i)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(j));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(i){return["(",i," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(i){return $("<li/>").attr("id","dataset-"+i.id).addClass("dataset unpaired").attr("draggable",true).addClass(i.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(i.name)).data("dataset",i)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var i=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(i);return i},_renderUnpairedNotShown:function(){var i=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(i);return i},_adjUnpairedOnScrollbar:function(){var l=this.$(".unpaired-columns").last(),m=this.$(".unpaired-columns .reverse-column .dataset").first();if(!m.size()){return}var i=l.offset().left+l.outerWidth(),k=m.offset().left+m.outerWidth(),j=Math.floor(i)-Math.floor(k);this.$(".unpaired-columns .forward-column").css("margin-left",(j>0)?j:0)},_renderPaired:function(j,k){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var i=this;this.paired.forEach(function(n,l){var m=new f({pair:n});i.$(".paired-columns .column-datasets").append(m.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var i=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(i);return i},_renderFooter:function(j,k){var i=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return i},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(i){function j(m,l){return['<button class="filter-choice btn" ','data-forward="',m,'" data-reverse="',l,'">',d("Forward"),": ",m,", ",d("Reverse"),": ",l,"</button>"].join("")}var k=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",j("_1","_2"),j("_R1","_R2"),"</div>"].join(""))({}));return this.$(i).popover({container:".collection-creator",placement:"bottom",html:true,content:k})},_validationWarning:function(j,i){var k="validation-warning";if(j==="name"){j=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(i){j=j||this.$("."+k);j.removeClass(k)}else{j.addClass(k)}},_setUpBehaviors:function(){this.once("rendered",function(){this.trigger("rendered:initial",this)});this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(i){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var i,j=null;if(this.paired.length){j="alert-success";i=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){i+=": "+d("all datasets have been successfully paired");this.hideUnpaired();this.$(".collection-name").focus()}}else{i=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(i,j)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(i){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(i){$(i.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(i){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(i){$(i.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(i){this.toggleExtensions()},"change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(i){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(i){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(i){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(j,i){i=i||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(i).show().find(".alert-message").html(j)},_hideAlert:function(i){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(i){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(i){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(i,j){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(i,j)},hidePaired:function(i,j){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(i,j)},splitView:function(i,j){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(i,j);return this},_clickUnpairAll:function(i){this.unpairAll()},_clickAutopair:function(i){this.autoPair();this.trigger("autopair")},_clickFilterChoice:function(j){var i=$(j.currentTarget);this.$(".forward-unpaired-filter input").val(i.data("forward"));this.$(".reverse-unpaired-filter input").val(i.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(i){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(i){i.stopPropagation();return this.toggleSelectUnpaired($(i.currentTarget))},toggleSelectUnpaired:function(k,j){j=j||{};var l=k.data("dataset"),i=j.force!==undefined?j.force:!k.hasClass("selected");if(!k.size()||l===undefined){return k}if(i){k.addClass("selected");if(!j.waitToPair){this.pairAllSelected()}}else{k.removeClass("selected")}return k},pairAllSelected:function(j){j=j||{};var k=this,l=[],i=[],m=[];k.$(".unpaired-columns .forward-column .dataset.selected").each(function(){l.push($(this).data("dataset"))});k.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){i.push($(this).data("dataset"))});l.length=i.length=Math.min(l.length,i.length);l.forEach(function(o,n){try{m.push(k._pair(o,i[n],{silent:true}))}catch(p){k.error(p)}});if(m.length&&!j.silent){this.trigger("pair:new",m)}return m},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(k){if(k.shiftKey){var j=this,i=$(k.target).addClass("selected"),l=function(m){j.$(m.target).filter(".dataset").addClass("selected")};i.parent().on("mousemove",l);$(document).one("mouseup",function(m){i.parent().off("mousemove",l);j.pairAllSelected()})}},_clickPairRow:function(k){var l=$(k.currentTarget).index(),j=$(".unpaired-columns .forward-column .dataset").eq(l).data("dataset"),i=$(".unpaired-columns .reverse-column .dataset").eq(l).data("dataset");this._pair(j,i)},_startPartitionDrag:function(j){var i=this,m=j.pageY;$("body").css("cursor","ns-resize");i.$(".flexible-partition-drag").css("color","black");function l(n){i.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",k)}function k(n){var o=n.pageY-m;if(!i.adjPartition(o)){$("body").trigger("mouseup")}i._adjUnpairedOnScrollbar();m+=o}$("body").mousemove(k);$("body").one("mouseup",l)},adjPartition:function(j){var i=this.$(".unpaired-columns"),k=this.$(".paired-columns"),l=parseInt(i.css("height"),10),m=parseInt(k.css("height"),10);l=Math.max(10,l+j);m=m-j;var n=j<0;if(n){if(this.unpairedPanelHidden){return false}else{if(l<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){i.show();this.unpairedPanelHidden=false}}if(!n){if(this.pairedPanelHidden){return false}else{if(m<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){k.show();this.pairedPanelHidden=false}}i.css({height:l+"px",flex:"0 0 auto"});return true},selectPair:function(i){i.stopPropagation();$(i.currentTarget).toggleClass("selected")},clearSelectedPaired:function(i){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(l){l.stopPropagation();var n=$(l.currentTarget),k=n.parent().parent(),j=k.index(".dataset.paired"),m=this.paired[j],i=prompt("Enter a new name for the pair:",m.name);if(i){m.name=i;m.customizedName=true;n.text(m.name)}},_clickUnpair:function(j){var i=Math.floor($(j.currentTarget).index(".unpair-btn"));this._unpair(this.paired[i])},_dragoverPairedColumns:function(l){l.preventDefault();var j=this.$(".paired-columns .column-datasets");this._checkForAutoscroll(j,l.originalEvent.clientY);var k=this._getNearestPairedDatasetLi(l.originalEvent.clientY);$(".paired-drop-placeholder").remove();var i=$('<div class="paired-drop-placeholder"></div>');if(!k.size()){j.append(i)}else{k.before(i)}},_checkForAutoscroll:function(i,o){var m=2;var n=i.offset(),l=i.scrollTop(),j=o-n.top,k=(n.top+i.outerHeight())-o;if(j>=0&&j<this.autoscrollDist){i.scrollTop(l-m)}else{if(k>=0&&k<this.autoscrollDist){i.scrollTop(l+m)}}},_getNearestPairedDatasetLi:function(p){var m=4,k=this.$(".paired-columns .column-datasets li").toArray();for(var l=0;l<k.length;l++){var o=$(k[l]),n=o.offset().top,j=Math.floor(o.outerHeight()/2)+m;if(n+j>p&&n-j<p){return o}}return $()},_dropPairedColumns:function(j){j.preventDefault();j.dataTransfer.dropEffect="move";var i=this._getNearestPairedDatasetLi(j.originalEvent.clientY);if(i.size()){this.$dragging.insertBefore(i)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var i=[];this.$(".paired-columns .dataset.paired").each(function(){i.push($(this).data("pair"))});this.paired=i;this._renderPaired()},_pairDragstart:function(j,k){k.$el.addClass("selected");var i=this.$(".paired-columns .dataset.selected");this.$dragging=i},_pairDragend:function(i,j){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(j){var i=this;i.removeExtensions=(j!==undefined)?(j):(!i.removeExtensions);_.each(i.paired,function(k){if(k.customizedName){return}k.name=i._guessNameForPair(k.forward,k.reverse)});i._renderPaired();i._renderFooter()},_changeName:function(i){this._validationWarning("name",!!this._getName())},_nameCheckForEnter:function(i){if(i.keyCode===13){this._clickCreate()}},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(j){var i=this._getName();if(!i){this._validationWarning("name")}else{this.createList()}},_printList:function(j){var i=this;_.each(j,function(k){if(j===i.paired){i._printPair(k)}else{}})},_printPair:function(i){this.debug(i.forward.name,i.reverse.name,": ->",i.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function i(k,j){k=k||"body";if(!this.size()){return this}$(this).each(function(){var m=$(this),l=m.data("target");if(l){m.mouseover(function(n){$(l,k).css({background:j})}).mouseout(function(n){$(l).css({background:""})})}});return this}})}());var b=function c(k,i){console.log(k);i=_.defaults(i||{},{datasets:k,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var j=new e(i).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:j.$el,width:"80%",height:"800px",closing_events:true});window.PCC=j;return j};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/packed/utils/natural-sort.js
--- /dev/null
+++ b/static/scripts/packed/utils/natural-sort.js
@@ -0,0 +1,1 @@
+define([],function(){function a(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}return a});
\ No newline at end of file
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 static/scripts/utils/natural-sort.js
--- /dev/null
+++ b/static/scripts/utils/natural-sort.js
@@ -0,0 +1,30 @@
+define([], function(){
+// Alphanumeric/natural sort fn
+function naturalSort(a, b) {
+ // setup temp-scope variables for comparison evauluation
+ var re = /(-?[0-9\.]+)/g,
+ x = a.toString().toLowerCase() || '',
+ y = b.toString().toLowerCase() || '',
+ nC = String.fromCharCode(0),
+ xN = x.replace( re, nC + '$1' + nC ).split(nC),
+ yN = y.replace( re, nC + '$1' + nC ).split(nC),
+ xD = (new Date(x)).getTime(),
+ yD = xD ? (new Date(y)).getTime() : null;
+ // natural sorting of dates
+ if ( yD ) {
+ if ( xD < yD ) { return -1; }
+ else if ( xD > yD ) { return 1; }
+ }
+ // natural sorting through split numeric strings and default strings
+ var oFxNcL, oFyNcL;
+ for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
+ oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
+ oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
+ if (oFxNcL < oFyNcL) { return -1; }
+ else if (oFxNcL > oFyNcL) { return 1; }
+ }
+ return 0;
+}
+
+return naturalSort;
+})
diff -r 109da695364ceee5c27bf71b6a0bed918813fcda -r 38529c8600696278d2c4299c03e9be38aa32e146 test/qunit/tests/paired-collection-creator.js
--- a/test/qunit/tests/paired-collection-creator.js
+++ b/test/qunit/tests/paired-collection-creator.js
@@ -2,8 +2,7 @@
"mvc/collection/paired-collection-creator",
"test-data/paired-collection-creator.data",
"jquery",
- "sinon-qunit",
- "galaxy.base"
+ "sinon-qunit"
], function(
PAIRED_COLLECTION_CREATOR,
// why am I yelling?
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0