summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--__init__.py37
-rw-r--r--locale/fr/LC_MESSAGES/django.po81
-rw-r--r--migrations/0001_initial.py26
-rw-r--r--migrations/__init__.py0
-rw-r--r--models.py14
-rw-r--r--templates/texteo/customtext_form.html25
-rw-r--r--templates/texteo/customtext_list.html27
-rw-r--r--templates/texteo/manager_base.html11
-rw-r--r--urls.py36
-rw-r--r--views.py23
10 files changed, 280 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..dddef5a
--- /dev/null
+++ b/__init__.py
@@ -0,0 +1,37 @@
+# texteo - Texts management system
+# Copyright (C) 2015 Entr'ouvert
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import django.apps
+from django.core.urlresolvers import reverse
+from django.utils.translation import ugettext as _
+
+class Plugin(object):
+ def get_apps(self):
+ return [__name__]
+
+
+class AppConfig(django.apps.AppConfig):
+ name = 'combo.apps.texteo'
+
+ def get_before_urls(self):
+ from . import urls
+ return urls.urlpatterns
+
+ def get_extra_manager_actions(self):
+ return [{'href': reverse('texteo-manager-homepage'),
+ 'text': _('Custom Texts')}]
+
+default_app_config = 'combo.apps.texteo.AppConfig'
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
new file mode 100644
index 0000000..fb6ce8b
--- /dev/null
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -0,0 +1,81 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: texteo\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-10-16 15:14+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Serghei Mihai <smihai@entrouvert.com>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: __init__.py:35 models.py:11 templates/texteo/manager_base.html:10
+msgid "Custom Texts"
+msgstr "Textes personnalisés"
+
+#: models.py:7
+msgid "Title"
+msgstr "Titre"
+
+#: models.py:8
+msgid "Content"
+msgstr "Contenu"
+
+#: templates/texteo/customtext_confirm_delete.html:11
+msgid "Are you sure you want to delete this?"
+msgstr "Etes-vous sûr de vouloir supprimer ça?"
+
+#: templates/texteo/customtext_confirm_delete.html:13
+msgid "Confirm Deletion"
+msgstr "Confirmer"
+
+#: templates/texteo/customtext_confirm_delete.html:14
+#: templates/texteo/customtext_form.html:19
+msgid "Cancel"
+msgstr "Annuler"
+
+#: templates/texteo/customtext_form.html:6
+msgid "Edit Text"
+msgstr "Edition texte"
+
+#: templates/texteo/customtext_form.html:8
+msgid "New Text"
+msgstr "Nouveau texte"
+
+#: templates/texteo/customtext_form.html:18
+msgid "Save"
+msgstr "Sauvegarder"
+
+#: templates/texteo/customtext_form.html:21
+msgid "Delete"
+msgstr "Supprimer"
+
+#: templates/texteo/customtext_list.html:6
+msgid "New"
+msgstr "Nouveau"
+
+#: templates/texteo/customtext_list.html:20
+msgid ""
+"\n"
+" This site doesn't have any custom texts yet. Click on the \"New\" button "
+"in the top\n"
+" right of the page to add a first one.\n"
+" "
+msgstr ""
+"\n"
+"Ce site ne contient aucun texte personnalisé. Cliquez sur \"Nouveau\" "
+"pour en rajouter.\n"
+" "
+
+#: templates/texteo/manager_base.html:5
+msgid "Texts"
+msgstr "Textes"
diff --git a/migrations/0001_initial.py b/migrations/0001_initial.py
new file mode 100644
index 0000000..f5c35cb
--- /dev/null
+++ b/migrations/0001_initial.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import ckeditor.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='CustomText',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('title', models.CharField(max_length=64, verbose_name='Title')),
+ ('content', ckeditor.fields.RichTextField(verbose_name='Content')),
+ ],
+ options={
+ 'verbose_name': 'Custom Texts',
+ },
+ bases=(models.Model,),
+ ),
+ ]
diff --git a/migrations/__init__.py b/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/migrations/__init__.py
diff --git a/models.py b/models.py
new file mode 100644
index 0000000..2a64542
--- /dev/null
+++ b/models.py
@@ -0,0 +1,14 @@
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+from ckeditor.fields import RichTextField
+
+class CustomText(models.Model):
+ title = models.CharField(_('Title'), max_length=64)
+ content = RichTextField(_('Content'))
+
+ class Meta:
+ verbose_name = _('Custom Texts')
+
+ def __unicode__(self):
+ return self.title
diff --git a/templates/texteo/customtext_form.html b/templates/texteo/customtext_form.html
new file mode 100644
index 0000000..d4413c0
--- /dev/null
+++ b/templates/texteo/customtext_form.html
@@ -0,0 +1,25 @@
+{% extends "texteo/manager_base.html" %}
+{% load i18n %}
+
+{% block appbar %}
+{% if object.id %}
+<h2>{% trans "Edit Text" %}</h2>
+{% else %}
+<h2>{% trans "New Text" %}</h2>
+{% endif %}
+{% endblock %}
+
+{% block content %}
+
+<form method="post" enctype="multipart/form-data">
+ {% csrf_token %}
+ {{ form.as_p }}
+ <div class="buttons">
+ <button>{% trans "Save" %}</button>
+ <a class="cancel" href="{% url 'texteo-manager-homepage' %}">{% trans 'Cancel' %}</a>
+ {% if object.id %}
+ <a class="delete" rel="popup" href="{% url 'texteo-manager-text-delete' pk=object.id %}">{% trans 'Delete' %}</a>
+ {% endif %}
+ </div>
+</form>
+{% endblock %}
diff --git a/templates/texteo/customtext_list.html b/templates/texteo/customtext_list.html
new file mode 100644
index 0000000..1f5c6eb
--- /dev/null
+++ b/templates/texteo/customtext_list.html
@@ -0,0 +1,27 @@
+{% extends "texteo/manager_base.html" %}
+{% load i18n %}
+
+{% block appbar %}
+{{ block.super }}
+<a rel="popup" href="{% url 'texteo-manager-text-add' %}">{% trans 'New' %}</a>
+{% endblock %}
+
+{% block content %}
+
+{% if object_list %}
+<div class="objects-list">
+ {% for text in object_list %}
+ <div>
+ <a href="{% url 'texteo-manager-text-edit' pk=text.id %}">{{ text.title }}</a> </div>
+ {% endfor %}
+</div>
+{% else %}
+<div class="big-msg-info">
+ {% blocktrans %}
+ This site doesn't have any custom texts yet. Click on the "New" button in the top
+ right of the page to add a first one.
+ {% endblocktrans %}
+</div>
+{% endif %}
+
+{% endblock %}
diff --git a/templates/texteo/manager_base.html b/templates/texteo/manager_base.html
new file mode 100644
index 0000000..fd625e5
--- /dev/null
+++ b/templates/texteo/manager_base.html
@@ -0,0 +1,11 @@
+{% extends "combo/manager_base.html" %}
+{% load i18n %}
+
+{% block appbar %}
+<h2>{% trans 'Texts' %}</h2>
+{% endblock %}
+
+{% block more-user-links %}
+{{ block.super }}
+<a href="{% url 'texteo-manager-homepage' %}">{% trans 'Custom Texts' %}</a>
+{% endblock %}
diff --git a/urls.py b/urls.py
new file mode 100644
index 0000000..fae6916
--- /dev/null
+++ b/urls.py
@@ -0,0 +1,36 @@
+# texteo - Texts management system
+# Copyright (C) 2015 Entr'ouvert
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from django.conf.urls import patterns, url, include
+
+from combo.urls_utils import decorated_includes, manager_required
+
+from .views import (TextListView, TextCreateView, TextUpdateView,
+ TextDeleteView)
+
+texteo_manager_urls = patterns('lingo.manager_views',
+ url('^$', TextListView.as_view(), name='texteo-manager-homepage'),
+ url('^text/add/$', TextCreateView.as_view(), name='texteo-manager-text-add'),
+ url('^text/(?P<pk>\w+)/edit$', TextUpdateView.as_view(),
+ name='texteo-manager-text-edit'),
+ url('^text/(?P<pk>\w+)/delete$', TextDeleteView.as_view(),
+ name='texteo-manager-text-delete'),
+)
+
+urlpatterns = patterns('',
+ url(r'^manage/texteo/', decorated_includes(manager_required,
+ include(texteo_manager_urls))),
+)
diff --git a/views.py b/views.py
new file mode 100644
index 0000000..2910a53
--- /dev/null
+++ b/views.py
@@ -0,0 +1,23 @@
+from django.views.generic import CreateView, ListView, UpdateView, DeleteView
+from django.core.urlresolvers import reverse_lazy
+
+from .models import CustomText
+
+class TextListView(ListView):
+ model = CustomText
+ success_url = reverse_lazy('texteo-manager-homepage')
+
+
+class TextCreateView(CreateView):
+ model = CustomText
+ success_url = reverse_lazy('texteo-manager-homepage')
+
+
+class TextUpdateView(UpdateView):
+ model = CustomText
+ success_url = reverse_lazy('texteo-manager-homepage')
+
+
+class TextDeleteView(DeleteView):
+ model = CustomText
+ success_url = reverse_lazy('texteo-manager-homepage')