Author: antoni.aloy
Date: Wed Jun 17 14:56:19 2009
New Revision: 570

Added:
    trunk/example/templates/pages/editor.html
    trunk/pages/templates/admin/pages/page/widgets/editarea.html
Modified:
    trunk/   (props changed)
    trunk/example/settings.py
    trunk/example/templates/pages/index.html
    trunk/pages/admin/widgets.py

Log:
Added edit area widget to allow html code edition


Modified: trunk/example/settings.py
==============================================================================
--- trunk/example/settings.py   (original)
+++ trunk/example/settings.py   Wed Jun 17 14:56:19 2009
@@ -136,6 +136,7 @@
  PAGE_TEMPLATES = (
      ('pages/nice.html', 'nice one'),
      ('pages/cool.html', 'cool one'),
+    ('pages/editor.html', 'raw editor'),
  )

  try:

Added: trunk/example/templates/pages/editor.html
==============================================================================
--- (empty file)
+++ trunk/example/templates/pages/editor.html   Wed Jun 17 14:56:19 2009
@@ -0,0 +1,14 @@
+{% extends "pages/index.html" %}
+{% load pages_tags %}
+
+{% block title %}Cool template{% endblock %}
+
+{% block content %}{{ block.super }}
+<div style="width:70%">
+    <div>HTML Content editor
+        <div id="fancy-content" class="placeholder">
+            {% placeholder html-content with EditArea parsed %}
+        </div>
+    </div>
+</div>
+{% endblock %}

Modified: trunk/example/templates/pages/index.html
==============================================================================
--- trunk/example/templates/pages/index.html    (original)
+++ trunk/example/templates/pages/index.html    Wed Jun 17 14:56:19 2009
@@ -101,9 +101,8 @@
  <p>Test show_content and get_content template tag : {% show_content  
current_page.slug "slug" %} {% get_content current_page.slug "slug" as  
content %}</p>
  {% endif %}

-{% placeholder right-column with RichTextarea parsed as right_column %}
-
  {% block content %}
+    {% placeholder right-column with RichTextarea parsed as right_column %}
      <div style="float:right;width:25%">
      <h3>Right column placeholder</h3>
      <div class="right_column">{{ right_column }}</div>

Modified: trunk/pages/admin/widgets.py
==============================================================================
--- trunk/pages/admin/widgets.py        (original)
+++ trunk/pages/admin/widgets.py        Wed Jun 17 14:56:19 2009
@@ -150,3 +150,28 @@
          }
          return rendered + mark_safe(render_to_string(
              'admin/pages/page/widgets/markituphtml.html', context))
+
+class EditArea(Textarea):
+    "EditArea is a html syntax coloured widget"
+    class Media:
+        js = [join(PAGES_MEDIA_URL, path) for path in (
+            'edit_area/edit_area_full.js',
+        )]
+
+
+    def __init__(self, language=None, attrs=None):
+        self.language = language or settings.LANGUAGE_CODE[:2]
+        self.attrs = {'class': 'editarea',}
+        if attrs:
+            self.attrs.update(attrs)
+        super(EditArea, self).__init__(attrs)
+
+    def render(self, name, value, attrs=None):
+        rendered = super(EditArea, self).render(name, value, attrs)
+        context = {
+            'name': name,
+            'language': self.language,
+            'PAGES_MEDIA_URL': PAGES_MEDIA_URL,
+        }
+        return rendered + mark_safe(render_to_string(
+            'admin/pages/page/widgets/editarea.html', context))

Added: trunk/pages/templates/admin/pages/page/widgets/editarea.html
==============================================================================
--- (empty file)
+++ trunk/pages/templates/admin/pages/page/widgets/editarea.html        Wed Jun 
17  
14:56:19 2009
@@ -0,0 +1,12 @@
+<script type="text/javascript">
+editAreaLoader.init({
+       id : "id_{{ name }}"            // textarea id
+       ,syntax: "html"                 // syntax to be uses for highgliting
+       ,start_highlight: true          // to display with highlight mode on 
start-up
+    ,font_family: "verdana, monospace"
+    ,allow_resize: "n"
+    ,min_width:  800
+    ,min_height: 300
+    ,toolbar: "search, go_to_line, |, undo, redo, |, select_font,|,  
change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
+});
+</script>
\ No newline at end of file

--~--~---------~--~----~------------~-------~--~----~
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