Skip to content
Browse files

MINOR Using '.cms-edit-form' instead of '#Form_EditForm' selector

  • Loading branch information...
1 parent 7b655d6 commit 4fe07e9b711c066e2477195959a0a9e65986ba6a @chillu chillu committed Mar 31, 2011
View
2 code/controller/AssetAdmin.php
@@ -285,7 +285,7 @@ function doUpload($data, $form) {
// 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;
View
11 code/controller/CMSMain.php
@@ -462,6 +462,11 @@ public function getEditForm($id = null) {
$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 @@ function RootForm() {
$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);
View
13 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
View
2 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() {
View
34 javascript/CMSMain.EditForm.js
@@ -4,23 +4,23 @@
(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'));
}
});
/**
- * 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
View
8 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');
View
8 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));
View
4 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,
View
2 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();
View
2 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() {

0 comments on commit 4fe07e9

Please sign in to comment.
Something went wrong with that request. Please try again.