fmartingr
/
shelfzilla
Archived
1
0
Fork 0

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
This commit is contained in:
Felipe Martín 2014-08-24 17:20:06 +02:00
parent a36ec8e795
commit 66ca8ccde5
11 changed files with 60 additions and 13 deletions

2
fabfile.py vendored
View File

@ -241,6 +241,7 @@ def makemessages():
run('django-admin.py makemessages -l es', quiet=True) run('django-admin.py makemessages -l es', quiet=True)
""" """
@task_environment
@task @task
def clean_backups(BCK_BASE_PATH='/backups/sql', DAYS='30'): 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')): with settings(hide('warnings', 'running', 'stdout', 'stderr')):
local('find %s -mtime +%s -exec rm -rf {} \;' % (BCK_BASE_PATH, DAYS)) local('find %s -mtime +%s -exec rm -rf {} \;' % (BCK_BASE_PATH, DAYS))
@task_environment
@task @task
def backup(): def backup():
""" """

View File

@ -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
}
}

View File

@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-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:04+0200\n" "PO-Revision-Date: 2014-08-24 17:18+0200\n"
"Last-Translator: Felipe Martin <fmartingr@me.com>\n" "Last-Translator: Felipe Martin <fmartingr@me.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -115,7 +115,7 @@ msgstr "Editorial"
#: apps/manga/models.py:54 themes/bootflat/templates/_layout.html:36 #: apps/manga/models.py:54 themes/bootflat/templates/_layout.html:36
#: themes/bootflat/templates/manga/publishers/list.html:4 #: 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" msgid "Publishers"
msgstr "Editoriales" msgstr "Editoriales"
@ -124,7 +124,7 @@ msgid "Summary"
msgstr "Resumen" msgstr "Resumen"
#: apps/manga/models.py:62 #: apps/manga/models.py:62
#: themes/bootflat/templates/manga/series/detail.html:25 #: themes/bootflat/templates/manga/series/detail.html:31
msgid "Finished" msgid "Finished"
msgstr "Finalizado" msgstr "Finalizado"
@ -326,7 +326,7 @@ msgstr "Sin resultados"
#: themes/bootflat/templates/manga/publishers/detail.html:14 #: themes/bootflat/templates/manga/publishers/detail.html:14
#: themes/bootflat/templates/manga/publishers/detail.html:43 #: 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 #: themes/bootflat/templates/manga/series/includes/volume.html:25
msgid "Requires review" msgid "Requires review"
msgstr "Requiere revisión" msgstr "Requiere revisión"
@ -335,23 +335,28 @@ msgstr "Requiere revisión"
msgid "Homepage" msgid "Homepage"
msgstr "Página principal" 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" msgid "Status"
msgstr "Estado" msgstr "Estado"
#: themes/bootflat/templates/manga/series/detail.html:27 #: themes/bootflat/templates/manga/series/detail.html:33
msgid "Open" msgid "Open"
msgstr "Abierta" msgstr "Abierta"
#: themes/bootflat/templates/manga/series/detail.html:35 #: themes/bootflat/templates/manga/series/detail.html:41
msgid "Art" msgid "Art"
msgstr "Arte" msgstr "Arte"
#: themes/bootflat/templates/manga/series/detail.html:50 #: themes/bootflat/templates/manga/series/detail.html:56
msgid "Story" msgid "Story"
msgstr "Historia" msgstr "Historia"
#: themes/bootflat/templates/manga/series/detail.html:69 #: themes/bootflat/templates/manga/series/detail.html:75
msgid "Original publisher" msgid "Original publisher"
msgstr "Editorial original" msgstr "Editorial original"

View File

@ -79,6 +79,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'shelfzilla.apps.pjax.context_processors.pjax', 'shelfzilla.apps.pjax.context_processors.pjax',
'shelfzilla.apps.manga.context_processors.user_have_volumes', 'shelfzilla.apps.manga.context_processors.user_have_volumes',
'shelfzilla.apps.manga.context_processors.user_wishlisted_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 = ( MIDDLEWARE_CLASSES = (

View File

@ -53,6 +53,11 @@
width: @size; width: @size;
} }
} }
.admin {
position: absolute;
bottom: 10px;
}
} }
.navbar-nav { .navbar-nav {

View File

@ -5,6 +5,12 @@
{% block main_content %} {% block main_content %}
<div class="container"> <div class="container">
{% if USER_IS_STAFF and USER_CONFIG.show_admin_links %}
<div class="text-right">
<a class="btn btn-info" href="{% url 'admin:manga_publisher_change' item.pk %}">{% trans "Edit in admin" %}</a>
</div>
<br />
{% endif %}
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<div class="panel panel-primary"> <div class="panel panel-primary">

View File

@ -5,6 +5,12 @@
{% block main_content %} {% block main_content %}
<div class="container"> <div class="container">
{% if USER_IS_STAFF and USER_CONFIG.show_admin_links %}
<div class="text-right">
<a class="btn btn-info" href="{% url 'admin:manga_series_change' item.pk %}">{% trans "Edit in admin" %}</a>
</div>
<br />
{% endif %}
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<div class="panel panel-warning"> <div class="panel panel-warning">

View File

@ -35,4 +35,11 @@
{% endif %} {% endif %}
</div> </div>
<img src="{% thumbnail volume.cover 150x150 %}" class="volume-cover max-width-80" /> <img src="{% thumbnail volume.cover 150x150 %}" class="volume-cover max-width-80" />
{% if USER_IS_STAFF and USER_CONFIG.show_admin_links %}
<div class="admin">
<a class="btn btn-info btn-xs"
href="{% url 'admin:manga_volume_change' volume.pk %}">
{% trans "Edit in admin" %}</a>
</div>
{% endif %}
</div> </div>

View File

@ -40,7 +40,7 @@
</div> </div>
</div> </div>
<div> <div>
<button class="btn btn-normal btn-block">{% trans "Edit my profile" %} <- NOT WORKING</button> <button class="btn btn-info btn-block">{% trans "Edit my profile" %}</button>
</div> </div>
</div> </div>
<div class="col-sm-9" data-pjax-container="profile"> <div class="col-sm-9" data-pjax-container="profile">

View File

@ -7,18 +7,19 @@
{% block profile_content %} {% block profile_content %}
<div class="row text-center"> <div class="row text-center">
<div class="col-sm-3"> <div class="col-sm-6">
<div class="well"> <div class="well">
<h2 class="no-margin-top">{{ user.have_volumes.count }}</h2> <h2 class="no-margin-top">{{ user.have_volumes.count }}</h2>
{% trans "Volumes owned" %} {% trans "Volumes owned" %}
</div> </div>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-6">
<div class="well"> <div class="well">
<h2 class="no-margin-top">{{ user.wishlisted_volumes.count }}</h2> <h2 class="no-margin-top">{{ user.wishlisted_volumes.count }}</h2>
{% trans "Volumes wishlisted" %} {% trans "Volumes wishlisted" %}
</div> </div>
</div> </div>
{% comment %}
<div class="col-sm-3"> <div class="col-sm-3">
<div class="well"> <div class="well">
<h2 class="no-margin-top">--</h2> <h2 class="no-margin-top">--</h2>
@ -31,6 +32,7 @@
Other Other
</div> </div>
</div> </div>
{% endcomment %}
</div> </div>
<div class="well"> <div class="well">
<p>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.</p> <p>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.</p>