mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
MINOR Using '.cms-edit-form' instead of '#Form_EditForm' selector
This commit is contained in:
parent
7b655d6199
commit
4fe07e9b71
@ -285,7 +285,7 @@ JS
|
||||
// echo <<<HTML
|
||||
// <script type="text/javascript">
|
||||
// var url = parent.document.getElementById('sitetree').getTreeNodeByIdx( "{$folder->ID}" ).getElementsByTagName('a')[0].href;
|
||||
// parent.jQuery('#Form_EditForm').entwine('ss').loadForm(url);
|
||||
// parent.jQuery('.cms-edit-form').entwine('ss').loadForm(url);
|
||||
// parent.statusMessage("{$statusMessage}","{$status}");
|
||||
// </script>
|
||||
// HTML;
|
||||
|
@ -462,6 +462,11 @@ JS;
|
||||
$form = new Form($this, "EditForm", $fields, $actions, $validator);
|
||||
$form->loadDataFrom($record);
|
||||
$form->disableDefaultAction();
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
|
||||
// TODO Can't merge $FormAttributes in template at the moment
|
||||
$form->addExtraClass('cms-content center ss-tabset');
|
||||
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
|
||||
|
||||
if(!$record->canEdit() || $record->IsDeletedFromStage) {
|
||||
$readonlyFields = $form->Fields()->makeReadonly();
|
||||
@ -488,8 +493,14 @@ JS;
|
||||
$fields = $siteConfig->getCMSFields();
|
||||
|
||||
$form = new Form($this, 'RootForm', $fields, $siteConfig->getCMSActions());
|
||||
$form->addExtraClass('root-form');
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
// TODO Can't merge $FormAttributes in template at the moment
|
||||
$form->addExtraClass('cms-content center ss-tabset');
|
||||
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
|
||||
$form->setHTMLID('Form_EditForm');
|
||||
$form->loadDataFrom($siteConfig);
|
||||
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
|
||||
|
||||
$this->extend('updateEditForm', $form);
|
||||
|
||||
|
13
config.rb
Normal file
13
config.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# Require any additional compass plugins here.
|
||||
require 'compass-colors'
|
||||
|
||||
project_type = :stand_alone
|
||||
# Set this to the root of your project when deployed:
|
||||
http_path = "/"
|
||||
css_dir = "css"
|
||||
sass_dir = "sass"
|
||||
images_dir = "images"
|
||||
javascripts_dir = "javascript"
|
||||
output_style = :compact
|
||||
# To enable relative paths to assets via compass helper functions. Uncomment:
|
||||
# relative_assets = true
|
@ -47,7 +47,7 @@
|
||||
var currNode = $('#sitetree')[0].firstSelected();
|
||||
if(currNode) {
|
||||
var url = $(currNode).find('a').attr('href');
|
||||
$('#Form_EditForm').loadForm(url);
|
||||
$('.cms-edit-form').loadForm(url);
|
||||
}
|
||||
$('#sitetree')[0].setCustomURL('admin/assets/getsubtree');
|
||||
$('#sitetree')[0].reload({onSuccess: function() {
|
||||
|
@ -4,11 +4,11 @@
|
||||
(function($) {
|
||||
$.entwine('ss', function($){
|
||||
/**
|
||||
* Class: #Form_EditForm :input[name=ClassName]
|
||||
* Class: .cms-edit-form :input[name=ClassName]
|
||||
* Alert the user on change of page-type. This might have implications
|
||||
* on the available form fields etc.
|
||||
*/
|
||||
$('#Form_EditForm :input[name=ClassName]').entwine({
|
||||
$('.cms-edit-form :input[name=ClassName]').entwine({
|
||||
// Function: onchange
|
||||
onchange: function() {
|
||||
alert(ss.i18n._t('CMSMAIN.ALERTCLASSNAME'));
|
||||
@ -16,11 +16,11 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm input[name=URLSegment]
|
||||
* Class: .cms-edit-form input[name=URLSegment]
|
||||
*
|
||||
* Input validation on the URLSegment field
|
||||
*/
|
||||
$('#Form_EditForm input[name=URLSegment]').entwine({
|
||||
$('.cms-edit-form input[name=URLSegment]').entwine({
|
||||
/**
|
||||
* Property: FilterRegex
|
||||
* Regex
|
||||
@ -88,17 +88,17 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm input[name=Title]
|
||||
* Class: .cms-edit-form input[name=Title]
|
||||
*
|
||||
* Input validation on the Title field
|
||||
*/
|
||||
$('#Form_EditForm input[name=Title]').entwine({
|
||||
$('.cms-edit-form input[name=Title]').entwine({
|
||||
// Constructor: onmatch
|
||||
onmatch : function() {
|
||||
var self = this;
|
||||
|
||||
this.bind('change', function(e) {
|
||||
self.updateURLSegment(jQuery('#Form_EditForm input[name=URLSegment]'));
|
||||
self.updateURLSegment(jQuery('.cms-edit-form input[name=URLSegment]'));
|
||||
// TODO We should really user-confirm these changes
|
||||
self.parents('form').find('input[name=MetaTitle], input[name=MenuTitle]').val(self.val());
|
||||
});
|
||||
@ -137,12 +137,12 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm .parentTypeSelector
|
||||
* Class: .cms-edit-form .parentTypeSelector
|
||||
*
|
||||
* ParentID field combination - mostly toggling between
|
||||
* the two radiobuttons and setting the hidden "ParentID" field
|
||||
*/
|
||||
$('#Form_EditForm .parentTypeSelector').entwine({
|
||||
$('.cms-edit-form .parentTypeSelector').entwine({
|
||||
// Constructor: onmatch
|
||||
onmatch : function() {
|
||||
var self = this;
|
||||
@ -168,12 +168,12 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm #CanViewType, #Form_EditForm #CanEditType
|
||||
* Class: .cms-edit-form #CanViewType, .cms-edit-form #CanEditType
|
||||
*
|
||||
* Toggle display of group dropdown in "access" tab,
|
||||
* based on selection of radiobuttons.
|
||||
*/
|
||||
$('#Form_EditForm #CanViewType, #Form_EditForm #CanEditType').entwine({
|
||||
$('.cms-edit-form #CanViewType, .cms-edit-form #CanEditType').entwine({
|
||||
// Constructor: onmatch
|
||||
onmatch: function() {
|
||||
// TODO Decouple
|
||||
@ -194,12 +194,12 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm .Actions #Form_EditForm_action_email
|
||||
* Class: .cms-edit-form .Actions #Form_EditForm_action_email
|
||||
*
|
||||
* Email containing the link to the archived version of the page.
|
||||
* Visible on readonly older versions of a specific page at the moment.
|
||||
*/
|
||||
$('#Form_EditForm .Actions #Form_EditForm_action_email').entwine({
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_email').entwine({
|
||||
/**
|
||||
* Function: onclick
|
||||
*
|
||||
@ -220,12 +220,12 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm .Actions #Form_EditForm_action_print
|
||||
* Class: .cms-edit-form .Actions #Form_EditForm_action_print
|
||||
*
|
||||
* Open a printable representation of the form in a new window.
|
||||
* Used for readonly older versions of a specific page.
|
||||
*/
|
||||
$('#Form_EditForm .Actions #Form_EditForm_action_print').entwine({
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_print').entwine({
|
||||
/**
|
||||
* Function: onclick
|
||||
*
|
||||
@ -245,11 +245,11 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Class: #Form_EditForm .Actions #Form_EditForm_action_rollback
|
||||
* Class: .cms-edit-form .Actions #Form_EditForm_action_rollback
|
||||
*
|
||||
* A "rollback" to a specific version needs user confirmation.
|
||||
*/
|
||||
$('#Form_EditForm .Actions #Form_EditForm_action_rollback').entwine({
|
||||
$('.cms-edit-form .Actions #Form_EditForm_action_rollback').entwine({
|
||||
|
||||
/**
|
||||
* Function: onclick
|
||||
|
@ -169,7 +169,7 @@
|
||||
* Class: Form_SideReportsForm
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
$('#Form_SideReportsForm').entwine(/** @lends ss.reports_holder */{
|
||||
ReportContainer: null,
|
||||
@ -275,7 +275,7 @@
|
||||
if (e.button!=2) {
|
||||
var $link = $(this);
|
||||
$link.addClass('loading');
|
||||
jQuery('#Form_EditForm').entwine('ss').loadForm(
|
||||
jQuery('.cms-edit-form').entwine('ss').loadForm(
|
||||
$(this).attr('href'),
|
||||
function(e) {
|
||||
$link.removeClass('loading');
|
||||
@ -337,7 +337,7 @@
|
||||
|
||||
var link = $(this).siblings('.versionlink').find('a').attr('href');
|
||||
td.addClass('loading');
|
||||
jQuery('#Form_EditForm').entwine('ss').loadForm(
|
||||
jQuery('.cms-edit-form').entwine('ss').loadForm(
|
||||
link,
|
||||
function(e) {
|
||||
td.removeClass('loading');
|
||||
@ -388,7 +388,7 @@
|
||||
data.push({name:$button.attr('name'), value: $button.val()});
|
||||
|
||||
if(loadEditForm) {
|
||||
jQuery('#Form_EditForm').entwine('ss').loadForm(
|
||||
jQuery('.cms-edit-form').entwine('ss').loadForm(
|
||||
this.attr('action'),
|
||||
function(e) {
|
||||
$button.removeClass('loading');
|
||||
|
8
javascript/CMSPagesController.Tree.js
Normal file
8
javascript/CMSPagesController.Tree.js
Normal file
@ -0,0 +1,8 @@
|
||||
(function($) {
|
||||
// Load tree links directly rather than through ajax into .cms-edit-form.
|
||||
$('.cms-tree').bind('select_node.jstree', function(e, data) {
|
||||
var node = data.rslt.obj, url = $(node).find('a:first').attr('href');
|
||||
if(url && url != '#') document.location.href = url;
|
||||
return false;
|
||||
});
|
||||
}(jQuery));
|
@ -25,11 +25,11 @@ CommentTableField.prototype = {
|
||||
rules['#'+this.id+' table.data a.hamlink'] = {
|
||||
onclick: this.removeRowAfterAjax.bind(this)
|
||||
};
|
||||
rules['#Form_EditForm div.CommentFilter input'] = {
|
||||
rules['.edit-form div.CommentFilter input'] = {
|
||||
onkeypress : this.prepareSearch.bind(this)
|
||||
};
|
||||
|
||||
rules['#Form_EditForm'] = {
|
||||
rules['.edit-form'] = {
|
||||
changeDetection_fieldsToIgnore : {
|
||||
'ctf[start]' : true,
|
||||
'ctf[ID]' : true,
|
||||
|
@ -11,7 +11,7 @@
|
||||
$('#sitetree').entwine({
|
||||
onmatch: function() {
|
||||
// make sure current ID of loaded form is actually selected in tree
|
||||
var id = $('#Form_EditForm :input[name=ID]').val();
|
||||
var id = $('.cms-edit-form :input[name=ID]').val();
|
||||
if (id) this[0].setCurrentByIdx(id);
|
||||
|
||||
this._super();
|
||||
|
@ -55,7 +55,7 @@ WidgetAreaEditorClass.prototype = {
|
||||
|
||||
// Ensure correct sort values are written when page is saved
|
||||
// TODO Adjust to new event listeners
|
||||
jQuery('#Form_EditForm').bind('ajaxsubmit', this.beforeSave.bind(this));
|
||||
jQuery('.cms-edit-form').bind('ajaxsubmit', this.beforeSave.bind(this));
|
||||
},
|
||||
|
||||
rewriteWidgetAreaAttributes: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user