Author: jmorliaguet
Date: Fri Jun  2 01:00:12 2006
New Revision: 3286

Modified:
   
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py

Log:

- simpler UI for selecting presets



Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt
==============================================================================
--- 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    (original)
+++ 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    Fri Jun  2 01:00:12 2006
@@ -38,49 +38,46 @@
   </ul>
 
   <div class="form">
-  <div style="padding: 0.5em; font-style: italic" tal:condition="format">
-    <form style="float:right" tal:condition="python: edited_type in 
preset_info"
+
+    <form style="float:right"
+          tal:define="preset_uri info/preset_uri"
+          tal:condition="python: format and edited_type in preset_info"
           tal:attributes="action string:${display/@@absolute_url}/@@usePreset">
-      <span>Use this preset
+      Use preset:
       <select name="uri">
-        <option tal:condition="not:preset"></option>
+        <option value=""></option>
         <option tal:repeat="preset preset_info/?edited_type"
-                tal:attributes="value preset/uri; selected python: 
info['preset_uri'] == preset['uri']">
+                tal:attributes="value preset/uri;
+                                selected python: preset_uri == preset['uri']">
           <tal:block content="preset/name" />
         </option>
       </select>
+      <input type="hidden" name="current_uri" tal:attributes="value 
preset_uri" />
       <input type="submit" value="OK" />
     </form>
-    <span tal:condition="preset">Warning: you are editing the '<tal:block 
content="preset/name" />' preset.
-       This will most likely affect other parts of the site.<br/>
-      <a style="font-weight: bold"
-         href="" tal:attributes="href 
string:${display/@@absolute_url}/@@stopUsingPreset?uri=${info/preset_uri}">Use 
a copy</a> of it.
-    </span>
-    <span tal:condition="not:preset">
-      Do you want to reuse these settings?
-    <a style="font-weight: bold" tal:attributes="href 
string:javascript:CPSSkins.getModelById('element-editor').updateData({form: 
{id: $id, tab: '${edited_type}', mode: 'create-preset'} })">create a preset</a>.
-    </span>
-  </div>
 
-  <tal:block condition="python: mode == 'edit'"
-             content="structure edited/@@edit.html" />
-  <fieldset class="panel" tal:condition="python: mode == 'preview'">
-    <legend class="panelTitle">Preview</legend>
-    <tal:block content="structure info/preview" />
-  </fieldset>
-  <div tal:condition="python: mode == 'create-preset' or preset">
-    <fieldset class="panel" tal:condition="not:preset">
+    <tal:block condition="python: mode == 'edit'"
+               content="structure edited/@@edit.html" />
+
+    <fieldset class="panel" tal:condition="python: mode == 'preview'">
+      <legend class="panelTitle">Preview
+        <tal:block content="preset/name" condition="preset" />
+      </legend>
+      <tal:block content="structure info/preview" />
+    </fieldset>
+
+    <fieldset class="panel" tal:condition="python: format and not preset">
       <legend class="panelTitle">Create a preset</legend>
+      <p><em>You can save these settings as a preset.</em></p>
       <form enctype="multipart/form-data" method="post"
-       tal:attributes="action string:${edited/@@absolute_url}/@@createPreset">
-        <p>
-        <label for="title">Title</label>
-        <input id="title" type="text" name="title" />
+            tal:attributes="action 
string:${edited/@@absolute_url}/@@createPreset">
+        <label for="title">Choose a title</label>
+        <input id="title" style="padding: 1px" type="text" name="title" />
         <input type="hidden" name="uri" tal:attributes="value info/uri" />
-        <input type="submit" name="UPDATE_SUBMIT"
-        i18n:translate="create-button" value="Create" />
-        </p>
+        <input type="submit" style="padding: 1px" name="UPDATE_SUBMIT"
+               i18n:translate="create-button" value="Save" />
       </form>
     </fieldset>
+
   </div>
 </tal:block>

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Fri Jun 
 2 01:00:12 2006
@@ -113,15 +113,17 @@
 
         resources.register(title=title, resource=resource, context=context)
 
-    def usePreset(self, uri=u''):
+    def usePreset(self, uri=u'', current_uri=u''):
         """Use a preset referred to by its URI
 
         The context is the display
 
         """
         context = self.context
+        if not uri and not current_uri:
+            raise ValueError("Must specify a URI to use or a URI to stop 
using")
         if not uri:
-            raise KeyError("Must specify a preset's URI.")
+            return self.stopUsingPreset(current_uri)
 
         if not IDisplay.providedBy(context):
             raise TypeError("The context must be a display.")
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to