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 @@
-- 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.