From 66ca8ccde550445b323a6395e0c90a3999cd2924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Sun, 24 Aug 2014 17:20:06 +0200 Subject: [PATCH] Added direct links to admin site if user is staff for series, volumes and publishers Added context manager with the user configuration (not implemented) and user is staff bool --- fabfile.py | 2 ++ shelfzilla/apps/users/context_processors.py | 12 +++++++++ shelfzilla/locale/es/LC_MESSAGES/django.mo | Bin 4719 -> 4768 bytes shelfzilla/locale/es/LC_MESSAGES/django.po | 25 +++++++++++------- shelfzilla/settings/base.py | 2 ++ .../themes/bootflat/static/less/fixes.less | 5 ++++ .../templates/manga/publishers/detail.html | 6 +++++ .../templates/manga/series/detail.html | 6 +++++ .../manga/series/includes/volume.html | 7 +++++ .../bootflat/templates/users/profile.html | 2 +- .../templates/users/profile/summary.html | 6 +++-- 11 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 shelfzilla/apps/users/context_processors.py diff --git a/fabfile.py b/fabfile.py index 44f30fe..e3055b5 100644 --- a/fabfile.py +++ b/fabfile.py @@ -241,6 +241,7 @@ def makemessages(): run('django-admin.py makemessages -l es', quiet=True) """ +@task_environment @task def clean_backups(BCK_BASE_PATH='/backups/sql', DAYS='30'): """ @@ -250,6 +251,7 @@ def clean_backups(BCK_BASE_PATH='/backups/sql', DAYS='30'): with settings(hide('warnings', 'running', 'stdout', 'stderr')): local('find %s -mtime +%s -exec rm -rf {} \;' % (BCK_BASE_PATH, DAYS)) +@task_environment @task def backup(): """ diff --git a/shelfzilla/apps/users/context_processors.py b/shelfzilla/apps/users/context_processors.py new file mode 100644 index 0000000..7f37edc --- /dev/null +++ b/shelfzilla/apps/users/context_processors.py @@ -0,0 +1,12 @@ +def user_is_staff(request): + return { + 'USER_IS_STAFF': request.user.is_staff + } + + +def user_configuration(request): + return { + 'USER_CONFIG': { + 'show_admin_links': False + } + } diff --git a/shelfzilla/locale/es/LC_MESSAGES/django.mo b/shelfzilla/locale/es/LC_MESSAGES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p;H^|KxJwdYJM6OSSxDXcGS2I zmx3ZWZ#%A9v#2l2p?)0&R4U)1CVsa4-%tSuSY7SwP#ZbCbXgmbA!ZNiE@V*S+K|V% zXL&24OV(c0*<43uW*D{5J=_1pwvV9}dXCD(1ZvzQYNJ`yIzOy_@=wuJqmFPhGT$|O z{}s#u)EOSO^)sk1?nDLBXWO&3eis#Z9yj8B?7#_B#**Y;89aizyj`fkdQce~z@&cv zc?w!+$~uje)aP(LE~3t`hI5kjsDQSkj&3(E-GM`xz&_MnC|aMPGBu70>;>vBeNtT! m`N)%l4%Xqp!6DzvVwZo+>uG2jj0fwX*b)qRirwYge18BmmU{jG diff --git a/shelfzilla/locale/es/LC_MESSAGES/django.po b/shelfzilla/locale/es/LC_MESSAGES/django.po index 93e5f68..7e6c619 100644 --- a/shelfzilla/locale/es/LC_MESSAGES/django.po +++ b/shelfzilla/locale/es/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-08-24 17:04+0200\n" -"PO-Revision-Date: 2014-08-24 17:04+0200\n" +"POT-Creation-Date: 2014-08-24 17:18+0200\n" +"PO-Revision-Date: 2014-08-24 17:18+0200\n" "Last-Translator: Felipe Martin \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -115,7 +115,7 @@ msgstr "Editorial" #: apps/manga/models.py:54 themes/bootflat/templates/_layout.html:36 #: themes/bootflat/templates/manga/publishers/list.html:4 -#: themes/bootflat/templates/manga/series/detail.html:64 +#: themes/bootflat/templates/manga/series/detail.html:70 msgid "Publishers" msgstr "Editoriales" @@ -124,7 +124,7 @@ msgid "Summary" msgstr "Resumen" #: apps/manga/models.py:62 -#: themes/bootflat/templates/manga/series/detail.html:25 +#: themes/bootflat/templates/manga/series/detail.html:31 msgid "Finished" msgstr "Finalizado" @@ -326,7 +326,7 @@ msgstr "Sin resultados" #: themes/bootflat/templates/manga/publishers/detail.html:14 #: themes/bootflat/templates/manga/publishers/detail.html:43 -#: themes/bootflat/templates/manga/series/detail.html:19 +#: themes/bootflat/templates/manga/series/detail.html:25 #: themes/bootflat/templates/manga/series/includes/volume.html:25 msgid "Requires review" msgstr "Requiere revisión" @@ -335,23 +335,28 @@ msgstr "Requiere revisión" msgid "Homepage" msgstr "Página principal" -#: themes/bootflat/templates/manga/series/detail.html:23 +#: themes/bootflat/templates/manga/series/detail.html:10 +#: themes/bootflat/templates/manga/series/includes/volume.html:42 +msgid "Edit in admin" +msgstr "Editar en el admin" + +#: themes/bootflat/templates/manga/series/detail.html:29 msgid "Status" msgstr "Estado" -#: themes/bootflat/templates/manga/series/detail.html:27 +#: themes/bootflat/templates/manga/series/detail.html:33 msgid "Open" msgstr "Abierta" -#: themes/bootflat/templates/manga/series/detail.html:35 +#: themes/bootflat/templates/manga/series/detail.html:41 msgid "Art" msgstr "Arte" -#: themes/bootflat/templates/manga/series/detail.html:50 +#: themes/bootflat/templates/manga/series/detail.html:56 msgid "Story" msgstr "Historia" -#: themes/bootflat/templates/manga/series/detail.html:69 +#: themes/bootflat/templates/manga/series/detail.html:75 msgid "Original publisher" msgstr "Editorial original" diff --git a/shelfzilla/settings/base.py b/shelfzilla/settings/base.py index 7ab6d5e..4c0a07d 100644 --- a/shelfzilla/settings/base.py +++ b/shelfzilla/settings/base.py @@ -79,6 +79,8 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'shelfzilla.apps.pjax.context_processors.pjax', 'shelfzilla.apps.manga.context_processors.user_have_volumes', 'shelfzilla.apps.manga.context_processors.user_wishlisted_volumes', + 'shelfzilla.apps.users.context_processors.user_is_staff', + 'shelfzilla.apps.users.context_processors.user_configuration', ) MIDDLEWARE_CLASSES = ( diff --git a/shelfzilla/themes/bootflat/static/less/fixes.less b/shelfzilla/themes/bootflat/static/less/fixes.less index 47f1b06..053490b 100644 --- a/shelfzilla/themes/bootflat/static/less/fixes.less +++ b/shelfzilla/themes/bootflat/static/less/fixes.less @@ -53,6 +53,11 @@ width: @size; } } + + .admin { + position: absolute; + bottom: 10px; + } } .navbar-nav { diff --git a/shelfzilla/themes/bootflat/templates/manga/publishers/detail.html b/shelfzilla/themes/bootflat/templates/manga/publishers/detail.html index a5e5174..2e88241 100644 --- a/shelfzilla/themes/bootflat/templates/manga/publishers/detail.html +++ b/shelfzilla/themes/bootflat/templates/manga/publishers/detail.html @@ -5,6 +5,12 @@ {% block main_content %}
+ {% if USER_IS_STAFF and USER_CONFIG.show_admin_links %} + +
+ {% endif %}
diff --git a/shelfzilla/themes/bootflat/templates/manga/series/detail.html b/shelfzilla/themes/bootflat/templates/manga/series/detail.html index 483978d..7ba9606 100644 --- a/shelfzilla/themes/bootflat/templates/manga/series/detail.html +++ b/shelfzilla/themes/bootflat/templates/manga/series/detail.html @@ -5,6 +5,12 @@ {% block main_content %}
+ {% if USER_IS_STAFF and USER_CONFIG.show_admin_links %} + +
+ {% endif %}
diff --git a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html index 16d93e5..b531fea 100644 --- a/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html +++ b/shelfzilla/themes/bootflat/templates/manga/series/includes/volume.html @@ -35,4 +35,11 @@ {% endif %}
+ {% if USER_IS_STAFF and USER_CONFIG.show_admin_links %} + + {% endif %}
diff --git a/shelfzilla/themes/bootflat/templates/users/profile.html b/shelfzilla/themes/bootflat/templates/users/profile.html index cc2cff4..6891fe8 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile.html +++ b/shelfzilla/themes/bootflat/templates/users/profile.html @@ -40,7 +40,7 @@
- +
diff --git a/shelfzilla/themes/bootflat/templates/users/profile/summary.html b/shelfzilla/themes/bootflat/templates/users/profile/summary.html index 55a5d5e..612121e 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile/summary.html +++ b/shelfzilla/themes/bootflat/templates/users/profile/summary.html @@ -7,18 +7,19 @@ {% block profile_content %}
-
+

{{ user.have_volumes.count }}

{% trans "Volumes owned" %}
-
+

{{ user.wishlisted_volumes.count }}

{% trans "Volumes wishlisted" %}
+ {% comment %}

--

@@ -31,6 +32,7 @@ Other
+ {% endcomment %}

Interesting. No, wait, the other thing: tedious. What are you hacking off? Is it my torso?! 'It is!' My precious torso! Yes, if you make it look like an electrical fire. When you do things right, people won't be sure you've done anything at all. Take me to your leader! Ven ve voke up, ve had zese wodies.