Add CKeditor to the agenda item text field
This commit is contained in:
parent
2b04980fc7
commit
8f274c2691
@ -16,16 +16,19 @@ from django import forms
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from mptt.forms import TreeNodeChoiceField
|
||||
|
||||
from openslides.utils.forms import CssClassMixin
|
||||
from openslides.utils.forms import CssClassMixin, CleanHtmlFormMixin
|
||||
from openslides.utils.person.forms import PersonFormField
|
||||
|
||||
from .models import Item, Speaker
|
||||
|
||||
|
||||
class ItemForm(CssClassMixin, forms.ModelForm):
|
||||
class ItemForm(CleanHtmlFormMixin, CssClassMixin, forms.ModelForm):
|
||||
"""
|
||||
Form to create of update an item.
|
||||
"""
|
||||
|
||||
clean_html_fields = ('text', )
|
||||
|
||||
parent = TreeNodeChoiceField(
|
||||
queryset=Item.objects.all(), label=ugettext_lazy("Parent item"), required=False)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
{% load i18n %}
|
||||
{% load tags %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block title %}
|
||||
{% if item %}
|
||||
@ -12,6 +13,23 @@
|
||||
– {{ block.super }}
|
||||
{% endblock %}
|
||||
|
||||
{% block header %}
|
||||
{{ block.super }}
|
||||
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/ckeditor.css' %}" />
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript" src="{% static 'javascript/ckeditor/ckeditor.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'javascript/ckeditor-config.js' %}"></script>
|
||||
<script>
|
||||
// Init CKeditor
|
||||
$(function() {
|
||||
CKEDITOR.replace('id_text', ck_options);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>
|
||||
{% if item %}
|
||||
|
@ -44,7 +44,7 @@
|
||||
</h1>
|
||||
<p>
|
||||
{% if not item.content_object %}
|
||||
{{ item.text|safe|linebreaks }}
|
||||
{{ item.text|safe }}
|
||||
{% else %}
|
||||
<a href="{{ item.content_object|absolute_url }}" class="btn btn-small">{% trans item.content_type.name %} {{ item.content_object }}</a>
|
||||
{% endif %}
|
||||
|
@ -5,12 +5,14 @@
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block header %}
|
||||
{{ block.super }}
|
||||
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/motion.css' %}" />
|
||||
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/ckeditor.css' %}" />
|
||||
<link href="{% static 'styles/jquery.bsmselect.css' %}" type="text/css" rel="stylesheet" />
|
||||
{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript" src="{% static 'javascript/ckeditor/ckeditor.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'javascript/ckeditor-config.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'javascript/jquery.bsmselect.js' %}"></script>
|
||||
@ -24,6 +26,12 @@
|
||||
listItemLabelClass: 'bsmListItemLabel-custom',
|
||||
removeClass: 'bsmListItemRemove-custom'
|
||||
});
|
||||
|
||||
// Init CKeditor
|
||||
$(function() {
|
||||
CKEDITOR.replace('id_text', ck_options);
|
||||
CKEDITOR.replace('id_reason', ck_options);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
/*
|
||||
* Configuration file for the CKeditor
|
||||
*/
|
||||
$(function() {
|
||||
var ck_options = {
|
||||
|
||||
// Using a custom CSS file allows us to specifically style elements entered
|
||||
@ -43,7 +42,3 @@ $(function() {
|
||||
],
|
||||
toolbar: 'Full'
|
||||
};
|
||||
|
||||
CKEDITOR.replace('id_text', ck_options);
|
||||
CKEDITOR.replace('id_reason', ck_options);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user