Skip to content

Commit

Permalink
Fixed: #11
Browse files Browse the repository at this point in the history
  • Loading branch information
sakydev committed Apr 17, 2019
1 parent 17fe972 commit 5ede762
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 85 deletions.
71 changes: 26 additions & 45 deletions admin/skins/default/skeleton/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ <h4 class="card-title">Users Manager ({{subSection}})</h4>
<table class="table table-bordered">
<thead>
<tr>
<th class="bulk-check-main">
<div class="form-check form-check-flat form-check-primary">
<label class="form-check-label">
<input type="checkbox" name="bulk[]" class="form-check-input">
<i class="input-helper"></i>
</label>
<th>
<div class="checkbox">
<label><input class="bulk-check-main" type="checkbox" name="bulk[]"></label>
</div>
</th>
<th>#</th>
Expand All @@ -119,13 +116,13 @@ <h4 class="card-title">Users Manager ({{subSection}})</h4>
{% for user in results %}
<tr>
<td>
<div class="form-check form-check-flat form-check-primary">
<label class="form-check-label">
<input class="bulk-check-sub" type="checkbox" videokey="{{user.username}}" >
<i class="input-helper"></i>
</label>
</div>
</td>
<div class="checkbox">
<label>
<input class="bulk-check-sub" videokey="{{user.username}}" type="checkbox">
<i class="input-helper"></i>
</label>
</div>
</td>
<td>{{user.id}}</td>
<td><a href="{{_coreUrl}}/channel/?name={{user.username}}" target="_blank"><img src="{{user.thumbnail}}"></a></td>
<td>
Expand Down Expand Up @@ -203,46 +200,30 @@ <h4 class="card-title">Users Manager ({{subSection}})</h4>
});

$('.bulk-check-main').on('click', function() {
if ($(this).attr('check') == 'selected') {
var mode = 'unselected';
$('.bulk-check-sub').removeClass('selected').addClass('unselected').attr('check', 'unselected');
$(this).removeClass('selected').addClass('unselected').attr('check', 'unselected');
} else {
var mode = 'selected';
$('.bulk-check-sub').removeClass('unselected').addClass('selected').attr('check', 'selected');
$(this).removeClass('unselected').addClass('selected').attr('check', 'selected');
}

$('.bulk-check-sub').each(function(i, obj) {
if (mode == 'selected') {
if ($(obj).hasClass('selected')) {
$(obj).trigger('click');
}
} else {
if ($(obj).hasClass('unselected')) {
$(obj).trigger('click');
}
}
var mainMode = (this.checked ? "check" : "uncheck");
$('input[type=checkbox]').each(function () {
var subMode = (this.checked ? "check" : "uncheck");
if (mainMode != subMode) {
$(this).trigger('click');
}
});
});
});

$('.bulk-actions').on('click', function(e) {
e.preventDefault();
var action = $(this).attr('action');
$('#bulk-action').val(action);
$('.bulk-actions').on('click', function(e) {
e.preventDefault();
$('#bulk-action').val($(this).attr('action'));

var allkeys = '';
$('.selected').each(function(i, obj) {
// bulk-keys
var currentKey = $(obj).attr('videokey');
if (currentKey != null) {
allkeys += currentKey + ',';
var allkeys = '';
$('input[type=checkbox]').each(function () {
var checked = (this.checked ? true : false);
if (this.checked) {
allkeys += $(this).attr('videokey') + ',';
}
});

$('#bulk-keys').val(allkeys);
$('#bulk-actions').submit();
});
});
});
</script>

Expand Down
61 changes: 21 additions & 40 deletions admin/skins/default/skeleton/videos.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ <h4 class="card-title">Videos Manager ({{subSection}})</h4>
<table class="table ">
<thead>
<tr>
<th class="bulk-check-main">
<div class="form-check form-check-flat form-check-primary">
<label class="form-check-label">
<input type="checkbox" name="bulk[]" class="form-check-input">
<i class="input-helper"></i>
</label>
<th>
<div class="checkbox">
<label><input class="bulk-check-main" type="checkbox" name="bulk[]"></label>
</div>
</th>
<th>#</th>
Expand All @@ -143,12 +140,12 @@ <h4 class="card-title">Videos Manager ({{subSection}})</h4>
{% for video in results %}
<tr>
<td>
<div class="form-check form-check-flat form-check-primary">
<label class="form-check-label">
<input class="bulk-check-sub" type="checkbox" videokey="{{video.vkey}}" >
<i class="input-helper"></i>
</label>
</div>
<div class="checkbox">
<label>
<input class="bulk-check-sub" videokey="{{video.vkey}}" type="checkbox">
<i class="input-helper"></i>
</label>
</div>
</td>
<td>{{video.id}}</td>
<td>
Expand Down Expand Up @@ -244,40 +241,24 @@ <h4 class="card-title">Videos Manager ({{subSection}})</h4>
});

$('.bulk-check-main').on('click', function() {
if ($(this).attr('check') == 'selected') {
var mode = 'unselected';
$('.bulk-check-sub').removeClass('selected').addClass('unselected').attr('check', 'unselected');
$(this).removeClass('selected').addClass('unselected').attr('check', 'unselected');
} else {
var mode = 'selected';
$('.bulk-check-sub').removeClass('unselected').addClass('selected').attr('check', 'selected');
$(this).removeClass('unselected').addClass('selected').attr('check', 'selected');
}

$('.bulk-check-sub').each(function(i, obj) {
if (mode == 'selected') {
if ($(obj).hasClass('selected')) {
$(obj).trigger('click');
}
} else {
if ($(obj).hasClass('unselected')) {
$(obj).trigger('click');
}
}
var mainMode = (this.checked ? "check" : "uncheck");
$('input[type=checkbox]').each(function () {
var subMode = (this.checked ? "check" : "uncheck");
if (mainMode != subMode) {
$(this).trigger('click');
}
});
});
});

$('.bulk-actions').on('click', function(e) {
e.preventDefault();
var action = $(this).attr('action');
$('#bulk-action').val(action);
$('#bulk-action').val($(this).attr('action'));

var allkeys = '';
$('.selected').each(function(i, obj) {
// bulk-keys
var currentKey = $(obj).attr('videokey');
if (currentKey != null) {
allkeys += currentKey + ',';
$('input[type=checkbox]').each(function () {
var checked = (this.checked ? true : false);
if (this.checked) {
allkeys += $(this).attr('videokey') + ',';
}
});

Expand Down

0 comments on commit 5ede762

Please sign in to comment.