diff --git a/src/plone/app/theming/browser/mapper.pt b/src/plone/app/theming/browser/mapper.pt index 62413df0..b05211c5 100644 --- a/src/plone/app/theming/browser/mapper.pt +++ b/src/plone/app/theming/browser/mapper.pt @@ -135,6 +135,16 @@ $(".ie-warning").show(); } + // Help and preview + $("#preview").click(function() { + window.open($(this).attr("data-href"), "preview"); + return false; + }); + + $("#helpButtonForm").prepOverlay({ + subtype: 'iframe' + }); + // Rule builder and highlighters var ruleBuilder = null; @@ -147,18 +157,21 @@ onBeforeClose: function() { if(ruleBuilder.active && $("#new-rule-step-2").is(":visible")) { ruleBuilder.end(); - rulesEditor.focus(); + if(rulesEditor !== null) + rulesEditor.focus(); } } }); var ruleBuilderOverlay = $("#new-rule").data('overlay'); - var rulesEditor = new SourceEditor('editor', extensionModes.html, $("#file-contents").text(), !EDITABLE, - function() { - dirties['rules.xml'] = true; - $("#rules-editor .dirtyMarker").show(); - } - ); + if($("#file-contents").length > 0) { + rulesEditor = new SourceEditor('editor', extensionModes.html, $("#file-contents").text(), !EDITABLE, + function() { + dirties['rules.xml'] = true; + $("#rules-editor .dirtyMarker").show(); + } + ); + } themeFrameHighlighter = new FrameHighlighter("#theme-frame", function(highlighter, node) { // onselect @@ -383,20 +396,10 @@ return false; }); - // Enable/disable highlighter - - $(".highlighterToggle").click(function(event) { - event.preventDefault(); - $(this).toggleClass("highlighterDisabled"); - return false; - }); - // Rules editor (function() { - $("#rules-help").overlay(); - $("#rules-save").click(function() { var data = rulesEditor.getValue(); @@ -420,13 +423,11 @@ if($("#editor").css('height') == FULLSCREEN_HEIGHT) { $("#theme-content-row").show(); $("#page-intro").show(); - $("#new-rule").show(); $("#editor").css('height', WINDOWED_HEIGHT); rulesEditor.resize(); } else { $("#theme-content-row").hide(); $("#page-intro").hide(); - $("#new-rule").hide(); $("#editor").css('height', FULLSCREEN_HEIGHT); rulesEditor.resize(); } @@ -480,8 +481,17 @@ } }); - $("#theme-panel .highlighterToggle").click(function() { - themeFrameHighlighter.enabled = ! themeFrameHighlighter.enabled; + $("#theme-inspector-on").click(function() { + themeFrameHighlighter.enabled = true; + $("#theme-inspector-on").attr('disabled', 'disabled'); + $("#theme-inspector-off").removeAttr('disabled'); + $("#theme-footer-help").show(); + }); + $("#theme-inspector-off").click(function() { + themeFrameHighlighter.enabled = false; + $("#theme-inspector-off").attr('disabled', 'disabled'); + $("#theme-inspector-on").removeAttr('disabled'); + $("#theme-footer-help").hide(); }); $("#theme-panel .fullscreen").click(function(event) { @@ -548,8 +558,17 @@ } }); - $("#content-panel .highlighterToggle").click(function() { - contentFrameHighlighter.enabled = ! contentFrameHighlighter.enabled; + $("#content-inspector-on").click(function() { + contentFrameHighlighter.enabled = true; + $("#content-inspector-on").attr('disabled', 'disabled'); + $("#content-inspector-off").removeAttr('disabled'); + $("#content-footer-help").show(); + }); + $("#content-inspector-off").click(function() { + contentFrameHighlighter.enabled = false; + $("#content-inspector-off").attr('disabled', 'disabled'); + $("#content-inspector-on").removeAttr('disabled'); + $("#content-footer-help").hide(); }); $("#content-panel .fullscreen").click(function(event) { @@ -595,21 +614,24 @@ (function() { var canon = require('pilot/canon'); - canon.addCommand({ - name: 'saveEditor', - bindKey: { - mac: 'Command-S', - win: 'Ctrl+S', - sender: 'editor' - }, - exec: function(env, args, request) { - if($(env.editor.container).is("#theme-source")) { - $("#theme-save").click(); - } else if($(env.editor.container).is("#editor")) { - $("#rules-save").click(); + + if(rulesEditor !== null) { + canon.addCommand({ + name: 'saveEditor', + bindKey: { + mac: 'Command-S', + win: 'Ctrl+S', + sender: 'editor' + }, + exec: function(env, args, request) { + if($(env.editor.container).is("#theme-source")) { + $("#theme-save").click(); + } else if($(env.editor.container).is("#editor")) { + $("#rules-save").click(); + } } - } - }); + }); + } canon.addCommand({ name: 'newRule', @@ -631,7 +653,7 @@ sender: 'editor' }, exec: function(env, args, request) { - $("#rules-help").click(); + $("#helpButtonForm").submit(); } }); @@ -648,7 +670,7 @@ -
+
Portal status message @@ -669,7 +691,9 @@

Map rules for - name

+ name + (read-only) + - Below you will find four panels: The raw theme, which you can - edit from the - Manage theme files - tab; the unthemed content, i.e. Plone; the rules file, which - you can modify; and a preview of the theme being applied to - the content using these rules. Use the New rule - button to build new theming rules using an interactive wizard. + Use the rules editor at the bottom of this screen to edit theme + rules. Hover over elements in the HTML mockup or + Unthemed content panels to discover theme + selectors. Click New rule to + create and insert rules using a point-and-click wizard.

- Below you will find four panels: The raw theme; the unthemed - content, i.e. Plone; the rules file; and a preview of the theme - being applied to the content using these rules. Use the - New rule button to build new theming rules - using an interactive wizard. Changes made to the theme or rules - on the filesystem are reflected immediately after the page - is reloaded so long as Zope is running development mode. -

- -

- Hover over an element in the "HTML mockup" or "Unthemed content" - panel to see its selector in the status bar at the bottom - of the panel. If you wish to navigate the theme or content by clicking links, - you can disable the element selector using the toggle icon above the panel. + Hover over elements in the HTML mockup or + Unthemed content panels to discover theme + selectors. Click New rule to + create rules using a point-and-click wizard, which you can copy + into a rules.xml file on the filesystem.

+
+ + + + + +
+ +
+ +
+
@@ -751,19 +786,7 @@
- -   -    
@@ -782,8 +805,31 @@
-
- Left-click or press Enter to save. Press Esc to select parent. + + + +
@@ -791,7 +837,6 @@
  -    
@@ -810,14 +855,24 @@
-
- Left-click or press Enter to save. Press Esc to select parent. + + + +
-
+
@@ -830,15 +885,6 @@ i18n:attributes="title" i18n:translate="" >Save -   diff --git a/src/plone/app/theming/browser/resources/mapper.css b/src/plone/app/theming/browser/resources/mapper.css index e928d087..79f6b77b 100644 --- a/src/plone/app/theming/browser/resources/mapper.css +++ b/src/plone/app/theming/browser/resources/mapper.css @@ -8,6 +8,22 @@ display: none; } +/* Buttons */ +#themeMapper button, +#themeMapper input.context, +#themeMapper input.standalone { + padding: 4px; + margin: 3px 6px 3px 0; +} + +#helpButtonForm { + display: inline; +} + +.globalToolbar { + margin: 1em 0; +} + /* Panels */ #content #editor, @@ -54,12 +70,28 @@ font-weight: normal; } +.inspector-switch { + float: right; +} + +.panel-footer label { + vertical-align: middle; +} + +.footer-help { + margin-top: 7px; +} + #file-selector, .save-button { margin-right: 5px; vertical-align: middle !important; } +#theme-panel, #content-panel { + height: 390px; +} + /* Dividing lines */ #theme-panel { @@ -107,7 +139,7 @@ a.sourceToggle { line-height: 12px; padding: 0 0 0 20px; margin: 5px 0 0 5px; - background-image: url('./preview.png'); + background-image: url('./source.png'); background-repeat: no-repeat; text-decoration: none; border-bottom: none !important; @@ -116,7 +148,7 @@ a.sourceToggle { content: none; } a.sourceActive { - background-image: url('./source.png'); + background-image: url('./preview.png'); } a.highlighterToggle {