Commits

Scott Nixon committed 5a53bb2 Draft

Fixed editor with new Redactor.

  • Participants
  • Parent commits c855807

Comments (0)

Files changed (4)

File article/forms.py

 
 from django_cloudi.widgets import CloudImages
 from widgets import WYMEditor
+from tinymce.widgets import TinyMCE
 
 class PostAdminModelForm(forms.ModelForm):
-    #post_content = forms.CharField(widget=WYMEditor())
+    post_content = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
+    #post_content = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
+    #change_form_template = 'article/templates/admin_post_form.html'
 
     class Meta:
         model = get_model('article', 'post')
 
+    class Media:
+        js = (
+            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
+            '//photos.happyherbivore.com/admin/redactor/802/redactor.min.js',
+            '//photos.happyherbivore.com/admin/redactor/redactor_init.js',
+            )
+        css = {
+            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
+                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
+            }
+
 class RecipeAdminModelForm(forms.ModelForm):
-    #recipe_description = forms.CharField(widget=WYMEditor())
-    #recipe_instructions = forms.CharField(widget=WYMEditor())
+    recipe_description = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
+    recipe_instructions = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
     
     class Meta:
         model = get_model('article', 'recipe')   
 
+    class Media:
+        js = (
+            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
+            '//photos.happyherbivore.com/admin/redactor/802/redactor.min.js',
+            '//photos.happyherbivore.com/admin/redactor/redactor_init.js',
+            )
+        css = {
+            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
+                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
+            }
+
 class FlatPagesAdminModelForm(FlatpageForm):
-    #content = forms.CharField(widget=WYMEditor())
+    content = forms.CharField(widget=forms.Textarea(attrs={'class':'redactor','cols': 80, 'rows': 30}))
 
     class Meta:
         model = FlatPage
+        
+    class Media:
+        js = (
+            '//happyherb-photos.s3.amazonaws.com/admin/grappelli/jquery/jquery-1.6.2.min.js',
+            '//photos.happyherbivore.com/admin/redactor/802/redactor.min.js',
+            '//photos.happyherbivore.com/admin/redactor/redactor_init.js',
+            )
+        css = {
+            "all" : ('//photos.happyherbivore.com/admin/redactor/802/redactor.css',
+                '//photos.happyherbivore.com/admin/redactor/custom_redactor-v0.css')
+            }
 
 class RecipePhotosAdminForm(forms.ModelForm):
     url = forms.CharField(widget=CloudImages(attrs={'style':'width:400px;'}))    

File article/templates/post_detail.html

                 {% if post.post_tags %}<p class="meta">Category: {% for p in post.get_tag_list %}<a href="{% url category p %}">{{ p }}</a> {% endfor %}{% endif %}</p>
                 
                 <div class="content">
-                  {{ post.post_content|safe|linebreaks }}
+                  {{ post.post_content|safe }}
                 </div>
 
                 {% include  "_blog_recipe.html" %}

File article/templates/post_list.html

 {% extends "theme_base.html" %}
 
 {% block meta %}
-    <meta name="keywords" content="Vegan, Vegetarian, Recipes, low fat, Blog" />
+    <meta name="keywords" content="Vegan, Vegetarian, Recipes, low fat, Blog, Plant Based" />
     <meta name="description" content="I'm Lindsay S Nixon and Happy Herbivore is my recipe website, home to more than 130 fat-free and low fat vegan recipes! I cook with no added fats and mostly whole, unprocessed food. You won't find processed flour, refined sugars and gobs of oil or margarine in my recipes. What you will find, however, is food that is good for you and tastes great!" />
 
     <meta property="og:title" content="Blog Index | Happy Herbivore"/>
                 {% if post.post_tags %}<p class="meta">Category: {% for p in post.get_tag_list %}<a href="{% url category p %}">{{ p }}</a> {% endfor %}</p>{% endif %}
 
                 <div class="content">
-                  {{ post.post_content|safe|linebreaks }}
+                  {{ post.post_content|safe }}
                 </div>
 
                 {% include  "_blog_recipe.html" %}

File article/templates/recipe_detail.html

 	                <li class="ingredient">
 	                  <span class="value">
 	                    {% if r.ri_amount %}
-	                    {{ r.ri_amount|html_fraction|safe}}
+	                    {{ r.ri_amount|html_fraction|safe }}
 	                    {% endif %} 
 		                {{ r.ri_measurement.m_name }}
 	                  </span>