Basic button behavior
This commit is contained in:
parent
a726cce755
commit
d141765752
|
@ -1,177 +1,189 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
$.entwine('colymba', function($) {
|
$.entwine('ss', function($) {
|
||||||
|
|
||||||
|
// start SS namespace overrides
|
||||||
|
|
||||||
|
// end SS namespace overrides
|
||||||
|
|
||||||
|
|
||||||
|
$.entwine('colymba', function($) {
|
||||||
|
|
||||||
$('td.col-bulkSelect').entwine({
|
$('td.col-bulkSelect').entwine({
|
||||||
onmatch: function(){
|
onmatch: function(){
|
||||||
},
|
},
|
||||||
onunmatch: function(){
|
onunmatch: function(){
|
||||||
},
|
},
|
||||||
onmouseover: function(){
|
onmouseover: function(){
|
||||||
//disable default row click behaviour -> avoid navigation to edit form when clicking the checkbox
|
//disable default row click behaviour -> avoid navigation to edit form when clicking the checkbox
|
||||||
$(this).parents('.ss-gridfield-item').find('.edit-link').removeClass('edit-link').addClass('tempDisabledEditLink');
|
$(this).parents('.ss-gridfield-item').find('.edit-link').removeClass('edit-link').addClass('tempDisabledEditLink');
|
||||||
},
|
},
|
||||||
onmouseout: function(){
|
onmouseout: function(){
|
||||||
//re-enable default row click behaviour
|
//re-enable default row click behaviour
|
||||||
$(this).parents('.ss-gridfield-item').find('.tempDisabledEditLink').addClass('edit-link').removeClass('tempDisabledEditLink');
|
$(this).parents('.ss-gridfield-item').find('.tempDisabledEditLink').addClass('edit-link').removeClass('tempDisabledEditLink');
|
||||||
},
|
},
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
//check/uncheck checkbox when clicking cell
|
//check/uncheck checkbox when clicking cell
|
||||||
var cb = $(e.target).find('input');
|
var cb = $(e.target).find('input');
|
||||||
if ( !$(cb).prop('checked') ) $(cb).prop('checked', true);
|
if ( !$(cb).prop('checked') ) $(cb).prop('checked', true);
|
||||||
else $(cb).prop('checked', false);
|
else $(cb).prop('checked', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('td.col-bulkSelect input').entwine({
|
$('td.col-bulkSelect input').entwine({
|
||||||
onmatch: function(){
|
onmatch: function(){
|
||||||
},
|
},
|
||||||
onunmatch: function(){
|
onunmatch: function(){
|
||||||
},
|
},
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
$(this).parents('.ss-gridfield-table').find('input.bulkSelectAll').prop('checked', '');
|
$(this).parents('.ss-gridfield-table').find('input.bulkSelectAll').prop('checked', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input.bulkSelectAll').entwine({
|
$('input.bulkSelectAll').entwine({
|
||||||
onmatch: function(){
|
onmatch: function(){
|
||||||
},
|
},
|
||||||
onunmatch: function(){
|
onunmatch: function(){
|
||||||
},
|
},
|
||||||
onclick: function()
|
onclick: function()
|
||||||
{
|
{
|
||||||
var state = $(this).prop('checked');
|
var state = $(this).prop('checked');
|
||||||
$(this).parents('.ss-gridfield-table')
|
$(this).parents('.ss-gridfield-table')
|
||||||
.find('td.col-bulkSelect input')
|
.find('td.col-bulkSelect input')
|
||||||
.prop('checked', state);
|
.prop('checked', state);
|
||||||
},
|
},
|
||||||
getSelectRecordsID: function()
|
getSelectRecordsID: function()
|
||||||
{
|
{
|
||||||
return $(this).parents('.ss-gridfield-table')
|
return $(this).parents('.ss-gridfield-table')
|
||||||
.find('td.col-bulkSelect input:checked')
|
.find('td.col-bulkSelect input:checked')
|
||||||
.map(function() {
|
.map(function() {
|
||||||
return parseInt( $(this).data('record') )
|
return parseInt( $(this).data('record') )
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('select.bulkActionName').entwine({
|
$('select.bulkActionName').entwine({
|
||||||
onmatch: function(){
|
onmatch: function(){
|
||||||
},
|
},
|
||||||
onunmatch: function(){
|
onunmatch: function(){
|
||||||
},
|
},
|
||||||
onchange: function(e)
|
onchange: function(e)
|
||||||
{
|
|
||||||
var value = $(this).val(),
|
|
||||||
$parent = $(this).parents('.bulkManagerOptions'),
|
|
||||||
$btn = $parent.find('.doBulkActionButton'),
|
|
||||||
config = $btn.data('config'),
|
|
||||||
$icon = $parent.find('.doBulkActionButton .ui-icon')
|
|
||||||
;
|
|
||||||
|
|
||||||
$.each( config, function( configKey, configData )
|
|
||||||
{
|
{
|
||||||
if ( configKey != value )
|
var value = $(this).val(),
|
||||||
|
$parent = $(this).parents('.bulkManagerOptions'),
|
||||||
|
$btn = $parent.find('.doBulkActionButton'),
|
||||||
|
config = $btn.data('config'),
|
||||||
|
$icon = $parent.find('.doBulkActionButton .ui-icon')
|
||||||
|
;
|
||||||
|
|
||||||
|
$.each( config, function( configKey, configData )
|
||||||
{
|
{
|
||||||
$icon.removeClass('btn-icon-'+configData['icon']);
|
if ( configKey != value )
|
||||||
}
|
{
|
||||||
});
|
$icon.removeClass('btn-icon-'+configData['icon']);
|
||||||
$icon.addClass('btn-icon-'+config[value]['icon']);
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( config[value]['isDestructive'] )
|
|
||||||
{
|
|
||||||
$btn.addClass('ss-ui-action-destructive');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$btn.removeClass('ss-ui-action-destructive');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.doBulkActionButton').entwine({
|
|
||||||
onmatch: function(){
|
|
||||||
},
|
|
||||||
onunmatch: function(){
|
|
||||||
},
|
|
||||||
getActionURL: function(action, url)
|
|
||||||
{
|
|
||||||
var cacheBuster = new Date().getTime();
|
|
||||||
url = url.split('?');
|
|
||||||
|
|
||||||
if ( action )
|
|
||||||
{
|
|
||||||
action = '/' + action;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
action = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( url[1] )
|
|
||||||
{
|
|
||||||
url = url[0] + action + '?' + url[1] + '&' + 'cacheBuster=' + cacheBuster;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
url = url[0] + action + '?' + 'cacheBuster=' + cacheBuster;
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
},
|
|
||||||
onclick: function(e)
|
|
||||||
{
|
|
||||||
var $parent = $(this).parents('.bulkManagerOptions'),
|
|
||||||
$btn = $parent.find('a.doBulkActionButton'),
|
|
||||||
|
|
||||||
action = $parent.find('select.bulkActionName').val(),
|
|
||||||
config = $btn.data('config'),
|
|
||||||
|
|
||||||
url = this.getActionURL(action, $(this).data('url')),
|
|
||||||
|
|
||||||
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID(),
|
|
||||||
data = { records: ids }
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
if ( ids.length <= 0 )
|
|
||||||
{
|
|
||||||
alert( ss.i18n._t('GridFieldBulkManager.BULKACTION_EMPTY_SELECT') );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $btn.hasClass('ss-ui-action-destructive') )
|
|
||||||
{
|
|
||||||
if( !confirm(ss.i18n._t('GridFieldBulkManager.CONFIRM_DESTRUCTIVE_ACTION')) )
|
|
||||||
{
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$btn.addClass('loading');
|
|
||||||
|
|
||||||
if ( config[action]['isAjax'] )
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
data: data,
|
|
||||||
type: "POST",
|
|
||||||
context: $(this)
|
|
||||||
}).done(function() {
|
|
||||||
$(this).parents('.ss-gridfield').entwine('.').entwine('ss').reload();
|
|
||||||
$btn.removeClass('loading');
|
|
||||||
});
|
});
|
||||||
}
|
$icon.addClass('btn-icon-'+config[value]['icon']);
|
||||||
else{
|
|
||||||
var records = 'records[]='+ids.join('&records[]=');
|
|
||||||
url = url + '&' + records;
|
|
||||||
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if ( config[value]['isDestructive'] )
|
||||||
});
|
{
|
||||||
|
$btn.addClass('ss-ui-action-destructive');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$btn.removeClass('ss-ui-action-destructive');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.doBulkActionButton').entwine({
|
||||||
|
onmatch: function(){
|
||||||
|
},
|
||||||
|
onunmatch: function(){
|
||||||
|
},
|
||||||
|
getActionURL: function(action, url)
|
||||||
|
{
|
||||||
|
var cacheBuster = new Date().getTime();
|
||||||
|
url = url.split('?');
|
||||||
|
|
||||||
|
if ( action )
|
||||||
|
{
|
||||||
|
action = '/' + action;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( url[1] )
|
||||||
|
{
|
||||||
|
url = url[0] + action + '?' + url[1] + '&' + 'cacheBuster=' + cacheBuster;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
url = url[0] + action + '?' + 'cacheBuster=' + cacheBuster;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
},
|
||||||
|
onclick: function(e)
|
||||||
|
{
|
||||||
|
var $parent = $(this).parents('.bulkManagerOptions'),
|
||||||
|
$btn = $parent.find('a.doBulkActionButton'),
|
||||||
|
|
||||||
|
action = $parent.find('select.bulkActionName').val(),
|
||||||
|
config = $btn.data('config'),
|
||||||
|
|
||||||
|
url = this.getActionURL(action, $(this).data('url')),
|
||||||
|
|
||||||
|
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID(),
|
||||||
|
data = { records: ids }
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
if ( ids.length <= 0 )
|
||||||
|
{
|
||||||
|
alert( ss.i18n._t('GridFieldBulkManager.BULKACTION_EMPTY_SELECT') );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $btn.hasClass('ss-ui-action-destructive') )
|
||||||
|
{
|
||||||
|
if( !confirm(ss.i18n._t('GridFieldBulkManager.CONFIRM_DESTRUCTIVE_ACTION')) )
|
||||||
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$btn.addClass('loading');
|
||||||
|
|
||||||
|
if ( config[action]['isAjax'] )
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
type: "POST",
|
||||||
|
context: $(this)
|
||||||
|
}).done(function() {
|
||||||
|
$(this).parents('.ss-gridfield').entwine('.').entwine('ss').reload();
|
||||||
|
$btn.removeClass('loading');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var records = 'records[]='+ids.join('&records[]=');
|
||||||
|
url = url + '&' + records;
|
||||||
|
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
doBulkAction: function(action, ids)
|
||||||
|
{
|
||||||
|
console.log(action, ids);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
}(jQuery));
|
}(jQuery));
|
|
@ -269,21 +269,18 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||||
$finishButton = FormAction::create('Finish', _t('GridFieldBulkTools.FINISH_BTN_LABEL', 'Finish'))
|
$finishButton = FormAction::create('Finish', _t('GridFieldBulkTools.FINISH_BTN_LABEL', 'Finish'))
|
||||||
->addExtraClass('bulkUploadFinishButton')
|
->addExtraClass('bulkUploadFinishButton')
|
||||||
->setAttribute('data-icon', 'accept')
|
->setAttribute('data-icon', 'accept')
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true);
|
||||||
->setAttribute('src', '');//changes type to image so isn't hooked by default actions handlers
|
|
||||||
|
|
||||||
$cancelButton = FormAction::create('Cancel', _t('GridFieldBulkTools.CANCEL_BTN_LABEL', 'Cancel'))
|
$cancelButton = FormAction::create('Cancel', _t('GridFieldBulkTools.CANCEL_BTN_LABEL', 'Cancel'))
|
||||||
->addExtraClass('bulkUploadCancelButton ss-ui-action-destructive')
|
->addExtraClass('bulkUploadCancelButton ss-ui-action-destructive')
|
||||||
->setAttribute('data-icon', 'decline')
|
->setAttribute('data-icon', 'decline')
|
||||||
->setAttribute('data-url', $gridField->Link('bulkupload/cancel'))
|
->setAttribute('data-url', $gridField->Link('bulkupload/cancel'))
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true);
|
||||||
->setAttribute('src', '');
|
|
||||||
|
|
||||||
$clearErrorButton = FormAction::create('ClearError', _t('GridFieldBulkTools.CLEAR_ERROR_BTN_LABEL', 'Clear errors'))
|
$clearErrorButton = FormAction::create('ClearError', _t('GridFieldBulkTools.CLEAR_ERROR_BTN_LABEL', 'Clear errors'))
|
||||||
->addExtraClass('bulkUploadClearErrorButton')
|
->addExtraClass('bulkUploadClearErrorButton')
|
||||||
->setAttribute('data-icon', 'arrow-circle-double')
|
->setAttribute('data-icon', 'arrow-circle-double')
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true);
|
||||||
->setAttribute('src', '');
|
|
||||||
|
|
||||||
if ( $gridField->getConfig()->getComponentsByType('GridFieldBulkManager') )
|
if ( $gridField->getConfig()->getComponentsByType('GridFieldBulkManager') )
|
||||||
{
|
{
|
||||||
|
@ -291,8 +288,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||||
->addExtraClass('bulkUploadEditButton')
|
->addExtraClass('bulkUploadEditButton')
|
||||||
->setAttribute('data-icon', 'pencil')
|
->setAttribute('data-icon', 'pencil')
|
||||||
->setAttribute('data-url', $gridField->Link('bulkupload/edit'))
|
->setAttribute('data-url', $gridField->Link('bulkupload/edit'))
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true);
|
||||||
->setAttribute('src', '');
|
|
||||||
}else{
|
}else{
|
||||||
$editAllButton = '';
|
$editAllButton = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,118 +1,12 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
$.entwine('ss', function($) {
|
$.entwine('ss', function($) {
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// start SS namespace overrides
|
// start SS namespace overrides
|
||||||
// ============================================================================================
|
|
||||||
|
|
||||||
/*
|
|
||||||
* open/close edit form
|
|
||||||
*/
|
|
||||||
$('div.ss-upload .ss-uploadfield-item-edit, div.ss-upload .ss-uploadfield-item-name').entwine({
|
|
||||||
onclick: function(e)
|
|
||||||
{
|
|
||||||
this.closest('.ss-uploadfield-item').find('.ss-uploadfield-item-editform').toggleEditForm();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* edit all button
|
|
||||||
* @TODO fix
|
|
||||||
*/
|
|
||||||
$('div.ss-upload .fileOverview .ss-uploadfield-item-edit-all').entwine({
|
|
||||||
onmatch: function()
|
|
||||||
{
|
|
||||||
if( !$(this).hasClass('opened') ){
|
|
||||||
$(this).addClass('opened');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onunmatch: function(){},
|
|
||||||
onclick: function(e)
|
|
||||||
{
|
|
||||||
if( $(this).hasClass('opened') )
|
|
||||||
{
|
|
||||||
$('.ss-uploadfield-files .ss-uploadfield-item-editform').hide();
|
|
||||||
$(this).removeClass('opened');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$('.ss-uploadfield-files .ss-uploadfield-item-editform').show();
|
|
||||||
$(this).addClass('opened');
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* show/hide edit form
|
|
||||||
* overrides default behaviour
|
|
||||||
*/
|
|
||||||
$('div.ss-upload .ss-uploadfield-item-editform').entwine({
|
|
||||||
toggleEditForm: function()
|
|
||||||
{
|
|
||||||
if( this.css('display') == 'none' ) {
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* prevent submitting of individual edit forms
|
|
||||||
*/
|
|
||||||
$('#Form_uploadForm, div.ss-upload .ss-uploadfield-item-editform form').entwine({
|
|
||||||
onsubmit: function(e)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* initialise disabled state
|
|
||||||
*/
|
|
||||||
$('#bulkImageUploadUpdateBtn,#bulkImageUploadUpdateCancelBtn').entwine({
|
|
||||||
onmatch: function()
|
|
||||||
{
|
|
||||||
$(this).addClass('ui-state-disabled ssui-button-disabled');
|
|
||||||
$(this).attr('aria-disabled', 'true');
|
|
||||||
$(this).attr('disabled', 'true');
|
|
||||||
},
|
|
||||||
onunmatch: function(){}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* finish/return button
|
|
||||||
*/
|
|
||||||
$('#bulkImageUploadFinishBtn').entwine({
|
|
||||||
onmatch: function(){},
|
|
||||||
onunmatch: function(){},
|
|
||||||
onclick: function(e)
|
|
||||||
{
|
|
||||||
var formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate').length,
|
|
||||||
confirmed = true;
|
|
||||||
|
|
||||||
if ( formsWithUpadtes > 0 )
|
|
||||||
{
|
|
||||||
confirmed = confirm( ss.i18n._t('GridFieldBulkTools.FINISH_CONFIRM') );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (confirmed)
|
|
||||||
{
|
|
||||||
$('.cms-container').loadPanel(this.attr('href'), null, {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// end SS namespace overrides
|
// end SS namespace overrides
|
||||||
// ============================================================================================
|
|
||||||
|
|
||||||
// ============================================================================================
|
|
||||||
// start add-on behaviours
|
|
||||||
// ============================================================================================
|
|
||||||
|
|
||||||
$.entwine('colymba', function($) {
|
$.entwine('colymba', function($) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -254,7 +148,96 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.bulkUploadClearErrorButton').entwine({
|
||||||
|
onmatch: function(){
|
||||||
|
this.removeClass('action');
|
||||||
|
},
|
||||||
|
onunmatch: function(){},
|
||||||
|
onclick: function(e)
|
||||||
|
{
|
||||||
|
var $bulkUpload = this.parents('.bulkUpload'),
|
||||||
|
$errors = $bulkUpload.find('li.ss-uploadfield-item .ui-state-warning-text,li.ss-uploadfield-item .ui-state-error-text').parents('li')
|
||||||
|
;
|
||||||
|
|
||||||
|
$($errors.get().reverse()).each(function(index, Element){
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.bulkUploadCancelButton').entwine({
|
||||||
|
onmatch: function(){
|
||||||
|
this.removeClass('action');
|
||||||
|
},
|
||||||
|
onunmatch: function(){},
|
||||||
|
onclick: function()
|
||||||
|
{
|
||||||
|
var $bulkUpload = this.parents('.bulkUpload'),
|
||||||
|
$li = $bulkUpload.find('li.ss-uploadfield-item'),
|
||||||
|
$records = $li.filter('[data-recordid]'),
|
||||||
|
recordsID,
|
||||||
|
$other = $li.not($records),
|
||||||
|
$doBulkActionButton = $bulkUpload.parents('.ss-gridfield-table').find('.doBulkActionButton')
|
||||||
|
;
|
||||||
|
|
||||||
|
$other.each(function(index, Element){
|
||||||
|
// skip in progress
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( $doBulkActionButton.length > 0 )
|
||||||
|
{
|
||||||
|
recordsID = $records.map(function() {
|
||||||
|
return parseInt( $(this).data('recordid') )
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
$doBulkActionButton.doBulkAction('delete', recordsID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.bulkUploadFinishButton').entwine({
|
||||||
|
onmatch: function(){
|
||||||
|
this.removeClass('action');
|
||||||
|
},
|
||||||
|
onunmatch: function(){},
|
||||||
|
onclick: function()
|
||||||
|
{
|
||||||
|
var $bulkUpload = this.parents('.bulkUpload'),
|
||||||
|
$li = $bulkUpload.find('li.ss-uploadfield-item')
|
||||||
|
;
|
||||||
|
|
||||||
|
$li.each(function(index, Element){
|
||||||
|
// skip in progress
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.bulkUploadEditButton').entwine({
|
||||||
|
onmatch: function(){
|
||||||
|
this.removeClass('action');
|
||||||
|
},
|
||||||
|
onunmatch: function(){},
|
||||||
|
onclick: function()
|
||||||
|
{
|
||||||
|
var $bulkUpload = this.parents('.bulkUpload'),
|
||||||
|
$li = $bulkUpload.find('li.ss-uploadfield-item'),
|
||||||
|
$records = $li.filter('[data-recordid]'),
|
||||||
|
recordsID,
|
||||||
|
$doBulkActionButton = $bulkUpload.parents('.ss-gridfield-table').find('.doBulkActionButton')
|
||||||
|
;
|
||||||
|
|
||||||
|
if ( $doBulkActionButton.length > 0 )
|
||||||
|
{
|
||||||
|
recordsID = $records.map(function() {
|
||||||
|
return parseInt( $(this).data('recordid') )
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
$doBulkActionButton.doBulkAction('edit', recordsID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -380,10 +363,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}); // colymba namespace
|
||||||
// ============================================================================================
|
|
||||||
// end add-on behaviours
|
|
||||||
// ============================================================================================
|
|
||||||
|
|
||||||
});
|
}); // ss namespace
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
window.tmpl.cache['colymba-bulkuploaddownloadtemplate'] = tmpl(
|
window.tmpl.cache['colymba-bulkuploaddownloadtemplate'] = tmpl(
|
||||||
'{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' +
|
'{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' +
|
||||||
'<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% }else{ %} done{% } %}" data-fileid="{%=file.id%} data-recordid="{%=file.record.id%}">' +
|
'<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% }else{ %} done{% } %}" data-fileid="{%=file.id%}" data-recordid="{%=file.record.id%}">' +
|
||||||
'<div class="ss-uploadfield-item-preview preview"><span>' +
|
'<div class="ss-uploadfield-item-preview preview"><span>' +
|
||||||
'<img src="{%=file.thumbnail_url%}" alt="" />' +
|
'<img src="{%=file.thumbnail_url%}" alt="" />' +
|
||||||
'</span></div>' +
|
'</span></div>' +
|
||||||
|
|
Loading…
Reference in New Issue