diff --git a/code/controller/AssetAdmin.php b/code/controller/AssetAdmin.php index f1032cb3..b41cde8f 100755 --- a/code/controller/AssetAdmin.php +++ b/code/controller/AssetAdmin.php @@ -285,7 +285,7 @@ JS // echo << // 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}"); // // HTML; diff --git a/code/controller/CMSMain.php b/code/controller/CMSMain.php index e20c5042..c02bdfdd 100755 --- a/code/controller/CMSMain.php +++ b/code/controller/CMSMain.php @@ -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); diff --git a/config.rb b/config.rb new file mode 100644 index 00000000..7c4436f4 --- /dev/null +++ b/config.rb @@ -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 diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 153af8d1..7e1cd83d 100755 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -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() { diff --git a/javascript/CMSMain.EditForm.js b/javascript/CMSMain.EditForm.js index 2b225b6d..06c0c570 100644 --- a/javascript/CMSMain.EditForm.js +++ b/javascript/CMSMain.EditForm.js @@ -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 diff --git a/javascript/CMSMain.js b/javascript/CMSMain.js index f809cb0a..f11f82c1 100644 --- a/javascript/CMSMain.js +++ b/javascript/CMSMain.js @@ -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'); diff --git a/javascript/CMSPagesController.Tree.js b/javascript/CMSPagesController.Tree.js new file mode 100644 index 00000000..a2d91853 --- /dev/null +++ b/javascript/CMSPagesController.Tree.js @@ -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)); \ No newline at end of file diff --git a/javascript/CommentTableField.js b/javascript/CommentTableField.js index 3a5215cf..128cd237 100644 --- a/javascript/CommentTableField.js +++ b/javascript/CommentTableField.js @@ -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, diff --git a/javascript/ReportAdmin.Tree.js b/javascript/ReportAdmin.Tree.js index 3655b641..68457361 100755 --- a/javascript/ReportAdmin.Tree.js +++ b/javascript/ReportAdmin.Tree.js @@ -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(); diff --git a/javascript/WidgetAreaEditor.js b/javascript/WidgetAreaEditor.js index c37b06b3..65d3d40e 100644 --- a/javascript/WidgetAreaEditor.js +++ b/javascript/WidgetAreaEditor.js @@ -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() {