diff --git a/.idea/dictionaries/vabene1111.xml b/.idea/dictionaries/vabene1111.xml index a0d84d941..aff56db5f 100644 --- a/.idea/dictionaries/vabene1111.xml +++ b/.idea/dictionaries/vabene1111.xml @@ -2,6 +2,7 @@ dropbox + emoji \ No newline at end of file diff --git a/cookbook/forms.py b/cookbook/forms.py index ee7a1c5b1..ebd7f017a 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -1,6 +1,17 @@ from django.utils.translation import gettext as _ from django import forms from .models import * +from django.forms import widgets, TextInput, DateField + + +class MultiSelectWidget(widgets.SelectMultiple): + class Media: + js = ('custom/js/from_multiselect.js',) + + +class EmojiWidget(forms.TextInput): + class Media: + js = 'custom/js/form_emoji.js' class EditRecipeForm(forms.ModelForm): @@ -16,6 +27,15 @@ class EditRecipeForm(forms.ModelForm): } +class EditCategoryForm(forms.ModelForm): + class Media: + js = ('custom/js/form_emoji.js',) + + class Meta: + model = Category + fields = ('name', 'icon', 'description') + + class MonitorForm(forms.Form): path = forms.CharField(label=_('Path')) diff --git a/cookbook/static/custom/js/form_emoji.js b/cookbook/static/custom/js/form_emoji.js new file mode 100644 index 000000000..0f56171ed --- /dev/null +++ b/cookbook/static/custom/js/form_emoji.js @@ -0,0 +1,3 @@ +$(document).ready(function () { + $('#id_icon').emojioneArea(); +}); \ No newline at end of file diff --git a/cookbook/static/custom/js/form_multiselect.js b/cookbook/static/custom/js/form_multiselect.js new file mode 100644 index 000000000..0de439074 --- /dev/null +++ b/cookbook/static/custom/js/form_multiselect.js @@ -0,0 +1,3 @@ +$(document).ready(function () { + $('#id_keywords').select2(); +}); \ No newline at end of file diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index 0e6bf55c1..8e5944add 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -26,6 +26,9 @@ + {% block extra_head %} + {% endblock %} +