1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 07:08:55 +00:00

redesigned all checkbox; bugfix & improvement; removed unused code & file

This commit is contained in:
llj
2016-04-07 11:06:48 +08:00
parent d5170f7a18
commit 77aac3d811
16 changed files with 102 additions and 197 deletions

View File

@@ -16,7 +16,7 @@ define([
template: _.template($('#add-pubrepo-popup-tmpl').html()),
initialize: function(pubRepos) {
this.$el.html(this.template()).modal({});
this.$el.html(this.template()).modal({focus:false});
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
this.$table = this.$('table');

View File

@@ -25,9 +25,8 @@ define([
},
select: function () {
var checkbox = this.$('.checkbox');
checkbox.toggleClass('checkbox-checked');
if (checkbox.hasClass('checkbox-checked')) {
var $checkbox = this.$('[type=checkbox]');
if ($checkbox.prop('checked')) {
this.model.set({'selected':true}, {silent:true});
} else {
this.model.set({'selected':false}, {silent:true});

View File

@@ -83,13 +83,12 @@ define([
togglePasswdInput: function(e) {
var $checkbox = $('#encrypt-switch');
var pwd_input = this.$('input[type="password"]');
var $pwd_input = this.$('input[type="password"]');
$checkbox.parent().toggleClass('checkbox-checked');
if ($checkbox.prop('checked')) {
pwd_input.attr('disabled', false).removeClass('input-disabled');
$pwd_input.attr('disabled', false).removeClass('input-disabled');
} else {
pwd_input.attr('disabled', true).addClass('input-disabled');
$pwd_input.attr('disabled', true).addClass('input-disabled');
}
}

View File

@@ -746,24 +746,23 @@ define([
},
select: function () {
var $el = this.$('th .checkbox');
$el.toggleClass('checkbox-checked');
var $el = this.$('th [type=checkbox]');
var dir = this.dir;
var all_dirent_checkbox = this.$('.checkbox');
var $all_dirent_checkbox = this.$('[type=checkbox]');
var $dirents_op = this.$('#multi-dirents-op');
var $curDirOps = this.$('#upload-file, #add-new-dir, #add-new-file, #share-cur-dir');
if ($el.hasClass('checkbox-checked')) {
all_dirent_checkbox.addClass('checkbox-checked');
if ($el.prop('checked')) {
$all_dirent_checkbox.prop('checked', true);
dir.each(function(model) {
model.set({'selected': true}, {silent: true});
});
$dirents_op.css({'display':'inline-block'});
$curDirOps.hide();
} else {
all_dirent_checkbox.removeClass('checkbox-checked');
$all_dirent_checkbox.prop('checked', false);
dir.each(function(model) {
model.set({'selected': false}, {silent: true});
});

View File

@@ -91,9 +91,8 @@ define([
},
select: function () {
var checkbox = this.$('.checkbox');
checkbox.toggleClass('checkbox-checked');
if (checkbox.hasClass('checkbox-checked')) {
var $checkbox = this.$('[type=checkbox]');
if ($checkbox.prop('checked')) {
this.model.set({'selected':true}, {silent:true}); // do not trigger the 'change' event.
} else {
this.model.set({'selected':false}, {silent:true});
@@ -101,8 +100,13 @@ define([
var dirView = this.dirView;
var $dirents_op = dirView.$('#multi-dirents-op');
var toggle_all_checkbox = dirView.$('th .checkbox');
var checked_num = dirView.$('tr:gt(0) .checkbox-checked').length;
var $toggle_all_checkbox = dirView.$('th [type=checkbox]');
var checked_num = 0;
dirView.$('tr:gt(0) [type=checkbox]').each(function() {
if ($(this).prop('checked')) {
checked_num += 1;
}
});
var $curDirOps = dirView.$('#upload-file, #add-new-dir, #add-new-file, #share-cur-dir');
@@ -114,9 +118,9 @@ define([
$curDirOps.show();
}
if (checked_num == dirView.$('tr:gt(0)').length) {
toggle_all_checkbox.addClass('checkbox-checked');
$toggle_all_checkbox.prop('checked', true);
} else {
toggle_all_checkbox.removeClass('checkbox-checked');
$toggle_all_checkbox.prop('checked', false);
}
},

View File

@@ -68,9 +68,7 @@ define([
},
events: {
'mouseenter .checkbox-label': 'highlightCheckbox',
'mouseleave .checkbox-label': 'rmHighlightCheckbox',
'click .checkbox-orig': 'clickCheckbox',
'click [type="checkbox"]': 'clickCheckbox',
// download link
'submit #generate-download-link-form': 'generateDownloadLink',
@@ -95,19 +93,10 @@ define([
'click #add-dir-group-share-item .submit': 'dirGroupShare'
},
highlightCheckbox: function (e) {
$(e.currentTarget).addClass('hl');
},
rmHighlightCheckbox: function (e) {
$(e.currentTarget).removeClass('hl');
},
clickCheckbox: function(e) {
var el = e.currentTarget;
$(el).parent().toggleClass('checkbox-checked');
var $el = $(e.currentTarget);
// for link options such as 'password', 'expire'
$(el).closest('.checkbox-label').next().toggleClass('hide');
$el.closest('.checkbox-label').next().toggleClass('hide');
},
downloadLinkPanelInit: function() {