Author: batiste.bieler
Date: Thu Feb 12 05:02:52 2009
New Revision: 339

Added:
    trunk/pages/templates/admin/pages/page/widgets/tinymce.html
Modified:
    trunk/pages/admin/widgets.py

Log:
Add the TinyMCE widget to the project. But without all the tiny MCE files

Modified: trunk/pages/admin/widgets.py
==============================================================================
--- trunk/pages/admin/widgets.py        (original)
+++ trunk/pages/admin/widgets.py        Thu Feb 12 05:02:52 2009
@@ -55,6 +55,29 @@
          return rendered + mark_safe(render_to_string(
              'admin/pages/page/widgets/richtextarea.html', context))

+class TinyMCE(Textarea):
+    class Media:
+        js = [join(PAGES_MEDIA_URL, path) for path in (
+            'tiny_mce/tiny_mce.js',
+        )]
+
+    def __init__(self, language=None, attrs=None):
+        self.language = language or settings.LANGUAGE_CODE[:2]
+        self.attrs = {'class': 'tinymce'}
+        if attrs:
+            self.attrs.update(attrs)
+        super(TinyMCE, self).__init__(attrs)
+
+    def render(self, name, value, attrs=None):
+        rendered = super(TinyMCE, 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/tinymce.html', context))
+
  class WYMEditor(Textarea):
      class Media:
          js = [join(PAGES_MEDIA_URL, path) for path in (

Added: trunk/pages/templates/admin/pages/page/widgets/tinymce.html
==============================================================================
--- (empty file)
+++ trunk/pages/templates/admin/pages/page/widgets/tinymce.html Thu Feb 12  
05:02:52 2009
@@ -0,0 +1,12 @@
+<script type="text/javascript">
+    tinyMCE.init({
+        mode : "exact",
+        elements : "id_{{name}}",
+        language: "{{ language }}",
+        width : "640px",
+        height: "400px",
+        theme : "advanced",
+        theme_advanced_toolbar_location : "top",
+        theme_advanced_toolbar_align : "left"
+    });
+</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