mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Using '.cms-edit-form' instead of '#Form_EditForm' selector
This commit is contained in:
parent
fd0c38c175
commit
dad6169f73
@ -757,6 +757,7 @@ class LeftAndMain extends Controller {
|
||||
}
|
||||
|
||||
$form = new Form($this, "EditForm", $fields, $actions);
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
$form->loadDataFrom($record);
|
||||
|
||||
// Add a default or custom validator.
|
||||
@ -821,6 +822,8 @@ class LeftAndMain extends Controller {
|
||||
new FieldSet()
|
||||
);
|
||||
$form->unsetValidator();
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
$form->addExtraClass('root-form');
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -845,6 +848,7 @@ class LeftAndMain extends Controller {
|
||||
)
|
||||
);
|
||||
$form->addExtraClass('actionparams');
|
||||
$form->addExtraClass('add-form');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
$fields,
|
||||
$actions
|
||||
);
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
@ -4,16 +4,16 @@
|
||||
(function($) {
|
||||
$.entwine('ss', function($){
|
||||
/**
|
||||
* Class: #Form_AddForm
|
||||
* Class: .add-form
|
||||
*
|
||||
* Simple form with a page type dropdown
|
||||
* which creates a new page through #Form_EditForm and adds a new tree node.
|
||||
* which creates a new page through .cms-edit-form and adds a new tree node.
|
||||
*
|
||||
* Requires:
|
||||
* ss.i18n
|
||||
* #Form_EditForm
|
||||
* .cms-edit-form
|
||||
*/
|
||||
$('#Form_AddForm').entwine({
|
||||
$('.add-form').entwine({
|
||||
/**
|
||||
* Variable: Tree
|
||||
* (DOMElement)
|
||||
@ -91,7 +91,7 @@
|
||||
data.push({name:button.attr('name'),value:button.val()});
|
||||
|
||||
// TODO Should be set by hiddenfield already
|
||||
jQuery('#Form_EditForm').entwine('ss').loadForm(
|
||||
jQuery('.cms-edit-form').entwine('ss').loadForm(
|
||||
this.attr('action'),
|
||||
function() {
|
||||
// Tree updates are triggered by Form_EditForm load events
|
||||
|
@ -271,10 +271,10 @@
|
||||
// // only if the current page was modified
|
||||
// tree.jstree('select_node', selectedNode);
|
||||
// } else if(data.deleted[selectedNodeId]) {
|
||||
// jQuery('#Form_EditForm').entwine('ss').removeForm();
|
||||
// jQuery('.cms-edit-form').entwine('ss').removeForm();
|
||||
// }
|
||||
// } else {
|
||||
// jQuery('#Form_EditForm').entwine('ss').removeForm();
|
||||
// jQuery('.cms-edit-form').entwine('ss').removeForm();
|
||||
// }
|
||||
|
||||
// close panel
|
||||
|
@ -5,7 +5,7 @@
|
||||
$.entwine('ss', function($){
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm
|
||||
* Class: .cms-edit-form
|
||||
*
|
||||
* Base edit form, provides ajaxified saving
|
||||
* and reloading itself through the ajax return values.
|
||||
@ -19,7 +19,7 @@
|
||||
* removeform - A form is about to be removed from the DOM
|
||||
* load - Form is about to be loaded through ajax
|
||||
*/
|
||||
$('#Form_EditForm').entwine(/** @lends ss.Form_EditForm */{
|
||||
$('.cms-edit-form').entwine(/** @lends ss.Form_EditForm */{
|
||||
/**
|
||||
* Variable: PlaceholderHtml
|
||||
* (String_ HTML text to show when no form content is chosen.
|
||||
@ -340,29 +340,29 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm .Actions :submit
|
||||
* Class: .cms-edit-form .Actions :submit
|
||||
*
|
||||
* All buttons in the right CMS form go through here by default.
|
||||
* We need this onclick overloading because we can't get to the
|
||||
* clicked button from a form.onsubmit event.
|
||||
*/
|
||||
$('#Form_EditForm .Actions :submit').entwine({
|
||||
$('.cms-edit-form .Actions :submit').entwine({
|
||||
|
||||
/**
|
||||
* Function: onclick
|
||||
*/
|
||||
onclick: function(e) {
|
||||
jQuery('#Form_EditForm').entwine('ss').ajaxSubmit(this);
|
||||
jQuery('.cms-edit-form').entwine('ss').ajaxSubmit(this);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm textarea.htmleditor
|
||||
* Class: .cms-edit-form textarea.htmleditor
|
||||
*
|
||||
* Add tinymce to HtmlEditorFields within the CMS.
|
||||
*/
|
||||
$('#Form_EditForm textarea.htmleditor').entwine({
|
||||
$('.cms-edit-form textarea.htmleditor').entwine({
|
||||
|
||||
/**
|
||||
* Constructor: onmatch
|
||||
|
@ -124,7 +124,7 @@
|
||||
})
|
||||
// TODO Move to EditForm logic
|
||||
.bind('select_node.jstree', function(e, data) {
|
||||
var node = data.rslt.obj, loadedNodeID = $('#Form_EditForm :input[name=ID]').val()
|
||||
var node = data.rslt.obj, loadedNodeID = $('.edit-form :input[name=ID]').val()
|
||||
|
||||
// Don't allow checking disabled nodes
|
||||
if($(node).hasClass('disabled')) return false;
|
||||
@ -135,12 +135,12 @@
|
||||
|
||||
var url = $(node).find('a:first').attr('href');
|
||||
if(url && url != '#') {
|
||||
var xmlhttp = $('#Form_EditForm').loadForm(
|
||||
var xmlhttp = $('.edit-form').loadForm(
|
||||
url,
|
||||
function(response) {}
|
||||
);
|
||||
} else {
|
||||
$('#Form_EditForm').removeForm();
|
||||
$('.edit-form').removeForm();
|
||||
}
|
||||
})
|
||||
.bind('move_node.jstree', function(e, data) {
|
||||
@ -159,7 +159,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
$('#Form_EditForm').bind('loadnewpage', function(e, data) {
|
||||
$('.cms-edit-form').bind('loadnewpage', function(e, data) {
|
||||
self._onLoadNewPage(e, data);
|
||||
});
|
||||
},
|
||||
|
@ -62,7 +62,7 @@
|
||||
$(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
|
||||
|
||||
// @todo Doesn't resize properly if the response doesn't contain a tabset (see above)
|
||||
$('#Form_EditForm').bind('loadnewpage', function() {
|
||||
$('.cms-edit-form').bind('loadnewpage', function() {
|
||||
// HACK Delay resizing to give jquery-ui tabs a change their dimensions
|
||||
// through dynamically added css classes
|
||||
var timerID = "timerLeftAndMainResize";
|
||||
@ -119,14 +119,14 @@
|
||||
$('#contentPanel form', this).fitHeightToParent();
|
||||
$('#contentPanel form fieldset', this).fitHeightToParent();
|
||||
$('#contentPanel form fieldset .content', this).fitHeightToParent();
|
||||
$('#Form_EditForm').fitHeightToParent();
|
||||
$('#Form_EditForm fieldset', this).fitHeightToParent();
|
||||
$('.edit-form').fitHeightToParent();
|
||||
$('.edit-form fieldset', this).fitHeightToParent();
|
||||
// Order of resizing is important: Outer to inner
|
||||
// TODO Only supports two levels of tabs at the moment
|
||||
$('#Form_EditForm fieldset > .ss-tabset', this).fitHeightToParent();
|
||||
$('#Form_EditForm fieldset > .ss-tabset > .tab', this).fitHeightToParent();
|
||||
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
||||
$('#Form_EditForm fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
||||
$('.edit-form fieldset > .ss-tabset', this).fitHeightToParent();
|
||||
$('.edit-form fieldset > .ss-tabset > .tab', this).fitHeightToParent();
|
||||
$('.edit-form fieldset > .ss-tabset > .tab > .ss-tabset', this).fitHeightToParent();
|
||||
$('.edit-form fieldset > .ss-tabset > .tab > .ss-tabset > .tab', this).fitHeightToParent();
|
||||
}
|
||||
});
|
||||
|
||||
@ -307,7 +307,7 @@
|
||||
onmatch: function() {
|
||||
this._super();
|
||||
|
||||
$('#Form_EditForm').bind('loadnewpage delete', function(e) {
|
||||
$('.cms-edit-form').bind('loadnewpage delete', function(e) {
|
||||
var updatedSwitchView = $('#AjaxSwitchView');
|
||||
if(updatedSwitchView.length) {
|
||||
$('#SwitchView').html(updatedSwitchView.html());
|
||||
|
@ -88,24 +88,24 @@ AjaxMemberLookup = {
|
||||
* Class: MemberTableField
|
||||
*/
|
||||
MemberTableField = Class.create();
|
||||
MemberTableField.applyTo('#Form_EditForm div.MemberTableField');
|
||||
MemberTableField.applyTo('.cms-edit-form div.MemberTableField');
|
||||
MemberTableField.prototype = {
|
||||
|
||||
initialize: function() {
|
||||
Behaviour.register({
|
||||
'#Form_EditForm div.MemberFilter input' : {
|
||||
'.cms-edit-form div.MemberFilter input' : {
|
||||
onkeypress : this.prepareSearch.bind(this)
|
||||
},
|
||||
|
||||
'#Form_EditForm div.MemberTableField table.data tr.addtogrouprow input' : {
|
||||
'.cms-edit-form div.MemberTableField table.data tr.addtogrouprow input' : {
|
||||
onkeypress : this.prepareAddToGroup.bind(this)
|
||||
},
|
||||
|
||||
'#Form_EditForm div.MemberTableField table.data tr.addtogrouprow #Form_AddRecordForm_action_addtogroup' : {
|
||||
'.cms-edit-form div.MemberTableField table.data tr.addtogrouprow #Form_AddRecordForm_action_addtogroup' : {
|
||||
onclick : this.prepareAddToGroup.bind(this)
|
||||
},
|
||||
|
||||
'#Form_EditForm div.MemberTableField table.data tr.addtogrouprow td.actions input' : {
|
||||
'.cms-edit-form div.MemberTableField table.data tr.addtogrouprow td.actions input' : {
|
||||
initialise: function() {
|
||||
data = this.parentNode.parentNode.getElementsByTagName('input');
|
||||
var i,item,error = [];
|
||||
@ -116,9 +116,9 @@ MemberTableField.prototype = {
|
||||
onclick : this.addToGroup.bind(this)
|
||||
},
|
||||
|
||||
//'#Form_EditForm div.MemberTableField input' : AjaxMemberLookup,
|
||||
//'.cms-edit-form div.MemberTableField input' : AjaxMemberLookup,
|
||||
|
||||
'#Form_EditForm' : {
|
||||
'.cms-edit-form' : {
|
||||
changeDetection_fieldsToIgnore : {
|
||||
'ctf[start]' : true,
|
||||
'ctf[ID]' : true,
|
||||
@ -325,7 +325,7 @@ MemberFilterButton.prototype = {
|
||||
|
||||
// has to be external from initialize() because otherwise request will double on each reload - WTF
|
||||
Behaviour.register({
|
||||
'#Form_EditForm div.MemberTableField table.data input.text' : AjaxMemberLookup
|
||||
'.cms-edit-form div.MemberTableField table.data input.text' : AjaxMemberLookup
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@
|
||||
this.trigger('historyGoBack', {url:previousPage});
|
||||
|
||||
// load new location
|
||||
$('#Form_EditForm').loadForm(previousPage);
|
||||
$('.cms-edit-form').loadForm(previousPage);
|
||||
|
||||
this.redraw();
|
||||
}
|
||||
@ -136,7 +136,7 @@
|
||||
this.trigger('historyGoForward', {url:nextPage});
|
||||
|
||||
// load new location
|
||||
$('#Form_EditForm').loadForm(nextPage);
|
||||
$('.cms-edit-form').loadForm(nextPage);
|
||||
|
||||
this.redraw();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@
|
||||
var btn = $(this[0].clickedButton);
|
||||
btn.addClass('loading');
|
||||
|
||||
$('#Form_EditForm').loadForm(
|
||||
$('.cms-edit-form').loadForm(
|
||||
this.attr('action'),
|
||||
function() {
|
||||
btn.removeClass('loading');
|
||||
@ -135,7 +135,7 @@
|
||||
onclick: function(e) {
|
||||
var firstLink = this.find('a[href]');
|
||||
if(!firstLink) return;
|
||||
$('#Form_EditForm').loadForm(firstLink.attr('href'));
|
||||
$('.cms-edit-form').loadForm(firstLink.attr('href'));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@ -153,7 +153,7 @@
|
||||
className = $('select option:selected', this).val();
|
||||
requestPath = this.attr('action').replace('ManagedModelsSelect', className + '/add');
|
||||
var $button = $(':submit', this);
|
||||
$('#Form_EditForm').loadForm(
|
||||
$('.cms-edit-form').loadForm(
|
||||
requestPath,
|
||||
function() {
|
||||
$button.removeClass('loading');
|
||||
@ -166,11 +166,11 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm input[name=action_doDelete]
|
||||
* Class: .cms-edit-form input[name=action_doDelete]
|
||||
*
|
||||
* RHS panel Delete button
|
||||
*/
|
||||
$('#Form_EditForm input[name=action_doDelete]').entwine({
|
||||
$('.cms-edit-form input[name=action_doDelete]').entwine({
|
||||
// Function: onclick
|
||||
onclick: function(e) {
|
||||
if(!confirm(ss.i18n._t('ModelAdmin.REALLYDELETE', 'Really delete?'))) {
|
||||
|
@ -53,9 +53,9 @@
|
||||
|
||||
$.entwine('ss', function($){
|
||||
/**
|
||||
* Class: #Form_EditForm .Actions #Form_EditForm_action_addmember
|
||||
* Class: .cms-edit-form .Actions #Form_EditForm_action_addmember
|
||||
*/
|
||||
$('#Form_EditForm .Actions #Form_EditForm_action_addmember').entwine({
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_addmember').entwine({
|
||||
// Function: onclick
|
||||
onclick: function(e) {
|
||||
// CAUTION: Assumes that a MemberTableField-instance is present as an editing form
|
||||
|
Loading…
Reference in New Issue
Block a user