Author: leidel
Date: Sun Dec  7 15:23:59 2008
New Revision: 269

Added:
    trunk/pages/templates/admin/pages/page/widgets/richtextarea.html
Modified:
    trunk/example/templates/index.html
    trunk/pages/admin/__init__.py
    trunk/pages/admin/widgets.py
    trunk/pages/templates/admin/pages/page/change_form.html

Log:
Moved RichTextarea to its own template and added delete permission admin  
view.


Modified: trunk/example/templates/index.html
==============================================================================
--- trunk/example/templates/index.html  (original)
+++ trunk/example/templates/index.html  Sun Dec  7 15:23:59 2008
@@ -95,7 +95,7 @@

  <h2>Content</h2>

-{% placeholder right-column parsed as right_column %}
+{% placeholder right-column with RichTextarea parsed as right_column %}

  {% block content %}
      <div style="float:right;width:25%">

Modified: trunk/pages/admin/__init__.py
==============================================================================
--- trunk/pages/admin/__init__.py       (original)
+++ trunk/pages/admin/__init__.py       Sun Dec  7 15:23:59 2008
@@ -192,7 +192,7 @@
          for placeholder in get_placeholders(request, template):
              widget = self.get_widget(request, placeholder.widget)()
              if placeholder.parsed:
-                help_text = _('Note: This field is evaluated as template  
code, within the current context.')
+                help_text = _('Note: This field is evaluated as template  
code.')
              else:
                  help_text = ""
              name = placeholder.name
@@ -246,6 +246,15 @@
          if settings.PAGE_PERMISSION and obj is not None:
              return obj.has_page_permission(request)
          return super(PageAdmin, self).has_change_permission(request, obj)
+
+    def has_delete_permission(self, request, obj=None):
+        """
+        Return true if the current user has permission on the page.
+        Return the string 'All' if the user has all rights.
+        """
+        if settings.PAGE_PERMISSION and obj is not None:
+            return obj.has_page_permission(request)
+        return super(PageAdmin, self).has_delete_permission(request, obj)

      def list_pages(self, request, template_name=None, extra_context=None):
          """

Modified: trunk/pages/admin/widgets.py
==============================================================================
--- trunk/pages/admin/widgets.py        (original)
+++ trunk/pages/admin/widgets.py        Sun Dec  7 15:23:59 2008
@@ -32,9 +32,28 @@
                  'admin/pages/page/widgets/autocompletetaginput.html',  
context))

  class RichTextarea(Textarea):
+    class Media:
+        js = [join(PAGES_MEDIA_URL, path) for path in (
+            'javascript/jquery.js',
+        )]
+        css = {
+            'all': [join(PAGES_MEDIA_URL, path) for path in (
+                'css/rte.css',
+            )]
+        }
+
      def __init__(self, attrs=None):
          attrs = {'class': 'rte'}
          super(RichTextarea, self).__init__(attrs)
+
+    def render(self, name, value, attrs=None):
+        rendered = super(RichTextarea, self).render(name, value, attrs)
+        context = {
+            'name': name,
+            'PAGES_MEDIA_URL': PAGES_MEDIA_URL,
+        }
+        return rendered + mark_safe(render_to_string(
+            'admin/pages/page/widgets/richtextarea.html', context))

  class WYMEditor(Textarea):
      class Media:

Modified: trunk/pages/templates/admin/pages/page/change_form.html
==============================================================================
--- trunk/pages/templates/admin/pages/page/change_form.html     (original)
+++ trunk/pages/templates/admin/pages/page/change_form.html     Sun Dec  7  
15:23:59 2008
@@ -15,7 +15,6 @@
  {% block object-tools %}
  {% if change %}{% if not is_popup %}
    <ul class="object-tools">
-  <!--<li><a href="history/" class="historylink">{%  
trans "History" %}</a></li>-->
    {% if has_absolute_url %}<li><a href="{{ page.get_absolute_url }}"  
class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
    </ul>
  {% endif %}{% endif %}
@@ -43,24 +42,10 @@
  </div>
  {% endif %}

-
-<div class="submit-row" style="overflow:hidden">
-<input type="submit" value="{% trans "Save" %}" class="default" />
-<p class="deletelink-box"><a href="delete/" class="deletelink">{%  
trans "Delete" %}</a></p>
-<input type="submit" value="{% trans "Save and continue editing" %}"  
name="_continue" />
-</div>
-<script type="text/javascript">
-    if(window.$) {
-        $(document).ready(function() {
-            if($.fn.rte)
-                $('.rte').rte('{{ PAGES_MEDIA_URL }}/css/rte.css', '{{  
PAGES_MEDIA_URL }}/images/');
-        });
-    }
-</script>
-
+{% submit_row %}
  </div>
  </form>

  <br class="clear" />
  <!-- END Content -->
-{% endblock %}
\ No newline at end of file
+{% endblock %}

Added: trunk/pages/templates/admin/pages/page/widgets/richtextarea.html
==============================================================================
--- (empty file)
+++ trunk/pages/templates/admin/pages/page/widgets/richtextarea.html    Sun  
Dec  7 15:23:59 2008
@@ -0,0 +1,8 @@
+<script type="text/javascript">
+    if(window.$) {
+        $(document).ready(function() {
+            if($.fn.rte)
+                $('#id_{{ name }}').rte('{{ PAGES_MEDIA_URL  
}}/css/rte.css', '{{ PAGES_MEDIA_URL }}/images/');
+        });
+    }
+</script>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to