Rename publishable to approved, add profile option to approve by default.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 10 Oct 2023 13:51:11 +0000 (15:51 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 10 Oct 2023 13:51:11 +0000 (15:51 +0200)
20 files changed:
src/documents/locale/pl/LC_MESSAGES/django.mo
src/documents/locale/pl/LC_MESSAGES/django.po
src/documents/migrations/0013_alter_chunkchange_publishable_and_more.py [new file with mode: 0644]
src/documents/models/book.py
src/documents/models/image.py
src/dvcs/locale/pl/LC_MESSAGES/django.mo
src/dvcs/locale/pl/LC_MESSAGES/django.po
src/dvcs/models.py
src/redakcja/static/css/history.css
src/redakcja/static/js/wiki/base.js
src/redakcja/static/js/wiki/dialog_pubmark.js
src/redakcja/static/js/wiki/view_history.js
src/team/admin.py
src/team/migrations/0002_profile_approve_by_default.py [new file with mode: 0644]
src/team/models.py
src/wiki/forms.py
src/wiki/locale/pl/LC_MESSAGES/django.mo
src/wiki/locale/pl/LC_MESSAGES/django.po
src/wiki/templates/wiki/tabs/history_view.html
src/wiki/views.py

index 453940f..1ff7cb4 100644 (file)
Binary files a/src/documents/locale/pl/LC_MESSAGES/django.mo and b/src/documents/locale/pl/LC_MESSAGES/django.mo differ
index b9c500f..8edabb4 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Platforma Redakcyjna\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2021-12-17 11:37+0100\n"
+"PO-Revision-Date: 2023-10-10 15:35+0200\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org."
 "pl>\n"
@@ -17,101 +17,101 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
 "|| n%100>=20) ? 1 : 2);\n"
-"X-Generator: Poedit 3.0\n"
+"X-Generator: Poedit 3.0.1\n"
 
-#: documents/forms.py:41
+#: documents/forms.py:43
 msgid "Text file must be UTF-8 encoded."
 msgstr "Plik powinien mieć kodowanie UTF-8."
 
-#: documents/forms.py:57
+#: documents/forms.py:59
 msgid "Title not set"
 msgstr "Brak tytułu"
 
-#: documents/forms.py:60
+#: documents/forms.py:62
 msgid "Slug not set"
 msgstr "Brak slugu"
 
-#: documents/forms.py:63
+#: documents/forms.py:65
 msgid "You must either enter text or upload a file"
 msgstr "Proszę wpisać tekst albo wybrać plik do załadowania"
 
-#: documents/forms.py:72
+#: documents/forms.py:74
 msgid "ZIP file"
 msgstr "Plik ZIP"
 
-#: documents/forms.py:73
+#: documents/forms.py:75
 msgid "Directories are documents in chunks"
 msgstr "Katalogi zawierają dokumenty w częściach"
 
-#: documents/forms.py:97 documents/forms.py:198
+#: documents/forms.py:99 documents/forms.py:200
 msgid "Assigned to"
 msgstr "Przypisane do"
 
-#: documents/forms.py:118 documents/forms.py:132
+#: documents/forms.py:120 documents/forms.py:134
 msgid "Chunk with this slug already exists"
 msgstr "Część z tym slugiem już istnieje"
 
-#: documents/forms.py:141
+#: documents/forms.py:143
 msgid "Append to"
 msgstr "Dołącz do"
 
-#: documents/models/book.py:27 documents/models/chunk.py:21
+#: documents/models/book.py:32 documents/models/chunk.py:21
 #: documents/models/image.py:20
 msgid "title"
 msgstr "tytuł"
 
-#: documents/models/book.py:28 documents/models/chunk.py:22
+#: documents/models/book.py:33 documents/models/chunk.py:22
 #: documents/models/image.py:21
 msgid "slug"
 msgstr "slug"
 
-#: documents/models/book.py:29 documents/models/image.py:22
+#: documents/models/book.py:39 documents/models/image.py:22
 msgid "public"
 msgstr "publiczna"
 
-#: documents/models/book.py:30
+#: documents/models/book.py:43
 msgid "scan gallery name"
 msgstr "nazwa galerii skanów"
 
-#: documents/models/book.py:33
+#: documents/models/book.py:48
 msgid "parent"
 msgstr "rodzic"
 
-#: documents/models/book.py:34
+#: documents/models/book.py:49
 msgid "parent number"
 msgstr "numeracja rodzica"
 
-#: documents/models/book.py:60 documents/models/chunk.py:19
+#: documents/models/book.py:82 documents/models/chunk.py:19
 #: documents/models/publish_log.py:15
-#: documents/templates/documents/book_detail.html:145
+#: documents/templates/documents/book_detail.html:216
 msgid "book"
 msgstr "książka"
 
-#: documents/models/book.py:61 documents/views.py:627
+#: documents/models/book.py:83 documents/views.py:651
 msgid "books"
 msgstr "książki"
 
-#: documents/models/book.py:271
+#: documents/models/book.py:301
 msgid "No chunks in the book."
 msgstr "Książka nie ma części."
 
-#: documents/models/book.py:275
-msgid "Not all chunks have publishable revisions."
-msgstr "Niektóre części nie są gotowe do publikacji."
+#: documents/models/book.py:305
+msgid "Not all chunks have approved revisions."
+msgstr "Niektóre części nie mają zatwierdzonych wersji."
 
-#: documents/models/book.py:282 documents/models/image.py:83
+#: documents/models/book.py:312 documents/models/image.py:83
 msgid "Invalid XML"
 msgstr "Nieprawidłowy XML"
 
-#: documents/models/book.py:284 documents/models/image.py:85
+#: documents/models/book.py:314 documents/models/image.py:85
 msgid "No Dublin Core found."
 msgstr "Brak sekcji Dublin Core."
 
-#: documents/models/book.py:286 documents/models/image.py:87
+#: documents/models/book.py:316 documents/models/image.py:87
 msgid "Invalid Dublin Core"
 msgstr "Nieprawidłowy Dublin Core"
 
-#: documents/models/book.py:289 documents/models/image.py:91
+#: documents/models/book.py:319 documents/models/image.py:91
 msgid "rdf:about is not"
 msgstr "rdf:about jest różny od"
 
@@ -141,8 +141,8 @@ msgid "images"
 msgstr "obrazy"
 
 #: documents/models/image.py:75
-msgid "There is no publishable revision"
-msgstr "Żadna wersja nie została oznaczona do publikacji."
+msgid "There is no approved revision"
+msgstr "Żadna wersja nie została zatwierdzona"
 
 #: documents/models/project.py:11
 msgid "name"
@@ -213,7 +213,7 @@ msgstr "Użytkownicy aktywni w roku"
 msgid "Activity"
 msgstr "Aktywność"
 
-#: documents/templates/documents/base.html:13
+#: documents/templates/documents/base.html:14
 msgid "Platforma Redakcyjna"
 msgstr "Platforma Redakcyjna"
 
@@ -222,99 +222,107 @@ msgstr "Platforma Redakcyjna"
 msgid "Append book"
 msgstr "Dołącz książkę"
 
-#: documents/templates/documents/book_detail.html:24
+#: documents/templates/documents/book_detail.html:26
 #: documents/templates/documents/book_edit.html:13
 #: documents/templates/documents/chunk_edit.html:22
 #: documents/templates/documents/image_detail.html:22
 msgid "Save"
 msgstr "Zapisz"
 
-#: documents/templates/documents/book_detail.html:31
+#: documents/templates/documents/book_detail.html:33
 msgid "Edit gallery"
 msgstr "Edytuj galerię"
 
-#: documents/templates/documents/book_detail.html:34
+#: documents/templates/documents/book_detail.html:36
 msgid "Append to other book"
 msgstr "Dołącz do innej książki"
 
-#: documents/templates/documents/book_detail.html:53
+#: documents/templates/documents/book_detail.html:55
 msgid "Chunks"
 msgstr "Części"
 
-#: documents/templates/documents/book_detail.html:71
+#: documents/templates/documents/book_detail.html:73
 #: documents/templates/documents/image_detail.html:47
 #: documents/templatetags/wall.py:108 documents/templatetags/wall.py:129
 msgid "Publication"
 msgstr "Publikacja"
 
-#: documents/templates/documents/book_detail.html:89
+#: documents/templates/documents/book_detail.html:110
 #: documents/templates/documents/image_detail.html:51
 msgid "Last published"
 msgstr "Ostatnio opublikowano"
 
-#: documents/templates/documents/book_detail.html:99
+#: documents/templates/documents/book_detail.html:120
 msgid "Full XML"
 msgstr "Pełny XML"
 
-#: documents/templates/documents/book_detail.html:100
+#: documents/templates/documents/book_detail.html:121
 msgid "HTML version"
 msgstr "Wersja HTML"
 
-#: documents/templates/documents/book_detail.html:101
+#: documents/templates/documents/book_detail.html:122
 msgid "TXT version"
 msgstr "Wersja TXT"
 
-#: documents/templates/documents/book_detail.html:102
+#: documents/templates/documents/book_detail.html:123
 msgid "PDF version"
 msgstr "Wersja PDF"
 
-#: documents/templates/documents/book_detail.html:103
+#: documents/templates/documents/book_detail.html:124
 msgid "PDF version for mobiles"
 msgstr "Wersja PDF na telefony"
 
-#: documents/templates/documents/book_detail.html:104
+#: documents/templates/documents/book_detail.html:125
 msgid "EPUB version"
 msgstr "Wersja EPUB"
 
-#: documents/templates/documents/book_detail.html:105
+#: documents/templates/documents/book_detail.html:126
 msgid "MOBI version"
 msgstr "Wersja MOBI"
 
-#: documents/templates/documents/book_detail.html:119
+#: documents/templates/documents/book_detail.html:142
 #: documents/templates/documents/image_detail.html:70
 msgid "Publish"
 msgstr "Opublikuj"
 
-#: documents/templates/documents/book_detail.html:123
+#: documents/templates/documents/book_detail.html:194
 #: documents/templates/documents/image_detail.html:74
 msgid "Log in to publish."
 msgstr "Zaloguj się, aby opublikować."
 
-#: documents/templates/documents/book_detail.html:126
+#: documents/templates/documents/book_detail.html:197
 #: documents/templates/documents/image_detail.html:77
 msgid "This book can't be published yet, because:"
 msgstr "Ta książka nie może jeszcze zostać opublikowana. Powód:"
 
-#: documents/templates/documents/book_detail.html:138
+#: documents/templates/documents/book_detail.html:209
 msgid "Statistics"
 msgstr "Statystyki"
 
-#: documents/templates/documents/book_detail.html:147
+#: documents/templates/documents/book_detail.html:218
 msgid "characters"
 msgstr "znaki"
 
-#: documents/templates/documents/book_detail.html:148
-msgid "words"
-msgstr "słowa"
-
-#: documents/templates/documents/book_detail.html:149
+#: documents/templates/documents/book_detail.html:219
 msgid "characters (with footnotes)"
 msgstr "znaki (z przypisami)"
 
-#: documents/templates/documents/book_detail.html:150
+#: documents/templates/documents/book_detail.html:220
+msgid "words"
+msgstr "słowa"
+
+#: documents/templates/documents/book_detail.html:221
 msgid "words (with footnotes)"
 msgstr "słowa (z przypisami)"
 
+#: documents/templates/documents/book_detail.html:222
+msgid "wiersze (+ inne znaki)"
+msgstr ""
+
+#: documents/templates/documents/book_detail.html:223
+msgid "wiersze (+ inne znaki, z przypisami)"
+msgstr ""
+
 #: documents/templates/documents/book_edit.html:5
 msgid "Edit book"
 msgstr "Edytuj książkę"
@@ -348,24 +356,24 @@ msgstr "Ustawienia części"
 #: documents/templates/documents/book_list/book.html:20
 #: documents/templates/documents/book_list/book.html:42
 #: documents/templates/documents/image_short.html:17
-#: documents/templatetags/book_list.py:82
-#: documents/templatetags/book_list.py:150
+#: documents/templatetags/book_list.py:92
+#: documents/templatetags/book_list.py:160
 msgid "published"
 msgstr "opublikowane"
 
 #: documents/templates/documents/book_list/book.html:23
 #: documents/templates/documents/book_list/book.html:45
 #: documents/templates/documents/image_short.html:20
-#: documents/templatetags/book_list.py:80
-#: documents/templatetags/book_list.py:148
+#: documents/templatetags/book_list.py:90
+#: documents/templatetags/book_list.py:158
 msgid "publishable"
 msgstr "do publikacji"
 
 #: documents/templates/documents/book_list/book.html:26
 #: documents/templates/documents/book_list/chunk.html:26
 #: documents/templates/documents/image_short.html:23
-#: documents/templatetags/book_list.py:81
-#: documents/templatetags/book_list.py:149
+#: documents/templatetags/book_list.py:91
+#: documents/templatetags/book_list.py:159
 msgid "changed"
 msgstr "zmienione"
 
@@ -382,6 +390,7 @@ msgstr "etap"
 #: documents/templates/documents/book_list/book_list.html:36
 #: documents/templates/documents/book_list/book_list.html:47
 #: documents/templates/documents/book_list/book_list.html:68
+#: documents/templates/documents/book_list/book_list.html:120
 #: documents/templates/documents/image_table.html:32
 #: documents/templates/documents/image_table.html:43
 #: documents/templates/documents/image_table.html:62
@@ -549,11 +558,11 @@ msgstr "Nie znaleziono obrazów."
 msgid "My page"
 msgstr "Moja strona"
 
-#: documents/templates/documents/my_page.html:27
+#: documents/templates/documents/my_page.html:54
 msgid "Your last edited documents"
 msgstr "Twoje ostatnie edycje"
 
-#: documents/templates/documents/my_page.html:47
+#: documents/templates/documents/my_page.html:74
 #: documents/templates/documents/user_page.html:18
 msgid "Recent activity for"
 msgstr "Ostatnia aktywność dla:"
@@ -577,13 +586,13 @@ msgstr "nie zalogowany"
 msgid "No activity recorded."
 msgstr "Nie zanotowano aktywności."
 
-#: documents/templatetags/book_list.py:83
-#: documents/templatetags/book_list.py:151
+#: documents/templatetags/book_list.py:93
+#: documents/templatetags/book_list.py:161
 msgid "unpublished"
 msgstr "nie opublikowane"
 
-#: documents/templatetags/book_list.py:84
-#: documents/templatetags/book_list.py:152
+#: documents/templatetags/book_list.py:94
+#: documents/templatetags/book_list.py:162
 msgid "empty"
 msgstr "puste"
 
@@ -611,20 +620,20 @@ msgstr "Powiązana zmiana"
 msgid "Edit"
 msgstr "Zmiana"
 
-#: documents/views.py:172
+#: documents/views.py:179
 #, python-format
 msgid "Slug already used for %s"
 msgstr "Slug taki sam jak dla pliku %s"
 
-#: documents/views.py:174
+#: documents/views.py:181
 msgid "Slug already used in repository."
 msgstr "Dokument o tym slugu już istnieje w repozytorium."
 
-#: documents/views.py:180
+#: documents/views.py:187
 msgid "File should be UTF-8 encoded."
 msgstr "Plik powinien mieć kodowanie UTF-8."
 
-#: documents/views.py:629
+#: documents/views.py:653
 msgid "scan gallery"
 msgstr "galeria skanów"
 
diff --git a/src/documents/migrations/0013_alter_chunkchange_publishable_and_more.py b/src/documents/migrations/0013_alter_chunkchange_publishable_and_more.py
new file mode 100644 (file)
index 0000000..72ae88c
--- /dev/null
@@ -0,0 +1,23 @@
+# Generated by Django 4.1.9 on 2023-10-10 15:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("documents", "0012_remove_book_legimi_id_remove_book_woblink_id"),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name="chunkchange",
+            name="publishable",
+            field=models.BooleanField(default=False, verbose_name="approved"),
+        ),
+        migrations.AlterField(
+            model_name="imagechange",
+            name="publishable",
+            field=models.BooleanField(default=False, verbose_name="approved"),
+        ),
+    ]
index a13c00b..bede8d0 100644 (file)
@@ -286,7 +286,7 @@ class Book(models.Model):
         try:
             changes = self.get_current_changes(publishable=True)
         except self.NoTextError:
-            raise AssertionError(_('Not all chunks have publishable revisions.'))
+            raise AssertionError(_('Not all chunks have approved revisions.'))
 
         from librarian import NoDublinCore, ParseError, ValidationError
 
index fd3d8c4..c14cca0 100644 (file)
@@ -72,7 +72,7 @@ class Image(dvcs_models.Document):
                 return open(self.image.path)
 
         publishable = self.publishable()
-        assert publishable, _("There is no publishable revision")
+        assert publishable, _("There is no approved revision")
         picture_xml = publishable.materialize()
 
         try:
index dfd85c2..86acb55 100644 (file)
Binary files a/src/dvcs/locale/pl/LC_MESSAGES/django.mo and b/src/dvcs/locale/pl/LC_MESSAGES/django.mo differ
index 79bba13..d73669b 100644 (file)
@@ -5,17 +5,18 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2011-12-14 15:27+0100\n"
+"PO-Revision-Date: 2023-10-10 15:48+0200\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"Language: \n"
+"Language-Team: \n"
+"Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
-"|| n%100>=20) ? 1 : 2)\n"
+"|| n%100>=20) ? 1 : 2);\n"
+"X-Generator: Poedit 3.0.1\n"
 
 #: dvcs/models.py:23
 msgid "name"
@@ -62,8 +63,8 @@ msgid "description"
 msgstr "opis"
 
 #: dvcs/models.py:89
-msgid "publishable"
-msgstr "do publikacji"
+msgid "approved"
+msgstr "zatwierdzona"
 
 #: dvcs/models.py:175
 msgid "tag"
@@ -116,3 +117,6 @@ msgstr "użytkownik"
 #: dvcs/models.py:240
 msgid "Work assignment."
 msgstr "Przypisanie pracy użytkownikowi."
+
+#~ msgid "publishable"
+#~ msgstr "do publikacji"
index 5d465ca..5d7d7ff 100644 (file)
@@ -86,7 +86,7 @@ class Change(models.Model):
 
     description = models.TextField(_('description'), blank=True, default='')
     created_at = models.DateTimeField(editable=False, db_index=True, default=datetime.now)
-    publishable = models.BooleanField(_('publishable'), default=False)
+    publishable = models.BooleanField(_('approved'), default=False)
 
     class Meta:
         abstract = True
index 18c606c..340b878 100644 (file)
@@ -88,6 +88,24 @@ table#changes-list-container {
     vertical-align: text-top;
 }
 
+.can-approve #changes-list .approved:hover {
+    cursor: pointer;
+}
+#pubmark-changeset-button {display: none;}
+.can-approve #pubmark-changeset-button {display: inline-block;}
+
+#changes-list *[data-approved = 'false'] .approved:after {
+    content: '☐';
+    color: red;
+    white-space: pre-line;
+}
+#changes-list *[data-approved = 'true'] .approved:after {
+    content: '🗹';
+    font-size: .8em;
+    color: #80ff80;
+    white-space: pre-line;
+}
+
 #changes-list *[data-stub-value = 'description'] {
     font-size: .8em;
     color: gray;
index d914168..1b031ca 100644 (file)
         $elem.removeClass('row-stub');
         params.container.append($elem);
 
-        $('*[data-stub-value]', $elem).each(function() {
-            var $this = $(this);
+        var populate = function($this) {
             var field = $this.attr('data-stub-value');
 
             var value = params.data[field];
                 $this.removeAttr('data-stub-target');
                 $this.removeAttr('data-stub-value');
             }
-        });
+        }
+        if ($elem.attr('data-stub-value')) populate($elem);
+        $('*[data-stub-value]', $elem).each(function() {populate($(this))});
 
         $elem.show();
         return $elem;
         $.ajax("/editor/editor-user-area/", {
             success: function(d) {
                 $("#user-area")[0].innerHTML = d;
+                $('#history-view-editor').toggleClass('can-approve', $('#user-area #pubmark_dialog').length > 0);
             }
         });
     }, false);
index 6d20493..7d0126e 100644 (file)
 
             $("input[name='pubmark-id']", this.$form).val(CurrentDocument.id);
             $("input[name='pubmark-revision']", this.$form).val(options.revision);
-
+            if (options.approved) {
+                $("input[name='pubmark-publishable']", this.$form).prop('checked');
+            } else {
+                $("input[name='pubmark-publishable']", this.$form).removeProp('checked');
+            }
         }
 
         cancelAction() {
index def2bb6..9ce518c 100644 (file)
                     attr('disabled', null);
             });
 
+            $(document).on('click', '#changes-list .entry .approved', function(){
+                $("#changes-list .entry.selected").removeClass('selected');
+                $(this).closest('.entry').click();
+                self.showPubmarkForm();
+                return false;
+            })
             $(document).on('click', '#changes-list span.tag', function(event){
                 return false;
             });
             }
 
             var version = parseInt($("*[data-stub-value='version']", selected[0]).text());
-            $.wiki.showDialog('#pubmark_dialog', {'revision': version});
+            var approved = selected.attr('data-approved') == 'true';
+            $.wiki.showDialog('#pubmark_dialog', {'revision': version, 'approved': !approved});
         }
 
         makeDiff() {
index cff6321..b8c448a 100644 (file)
@@ -1,10 +1,24 @@
 from django.contrib import admin
+from django.contrib.auth.admin import UserAdmin
+from django.contrib.auth.models import User
 from . import models
 
 
-@admin.register(models.Profile)
-class ProfileAdmin(admin.ModelAdmin):
-    list_display = ['user', 'presence']
+class ProfileInline(admin.StackedInline):
+    model = models.Profile
+    can_delete = False
+
+
+class CustomUserAdmin(UserAdmin):
+    inlines = (ProfileInline, )
+
+    def get_inline_instances(self, request, obj=None):
+        if not obj:
+            return list()
+        return super(CustomUserAdmin, self).get_inline_instances(request, obj)
+
+admin.site.unregister(User)
+admin.site.register(User, CustomUserAdmin)
 
 
 @admin.register(models.Presence)
diff --git a/src/team/migrations/0002_profile_approve_by_default.py b/src/team/migrations/0002_profile_approve_by_default.py
new file mode 100644 (file)
index 0000000..7827fea
--- /dev/null
@@ -0,0 +1,19 @@
+# Generated by Django 4.1.9 on 2023-10-10 15:28
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("team", "0001_initial"),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name="profile",
+            name="approve_by_default",
+            field=models.BooleanField(default=False),
+            preserve_default=False,
+        ),
+    ]
index 05372c4..6e53dd3 100644 (file)
@@ -6,6 +6,13 @@ from django.utils.timezone import now
 class Profile(models.Model):
     user = models.OneToOneField(settings.AUTH_USER_MODEL, models.CASCADE)
     presence = models.BooleanField()
+    approve_by_default = models.BooleanField()
+
+    class Meta:
+        verbose_name = verbose_name_plural = 'profil'
+
+    def __str__(self):
+        return self.user.username
 
 
 class Presence(models.Model):
index 4619467..f7827bc 100644 (file)
@@ -9,12 +9,12 @@ from documents.models import Chunk
 
 class DocumentPubmarkForm(forms.Form):
     """
-        Form for marking revisions for publishing.
+        Form for approving revisions.
     """
 
     id = forms.CharField(widget=forms.HiddenInput)
     publishable = forms.BooleanField(required=False, initial=True,
-            label=_('Publishable'))
+            label=_('Approved'))
     revision = forms.IntegerField(widget=forms.HiddenInput)
 
 
@@ -58,8 +58,8 @@ class DocumentTextSaveForm(forms.Form):
     )
 
     publishable = forms.BooleanField(required=False, initial=False,
-        label=_('Publishable'),
-        help_text=_(u"Mark this revision as publishable.")
+        label=_('Approve'),
+        help_text=_("Approve this revision.")
     )
 
     def __init__(self, *args, **kwargs):
@@ -68,6 +68,14 @@ class DocumentTextSaveForm(forms.Form):
         if user and user.is_authenticated:
             self.fields['author_name'].required = False
             self.fields['author_email'].required = False
+            try:
+                user.profile
+            except:
+                pass
+            else:
+                if user.profile.approve_by_default:
+                    self.fields['publishable'].initial = True
+
         return r
 
 
index 07d83ef..4ac2575 100644 (file)
Binary files a/src/wiki/locale/pl/LC_MESSAGES/django.mo and b/src/wiki/locale/pl/LC_MESSAGES/django.mo differ
index 1b2f1b6..0866257 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Platforma Redakcyjna\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2023-06-27 11:54+0200\n"
+"PO-Revision-Date: 2023-10-10 15:18+0200\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org."
 "pl>\n"
@@ -17,27 +17,27 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "X-Generator: Poedit 3.0.1\n"
 
-#: wiki/forms.py:17 wiki/forms.py:61 wiki/views.py:303
-msgid "Publishable"
-msgstr "Gotowe do publikacji"
+#: wiki/forms.py:17
+msgid "Approved"
+msgstr "Zatwierdzona"
 
-#: wiki/forms.py:36 wiki/forms.py:87
+#: wiki/forms.py:36 wiki/forms.py:95
 msgid "Author"
 msgstr "Autor"
 
-#: wiki/forms.py:37 wiki/forms.py:88
+#: wiki/forms.py:37 wiki/forms.py:96
 msgid "Your name"
 msgstr "Imię i nazwisko"
 
-#: wiki/forms.py:42 wiki/forms.py:93
+#: wiki/forms.py:42 wiki/forms.py:101
 msgid "Author's email"
 msgstr "E-mail autora"
 
-#: wiki/forms.py:43 wiki/forms.py:94
+#: wiki/forms.py:43 wiki/forms.py:102
 msgid "Your email address, so we can show a gravatar :)"
 msgstr "Adres e-mail, żebyśmy mogli pokazać gravatar :)"
 
-#: wiki/forms.py:49 wiki/forms.py:100
+#: wiki/forms.py:49 wiki/forms.py:108
 msgid "Your comments"
 msgstr "Twój komentarz"
 
@@ -53,11 +53,15 @@ msgstr "Ukończono"
 msgid "If you completed a life cycle stage, select it."
 msgstr "Jeśli został ukończony etap prac, wskaż go."
 
+#: wiki/forms.py:61 wiki/templates/wiki/tabs/history_view.html:8
+msgid "Approve"
+msgstr "Zatwierdź"
+
 #: wiki/forms.py:62
-msgid "Mark this revision as publishable."
-msgstr "Oznacz tę wersję jako gotową do publikacji."
+msgid "Approve this revision."
+msgstr "Zatwierdź tę wersję."
 
-#: wiki/forms.py:101
+#: wiki/forms.py:109
 msgid "Describe the reason for reverting."
 msgstr "Opisz powód przywrócenia."
 
@@ -85,40 +89,44 @@ msgstr "Stara wersja"
 msgid "New version"
 msgstr "Nowa wersja"
 
-#: wiki/templates/wiki/document_details.html:39
+#: wiki/templates/wiki/document_details.html:46
 msgid "Click to open/close gallery"
 msgstr "Kliknij, aby (ro)zwinąć galerię"
 
-#: wiki/templates/wiki/document_details_base.html:51
+#: wiki/templates/wiki/document_details_base.html:56
 msgid "Help"
 msgstr "Pomoc"
 
-#: wiki/templates/wiki/document_details_base.html:62
+#: wiki/templates/wiki/document_details_base.html:67
 msgid "Version"
 msgstr "Wersja"
 
-#: wiki/templates/wiki/document_details_base.html:62
+#: wiki/templates/wiki/document_details_base.html:67
 msgid "Unknown"
 msgstr "Nieznana"
 
-#: wiki/templates/wiki/document_details_base.html:64
+#: wiki/templates/wiki/document_details_base.html:69
 #: wiki/templates/wiki/pubmark_dialog.html:16
 msgid "Save"
 msgstr "Zapisz"
 
-#: wiki/templates/wiki/document_details_base.html:65
+#: wiki/templates/wiki/document_details_base.html:70
 msgid "Save attempt in progress"
 msgstr "Trwa zapisywanie"
 
-#: wiki/templates/wiki/document_details_base.html:66
+#: wiki/templates/wiki/document_details_base.html:71
 msgid "There is a newer version of this document!"
 msgstr "Istnieje nowsza wersja tego dokumentu!"
 
+#: wiki/templates/wiki/gallery_dialog.html:8
 #: wiki/templates/wiki/media_dialog.html:8
+#: wiki/templates/wiki/meta_chooser.html:8
 msgid "Choose"
 msgstr "Wybierz"
 
+#: wiki/templates/wiki/gallery_dialog.html:9
 #: wiki/templates/wiki/media_dialog.html:9
+#: wiki/templates/wiki/meta_chooser.html:9
 #: wiki/templates/wiki/pubmark_dialog.html:17
 #: wiki/templates/wiki/revert_dialog.html:40
 msgid "Cancel"
@@ -136,15 +144,15 @@ msgstr "wszystkie"
 msgid "Annotations"
 msgstr "Przypisy"
 
-#: wiki/templates/wiki/tabs/gallery_view.html:7
+#: wiki/templates/wiki/tabs/gallery_view.html:8
 msgid "Go to first image of this part"
 msgstr "Przejdź na początek"
 
-#: wiki/templates/wiki/tabs/gallery_view.html:10
+#: wiki/templates/wiki/tabs/gallery_view.html:11
 msgid "Previous"
 msgstr "Poprzednie"
 
-#: wiki/templates/wiki/tabs/gallery_view.html:21
+#: wiki/templates/wiki/tabs/gallery_view.html:22
 msgid "Next"
 msgstr "Następne"
 
@@ -156,15 +164,11 @@ msgstr "Galeria"
 msgid "Compare versions"
 msgstr "Porównaj wersje"
 
-#: wiki/templates/wiki/tabs/history_view.html:9
-msgid "Mark for publishing"
-msgstr "Oznacz do publikacji"
-
-#: wiki/templates/wiki/tabs/history_view.html:12
+#: wiki/templates/wiki/tabs/history_view.html:10
 msgid "Revert document"
 msgstr "Przywróć wersję"
 
-#: wiki/templates/wiki/tabs/history_view.html:15
+#: wiki/templates/wiki/tabs/history_view.html:13
 msgid "View version"
 msgstr "Zobacz wersję"
 
@@ -219,49 +223,33 @@ msgstr "Kod źródłowy"
 msgid "Refresh from working copy"
 msgstr "Odśwież z edytowanej wersji"
 
-#: wiki/templates/wiki/tabs/summary_view.html:15
-msgid "Title"
-msgstr "Tytuł"
-
-#: wiki/templates/wiki/tabs/summary_view.html:19
+#: wiki/templates/wiki/tabs/summary_view.html:17
 msgid "Go to the book's page"
 msgstr "Przejdź do strony książki"
 
-#: wiki/templates/wiki/tabs/summary_view.html:22
+#: wiki/templates/wiki/tabs/summary_view.html:20
 msgid "Document ID"
 msgstr "ID dokumentu"
 
-#: wiki/templates/wiki/tabs/summary_view.html:26
-msgid "Current version"
-msgstr "Aktualna wersja"
-
-#: wiki/templates/wiki/tabs/summary_view.html:30
-msgid "Last edited by"
-msgstr "Ostatnio edytowane przez"
-
-#: wiki/templates/wiki/tabs/summary_view.html:34
-msgid "Link to gallery"
-msgstr "Link do galerii"
-
-#: wiki/templates/wiki/tabs/summary_view.html:39
+#: wiki/templates/wiki/tabs/summary_view.html:24
 msgid "Characters in document"
 msgstr "Znaków w dokumencie"
 
-#: wiki/templates/wiki/tabs/summary_view.html:41
-#: wiki/templates/wiki/tabs/summary_view.html:42
-#: wiki/templates/wiki/tabs/summary_view.html:45
+#: wiki/templates/wiki/tabs/summary_view.html:26
+#: wiki/templates/wiki/tabs/summary_view.html:27
+#: wiki/templates/wiki/tabs/summary_view.html:30
 msgid "pages"
 msgstr "stron maszynopisu"
 
-#: wiki/templates/wiki/tabs/summary_view.html:41
+#: wiki/templates/wiki/tabs/summary_view.html:26
 msgid "without footnotes and themes"
 msgstr "bez przypisów i motywów"
 
-#: wiki/templates/wiki/tabs/summary_view.html:42
+#: wiki/templates/wiki/tabs/summary_view.html:27
 msgid "with footnotes and themes"
 msgstr "z przypisami i motywami"
 
-#: wiki/templates/wiki/tabs/summary_view.html:45
+#: wiki/templates/wiki/tabs/summary_view.html:30
 msgid "untagged"
 msgstr "nieotagowane"
 
@@ -287,18 +275,39 @@ msgstr "Wstaw referencję"
 msgid "Visual editor"
 msgstr "Edytor wizualny"
 
-#: wiki/views.py:305
+#: wiki/views.py:326
 msgid "Published"
 msgstr "Opublikowano"
 
-#: wiki/views.py:326
+#: wiki/views.py:347
 msgid "Revision marked"
 msgstr "Wersja oznaczona"
 
-#: wiki/views.py:328
+#: wiki/views.py:349
 msgid "Nothing changed"
 msgstr "Nic nie uległo zmianie"
 
+#~ msgid "Publishable"
+#~ msgstr "Gotowe do publikacji"
+
+#~ msgid "Mark this revision as publishable."
+#~ msgstr "Oznacz tę wersję jako gotową do publikacji."
+
+#~ msgid "Mark for publishing"
+#~ msgstr "Oznacz do publikacji"
+
+#~ msgid "Title"
+#~ msgstr "Tytuł"
+
+#~ msgid "Current version"
+#~ msgstr "Aktualna wersja"
+
+#~ msgid "Last edited by"
+#~ msgstr "Ostatnio edytowane przez"
+
+#~ msgid "Link to gallery"
+#~ msgstr "Link do galerii"
+
 #~ msgid "Zoom in"
 #~ msgstr "Powiększ"
 
index 1384fb6..ba2388e 100644 (file)
@@ -1,13 +1,11 @@
 {% load i18n %}
-<div id="history-view-editor" class="editor" style="display: none">
+<div id="history-view-editor" class="editor {% if can_pubmark %}can-approve{% endif %}" style="display: none">
   <div class="toolbar navbar navbar-dark bg-secondary">
     <div class="nav">
       <button type="button" id="make-diff-button" class="btn btn-info mr-2"
               data-enabled-when="2" disabled="disabled">{% trans "Compare versions" %}</button>
-      {% if can_pubmark %}
-        <button type="button" id="pubmark-changeset-button" class="btn btn-info mr-2"
-                data-enabled-when="1" disabled="disabled">{% trans "Mark for publishing" %}</button>
-      {% endif %}
+      <button type="button" id="pubmark-changeset-button" class="btn btn-info mr-2"
+                data-enabled-when="1" disabled="disabled">{% trans "Approve" %}</button>
       <button type="button" id="doc-revert-button" class="btn btn-info mr-2"
               data-enabled-when="1" disabled="disabled">{% trans "Revert document" %}</button>
       <button id="open-preview-button" disabled="disabled" class="btn btn-info mr-2"
@@ -21,7 +19,7 @@
       <tbody id="changes-list">
       </tbody>
       <tbody style="display: none;">
-       <tr class="entry row-stub">
+       <tr data-stub-value="publishable" data-stub-target="data-approved" class="entry row-stub">
          <td data-stub-value="version"></td>
          <td>
             <span data-stub-value="date"></span>
@@ -30,7 +28,7 @@
            <span data-stub-value="description"></span>
          </td>
          <td>
-            <div data-stub-value="publishable"></div>
+            <div class="approved"></div>
             <div data-stub-value="published"></div>
             <div data-stub-value="tag"></div>
          </td>
index 26f031b..aea4439 100644 (file)
@@ -321,7 +321,7 @@ def history(request, chunk_id):
                 "description": change.description,
                 "author": change.author_str(),
                 "date": localize(change.created_at),
-                "publishable": _("Publishable") + "\n" if change.publishable else "",
+                "publishable": change.publishable,
                 "tag": ',\n'.join(str(tag) for tag in change.tags.all()),
                 "published": _("Published") + ": " + \
                     localize(change.publish_log.order_by('-book_record__timestamp')[0].book_record.timestamp) \