Changeset 21622

Show
Ignore:
Timestamp:
06/29/07 15:18:49 (1 year ago)
Author:
jmorliaguet
Message:

- made the style editor more "AJAX-like" (NXP-1283)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.theme/trunk/nuxeo-theme-jsf-editor-web/src/main/resources/nuxeo.war/nxthemes-jsf-editor/elementStyle.xhtml

    r21190 r21622  
    11<div xmlns="http://www.w3.org/1999/xhtml" 
    2        xmlns:nxthemes="http://nuxeo.org/nxthemes" 
    3        xmlns:f="http://java.sun.com/jsf/core" 
    4        xmlns:h="http://java.sun.com/jsf/html" 
    5        xmlns:c="http://java.sun.com/jstl/core" 
    6        xmlns:ui="http://java.sun.com/jsf/facelets"> 
     2  xmlns:nxthemes="http://nuxeo.org/nxthemes" 
     3  xmlns:f="http://java.sun.com/jsf/core" 
     4  xmlns:h="http://java.sun.com/jsf/html" 
     5  xmlns:c="http://java.sun.com/jstl/core" 
     6  xmlns:ui="http://java.sun.com/jsf/facelets"> 
     7 
    78  <c:choose> 
    89    <c:when test="${nxthemesUiManager.styleOfSelectedElement == null}"> 
    9       <form action="" class="nxthemesForm" onsubmit="NXThemesStyleEditor.createStyle(); return false;"> 
    10         <div>The element has no style. 
    11           <button>Create a style</button> 
     10      <form action="" class="nxthemesForm" 
     11        onsubmit="NXThemesStyleEditor.createStyle(); return false;"> 
     12        <div> 
     13          The element has no style. 
     14          <button> 
     15            Create a style 
     16          </button> 
    1217        </div> 
    1318      </form> 
    1419    </c:when> 
    1520    <c:otherwise> 
     21 
    1622      <style id="previewCss" type="text/css"></style> 
    1723 
    18       <div class="nxthemesButtonSelector" style="float: right; padding: 3px; margin-top: -40px"> 
    19         <span>Edit mode:</span> 
    20         <c:choose> 
    21           <c:when test="${nxthemesUiStates.styleEditMode == 'css'}"> 
    22             <a href="javascript:void(0)" onclick="NXThemesStyleEditor.setStyleEditMode('form', 'css')">form</a> 
    23             <a href="javascript:void(0)" class="selected">CSS</a> 
    24           </c:when> 
    25           <c:otherwise> 
    26             <a href="javascript:void(0)" class="selected">form</a> 
    27             <a href="javascript:void(0)" onclick="NXThemesStyleEditor.setStyleEditMode('css', 'form')">CSS</a> 
    28           </c:otherwise> 
    29         </c:choose> 
    30       </div> 
    31  
    32       <div class="nxthemesButtonSelector" style="text-align: left; padding: 4px 15px;"> 
     24      <div class="nxthemesButtonSelector" 
     25        style="text-align: left; padding: 4px 15px;"> 
    3326        <span>Layers: </span> 
    34         <ui:repeat value="#{nxthemesUiManager.styleLayersOfSelectedElement}" var="layer"> 
    35           <span><h:outputText escape="false" value="#{layer.rendered}"/></span> 
     27        <ui:repeat value="#{nxthemesUiManager.styleLayersOfSelectedElement}" 
     28          var="layer"> 
     29          <span><h:outputText escape="false" value="#{layer.rendered}" /> 
     30          </span> 
    3631        </ui:repeat> 
    3732      </div> 
     
    4136          <td style="width: 50%; vertical-align: top"> 
    4237            <fieldset class="nxthemesEditor"> 
    43               <legend>Preview</legend> 
     38              <legend> 
     39                Preview 
     40              </legend> 
    4441 
    45               <div id="stylePreviewArea" element="#{nxthemesUiStates.selectedElement.uid}"> 
    46                 <img src="/nuxeo/nxthemes-jsf-editor/img/progressbar.gif" alt="" width="220" height="19" 
    47                          style="padding: 5px; border: 1px solid #ccc; background-color: #fff" /> 
    48                 <nxthemes:view resource="style-preview.json"/> 
     42              <div id="stylePreviewArea" 
     43                element="#{nxthemesUiStates.selectedElement.uid}"> 
     44                <img src="/nuxeo/nxthemes-jsf-editor/img/progressbar.gif" alt="" 
     45                  width="220" height="19" 
     46                  style="padding: 5px; border: 1px solid #ccc; background-color: #fff" /> 
     47                <nxthemes:view resource="style-preview.json" /> 
    4948              </div> 
    5049            </fieldset> 
    51             <div id="labelInfo" style="display:none"/> 
     50            <div id="labelInfo" style="display:none" /> 
    5251 
    5352          </td> 
    5453          <td style="width: 50%; vertical-align: top"> 
    5554 
    56             <fieldset class="nxthemesEditor"> 
    57               <legend>Properties</legend> 
     55            <!--  Style properties form --> 
     56            <nxthemes:panel identifier="style properties" 
     57              url="/nuxeo/nxthemes-jsf-editor/styleProperties.faces" 
     58              controlledBy="style editor perspectives,style editor actions,element form actions" 
     59              visibleInPerspectives="style properties,style picker" /> 
    5860 
    59               <c:choose> 
    60                 <!-- Inline CSS editing --> 
    61                 <c:when test="${nxthemesUiStates.styleEditMode == 'css'}"> 
    62                   <form id="nxthemesElementStyleCSS" class="nxthemesForm" action="" onsubmit="return false"> 
    63                     <div> 
    64                       <textarea name="cssSource" rows="15" cols="72" 
    65                        style="width: 100%; height: 250px; font-size: 11px;">#{nxthemesUiManager.renderedElementStyleProperties}</textarea> 
    66                       <input type="hidden" name="id" value="#{nxthemesUiStates.selectedElement.uid}"/> 
    67                       <input type="hidden" name="viewName" value="#{nxthemesUiManager.currentViewName}"/> 
    68                     </div> 
    69                     <div style="padding-top: 10px"> 
    70                       <button type="submit">Save</button> 
    71                     </div> 
    72                   </form> 
    73                 </c:when> 
    74                 <!-- Edit form --> 
    75                 <c:otherwise> 
    76                   <form id="nxthemesElementStyle" class="nxthemesForm" action="" onsubmit="return false"> 
    77                     <p style="margin-bottom: 10px;"> 
    78                       <label>Selector</label> 
    79                       <h:selectOneMenu id="viewName" onchange="NXThemesStyleEditor.chooseStyleSelector(this)" value="#{nxthemesUiStates.currentStyleSelector}"> 
    80                         <f:selectItems value="#{nxthemesUiManager.availableStyleSelectorsForSelectedElement}"/> 
    81                       </h:selectOneMenu> 
    82                       <input type="hidden" name="id" value="#{nxthemesUiStates.selectedElement.uid}"/> 
    83                       <input type="hidden" name="path" value="#{nxthemesUiStates.currentStyleSelector}"/> 
    84                       <input type="hidden" name="viewName" value="#{nxthemesUiManager.currentViewName}"/> 
    85                     </p> 
     61            <!--  Style picker --> 
     62            <nxthemes:panel identifier="style picker" 
     63              url="/nuxeo/nxthemes-jsf-editor/stylePicker.faces" 
     64              controlledBy="style editor perspectives,toolbox mover" 
     65              visibleInPerspectives="style picker" /> 
    8666 
    87                     <c:choose> 
    88                       <c:when test="${nxthemesUiStates.currentStyleSelector != null}"> 
    89                       <div class="nxthemesButtonSelector" style="padding: 3px"> 
    90                         <span>categories: </span> 
    91                          <ui:repeat value="#{nxthemesUiManager.styleCategories}" var="category"> 
    92                           <h:outputText escape="false" value="#{category.rendered}"/> 
    93                         </ui:repeat> 
    94                        </div> 
    95                        </c:when> 
    96                     </c:choose> 
    97  
    98                     <c:choose> 
    99                       <c:when test="${!empty nxthemesUiManager.elementStyleProperties}"> 
    100                         <div style="height: 220px; margin-top: 5px; margin-bottom: 15px; overflow-y: scroll; overflow-x: hidden"> 
    101                           <ui:repeat value="#{nxthemesUiManager.elementStyleProperties}" var="property"> 
    102                             <p> 
    103                               <h:outputText escape="false" value="#{property.rendered}"/> 
    104                             </p> 
    105                           </ui:repeat> 
    106                         </div> 
    107                       <button type="submit">Save</button> 
    108                       </c:when> 
    109                     </c:choose> 
    110                   </form> 
    111                 </c:otherwise> 
    112               </c:choose> 
    113             </fieldset> 
    114  
    115           </td> 
    116           <td style="vertical-align: top"> 
    117             <!--  Style picker --> 
    118             <nxthemes:panel 
    119               identifier="style picker" 
    120               url="/nuxeo/nxthemes-jsf-editor/stylePicker.faces" 
    121               controlledBy="style editor perspectives" 
    122               visibleInPerspectives="style picker" /> 
    12367          </td> 
    12468        </tr> 
  • org.nuxeo.theme/trunk/nuxeo-theme-jsf-editor-web/src/main/resources/nuxeo.war/nxthemes-jsf-editor/stylePicker.xhtml

    r20311 r21622  
    33  xmlns:f="http://java.sun.com/jsf/core" 
    44  xmlns:ui="http://java.sun.com/jsf/facelets" 
    5   class="nxthemesToolbox"
     5  class="nxthemesToolbox"  id="nxthemesStylePicker"
    66 
    7 <fieldset class="nxthemesEditor"> 
    8   <legend>Style picker</legend> 
     7<div class="title"> 
     8<img class="close" onclick="javascript:NXThemesStyleEditor.closeStylePicker()" 
     9     src="/nuxeo/nxthemes-jsf-editor/img/close-button.png" width="14" height="14" alt="" /> 
     10Presets - #{nxthemesUiStates.styleCategory}</div> 
    911 
    1012  <div class="header">PRESETS: 
     
    2729  </div> 
    2830 
    29 </fieldset> 
    30  
    3131</div> 
  • org.nuxeo.theme/trunk/nuxeo-theme-jsf-editor/src/main/resources/nxthemes/jsf/editor/scripts/style-editor.js

    r21000 r21622  
    2222 
    2323NXThemesStyleEditor.closeStylePicker = function() { 
    24     NXThemes.getControllerById('style editor perspectives').switchTo('default'); 
     24    NXThemes.getControllerById('style editor perspectives').switchTo('style properties'); 
    2525}; 
    2626 
     
    6363NXThemesStyleEditor.setStyleSelector = function(selector) { 
    6464    Seam.Component.getInstance("nxthemesEditorAction").setCurrentStyleSelector( 
    65        selector, NXThemesStyleEditor.refreshEditor); 
     65       selector, function(r) { 
     66         NXThemes.getControllerById("style editor perspectives").switchTo("style properties"); 
     67         NXThemes.getViewById("style properties").refresh(); 
     68       }) 
    6669}; 
    6770 
     
    139142NXThemesStyleEditor.setCurrentStyleLayer = function(uid) { 
    140143    Seam.Component.getInstance("nxthemesEditorAction").setCurrentStyleLayer(uid, 
    141         NXThemesStyleEditor.refreshEditor); 
     144        function() { 
     145          NXThemes.getControllerById('style editor perspectives').switchTo('default'); 
     146          NXThemes.getViewById("element style").refresh(); 
     147        }); 
    142148}; 
    143149 
     
    158164    } 
    159165    Seam.Component.getInstance("nxthemesEditorAction").setStyleEditMode(mode, 
    160         NXThemesStyleEditor.refreshEditor); 
     166        function(r) { 
     167          NXThemes.getViewById("style properties").refresh(); 
     168        }); 
    161169}; 
    162170 
    163171NXThemesStyleEditor.setStylePropertyCategory = function(category) { 
    164172    Seam.Component.getInstance("nxthemesEditorAction").setStylePropertyCategory(category, 
    165         NXThemesStyleEditor.refreshEditor); 
     173        function(r) { 
     174          NXThemes.getViewById("style properties").refresh(); 
     175        }); 
    166176}; 
    167177 
  • org.nuxeo.theme/trunk/nuxeo-theme-jsf-editor/src/main/resources/nxthemes/jsf/editor/styles/authoring.css

    r21459 r21622  
    694694  border: none; 
    695695  width: 16px; 
    696   background: #fff url(/nuxeo/nxthemes-jsf-editor/img/style-picker.png) no-repeat; 
     696  background: transparent url(/nuxeo/nxthemes-jsf-editor/img/style-picker.png) no-repeat; 
    697697} 
    698698 
     
    10441044} 
    10451045 
     1046#nxthemesStylePicker { 
     1047  position: absolute; 
     1048  z-index: 50; 
     1049  right: 10px; 
     1050  top: 120px; 
     1051  background-color: #fff; 
     1052  border: 1px solid #000; 
     1053} 
     1054 
    10461055#nxthemesFragmentFactory { 
    10471056  position: absolute;