mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
ENHANCEMENT: javascript to hide/show the DMS detail form buttons
This commit is contained in:
parent
8264ab4396
commit
ba51c38262
@ -509,15 +509,20 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||
$gridFieldConfig
|
||||
);
|
||||
|
||||
$fields->add(new LiteralField('BottomTaskSelection',"<div id=\"Actions\" class=\"field actions\"><label class=\"left\">Actions</label><ul><li class=\"ss-ui-button\">Replace</li><li class=\"ss-ui-button\">Embargo</li></ul></div>"));
|
||||
$fields->add(new LiteralField('BottomTaskSelection',
|
||||
'<div id="Actions" class="field actions"><label class="left">Actions</label><ul>'.
|
||||
'<li class="ss-ui-button" data-panel="replace">Replace</li>'.
|
||||
'<li class="ss-ui-button" data-panel="embargo">Embargo</li>'.
|
||||
'<li class="ss-ui-button" data-panel="find-usage">Find usage</li>'.
|
||||
'</ul></div>'));
|
||||
//$fields->add($uploadField);
|
||||
|
||||
// This adds all the actions details into a group.
|
||||
// Embargo, History, etc to go in here
|
||||
// These are toggled on and off via the Actions Buttons above
|
||||
$fields->add($group = new FieldGroup(
|
||||
$uploadField,
|
||||
$pagesGrid
|
||||
$uploadField->addExtraClass('replace'),
|
||||
$pagesGrid->addExtraClass('find-usage')
|
||||
));
|
||||
$group->setName("ActionsPanel")->addExtraClass('dmsupload ss-upload ss-uploadfield');
|
||||
return $fields;
|
||||
|
@ -29,10 +29,30 @@
|
||||
|
||||
$('#Actions ul li').entwine({
|
||||
onclick: function(e) {
|
||||
//TODO - Fix so when clicking on an action it toggles the correct details inside the ActionsPanel
|
||||
// Currently this just hides the whole ActionsPanel when you click an action button
|
||||
e.preventDefault();
|
||||
this.parents('fieldset').find('#ActionsPanel').toggle();
|
||||
//add active state to the current button
|
||||
$('#Actions ul li').removeClass('dms-active');
|
||||
this.addClass('dms-active');
|
||||
|
||||
//hide all inner field sections
|
||||
var panel = $('#ActionsPanel');
|
||||
panel.find('div.fieldgroup-field').hide();
|
||||
|
||||
//show the correct group of controls
|
||||
panel.find('.'+this.data('panel')).closest('div.fieldgroup-field').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#ActionsPanel').entwine({
|
||||
onadd: function() {
|
||||
//do an initial show of the entire panel
|
||||
this.show();
|
||||
|
||||
//move the delete button into the panel
|
||||
$('#Actions ul').append('<li class="delete-button-appended"></li>');
|
||||
$('.delete-button-appended').append($('#Form_ItemEditForm_action_doDelete'));
|
||||
|
||||
//show the replace panel when the page loads
|
||||
$('li[data-panel="replace"]').click();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user