mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
added finish button
This commit is contained in:
parent
7972cef1f1
commit
8089c14447
@ -180,8 +180,25 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
*/
|
||||
public function uploadForm($id = null, $fields = null)
|
||||
{
|
||||
$crumbs = $this->Breadcrumbs();
|
||||
if($crumbs && $crumbs->count()>=2)
|
||||
{
|
||||
$one_level_up = $crumbs->offsetGet($crumbs->count()-2);
|
||||
$one_level_up = $one_level_up->Link;
|
||||
}
|
||||
|
||||
$actions = new FieldList();
|
||||
|
||||
$actions->push(
|
||||
FormAction::create('Finish', 'Finish')
|
||||
->setAttribute('id', 'bulkImageUploadFinishBtn')
|
||||
->addExtraClass('cms-panel-link')
|
||||
->setAttribute('data-icon', 'accept')
|
||||
->setAttribute('href', $one_level_up)
|
||||
->setUseButtonTag(true)
|
||||
->setAttribute('src', '')//changes type to image so isn't hooked by default actions handlers
|
||||
);
|
||||
|
||||
$actions->push(
|
||||
FormAction::create('SaveAll', 'Save All')
|
||||
->setAttribute('id', 'bulkImageUploadUpdateBtn')
|
||||
@ -254,12 +271,9 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
$actions
|
||||
);
|
||||
|
||||
|
||||
$crumbs = $this->Breadcrumbs();
|
||||
if($crumbs && $crumbs->count()>=2)
|
||||
if($one_level_up)
|
||||
{
|
||||
$one_level_up = $crumbs->offsetGet($crumbs->count()-2);
|
||||
$form->Backlink = $one_level_up->Link;
|
||||
$form->Backlink = $one_level_up;
|
||||
}
|
||||
|
||||
return $form;
|
||||
|
@ -41,7 +41,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('div.ss-upload .ss-uploadfield-item-editform form').entwine({
|
||||
$('#Form_uploadForm, div.ss-upload .ss-uploadfield-item-editform form').entwine({
|
||||
onsubmit: function(e) {
|
||||
return false;
|
||||
}
|
||||
@ -56,6 +56,28 @@
|
||||
onunmatch: function(){}
|
||||
});
|
||||
|
||||
$('#bulkImageUploadFinishBtn').entwine({
|
||||
onmatch: function(){},
|
||||
onunmatch: function(){},
|
||||
onclick: function(e){
|
||||
var formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate').length,
|
||||
confirmed = true;
|
||||
|
||||
if ( formsWithUpadtes > 0 )
|
||||
{
|
||||
confirmed = confirm(
|
||||
"You have unsaved changes. Continuing will loose all unsaved data.\n\n" +
|
||||
"Do your really want to continue?"
|
||||
);
|
||||
}
|
||||
|
||||
if (confirmed)
|
||||
{
|
||||
$('.cms-container').loadPanel(this.attr('href'), null, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// end SS overhides
|
||||
// start add-on behaviours
|
||||
|
||||
@ -203,7 +225,6 @@
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
});
|
||||
|
@ -1,3 +1,3 @@
|
||||
<a id="bulkImageUploadGFButton" href="$Link" class="action action-detail ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="drive-upload">
|
||||
<a id="bulkImageUploadGFButton" href="$Link" class="cms-panel-link ss-ui-action-constructive ss-ui-button" data-icon="drive-upload">
|
||||
$Label
|
||||
</a>
|
Loading…
Reference in New Issue
Block a user