From aa7bc239923a17dfafc006cbbb4314944681d013 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Fri, 18 May 2012 16:32:44 +1200 Subject: [PATCH 1/2] ENHANCEMENT: refactoring template "control" loops into "loop" and "with" to fit with the new template syntax --- templates/BreadcrumbsTemplate.ss | 4 ++-- templates/CMSPageHistoryController_versions.ss | 8 ++++---- templates/Includes/AssetAdmin_Content.ss | 12 ++++++------ templates/Includes/AssetAdmin_EditForm.ss | 8 ++++---- templates/Includes/CMSMain_EditForm.ss | 8 ++++---- templates/Includes/CMSPageAddController_Content.ss | 8 ++++---- templates/Includes/Install_deleteinstallfiles.ss | 4 ++-- templates/Includes/ReportAdmin_Content.ss | 8 ++++---- templates/ReportAdminForm.ss | 10 +++++----- templates/SSReportTableField_printable.ss | 12 ++++++------ 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/templates/BreadcrumbsTemplate.ss b/templates/BreadcrumbsTemplate.ss index d18be08c..b4314d31 100644 --- a/templates/BreadcrumbsTemplate.ss +++ b/templates/BreadcrumbsTemplate.ss @@ -1,5 +1,5 @@ <% if Pages %> - <% control Pages %> + <% loop Pages %> <% if Last %>$Title.XML<% else %>$MenuTitle.XML »<% end_if %> - <% end_control %> + <% end_loop %> <% end_if %> \ No newline at end of file diff --git a/templates/CMSPageHistoryController_versions.ss b/templates/CMSPageHistoryController_versions.ss index c6d9117c..b69f7935 100755 --- a/templates/CMSPageHistoryController_versions.ss +++ b/templates/CMSPageHistoryController_versions.ss @@ -9,15 +9,15 @@ - <% control Versions %> + <% loop Versions %> checked="checked"<% end_if %> /> - <% control LastEdited %> + <% with LastEdited %> $Nice - <% end_control %> + <% end_with %> <% if Author %>$Author.FirstName $Author.Surname.Initial<% else %><% _t('UNKNOWN','Unknown') %><% end_if %> <% if Published %><% if Publisher %>$Publisher.FirstName $Publisher.Surname.Initial<% else %><% _t('UNKNOWN','Unknown') %><% end_if %><% else %><% _t('NOTPUBLISHED','Not published') %><% end_if %> - <% end_control %> + <% end_loop %> \ No newline at end of file diff --git a/templates/Includes/AssetAdmin_Content.ss b/templates/Includes/AssetAdmin_Content.ss index efdb6aab..c4d6fb1b 100644 --- a/templates/Includes/AssetAdmin_Content.ss +++ b/templates/Includes/AssetAdmin_Content.ss @@ -2,27 +2,27 @@
- <% control EditForm %> + <% with EditForm %> <% include BackLink_Button %>

- <% control Controller %> + <% with Controller %> <% include CMSSectionIcon %> <% include CMSBreadcrumbs %> - <% end_control %> + <% end_with %>

<% if Fields.hasTabset %> <% with Fields.fieldByName('Root') %>
    - <% control Tabs %> + <% loop Tabs %> class="$extraClass"<% end_if %>>$Title - <% end_control %> + <% end_loop %>
<% end_with %> <% end_if %> - <% end_control %> + <% end_with %>
diff --git a/templates/Includes/AssetAdmin_EditForm.ss b/templates/Includes/AssetAdmin_EditForm.ss index e72225d4..7f4c0432 100644 --- a/templates/Includes/AssetAdmin_EditForm.ss +++ b/templates/Includes/AssetAdmin_EditForm.ss @@ -8,17 +8,17 @@
<% if Legend %>$Legend<% end_if %> - <% control Fields %> + <% loop Fields %> $FieldHolder - <% end_control %> + <% end_loop %>
<% if Actions %>
- <% control Actions %> + <% loop Actions %> $Field - <% end_control %> + <% end_loop %> <% if CurrentPage.LinkPreview %> <% _t('LeftAndMain.PreviewButton', 'Preview') %> » diff --git a/templates/Includes/CMSMain_EditForm.ss b/templates/Includes/CMSMain_EditForm.ss index bfebbe1f..0d6d7c2f 100644 --- a/templates/Includes/CMSMain_EditForm.ss +++ b/templates/Includes/CMSMain_EditForm.ss @@ -9,9 +9,9 @@
<% if Legend %>$Legend<% end_if %> - <% control Fields %> + <% loop Fields %> $FieldHolder - <% end_control %> + <% end_loop %>
@@ -19,9 +19,9 @@
<% if Actions %>
<% if Actions %>
- <% control Actions %> + <% loop Actions %> $Field - <% end_control %> + <% end_loop %>
<% end_if %>
diff --git a/templates/Includes/Install_deleteinstallfiles.ss b/templates/Includes/Install_deleteinstallfiles.ss index cd1a7574..60a57244 100644 --- a/templates/Includes/Install_deleteinstallfiles.ss +++ b/templates/Includes/Install_deleteinstallfiles.ss @@ -4,9 +4,9 @@

    - <% control UnsuccessfulFiles %> + <% loop UnsuccessfulFiles %>
  • $File
  • - <% end_control %> + <% end_loop %>
<% else %>

diff --git a/templates/Includes/ReportAdmin_Content.ss b/templates/Includes/ReportAdmin_Content.ss index f71516c3..04ff5800 100644 --- a/templates/Includes/ReportAdmin_Content.ss +++ b/templates/Includes/ReportAdmin_Content.ss @@ -2,16 +2,16 @@

- <% control EditForm %> + <% with EditForm %> <% include BackLink_Button %>

- <% control Controller %> + <% with Controller %> <% include CMSSectionIcon %> <% include CMSBreadcrumbs %> - <% end_control %> + <% end_with %>

- <% end_control %> + <% end_with %>
diff --git a/templates/ReportAdminForm.ss b/templates/ReportAdminForm.ss index 0466d91a..bc8e262b 100644 --- a/templates/ReportAdminForm.ss +++ b/templates/ReportAdminForm.ss @@ -13,11 +13,11 @@

<% _t('ReportAdminForm.FILTERBY', 'Filter by') %>

- <% control FieldMap.Filters %> - <% control Children %> + <% loop FieldMap.Filters %> + <% loop Children %> $FieldHolder - <% end_control %> - <% end_control %> + <% end_loop %> + <% end_loop %>
@@ -31,7 +31,7 @@ $FieldMap.ReportContent.FieldHolder - <% control HiddenFields %>$Field<% end_control %> + <% loop HiddenFields %>$Field<% end_loop %>
diff --git a/templates/SSReportTableField_printable.ss b/templates/SSReportTableField_printable.ss index 854fac0f..ca000527 100644 --- a/templates/SSReportTableField_printable.ss +++ b/templates/SSReportTableField_printable.ss @@ -8,19 +8,19 @@ <%-- --%> - <% control Form.Controller %> + <% with Form.Controller %>

$CurrentReport.Title

- <% control CurrentReport.getCmsFields %> + <% with CurrentReport.getCmsFields %> <% if Name == Filters %>

Filters

    - <% control FieldSet %> + <% loop FieldSet %>
  • $Title = $performReadonlyTransformation.Field
  • - <% end_control %> + <% end_loop %>
<% end_if %> - <% end_control %> - <% end_control %> + <% end_with %> + <% end_with %> <% include TableListField %> \ No newline at end of file From 7112032b4c0df1cbf21f1a0fb840de793464d43f Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Fri, 18 May 2012 16:33:34 +1200 Subject: [PATCH 2/2] BUGFIX: fixing the look of Settings tab in the CMS if it has multiple tabs --- code/controllers/CMSSettingsController.php | 9 ++--- .../Includes/CMSSettingsController_Content.ss | 34 ++++++++++++++++++- .../CMSSettingsController_EditForm.ss | 30 ++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 templates/Includes/CMSSettingsController_EditForm.ss diff --git a/code/controllers/CMSSettingsController.php b/code/controllers/CMSSettingsController.php index 028ecc6f..17e71749 100644 --- a/code/controllers/CMSSettingsController.php +++ b/code/controllers/CMSSettingsController.php @@ -1,5 +1,5 @@ getCMSActions(); $form = new Form($this, 'EditForm', $fields, $actions); $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 cms-panel-padded'); + + $form->addExtraClass('cms-edit-form cms-panel-padded center'); + if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet'); $form->setHTMLID('Form_EditForm'); $form->loadDataFrom($siteConfig); @@ -33,6 +33,7 @@ class CMSSettingsController extends CMSMain { return $form; } + /** * Save the current sites {@link SiteConfig} into the database * diff --git a/templates/Includes/CMSSettingsController_Content.ss b/templates/Includes/CMSSettingsController_Content.ss index 40443e04..cb9fd1b8 100644 --- a/templates/Includes/CMSSettingsController_Content.ss +++ b/templates/Includes/CMSSettingsController_Content.ss @@ -1 +1,33 @@ -$EditForm \ No newline at end of file +
\ No newline at end of file diff --git a/templates/Includes/CMSSettingsController_EditForm.ss b/templates/Includes/CMSSettingsController_EditForm.ss new file mode 100644 index 00000000..5c315fb4 --- /dev/null +++ b/templates/Includes/CMSSettingsController_EditForm.ss @@ -0,0 +1,30 @@ +
+ + <% if Message %> +

$Message

+ <% else %> + + <% end_if %> + +
+ <% if Legend %>$Legend<% end_if %> + <% loop Fields %> + $FieldHolder + <% end_loop %> +
+
+ + <% if Actions %> +
+ <% loop Actions %> + $Field + <% end_loop %> + <% if CurrentPage.LinkPreview %> + + <% _t('LeftAndMain.PreviewButton', 'Preview') %> » + + <% end_if %> +
+ <% end_if %> + +
\ No newline at end of file