publishable in save dialog
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 30 Nov 2011 15:24:21 +0000 (16:24 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 30 Nov 2011 15:24:21 +0000 (16:24 +0100)
apps/wiki/forms.py
apps/wiki/locale/pl/LC_MESSAGES/django.mo
apps/wiki/locale/pl/LC_MESSAGES/django.po
apps/wiki/templates/wiki/document_details.html
apps/wiki/templates/wiki/save_dialog.html
apps/wiki/templates/wiki/tabs/history_view.html
apps/wiki/views.py

index 394b823..3ef3ed1 100644 (file)
@@ -59,6 +59,11 @@ class DocumentTextSaveForm(forms.Form):
         help_text=_(u"If you completed a life cycle stage, select it."),
     )
 
+    publishable = forms.BooleanField(required=False, initial=False,
+        label=_('Publishable'),
+        help_text=_(u"Mark this revision as publishable.")
+    )
+
     def __init__(self, *args, **kwargs):
         user = kwargs.pop('user')
         r = super(DocumentTextSaveForm, self).__init__(*args, **kwargs)
index 96287ca..d886dce 100644 (file)
Binary files a/apps/wiki/locale/pl/LC_MESSAGES/django.mo and b/apps/wiki/locale/pl/LC_MESSAGES/django.mo differ
index eb51b71..0182abe 100644 (file)
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Platforma Redakcyjna\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-25 14:14+0100\n"
-"PO-Revision-Date: 2011-11-25 14:15+0100\n"
+"POT-Creation-Date: 2011-11-30 16:07+0100\n"
+"PO-Revision-Date: 2011-11-30 16:08+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org.pl>\n"
 "Language: \n"
@@ -17,32 +17,33 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 
 #: forms.py:19
-#: views.py:274
+#: forms.py:63
+#: views.py:279
 msgid "Publishable"
 msgstr "Gotowe do publikacji"
 
 #: forms.py:38
-#: forms.py:84
+#: forms.py:89
 msgid "Author"
 msgstr "Autor"
 
 #: forms.py:39
-#: forms.py:85
+#: forms.py:90
 msgid "Your name"
 msgstr "Imię i nazwisko"
 
 #: forms.py:44
-#: forms.py:90
+#: forms.py:95
 msgid "Author's email"
 msgstr "E-mail autora"
 
 #: forms.py:45
-#: forms.py:91
+#: forms.py:96
 msgid "Your email address, so we can show a gravatar :)"
 msgstr "Adres e-mail, żebyśmy mogli pokazać gravatar :)"
 
 #: forms.py:51
-#: forms.py:97
+#: forms.py:102
 msgid "Your comments"
 msgstr "Twój komentarz"
 
@@ -58,7 +59,11 @@ msgstr "Ukończono"
 msgid "If you completed a life cycle stage, select it."
 msgstr "Jeśli został ukończony etap prac, wskaż go."
 
-#: forms.py:98
+#: forms.py:64
+msgid "Mark this revision as publishable."
+msgstr "Oznacz tę wersję jako gotową do publikacji."
+
+#: forms.py:103
 msgid "Describe the reason for reverting."
 msgstr "Opisz powód przywrócenia."
 
@@ -74,11 +79,11 @@ msgstr "motyw"
 msgid "themes"
 msgstr "motywy"
 
-#: views.py:294
+#: views.py:299
 msgid "Revision marked"
 msgstr "Wersja oznaczona"
 
-#: views.py:296
+#: views.py:301
 msgid "Nothing changed"
 msgstr "Nic nie uległo zmianie"
 
@@ -164,15 +169,15 @@ msgstr "Galeria"
 msgid "Compare versions"
 msgstr "Porównaj wersje"
 
-#: templates/wiki/tabs/history_view.html:7
+#: templates/wiki/tabs/history_view.html:8
 msgid "Mark for publishing"
 msgstr "Oznacz do publikacji"
 
-#: templates/wiki/tabs/history_view.html:9
+#: templates/wiki/tabs/history_view.html:11
 msgid "Revert document"
 msgstr "Przywróć wersję"
 
-#: templates/wiki/tabs/history_view.html:12
+#: templates/wiki/tabs/history_view.html:14
 msgid "View version"
 msgstr "Zobacz wersję"
 
index d95603f..db003d2 100644 (file)
@@ -43,5 +43,7 @@
     {% include "wiki/save_dialog.html" %}
     {% include "wiki/revert_dialog.html" %}
     {% include "wiki/tag_dialog.html" %}
-    {% include "wiki/pubmark_dialog.html" %}
+    {% if can_pubmark %}
+        {% include "wiki/pubmark_dialog.html" %}
+    {% endif %}
 {% endblock %}
index c34eb9e..31c5b01 100644 (file)
                <span class="help_text">{{ forms.text_save.stage_completed.help_text }}</span>
                <span data-ui-error-for="{{ forms.text_save.stage_completed.name }}"> </span>
        </p>
+    {% if can_pubmark %}
+       <p>
+               {{ forms.text_save.publishable.label_tag }}:
+               {{ forms.text_save.publishable }}
+               <span class="help_text">{{ forms.text_save.publishable.help_text }}</span>
+               <span data-ui-error-for="{{ forms.text_save.publishable.name }}"> </span>
+       </p>
+    {% endif %}
+
        {% endif %}
 
 
index c363cef..0d662a7 100644 (file)
@@ -3,8 +3,10 @@
     <div class="toolbar">
        <button type="button" id="make-diff-button"
                        data-enabled-when="2" disabled="disabled">{% trans "Compare versions" %}</button>
+        {% if can_pubmark %}
                <button type="button" id="pubmark-changeset-button"
                        data-enabled-when="1" disabled="disabled">{% trans "Mark for publishing" %}</button>
+        {% endif %}
                <button type="button" id="doc-revert-button"
                        data-enabled-when="1" disabled="disabled">{% trans "Revert document" %}</button>
                <button id="open-preview-button" disabled="disabled"
index f58e03a..0356d50 100644 (file)
@@ -69,6 +69,7 @@ def editor(request, slug, chunk=None, template_name='wiki/document_details.html'
             "text_revert": forms.DocumentTextRevertForm(prefix="textrevert"),
             "pubmark": forms.DocumentPubmarkForm(prefix="pubmark"),
         },
+        'can_pubmark': request.user.has_perm('catalogue.can_pubmark'),
         'REDMINE_URL': settings.REDMINE_URL,
     })
 
@@ -125,6 +126,8 @@ def text(request, chunk_id):
                 parent = None
             stage = form.cleaned_data['stage_completed']
             tags = [stage] if stage else []
+            publishable = (form.cleaned_data['publishable'] and
+                    request.user.has_perm('catalogue.can_pubmark'))
             doc.commit(author=author,
                        text=text,
                        parent=parent,
@@ -132,6 +135,7 @@ def text(request, chunk_id):
                        tags=tags,
                        author_name=form.cleaned_data['author_name'],
                        author_email=form.cleaned_data['author_email'],
+                       publishable=publishable,
                        )
             revision = doc.revision()
             return JSONResponse({