Author: jmorliaguet Date: Sat May 13 12:18:46 2006 New Revision: 3115 Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.js cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.pt
Log: - cosmetic - we display element labels in the style editor Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.js ============================================================================== --- cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.js (original) +++ cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.js Sat May 13 12:18:46 2006 @@ -1,15 +1,21 @@ CPSSkins.addActions({ - 'selectTag': function(info) { - var target = info.target; - target.style.backgroundColor = '#ffc'; - var style_id = CPSSkins.getModelById('element-editor').getData().form.format; - var selector = getSelectorInContext(target, $('previewArea'), style_id); - - CPSSkins.getModelById('style-editor').updateData({'selector': selector, 'style_id': style_id}); - }, + 'selectTag': function(info) { + var target = info.target; + var saved_bg = target.saved_bg; + if (saved_bg) target.style.backgroundColor = saved_bg; + var style_id = CPSSkins.getModelById('element-editor').getData().form.format; + var selector = getSelectorInContext(target, $('previewArea'), style_id); + + CPSSkins.getModelById('style-editor').updateData({'selector': selector, 'style_id': style_id}); + }, + + 'updateLabel': function(info) { + var label = info.target.getAttribute("label"); + $('labelInfo').innerHTML = label || ' '; + } - }); +}); function getSelectorInContext(element, context, style_id) { var i, node, tag, name, selector, classnames; @@ -36,4 +42,5 @@ selectors.reverse(); selectors.shift(); return selectors.join(" "); - } +} + Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.pt ============================================================================== --- cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.pt (original) +++ cpsskins/branches/paris-sprint-2006/standard/filters/style/style_editor.pt Sat May 13 12:18:46 2006 @@ -5,19 +5,20 @@ widget display/formattable:widget; widget_types widget/types"> - <ins class="model" tal:content="python: view.getModelDef()" /> + <ins class="model" tal:content="view/getModelDef" /> <ins class="controller"> {"id": "style-editor-behaviour", "type": "behaviour", "rules": { "#previewArea": { - "click": "selectTag" + "click": "selectTag", + "mouseover": "updateLabel" } }} </ins> - <div class="inlineTabs"> + <div class="inlineTabs" style="margin-bottom: 0.3em"> <a i18n:translate="" tal:repeat="type widget_types" tal:content="string:widget.$type" @@ -27,13 +28,14 @@ <table width="100%"> <tr> <td width="50%" valign="top"> - <div id="previewArea"> - <ins class="view" tal:content="python: view.getPreviewDef()" /> + <div id="labelInfo"> </div> + <div id="previewArea" style="cursor: pointer"> + <ins class="view" tal:content="view/getPreviewDef" /> </div> </td> <td width="5%"></td> <td width="45%" valign="top"> - <ins class="view" tal:content="python: view.getFormDef()" /> + <ins class="view" tal:content="view/getFormDef" /> </td> </tr> </table> -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins