From 5e2e34bf0d12afdc74f1b2b0918e747c9628155b Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 07:30:39 -0600 Subject: [PATCH 01/19] Adding select-all to ftpupload --- static/scripts/mvc/upload/upload-ftp.js | 91 ++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 62bf8584238..f98530b5040 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -49,6 +49,48 @@ return Backbone.View.extend({ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); + // ADD THINGS HERE + // + $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){ + var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + var allChecked; + $this = $(this); + // + if($this.hasClass("fa-square-o")){ + $this.removeClass("fa-square-o"); + $this.removeClass("fa-minus-square-o"); + $this.addClass("fa-check-square-o"); + allChecked=true; + } + else{ + $this.removeClass("fa-check-square-o"); + $this.removeClass("fa-minus-square-o"); + $this.addClass("fa-square-o"); + allChecked=false; + } + // + for(i = 0; i < len; i++){ + if(allChecked) + { + + checkboxes.eq(i).removeClass("fa-square-o"); + checkboxes.eq(i).addClass("fa-check-square-o"); + } + else{ + checkboxes.eq(i).removeClass("fa-check-square-o"); + checkboxes.eq(i).addClass("fa-square-o"); + } + } + console.log(checkboxes, allChecked); + return; + } ); + + + + // END JC ADD + + } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); @@ -56,6 +98,10 @@ return Backbone.View.extend({ // hide spinner this.$el.find('#upload-ftp-wait').hide(); + + + + }, // add @@ -110,7 +156,40 @@ return Backbone.View.extend({ // add new icon class $icon.addClass(self.options.class_add); } + + var selectBox=$icon.parent().parent().parent().parent().find('#selectAll'); + var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; +// var checked = 0; + // console.log("BeforeLoop " + checked); + // for (i = 0; i < len; i++) { + // console.log("In loop "+checked, checkboxes.eq(i)); + // if (checkboxes.eq(i).hasClass("fa-check-square-o")) { + // checked++; + // console.log("In if "+checked); + // } + // } + if(lenChecked > 0 && lenChecked !== lenAll){ + selectBox.removeClass("fa-square-o"); + selectBox.removeClass("fa-check-square-o"); + selectBox.addClass("fa-minus-square-o"); + } + else if(lenChecked === lenAll){ + selectBox.removeClass("fa-square-o"); + selectBox.addClass("fa-check-square-o"); + selectBox.removeClass("fa-minus-square-o"); + } + else if(lenChecked === 0){ + selectBox.addClass("fa-square-o"); + selectBox.removeClass("fa-check-square-o"); + selectBox.removeClass("fa-minus-square-o"); + } + console.log(checkboxes,lenChecked); + }); + }, // get model index @@ -130,7 +209,7 @@ return Backbone.View.extend({ // template row _templateRow: function(options) { return '' + - '
' + + '
' + '

' + options.path + '

' + '' + Utils.bytesToString(options.size) + '' + '' + options.ctime + '' + @@ -149,7 +228,9 @@ return Backbone.View.extend({ '' + '' + '' + - '' + +//jc added + '' + +//end jc added '' + '' + '' + @@ -171,7 +252,11 @@ return Backbone.View.extend({ return '
' + '
' + '
This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.app.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
' + - '
' + + '
' +//jc added + +//end jc added + '
' + '
'; } From 89a7929fa0390cc1b038acd80db76042ff665d49 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 14:33:26 -0600 Subject: [PATCH 02/19] complete selectAll checkbox --- static/scripts/mvc/upload/upload-ftp.js | 184 ++++++++++++------------ 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index f98530b5040..22ebb7427c2 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -49,59 +49,62 @@ return Backbone.View.extend({ // update stats this.$el.find('#upload-ftp-number').html(ftp_files.length + ' files'); this.$el.find('#upload-ftp-disk').html(Utils.bytesToString (size, true)); - // ADD THINGS HERE - // - $($('.upload-ftp')[0]).find('#selectAll').on('click', function(){ - var checkboxes=$(this).parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); + + var selectAll = this.$el.find('#selectAll'); + + // call method to determine and set selectAll status on loading + this._updateSelectAll(selectAll); + + // selectAll checkbox has been clicked + selectAll.on('click', function(){ + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; var allChecked; $this = $(this); - // - if($this.hasClass("fa-square-o")){ - $this.removeClass("fa-square-o"); - $this.removeClass("fa-minus-square-o"); - $this.addClass("fa-check-square-o"); + + // change state of the selectAll checkbox + if($this.hasClass('fa-square-o')){ + // in unchecked, change to checked + $this.removeClass('fa-square-o fa-minus-square-o'); + $this.addClass('fa-check-square-o'); allChecked=true; } else{ - $this.removeClass("fa-check-square-o"); - $this.removeClass("fa-minus-square-o"); - $this.addClass("fa-square-o"); + // if checked, change to unchecked + $this.removeClass('fa-check-square-o fa-minus-square-o'); + $this.addClass('fa-square-o'); allChecked=false; } - // + + // change state of the sub-checkboxes for(i = 0; i < len; i++){ if(allChecked) { - - checkboxes.eq(i).removeClass("fa-square-o"); - checkboxes.eq(i).addClass("fa-check-square-o"); + // all checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-square-o')) + { + // if they are not checked, check them + checkboxes.eq(i).trigger('addToUpBox'); + } } else{ - checkboxes.eq(i).removeClass("fa-check-square-o"); - checkboxes.eq(i).addClass("fa-square-o"); + // no checkboxes should be checked + if(checkboxes.eq(i).hasClass('fa-check-square-o')) + { + // if they are checked, uncheck them + checkboxes.eq(i).trigger('addToUpBox'); + } } } - console.log(checkboxes, allChecked); return; } ); - - - // END JC ADD - - } else { // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - // hide spinner this.$el.find('#upload-ftp-wait').hide(); - - - - }, // add @@ -125,73 +128,74 @@ return Backbone.View.extend({ } else { icon_class = this.options.class_add; } - // add icon class $icon.addClass(icon_class); + + $it.on('addToUpBox', function(){ + var model_index = self._find(ftp_file); - // click to add ftp files - $it.on('click', function() { - // find model - var model_index = self._find(ftp_file); - - // update icon - $icon.removeClass(); - - // add model - if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); - - // add new icon class - $icon.addClass(self.options.class_remove); - } else { - // remove - self.app.collection.remove(model_index); - - // add new icon class - $icon.addClass(self.options.class_add); - } - - var selectBox=$icon.parent().parent().parent().parent().find('#selectAll'); - var checkboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div'); - var checkedCheckboxes=$icon.parent().parent().parent().parent().find('tr.upload-ftp-row>td>div.fa-check-square-o'); - var lenAll = checkboxes.length; - var lenChecked = checkedCheckboxes.length; -// var checked = 0; - // console.log("BeforeLoop " + checked); - // for (i = 0; i < len; i++) { - // console.log("In loop "+checked, checkboxes.eq(i)); - // if (checkboxes.eq(i).hasClass("fa-check-square-o")) { - // checked++; - // console.log("In if "+checked); - // } - // } - if(lenChecked > 0 && lenChecked !== lenAll){ - selectBox.removeClass("fa-square-o"); - selectBox.removeClass("fa-check-square-o"); - selectBox.addClass("fa-minus-square-o"); - } - else if(lenChecked === lenAll){ - selectBox.removeClass("fa-square-o"); - selectBox.addClass("fa-check-square-o"); - selectBox.removeClass("fa-minus-square-o"); - } - else if(lenChecked === 0){ - selectBox.addClass("fa-square-o"); - selectBox.removeClass("fa-check-square-o"); - selectBox.removeClass("fa-minus-square-o"); - } - console.log(checkboxes,lenChecked); + // update icon + $icon.removeClass(); + // add model + if (!model_index) { + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); + // add new icon class + $icon.addClass(self.options.class_remove); + } else { + // remove + self.app.collection.remove(model_index); + // add new icon class + $icon.addClass(self.options.class_add); + } }); - }, - + $it.on('click', function() { + //trigger my new event + $icon.trigger('addToUpBox'); + + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); + }, + + _updateSelectAll: function(selectBox){ + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; + + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll){ + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } + else if(lenChecked === lenAll){ + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } + else if(lenChecked === 0){ + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, + + + // get model index _find: function(ftp_file) { // check if exists already From ba91ea1f59a452a0b05c06820e70d91e5ffd6520 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 14:40:28 -0600 Subject: [PATCH 03/19] complete selectAll checkbox cleanup --- static/scripts/mvc/upload/upload-ftp.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 22ebb7427c2..f3b14593af2 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -103,6 +103,7 @@ return Backbone.View.extend({ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -128,10 +129,12 @@ return Backbone.View.extend({ } else { icon_class = this.options.class_add; } + // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function(){ + // find model var model_index = self._find(ftp_file); // update icon @@ -146,16 +149,19 @@ return Backbone.View.extend({ size : ftp_file.size, path : ftp_file.path }]); + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); + // add new icon class $icon.addClass(self.options.class_add); } }); + // click to add ftp files $it.on('click', function() { //trigger my new event $icon.trigger('addToUpBox'); @@ -232,9 +238,7 @@ return Backbone.View.extend({ '
NameSizeCreated
' + '' + '' + -//jc added '' + -//end jc added '' + '' + '' + @@ -257,9 +261,7 @@ return Backbone.View.extend({ '
' + '
This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.app.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
' + '
' -//jc added -//end jc added '
' + '
'; } From f6ce62b639da101846f6b8ab48bbbdf2500a61b4 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 14:53:07 -0600 Subject: [PATCH 04/19] complete selectAll tab fixes --- static/scripts/mvc/upload/upload-ftp.js | 180 ++++++++++++------------ 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index f3b14593af2..f6bf7f60e18 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -56,48 +56,48 @@ return Backbone.View.extend({ this._updateSelectAll(selectAll); // selectAll checkbox has been clicked - selectAll.on('click', function(){ - var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); - var len = checkboxes.length; - var allChecked; - $this = $(this); + selectAll.on('click', function(){ + var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); + var len = checkboxes.length; + var allChecked; + $this = $(this); - // change state of the selectAll checkbox - if($this.hasClass('fa-square-o')){ - // in unchecked, change to checked - $this.removeClass('fa-square-o fa-minus-square-o'); - $this.addClass('fa-check-square-o'); - allChecked=true; - } - else{ - // if checked, change to unchecked - $this.removeClass('fa-check-square-o fa-minus-square-o'); - $this.addClass('fa-square-o'); - allChecked=false; - } + // change state of the selectAll checkbox + if($this.hasClass('fa-square-o')){ + // in unchecked, change to checked + $this.removeClass('fa-square-o fa-minus-square-o'); + $this.addClass('fa-check-square-o'); + allChecked=true; + } + else{ + // if checked, change to unchecked + $this.removeClass('fa-check-square-o fa-minus-square-o'); + $this.addClass('fa-square-o'); + allChecked=false; + } - // change state of the sub-checkboxes - for(i = 0; i < len; i++){ - if(allChecked) - { - // all checkboxes should be checked + // change state of the sub-checkboxes + for(i = 0; i < len; i++){ + if(allChecked) + { + // all checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-square-o')) { - // if they are not checked, check them + // if they are not checked, check them checkboxes.eq(i).trigger('addToUpBox'); } - } - else{ - // no checkboxes should be checked + } + else{ + // no checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-check-square-o')) { - // if they are checked, uncheck them - checkboxes.eq(i).trigger('addToUpBox'); + // if they are checked, uncheck them + checkboxes.eq(i).trigger('addToUpBox'); } - } - } - return; - } ); + } + } + return; + } ); } else { // add info @@ -134,74 +134,74 @@ return Backbone.View.extend({ $icon.addClass(icon_class); $it.on('addToUpBox', function(){ - // find model - var model_index = self._find(ftp_file); +// find model +var model_index = self._find(ftp_file); - // update icon - $icon.removeClass(); + // update icon + $icon.removeClass(); - // add model - if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); + // add model + if (!model_index) { + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); - // add new icon class - $icon.addClass(self.options.class_remove); - } else { - // remove - self.app.collection.remove(model_index); - - // add new icon class - $icon.addClass(self.options.class_add); - } + // add new icon class + $icon.addClass(self.options.class_remove); + } else { + // remove + self.app.collection.remove(model_index); + + // add new icon class + $icon.addClass(self.options.class_add); + } }); // click to add ftp files - $it.on('click', function() { - //trigger my new event - $icon.trigger('addToUpBox'); + $it.on('click', function() { + //trigger my new event + $icon.trigger('addToUpBox'); - // click to add ftp files - // modify selectAll box based on number of checkboxes checked - var selectBox=$icon.parents().find('#selectAll'); - // determine and set state of selectAll after sub-checkbox clicked - self._updateSelectAll(selectBox); - }); - }, + // click to add ftp files + // modify selectAll box based on number of checkboxes checked + var selectBox=$icon.parents().find('#selectAll'); + // determine and set state of selectAll after sub-checkbox clicked + self._updateSelectAll(selectBox); + }); + }, - _updateSelectAll: function(selectBox){ - // array of all checkboxes - var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); - // array of only checked checkboxes - var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); - var lenAll = checkboxes.length; - var lenChecked = checkedCheckboxes.length; + _updateSelectAll: function(selectBox){ + // array of all checkboxes + var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); + // array of only checked checkboxes + var checkedCheckboxes=selectBox.parents().find('tr.upload-ftp-row>td>div.fa-check-square-o'); + var lenAll = checkboxes.length; + var lenChecked = checkedCheckboxes.length; + + // determine which state the selectAll checkbox needs to be and setting it + if(lenChecked > 0 && lenChecked !== lenAll){ + // indeterminate state + selectBox.removeClass('fa-square-o fa-check-square-o'); + selectBox.addClass('fa-minus-square-o'); + } + else if(lenChecked === lenAll){ + // checked state + selectBox.removeClass('fa-square-o fa-minus-square-o'); + selectBox.addClass('fa-check-square-o'); + } + else if(lenChecked === 0){ + // unchecked state + selectBox.removeClass('fa-check-square-o fa-minus-square-o'); + selectBox.addClass('fa-square-o'); + } + }, - // determine which state the selectAll checkbox needs to be and setting it - if(lenChecked > 0 && lenChecked !== lenAll){ - // indeterminate state - selectBox.removeClass('fa-square-o fa-check-square-o'); - selectBox.addClass('fa-minus-square-o'); - } - else if(lenChecked === lenAll){ - // checked state - selectBox.removeClass('fa-square-o fa-minus-square-o'); - selectBox.addClass('fa-check-square-o'); - } - else if(lenChecked === 0){ - // unchecked state - selectBox.removeClass('fa-check-square-o fa-minus-square-o'); - selectBox.addClass('fa-square-o'); - } - }, - // get model index _find: function(ftp_file) { // check if exists already From 9957cbae7595ebc506e6d81ee6cddc4abb72e309 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 14:56:46 -0600 Subject: [PATCH 05/19] complete selectAll tab fixes2 --- static/scripts/mvc/upload/upload-ftp.js | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index f6bf7f60e18..7270829e377 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -78,8 +78,8 @@ return Backbone.View.extend({ // change state of the sub-checkboxes for(i = 0; i < len; i++){ - if(allChecked) - { + if(allChecked) + { // all checkboxes should be checked if(checkboxes.eq(i).hasClass('fa-square-o')) { @@ -97,7 +97,7 @@ return Backbone.View.extend({ } } return; - } ); + }); } else { // add info @@ -134,24 +134,24 @@ return Backbone.View.extend({ $icon.addClass(icon_class); $it.on('addToUpBox', function(){ -// find model -var model_index = self._find(ftp_file); + // find model + var model_index = self._find(ftp_file); // update icon $icon.removeClass(); // add model if (!model_index) { - // add to uploadbox - self.app.uploadbox.add([{ - mode : 'ftp', - name : ftp_file.path, - size : ftp_file.size, - path : ftp_file.path - }]); + // add to uploadbox + self.app.uploadbox.add([{ + mode : 'ftp', + name : ftp_file.path, + size : ftp_file.size, + path : ftp_file.path + }]); - // add new icon class - $icon.addClass(self.options.class_remove); + // add new icon class + $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); From 330076fe168b2db3381571098e48503b4d884a54 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 14:59:58 -0600 Subject: [PATCH 06/19] complete selectAll tab fixes2 --- static/scripts/mvc/upload/upload-ftp.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 7270829e377..807d3ee329a 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -63,17 +63,17 @@ return Backbone.View.extend({ $this = $(this); // change state of the selectAll checkbox - if($this.hasClass('fa-square-o')){ - // in unchecked, change to checked - $this.removeClass('fa-square-o fa-minus-square-o'); - $this.addClass('fa-check-square-o'); - allChecked=true; - } - else{ - // if checked, change to unchecked + if($this.hasClass('fa-check-square-o')){ $this.removeClass('fa-check-square-o fa-minus-square-o'); $this.addClass('fa-square-o'); allChecked=false; + + } + else{ + // in unchecked, change to checked + $this.removeClass('fa-square-o fa-minus-square-o'); + $this.addClass('fa-check-square-o'); + allChecked=true; } // change state of the sub-checkboxes From 48962ef388c21d693bbed046f5ce191116189584 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Wed, 14 Jan 2015 15:10:38 -0600 Subject: [PATCH 07/19] complete selectAll indeter to checked --- static/scripts/mvc/upload/upload-ftp.js | 43 +++++++++++-------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 807d3ee329a..b4c03f63ef9 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -56,41 +56,36 @@ return Backbone.View.extend({ this._updateSelectAll(selectAll); // selectAll checkbox has been clicked - selectAll.on('click', function(){ + selectAll.on('click', function() { var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; var allChecked; $this = $(this); // change state of the selectAll checkbox - if($this.hasClass('fa-check-square-o')){ - $this.removeClass('fa-check-square-o fa-minus-square-o'); + if($this.hasClass('fa-check-square-o')) { + // if checked change to unchecked + $this.removeClass('fa-check-square-o'); $this.addClass('fa-square-o'); allChecked=false; - - } - else{ - // in unchecked, change to checked + } else { + // if checked or partially checked, change to checked $this.removeClass('fa-square-o fa-minus-square-o'); $this.addClass('fa-check-square-o'); allChecked=true; } // change state of the sub-checkboxes - for(i = 0; i < len; i++){ - if(allChecked) - { + for(i = 0; i < len; i++) { + if(allChecked) { // all checkboxes should be checked - if(checkboxes.eq(i).hasClass('fa-square-o')) - { + if(checkboxes.eq(i).hasClass('fa-square-o')) { // if they are not checked, check them checkboxes.eq(i).trigger('addToUpBox'); } - } - else{ + } else { // no checkboxes should be checked - if(checkboxes.eq(i).hasClass('fa-check-square-o')) - { + if(checkboxes.eq(i).hasClass('fa-check-square-o')) { // if they are checked, uncheck them checkboxes.eq(i).trigger('addToUpBox'); } @@ -133,9 +128,9 @@ return Backbone.View.extend({ // add icon class $icon.addClass(icon_class); - $it.on('addToUpBox', function(){ - // find model - var model_index = self._find(ftp_file); + $it.on('addToUpBox', function() { + // find model + var model_index = self._find(ftp_file); // update icon $icon.removeClass(); @@ -174,7 +169,7 @@ return Backbone.View.extend({ }); }, - _updateSelectAll: function(selectBox){ + _updateSelectAll: function(selectBox) { // array of all checkboxes var checkboxes=selectBox.parents().find('tr.upload-ftp-row>td>div'); // array of only checked checkboxes @@ -183,17 +178,15 @@ return Backbone.View.extend({ var lenChecked = checkedCheckboxes.length; // determine which state the selectAll checkbox needs to be and setting it - if(lenChecked > 0 && lenChecked !== lenAll){ + if(lenChecked > 0 && lenChecked !== lenAll) { // indeterminate state selectBox.removeClass('fa-square-o fa-check-square-o'); selectBox.addClass('fa-minus-square-o'); - } - else if(lenChecked === lenAll){ + } else if(lenChecked === lenAll) { // checked state selectBox.removeClass('fa-square-o fa-minus-square-o'); selectBox.addClass('fa-check-square-o'); - } - else if(lenChecked === 0){ + } else if(lenChecked === 0) { // unchecked state selectBox.removeClass('fa-check-square-o fa-minus-square-o'); selectBox.addClass('fa-square-o'); From b46df6dbdc8d2cccd3a6e45375f63ec4ac19854a Mon Sep 17 00:00:00 2001 From: JenCabral Date: Thu, 15 Jan 2015 07:35:52 -0600 Subject: [PATCH 08/19] remove non changes and use _updateSelectAll --- static/scripts/mvc/upload/upload-ftp.js | 34 +++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index b4c03f63ef9..20e1f9ef66e 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -35,6 +35,7 @@ return Backbone.View.extend({ // fill table _fill: function(ftp_files) { + var self = this; if (ftp_files && ftp_files.length > 0) { // add table this.$el.find('#upload-ftp-content').html($(this._templateTable())); @@ -59,21 +60,23 @@ return Backbone.View.extend({ selectAll.on('click', function() { var checkboxes=$(this).parents().find('tr.upload-ftp-row>td>div'); var len = checkboxes.length; - var allChecked; $this = $(this); + var allChecked = !($this.hasClass('fa-check-square-o')); + + // change state of the selectAll checkbox - if($this.hasClass('fa-check-square-o')) { - // if checked change to unchecked - $this.removeClass('fa-check-square-o'); - $this.addClass('fa-square-o'); - allChecked=false; - } else { - // if checked or partially checked, change to checked - $this.removeClass('fa-square-o fa-minus-square-o'); - $this.addClass('fa-check-square-o'); - allChecked=true; - } + // if($this.hasClass('fa-check-square-o')) { + // // if checked change to unchecked + // $this.removeClass('fa-check-square-o'); + // $this.addClass('fa-square-o'); + // allChecked=false; + // } else { + // // if checked or partially checked, change to checked + // $this.removeClass('fa-square-o fa-minus-square-o'); + // $this.addClass('fa-check-square-o'); + // allChecked=true; + // } // change state of the sub-checkboxes for(i = 0; i < len; i++) { @@ -91,6 +94,7 @@ return Backbone.View.extend({ } } } + self._updateSelectAll(selectAll); return; }); @@ -212,7 +216,7 @@ return Backbone.View.extend({ // template row _templateRow: function(options) { return '
' + - '' + + '' + '' + '' + '' + @@ -253,9 +257,7 @@ return Backbone.View.extend({ return '
' + '
' + '
This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at ' + this.app.options.ftp_upload_site + ' using your Galaxy credentials (email address and password).
' + - '
' - - '
' + + '
' + '
'; } From d55964ad60b74132a0f9bd0fe57590574822778c Mon Sep 17 00:00:00 2001 From: JenCabral Date: Thu, 15 Jan 2015 07:37:40 -0600 Subject: [PATCH 09/19] remove non changes and use _updateSelectAll2 --- static/scripts/mvc/upload/upload-ftp.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 20e1f9ef66e..b4ff688281d 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -102,7 +102,6 @@ return Backbone.View.extend({ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } - // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -128,17 +127,14 @@ return Backbone.View.extend({ } else { icon_class = this.options.class_add; } - // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function() { // find model var model_index = self._find(ftp_file); - // update icon $icon.removeClass(); - // add model if (!model_index) { // add to uploadbox @@ -148,13 +144,11 @@ return Backbone.View.extend({ size : ftp_file.size, path : ftp_file.path }]); - // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); - // add new icon class $icon.addClass(self.options.class_add); } @@ -216,7 +210,7 @@ return Backbone.View.extend({ // template row _templateRow: function(options) { return '
' + - '' + + '' + '' + '' + '' + From bc2daef9fc76c4d37f5cc98e82144ea6495b45e0 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Thu, 15 Jan 2015 07:41:26 -0600 Subject: [PATCH 10/19] remove non changes and use _updateSelectAll3 --- static/scripts/mvc/upload/upload-ftp.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index b4ff688281d..8fb03e19683 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -102,6 +102,7 @@ return Backbone.View.extend({ // add info this.$el.find('#upload-ftp-content').html($(this._templateInfo())); } + // hide spinner this.$el.find('#upload-ftp-wait').hide(); }, @@ -127,14 +128,17 @@ return Backbone.View.extend({ } else { icon_class = this.options.class_add; } + // add icon class $icon.addClass(icon_class); $it.on('addToUpBox', function() { // find model var model_index = self._find(ftp_file); + // update icon $icon.removeClass(); + // add model if (!model_index) { // add to uploadbox @@ -144,11 +148,13 @@ return Backbone.View.extend({ size : ftp_file.size, path : ftp_file.path }]); + // add new icon class $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); + // add new icon class $icon.addClass(self.options.class_add); } From c86fbcae3679b30dfc693d9d53bc9ffc069437eb Mon Sep 17 00:00:00 2001 From: JenCabral Date: Thu, 15 Jan 2015 07:44:15 -0600 Subject: [PATCH 11/19] remove non changes and use _updateSelectAll4 --- static/scripts/mvc/upload/upload-ftp.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/static/scripts/mvc/upload/upload-ftp.js b/static/scripts/mvc/upload/upload-ftp.js index 8fb03e19683..1aaa26a38df 100644 --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -62,21 +62,6 @@ return Backbone.View.extend({ var len = checkboxes.length; $this = $(this); var allChecked = !($this.hasClass('fa-check-square-o')); - - - - // change state of the selectAll checkbox - // if($this.hasClass('fa-check-square-o')) { - // // if checked change to unchecked - // $this.removeClass('fa-check-square-o'); - // $this.addClass('fa-square-o'); - // allChecked=false; - // } else { - // // if checked or partially checked, change to checked - // $this.removeClass('fa-square-o fa-minus-square-o'); - // $this.addClass('fa-check-square-o'); - // allChecked=true; - // } // change state of the sub-checkboxes for(i = 0; i < len; i++) { @@ -94,8 +79,8 @@ return Backbone.View.extend({ } } } + self._updateSelectAll(selectAll); - return; }); } else { From 88584e17d69e51f4cf92a0f5f4516666715e24c7 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Thu, 15 Jan 2015 09:44:03 -0600 Subject: [PATCH 12/19] adding packed file --- static/scripts/packed/mvc/upload/upload-ftp.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/scripts/packed/mvc/upload/upload-ftp.js b/static/scripts/packed/mvc/upload/upload-ftp.js index 0d5d1c4e195..30c528e2bea 100644 --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1 +1,2 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)},error:function(){b._fill()}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c&&c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'"},_templateTable:function(){return'Available files:   
NameSizeCreated

' + options.path + '

' + Utils.bytesToString(options.size) + '' + options.ctime + '

' + options.path + '

' + Utils.bytesToString(options.size) + '' + options.ctime + '

'+b.path+'

'+a.bytesToString(b.size)+''+b.ctime+"
NameSizeCreated
'},_templateInfo:function(){return'
Your FTP directory does not contain any files.
'},_template:function(){return'
This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at '+this.app.options.ftp_upload_site+' using your Galaxy credentials (email address and password).
'}})}); \ No newline at end of file +// dependencies +define(["utils/utils"],function(e){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(t){this.app=t;var n=this;this.setElement(this._template()),e.get({url:galaxy_config.root+"api/ftp_files",success:function(e){n._fill(e)},error:function(){n._fill()}})},events:{mousedown:function(e){e.preventDefault()}},_fill:function(t){var n=this;if(t&&t.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var r=0;for(key in t)this.add(t[key]),r+=t[key].size;this.$el.find("#upload-ftp-number").html(t.length+" files"),this.$el.find("#upload-ftp-disk").html(e.bytesToString(r,!0));var s=this.$el.find("#selectAll");this._updateSelectAll(s),s.on("click",function(){var e=$(this).parents().find("tr.upload-ftp-row>td>div"),t=e.length;$this=$(this);var r=!$this.hasClass("fa-check-square-o");for(i=0;itd>div"),n=e.parents().find("tr.upload-ftp-row>td>div.fa-check-square-o"),r=t.length,i=n.length;i>0&&i!==r?(e.removeClass("fa-square-o fa-check-square-o"),e.addClass("fa-minus-square-o")):i===r?(e.removeClass("fa-square-o fa-minus-square-o"),e.addClass("fa-check-square-o")):i===0&&(e.removeClass("fa-check-square-o fa-minus-square-o"),e.addClass("fa-square-o"))},_find:function(e){var t=this.app.collection.where({file_path:e.path}),n=null;for(var r in t){var i=t[r];i.get("status")=="init"&&i.get("file_mode")=="ftp"&&(n=i.get("id"))}return n},_templateRow:function(t){return'

'+t.path+"

"+''+e.bytesToString(t.size)+""+''+t.ctime+""+""},_templateTable:function(){return'Available files:   
NameSizeCreated
'},_templateInfo:function(){return'
Your FTP directory does not contain any files.
'},_template:function(){return'
This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at '+this.app.options.ftp_upload_site+" using your Galaxy credentials (email address and password).
"+'
'+"
"}})}); \ No newline at end of file From 37ae1b1024a3a63760d4b836ecd84a0204db59d5 Mon Sep 17 00:00:00 2001 From: JenCabral Date: Fri, 16 Jan 2015 15:23:05 -0600 Subject: [PATCH 13/19] Type drop-down for all files --- static/scripts/mvc/upload/upload-model.js | 1 + static/scripts/mvc/upload/upload-row.js | 3 +- static/scripts/mvc/upload/upload-view.js | 92 ++++++++++++++++++++++- 3 files changed, 93 insertions(+), 3 deletions(-) diff --git a/static/scripts/mvc/upload/upload-model.js b/static/scripts/mvc/upload/upload-model.js index 0acf8a36c2e..6d1757e3582 100644 --- a/static/scripts/mvc/upload/upload-model.js +++ b/static/scripts/mvc/upload/upload-model.js @@ -14,6 +14,7 @@ var Model = Backbone.Model.extend({ file_type : null, file_path : '', percentage : 0, + row : null, // settings space_to_tabs : false, diff --git a/static/scripts/mvc/upload/upload-row.js b/static/scripts/mvc/upload/upload-row.js index d7f9c385e80..4d523d0d970 100644 --- a/static/scripts/mvc/upload/upload-row.js +++ b/static/scripts/mvc/upload/upload-row.js @@ -83,7 +83,7 @@ return Backbone.View.extend({ }, data: self.app.list_extensions, container: it.find('#extension'), - value: self.model.get('extension') + value: self.app.select_extension.value() }); // initialize extension @@ -139,6 +139,7 @@ return Backbone.View.extend({ this.app.collection.on('reset', function() { self.remove(); }); + self.model.set('row', self); }, // render diff --git a/static/scripts/mvc/upload/upload-view.js b/static/scripts/mvc/upload/upload-view.js index db33657cf6d..0d682b90530 100644 --- a/static/scripts/mvc/upload/upload-view.js +++ b/static/scripts/mvc/upload/upload-view.js @@ -6,6 +6,7 @@ define(["utils/utils", "mvc/upload/upload-ftp", "mvc/ui/ui-popover", "mvc/ui/ui-modal", + "mvc/ui/ui-select", "utils/uploadbox"], function( Utils, @@ -14,7 +15,8 @@ define(["utils/utils", UploadItem, UploadFtp, Popover, - Modal + Modal, + Select ) { // galaxy upload @@ -35,6 +37,9 @@ return Backbone.View.extend({ // current history current_history: null, + + // extension selector + select_extension : null, // current upload size upload_size: 0, @@ -218,6 +223,23 @@ return Backbone.View.extend({ title : 'FTP files', container : button }); + + // select extension + this.select_extension = new Select.View({ + css: 'extension', + onchange : function() { + var newExten =self.select_extension.value() + var len = self.collection.models.length; + for(i = 0; i < len; i++) + { + self.collection.models[i].attributes['row'].select_extension.value(newExten); + } + }, + data: self.list_extensions, + container: self.$el.find('#extension'), + value: self.list_extensions[0] + }); + } // show modal @@ -228,6 +250,66 @@ return Backbone.View.extend({ // setup info this._updateScreen(); + + // handle extension info popover + self.$el.find('#extension-info').on('click' , function(e) { self._showExtensionInfo(); }) + .on('mousedown', function(e) { e.preventDefault(); }); + + }, + + _showExtensionInfo : function() { + // initialize + var self = this; + var $el = $(this.el).find('#extension-info'); + var extension = self.select_extension.value(); + + var title = this.select_extension.text(); + + var description = _.findWhere(self.list_extensions, {'id': extension}); + //console.log(extension, $el); + + // create popup + if (!this.extension_popup) { + this.extension_popup = new Popover.View({ + placement: 'bottom', + container: $el + }); + } + //console.log(description); + // show / hide popup + if (!this.extension_popup.visible) { + this.extension_popup.title(title); + this.extension_popup.empty(); + this.extension_popup.append(this._templateDescription(description)); + this.extension_popup.show(); + } else { + this.extension_popup.hide(); + } + }, + + _showSettings : function() { + // check if popover is visible + if (!this.settings.visible) { + // show popover + this.settings.empty(); + this.settings.append((new UploadSettings(this)).$el); + this.settings.show(); + } else { + // hide popover + this.settings.hide(); + } + }, + + _templateDescription: function(options) { + if (options.description) { + var tmpl = options.description; + if (options.description_url) { + tmpl += ' (read more)'; + } + return tmpl; + } else { + return 'There is no description available for this file extension.'; + } }, // @@ -513,6 +595,9 @@ return Backbone.View.extend({ // remove from queue this.uploadbox.reset(); + + // reset value for universal type drop-down + this.select_extension.value(this.list_extensions[0]); // reset button this.ui_button.set('percentage', 0); @@ -612,7 +697,10 @@ return Backbone.View.extend({ '' + 'Name' + 'Size' + - 'Type' + + 'Type' + + '
  ' + + '