From 52e81fb2db5803482ae536719309df181af8b92c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 16 Jul 2013 13:22:31 +0200 Subject: [PATCH] Projects in context menu. --- .../catalogue/locale/pl/LC_MESSAGES/django.mo | Bin 6858 -> 6890 bytes .../catalogue/locale/pl/LC_MESSAGES/django.po | 45 ++++++++++-------- .../catalogue/book_list/book_list.html | 2 +- apps/catalogue/views.py | 13 ++++- redakcja/static/js/catalogue/book_list.js | 8 ++++ 5 files changed, 46 insertions(+), 22 deletions(-) diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index fa4fb650f81873fc9a3f6102e31de798dabd8988..b6a12e32adb8df9ea567ba9cd27893235a73017b 100644 GIT binary patch delta 2355 zcmYk-drXye9LMo*aySQ#fH(y4I|ut+uwBxA*7xwe{?LpV#yIJ-_F7`98k~ z2C9Fp4u-QsyN#oZ$R}P)F;m5*Fei@Y(PlZg1k-RG(!`!ae)hbV1H75?cCUW}Z=<}= z>p#X2Y4OEBfpaE~kW{hG7^0SvXX~I32jeAimJ&alS zHEQCgkQLgG?jM**IhD?p(Xm*<_*TY+ZnUCixE5(^-KdVYU?(O}9bfVLVbY;;Hfn+~ z-8hEpo#y;zFxVGIXQ6Zjc5!I2E|ubKZvg;p9N4SFyi)!}&53a5B|C8}KwYGsR1 z?bf&*sOL8zbF@vUfp)k(UjI6(-8-4&UmYBvLLTx4M^FQQiJEc0-ycF{<}@m$=TPtb zcU0;xqcSyyN)4Qk8mJi6|0J)k@cMYbg*vSD8}l)JlvyKArM{INru(~49VL)t**??+ z4x%#nDXLvR=HYj!42+=KT|#9pOk?f-Jk)bRE$2JAXhN;D8}-0u)Mng?8t_fO|2}H3 z97OuGJ}ku_P!rH7T4_3x42z=rn}8ap94F#Ztk?JdA{QFyII4q_r~$r3ZJGz6@Hnc!@9}ONLG3>)R?z zd*Qs_{|&XGzfm1q?)7&bL#@0F^_Mh`>aQ8Kf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}R7e>(c@))fHFGg3O99^0ESiTWc&Y(RO>_98_BEPVU zn-ven@{`fi=%GA|uEduy{~dbDFQH3(8U336h|jO1{f(nh>*bWO{=QH~fgR6AM_h%T z;v_oLRY={i0XQa#=J_`c?}}-;HQkb3w5aiaB@SvKQ4!19u!GnT^IOsfvP)BskZUKF#?qC@H$Qr@ z*WngoHt{5}j#xr?0KBRQ_H}f**5JK_SCa5pFCgwDJSg*t<-{st8R1gZdB*$;@Hp{U zx+bSQwVsp*@?pZOiC|&EYNCtq+DOzB?uI+#<>%{etRP(NwS?EBL?yv@apP)^sk!KX zFWmO~#>z6ngXs%7McW=A>!vIwJjVABejnY0mj|Ge*g+(S9%4K3-&I4Rg?NhCM6?oK v_Y?C7PwE{5YjQtH3}ojYP2^NBtEj22uSuql7gpTJ3|uTM$Ql?f`8)A1TK>G` diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.po b/apps/catalogue/locale/pl/LC_MESSAGES/django.po index 97006191..6790400c 100644 --- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Platforma Redakcyjna\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-09 10:15+0200\n" -"PO-Revision-Date: 2013-07-09 10:15+0100\n" +"POT-Creation-Date: 2013-07-16 13:22+0200\n" +"PO-Revision-Date: 2013-07-16 13:22+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: Fundacja Nowoczesna Polska \n" @@ -61,11 +61,11 @@ msgstr "Dokument o tym slugu już istnieje w repozytorium." msgid "File should be UTF-8 encoded." msgstr "Plik powinien mieć kodowanie UTF-8." -#: views.py:487 models/book.py:56 +#: views.py:498 models/book.py:56 msgid "books" msgstr "książki" -#: views.py:489 +#: views.py:500 msgid "scan gallery" msgstr "galeria skanów" @@ -145,7 +145,7 @@ msgstr "nazwa" msgid "notes" msgstr "notatki" -#: models/project.py:19 +#: models/project.py:19 templates/catalogue/book_list/book_list.html:62 msgid "project" msgstr "projekt" @@ -362,36 +362,37 @@ msgid "No activity recorded." msgstr "Nie zanotowano aktywności." #: templates/catalogue/book_list/book.html:7 -#: templates/catalogue/book_list/book.html:27 +#: templates/catalogue/book_list/book.html:28 msgid "Book settings" msgstr "Ustawienia książki" -#: templates/catalogue/book_list/book_list.html:21 +#: templates/catalogue/book_list/book_list.html:22 msgid "Show hidden books" msgstr "Pokaż ukryte książki" -#: templates/catalogue/book_list/book_list.html:26 +#: templates/catalogue/book_list/book_list.html:27 msgid "Search in book titles" msgstr "Szukaj w tytułach książek" -#: templates/catalogue/book_list/book_list.html:31 +#: templates/catalogue/book_list/book_list.html:32 msgid "stage" msgstr "etap" -#: templates/catalogue/book_list/book_list.html:33 -#: templates/catalogue/book_list/book_list.html:44 +#: templates/catalogue/book_list/book_list.html:34 +#: templates/catalogue/book_list/book_list.html:45 +#: templates/catalogue/book_list/book_list.html:64 msgid "none" msgstr "brak" -#: templates/catalogue/book_list/book_list.html:42 +#: templates/catalogue/book_list/book_list.html:43 msgid "editor" msgstr "redaktor" -#: templates/catalogue/book_list/book_list.html:53 +#: templates/catalogue/book_list/book_list.html:54 msgid "status" msgstr "status" -#: templates/catalogue/book_list/book_list.html:77 +#: templates/catalogue/book_list/book_list.html:88 #, python-format msgid "%(c)s book" msgid_plural "%(c)s books" @@ -399,27 +400,31 @@ msgstr[0] "%(c)s książka" msgstr[1] "%(c)s książki" msgstr[2] "%(c)s książek" -#: templates/catalogue/book_list/book_list.html:82 +#: templates/catalogue/book_list/book_list.html:93 msgid "No books found." msgstr "Nie znaleziono książek." -#: templates/catalogue/book_list/book_list.html:88 +#: templates/catalogue/book_list/book_list.html:99 msgid "Set stage" msgstr "Ustaw etap" -#: templates/catalogue/book_list/book_list.html:89 +#: templates/catalogue/book_list/book_list.html:100 msgid "Set user" msgstr "Przypisz redaktora" -#: templates/catalogue/book_list/book_list.html:91 +#: templates/catalogue/book_list/book_list.html:102 +msgid "Project" +msgstr "Projekt" + +#: templates/catalogue/book_list/book_list.html:103 msgid "Mark publishable" msgstr "Oznacz do publikacji" -#: templates/catalogue/book_list/book_list.html:92 +#: templates/catalogue/book_list/book_list.html:104 msgid "Mark not publishable" msgstr "Odznacz do publikacji" -#: templates/catalogue/book_list/book_list.html:93 +#: templates/catalogue/book_list/book_list.html:105 msgid "Other user" msgstr "Inny użytkownik" diff --git a/apps/catalogue/templates/catalogue/book_list/book_list.html b/apps/catalogue/templates/catalogue/book_list/book_list.html index 35537684..90ae183f 100755 --- a/apps/catalogue/templates/catalogue/book_list/book_list.html +++ b/apps/catalogue/templates/catalogue/book_list/book_list.html @@ -99,6 +99,7 @@ + @@ -110,4 +111,3 @@ {% endif %}value="{{ user.username }}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }}) {% endfor %} - diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 1436fc02..e1dc2a30 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -25,7 +25,7 @@ from apiclient import NotAuthorizedError from catalogue import forms from catalogue import helpers from catalogue.helpers import active_tab -from catalogue.models import Book, Chunk, BookPublishRecord, ChunkPublishRecord +from catalogue.models import Book, Chunk, BookPublishRecord, ChunkPublishRecord, Project from fileupload.views import UploadView # @@ -429,6 +429,17 @@ def chunk_mass_edit(request): for b in books_affected: b.touch() # cache + project_id = request.POST.get('project') + if project_id: + try: + project = Project.objects.get(pk=int(project_id)) + except (Project.DoesNotExist, ValueError), e: + project = None + for c in chunks: + book = c.book + book.project = project + book.save() + for c in chunks: c.save() return HttpResponse("", content_type="text/plain") diff --git a/redakcja/static/js/catalogue/book_list.js b/redakcja/static/js/catalogue/book_list.js index c0fbf37d..9dd1e413 100644 --- a/redakcja/static/js/catalogue/book_list.js +++ b/redakcja/static/js/catalogue/book_list.js @@ -88,6 +88,14 @@ name: $("label[for=mass_edit_publish]").text(), icon: "ok", }, + "project" :{ + name: $("label[for=mass_edit_project]").text(), + items: get_items("project"), + }, + "publish": { + name: $("label[for=mass_edit_publish]").text(), + icon: "ok", + }, "unpublish": { name: $("label[for=mass_edit_unpublish]").text(), icon: "stop", -- 2.20.1