diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/login.js | 4 | ||||
-rw-r--r-- | core/js/oc-dialogs.js | 61 | ||||
-rw-r--r-- | core/js/share/sharedialoglinkshareview_popover_menu.handlebars | 3 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 15 | ||||
-rw-r--r-- | core/js/sharetemplates.js | 72 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialoglinkshareview.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 10 |
7 files changed, 104 insertions, 65 deletions
diff --git a/core/js/login.js b/core/js/login.js index 3447a5de724..64be29bfec6 100644 --- a/core/js/login.js +++ b/core/js/login.js @@ -17,7 +17,9 @@ OC.Login = _.extend(OC.Login || {}, { if($('form[name=login][action]').length === 0) { $('#submit-wrapper .submit-icon') .removeClass('icon-confirm-white') - .addClass('icon-loading-small-dark'); + .addClass(OCA.Theming && OCA.Theming.inverted + ? 'icon-loading-small' + : 'icon-loading-small-dark'); $('#submit') .attr('value', t('core', 'Logging in …')); $('.login-additional').fadeOut(); diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index dee74502a6f..3169dab4b88 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -192,6 +192,9 @@ var OCdialogs = { */ filepicker:function(title, callback, multiselect, mimetypeFilter, modal, type) { var self = this; + + this.filepicker.sortField = 'name'; + this.filepicker.sortOrder = 'asc'; // avoid opening the picker twice if (this.filepicker.loading) { return; @@ -252,7 +255,9 @@ var OCdialogs = { } self.$filePicker.ready(function() { + self.$fileListHeader = self.$filePicker.find('.filelist thead tr'); self.$filelist = self.$filePicker.find('.filelist tbody'); + self.$filelistContainer = self.$filePicker.find('.filelist-container'); self.$dirTree = self.$filePicker.find('.dirtree'); self.$dirTree.on('click', 'div:not(:last-child)', self, function (event) { self._handleTreeListSelect(event, type); @@ -260,6 +265,12 @@ var OCdialogs = { self.$filelist.on('click', 'tr', function(event) { self._handlePickerClick(event, $(this), type); }); + self.$fileListHeader.on('click', 'a', function(event) { + var dir = self.$filePicker.data('path'); + self.filepicker.sortField = $(event.currentTarget).data('sort'); + self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc'; + self._fillFilePicker(dir); + }); self._fillFilePicker(''); }); @@ -824,7 +835,7 @@ var OCdialogs = { var self = this; $.get(OC.filePath('core', 'templates', 'filepicker.html'), function(tmpl) { self.$filePickerTemplate = $(tmpl); - self.$listTmpl = self.$filePickerTemplate.find('.filelist tr:first-child').detach(); + self.$listTmpl = self.$filePickerTemplate.find('.filelist tbody tr:first-child').detach(); defer.resolve(self.$filePickerTemplate); }) .fail(function(jqXHR, textStatus, errorThrown) { @@ -886,34 +897,68 @@ var OCdialogs = { */ _fillFilePicker:function(dir) { var self = this; - this.$filelist.empty().addClass('icon-loading'); + this.$filelist.empty(); + this.$filePicker.find('.emptycontent').hide(); + this.$filelistContainer.addClass('icon-loading'); this.$filePicker.data('path', dir); var filter = this.$filePicker.data('mimetype'); if (typeof(filter) === "string") { filter = [filter]; } + self.$fileListHeader.find('.sort-indicator').addClass('hidden').removeClass('icon-triangle-n').removeClass('icon-triangle-s'); + self.$fileListHeader.find('[data-sort=' + self.filepicker.sortField + '] .sort-indicator').removeClass('hidden'); + if (self.filepicker.sortOrder === 'asc') { + self.$fileListHeader.find('[data-sort=' + self.filepicker.sortField + '] .sort-indicator').addClass('icon-triangle-n'); + } else { + self.$fileListHeader.find('[data-sort=' + self.filepicker.sortField + '] .sort-indicator').addClass('icon-triangle-s'); + } self.filepicker.filesClient.getFolderContents(dir).then(function(status, files) { if (filter && filter.length > 0 && filter.indexOf('*') === -1) { files = files.filter(function (file) { return file.type === 'dir' || filter.indexOf(file.mimetype) !== -1; }); } - files = files.sort(function(a, b) { - if (a.type === 'dir' && b.type !== 'dir') { + + var Comparators = { + name: function(fileInfo1, fileInfo2) { + if (fileInfo1.type === 'dir' && fileInfo2.type !== 'dir') { + return -1; + } + if (fileInfo1.type !== 'dir' && fileInfo2.type === 'dir') { + return 1; + } + return OC.Util.naturalSortCompare(fileInfo1.name, fileInfo2.name); + }, + size: function(fileInfo1, fileInfo2) { + return fileInfo1.size - fileInfo2.size; + }, + mtime: function(fileInfo1, fileInfo2) { + return fileInfo1.mtime - fileInfo2.mtime; + } + }; + var comparator = Comparators[self.filepicker.sortField] || Comparators.name; + files = files.sort(function(file1, file2) { + var isFavorite = function(fileInfo) { + return fileInfo.tags && fileInfo.tags.indexOf(OC.TAG_FAVORITE) >= 0; + }; + + if (isFavorite(file1) && !isFavorite(file2)) { return -1; - } else if(a.type !== 'dir' && b.type === 'dir') { + } else if (!isFavorite(file1) && isFavorite(file2)) { return 1; - } else { - return a.name.localeCompare(b.name, undefined, {numeric: true}); } + + return self.filepicker.sortOrder === 'asc' ? comparator(file1, file2) : -comparator(file1, file2); }); self._fillSlug(); if (files.length === 0) { self.$filePicker.find('.emptycontent').show(); + self.$fileListHeader.hide(); } else { self.$filePicker.find('.emptycontent').hide(); + self.$fileListHeader.show(); } $.each(files, function(idx, entry) { @@ -953,7 +998,7 @@ var OCdialogs = { self.$filelist.append($row); }); - self.$filelist.removeClass('icon-loading'); + self.$filelistContainer.removeClass('icon-loading'); }); }, /** diff --git a/core/js/share/sharedialoglinkshareview_popover_menu.handlebars b/core/js/share/sharedialoglinkshareview_popover_menu.handlebars index 59312bc70b0..9c715c7f4ee 100644 --- a/core/js/share/sharedialoglinkshareview_popover_menu.handlebars +++ b/core/js/share/sharedialoglinkshareview_popover_menu.handlebars @@ -37,7 +37,6 @@ </span> </li> {{/if}} - {{#if showHideDownloadCheckbox}} <li> <span class="menuitem"> <span class="icon-loading-small hidden"></span> @@ -46,7 +45,6 @@ <label for="sharingDialogHideDownload-{{cid}}">{{hideDownloadLabel}}</label> </span> </li> - {{/if}} {{#if showPasswordCheckBox}} <li> <span class="menuitem"> @@ -58,6 +56,7 @@ <li class="{{#unless isPasswordSet}}hidden{{/unless}} linkPassMenu"> <span class="menuitem icon-share-pass"> <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" autocomplete="new-password" /> + <input type="submit" class="icon-confirm share-pass-submit" value="" /> <span class="icon icon-loading-small hidden"></span> </span> </li> diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index e10193067db..989c10c2c57 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -54,8 +54,8 @@ // hide download 'change .hideDownloadCheckbox': 'onHideDownloadChange', // password - 'focusout input.linkPassText': 'onPasswordEntered', - 'keyup input.linkPassText': 'onPasswordKeyUp', + 'click input.share-pass-submit': 'onPasswordEntered', + 'keyup input.linkPassText': 'onPasswordKeyUp', // check for the enter key 'change .showPasswordCheckbox': 'onShowPasswordClick', 'change .passwordByTalkCheckbox': 'onPasswordByTalkChange', 'change .publicEditingCheckbox': 'onAllowPublicEditingChange', @@ -381,11 +381,12 @@ }, error: function(model, msg) { // destroy old tooltips - $input.tooltip('destroy'); + var $container = $input.parent(); + $container.tooltip('destroy'); $input.addClass('error'); - $input.attr('title', msg); - $input.tooltip({placement: 'bottom', trigger: 'manual'}); - $input.tooltip('show'); + $container.attr('title', msg); + $container.tooltip({placement: 'bottom', trigger: 'manual'}); + $container.tooltip('show'); } }); }, @@ -867,7 +868,6 @@ var isTalkEnabled = oc_appswebroots['spreed'] !== undefined; var sendPasswordByTalk = share.sendPasswordByTalk; - var showHideDownloadCheckbox = !this.model.isFolder(); var hideDownload = share.hideDownload; var maxDate = null; @@ -904,7 +904,6 @@ shareNote: share.note, hasNote: share.note !== '', maxDate: maxDate, - showHideDownloadCheckbox: showHideDownloadCheckbox, hideDownload: hideDownload, isExpirationEnforced: isExpirationEnforced, } diff --git a/core/js/sharetemplates.js b/core/js/sharetemplates.js index eb3489f6b4e..049ee90aa6f 100644 --- a/core/js/sharetemplates.js +++ b/core/js/sharetemplates.js @@ -122,68 +122,56 @@ templates['sharedialoglinkshareview_popover_menu'] = template({"1":function(cont + alias4(((helper = (helper = helpers.publicEditingLabel || (depth0 != null ? depth0.publicEditingLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"publicEditingLabel","hash":{},"data":data}) : helper))) + "</label>\n </span>\n </li>\n"; },"5":function(container,depth0,helpers,partials,data) { - var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - - return " <li>\n <span class=\"menuitem\">\n <span class=\"icon-loading-small hidden\"></span>\n <input type=\"checkbox\" name=\"hideDownload\" id=\"sharingDialogHideDownload-" - + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) - + "\" class=\"checkbox hideDownloadCheckbox\"\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hideDownload : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + " />\n <label for=\"sharingDialogHideDownload-" - + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) - + "\">" - + alias4(((helper = (helper = helpers.hideDownloadLabel || (depth0 != null ? depth0.hideDownloadLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hideDownloadLabel","hash":{},"data":data}) : helper))) - + "</label>\n </span>\n </li>\n"; -},"6":function(container,depth0,helpers,partials,data) { return "checked=\"checked\""; -},"8":function(container,depth0,helpers,partials,data) { +},"7":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <li>\n <span class=\"menuitem\">\n <input type=\"checkbox\" name=\"showPassword\" id=\"showPassword-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"checkbox showPasswordCheckbox\"\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordSet : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordSet : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordEnforced : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordEnforced : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " value=\"1\" />\n <label for=\"showPassword-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\">" + alias4(((helper = (helper = helpers.enablePasswordLabel || (depth0 != null ? depth0.enablePasswordLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"enablePasswordLabel","hash":{},"data":data}) : helper))) + "</label>\n </span>\n </li>\n <li class=\"" - + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPasswordSet : depth0),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isPasswordSet : depth0),{"name":"unless","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " linkPassMenu\">\n <span class=\"menuitem icon-share-pass\">\n <input id=\"linkPassText-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"linkPassText\" type=\"password\" placeholder=\"" + alias4(((helper = (helper = helpers.passwordPlaceholder || (depth0 != null ? depth0.passwordPlaceholder : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"passwordPlaceholder","hash":{},"data":data}) : helper))) - + "\" autocomplete=\"new-password\" />\n <span class=\"icon icon-loading-small hidden\"></span>\n </span>\n </li>\n"; -},"9":function(container,depth0,helpers,partials,data) { + + "\" autocomplete=\"new-password\" />\n <input type=\"submit\" class=\"icon-confirm share-pass-submit\" value=\"\" />\n <span class=\"icon icon-loading-small hidden\"></span>\n </span>\n </li>\n"; +},"8":function(container,depth0,helpers,partials,data) { return "disabled=\"disabled\""; -},"11":function(container,depth0,helpers,partials,data) { +},"10":function(container,depth0,helpers,partials,data) { return "hidden"; -},"13":function(container,depth0,helpers,partials,data) { +},"12":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <li>\n <span class=\"shareOption menuitem\">\n <span class=\"icon-loading-small hidden\"></span>\n <input type=\"checkbox\" name=\"passwordByTalk\" id=\"passwordByTalk-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"checkbox passwordByTalkCheckbox\"\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordByTalkSet : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isPasswordByTalkSet : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " />\n <label for=\"passwordByTalk-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\">" + alias4(((helper = (helper = helpers.passwordByTalkLabel || (depth0 != null ? depth0.passwordByTalkLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"passwordByTalkLabel","hash":{},"data":data}) : helper))) + "</label>\n </span>\n </li>\n"; -},"15":function(container,depth0,helpers,partials,data) { +},"14":function(container,depth0,helpers,partials,data) { return "datepicker"; -},"17":function(container,depth0,helpers,partials,data) { +},"16":function(container,depth0,helpers,partials,data) { var helper; return container.escapeExpression(((helper = (helper = helpers.expireDate || (depth0 != null ? depth0.expireDate : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"expireDate","hash":{},"data":data}) : helper))); -},"19":function(container,depth0,helpers,partials,data) { +},"18":function(container,depth0,helpers,partials,data) { var helper; return container.escapeExpression(((helper = (helper = helpers.defaultExpireDate || (depth0 != null ? depth0.defaultExpireDate : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"defaultExpireDate","hash":{},"data":data}) : helper))); -},"21":function(container,depth0,helpers,partials,data) { +},"20":function(container,depth0,helpers,partials,data) { return "readonly"; -},"23":function(container,depth0,helpers,partials,data) { +},"22":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <li>\n <a href=\"#\" class=\"menuitem pop-up\" data-url=\"" @@ -205,21 +193,29 @@ templates['sharedialoglinkshareview_popover_menu'] = template({"1":function(cont + "\" />\n </span>\n </li>\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.publicUpload : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.publicEditing : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showHideDownloadCheckbox : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPasswordCheckBox : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPasswordByTalkCheckBox : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " <li>\n <span class=\"menuitem\">\n <span class=\"icon-loading-small hidden\"></span>\n <input type=\"checkbox\" name=\"hideDownload\" id=\"sharingDialogHideDownload-" + + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + + "\" class=\"checkbox hideDownloadCheckbox\"\n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hideDownload : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " />\n <label for=\"sharingDialogHideDownload-" + + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + + "\">" + + alias4(((helper = (helper = helpers.hideDownloadLabel || (depth0 != null ? depth0.hideDownloadLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hideDownloadLabel","hash":{},"data":data}) : helper))) + + "</label>\n </span>\n </li>\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPasswordCheckBox : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPasswordByTalkCheckBox : depth0),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " <li>\n <span class=\"menuitem\">\n <input id=\"expireDate-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" type=\"checkbox\" name=\"expirationDate\" class=\"expireDate checkbox\"\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " />\n <label for=\"expireDate-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\">" + alias4(((helper = (helper = helpers.expireDateLabel || (depth0 != null ? depth0.expireDateLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"expireDateLabel","hash":{},"data":data}) : helper))) + "</label>\n </span>\n </li>\n <li class=\"" - + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"unless","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\">\n <span class=\"menuitem icon-expiredate expirationDateContainer-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\">\n <label for=\"expirationDatePicker-" @@ -231,27 +227,27 @@ templates['sharedialoglinkshareview_popover_menu'] = template({"1":function(cont + "</label>\n <!-- do not use the datepicker if enforced -->\n <input id=\"expirationDatePicker-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"" - + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"unless","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"unless","hash":{},"fn":container.program(14, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\" type=\"text\"\n placeholder=\"" + alias4(((helper = (helper = helpers.expirationDatePlaceholder || (depth0 != null ? depth0.expirationDatePlaceholder : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"expirationDatePlaceholder","hash":{},"data":data}) : helper))) + "\" value=\"" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"if","hash":{},"fn":container.program(17, data, 0),"inverse":container.program(19, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.hasExpireDate : depth0),{"name":"if","hash":{},"fn":container.program(16, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "") + "\"\n data-max-date=\"" + alias4(((helper = (helper = helpers.maxDate || (depth0 != null ? depth0.maxDate : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"maxDate","hash":{},"data":data}) : helper))) + "\" " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.isExpirationEnforced : depth0),{"name":"if","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " />\n </span>\n </li>\n <li>\n <a href=\"#\" class=\"share-add\">\n <span class=\"icon-loading-small hidden\"></span>\n <span class=\"icon icon-edit\"></span>\n <span>" + alias4(((helper = (helper = helpers.addNoteLabel || (depth0 != null ? depth0.addNoteLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"addNoteLabel","hash":{},"data":data}) : helper))) + "</span>\n <input type=\"button\" class=\"share-note-delete icon-delete " - + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasNote : depth0),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasNote : depth0),{"name":"unless","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\">\n </a>\n </li>\n <li class=\"share-note-form share-note-link " - + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasNote : depth0),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasNote : depth0),{"name":"unless","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\">\n <span class=\"menuitem icon-note\">\n <textarea class=\"share-note\">" + alias4(((helper = (helper = helpers.shareNote || (depth0 != null ? depth0.shareNote : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareNote","hash":{},"data":data}) : helper))) + "</textarea>\n <input type=\"submit\" class=\"icon-confirm share-note-submit\" value=\"\" id=\"add-note-" + alias4(((helper = (helper = helpers.shareId || (depth0 != null ? depth0.shareId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareId","hash":{},"data":data}) : helper))) + "\" />\n </span>\n </li>\n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.social : depth0),{"name":"each","hash":{},"fn":container.program(23, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.social : depth0),{"name":"each","hash":{},"fn":container.program(22, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " <li>\n <a href=\"#\" class=\"unshare\"><span class=\"icon-loading-small hidden\"></span><span class=\"icon icon-delete\"></span><span>" + alias4(((helper = (helper = helpers.unshareLinkLabel || (depth0 != null ? depth0.unshareLinkLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"unshareLinkLabel","hash":{},"data":data}) : helper))) + "</span></a>\n </li>\n <li>\n <a href=\"#\" class=\"new-share\">\n <span class=\"icon-loading-small hidden\"></span>\n <span class=\"icon icon-add\"></span>\n <span>" diff --git a/core/js/tests/specs/sharedialoglinkshareview.js b/core/js/tests/specs/sharedialoglinkshareview.js index c2d84fd2e87..9e6c67dca14 100644 --- a/core/js/tests/specs/sharedialoglinkshareview.js +++ b/core/js/tests/specs/sharedialoglinkshareview.js @@ -114,7 +114,7 @@ describe('OC.Share.ShareDialogLinkShareView', function () { $hideDownloadCheckbox = view.$el.find('.hideDownloadCheckbox'); - expect($hideDownloadCheckbox.length).toBeFalsy(); + expect($hideDownloadCheckbox.length).toBeTruthy(); }); it('checkbox is checked when the setting is enabled', function () { @@ -186,13 +186,11 @@ describe('OC.Share.ShareDialogLinkShareView', function () { }); view.render(); - var $passwordDiv = view.$el.find('#linkPass'); $passwordText = view.$el.find('.linkPassText'); $workingIcon = view.$el.find('.linkPassMenu .icon-loading-small'); sinon.stub(shareModel, 'saveLinkShare'); - expect($passwordDiv.hasClass('hidden')).toBeFalsy(); expect($passwordText.hasClass('hidden')).toBeFalsy(); expect($workingIcon.hasClass('hidden')).toBeTruthy(); diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index 8d5a2ae434d..83ec459dc90 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -127,7 +127,7 @@ describe('OC.Share.ShareDialogView', function() { describe('Share with link', function() { // TODO: test ajax calls // TODO: test password field visibility (whenever enforced or not) - it('update password on focus out', function() { + it('update password on enter', function() { $('#allowShareWithLink').val('yes'); dialog.model.set({ @@ -137,11 +137,11 @@ describe('OC.Share.ShareDialogView', function() { }); dialog.render(); - // Enable password, enter password and focusout + // Enable password and enter password dialog.$el.find('[name=showPassword]').click(); dialog.$el.find('.linkPassText').focus(); dialog.$el.find('.linkPassText').val('foo'); - dialog.$el.find('.linkPassText').focusout(); + dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13})); expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ @@ -149,7 +149,7 @@ describe('OC.Share.ShareDialogView', function() { password: 'foo' }); }); - it('update password on enter', function() { + it('update password on submit', function() { $('#allowShareWithLink').val('yes'); dialog.model.set({ @@ -163,7 +163,7 @@ describe('OC.Share.ShareDialogView', function() { dialog.$el.find('[name=showPassword]').click(); dialog.$el.find('.linkPassText').focus(); dialog.$el.find('.linkPassText').val('foo'); - dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13})); + dialog.$el.find('.linkPassText + .icon-confirm').click(); expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ |