From: Bryan Date: Fri, 27 Feb 2015 04:26:38 +0000 (-0500) Subject: Moving widgets out of an app to close #416 X-Git-Tag: release-20150325~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=47cd3a5eba3e44e0777e4c5c873d07b4cbaa9d7b;p=oweals%2Fkarmaworld.git Moving widgets out of an app to close #416 --- diff --git a/karmaworld/apps/notes/forms.py b/karmaworld/apps/notes/forms.py index a6a92f6..60c441e 100644 --- a/karmaworld/apps/notes/forms.py +++ b/karmaworld/apps/notes/forms.py @@ -5,7 +5,7 @@ from django.forms import ModelForm, IntegerField, HiddenInput, Form, CharField, from django.forms import TextInput from django_filepicker.widgets import FPFileWidget from django.template.loader import render_to_string -from wysihtml5.widgets import RichTextEditor +from karmaworld.utils.widgets import RichTextEditor from karmaworld.apps.notes.models import Note, NoteMarkdown diff --git a/karmaworld/apps/wysihtml5/widgets.py b/karmaworld/apps/wysihtml5/widgets.py deleted file mode 100644 index d96948c..0000000 --- a/karmaworld/apps/wysihtml5/widgets.py +++ /dev/null @@ -1,22 +0,0 @@ -from django import forms -from django.conf import settings -from django.utils.safestring import mark_safe -from django.template.loader import render_to_string - -class RichTextEditor(forms.Textarea): - def render(self, name, value, attrs=None): - return mark_safe(render_to_string("wysihtml5/widget.html", { - "name": name, - "value": value, - "attrs": attrs, - })) - - class Media: - css = {'all': (settings.STATIC_URL + "wysihtml5/toolbar.css",)} - js = ( - settings.STATIC_URL + "wysihtml5/wysihtml-0.4.17/dist/wysihtml5x-toolbar.min.js", - settings.STATIC_URL + "wysihtml5/wysihtml-0.4.17/parser_rules/advanced_and_extended.js", - settings.STATIC_URL + "wysihtml5/init.js", - ) - - diff --git a/karmaworld/utils/widgets.py b/karmaworld/utils/widgets.py new file mode 100644 index 0000000..d96948c --- /dev/null +++ b/karmaworld/utils/widgets.py @@ -0,0 +1,22 @@ +from django import forms +from django.conf import settings +from django.utils.safestring import mark_safe +from django.template.loader import render_to_string + +class RichTextEditor(forms.Textarea): + def render(self, name, value, attrs=None): + return mark_safe(render_to_string("wysihtml5/widget.html", { + "name": name, + "value": value, + "attrs": attrs, + })) + + class Media: + css = {'all': (settings.STATIC_URL + "wysihtml5/toolbar.css",)} + js = ( + settings.STATIC_URL + "wysihtml5/wysihtml-0.4.17/dist/wysihtml5x-toolbar.min.js", + settings.STATIC_URL + "wysihtml5/wysihtml-0.4.17/parser_rules/advanced_and_extended.js", + settings.STATIC_URL + "wysihtml5/init.js", + ) + +