diff options
-rw-r--r-- | pytask/static/css/base.css | 2 | ||||
-rwxr-xr-x | pytask/taskapp/views.py | 16 | ||||
-rw-r--r-- | pytask/templates/task/view_textbook.html | 18 |
3 files changed, 22 insertions, 14 deletions
diff --git a/pytask/static/css/base.css b/pytask/static/css/base.css index e8a4a6e..f926b00 100644 --- a/pytask/static/css/base.css +++ b/pytask/static/css/base.css @@ -185,7 +185,7 @@ h1 { #footer a:hover { color: #ccc; text-decoration: none; -} +} /* Form Related CSS definitions */ div #form { diff --git a/pytask/taskapp/views.py b/pytask/taskapp/views.py index f03b6ef..e8e8ea5 100755 --- a/pytask/taskapp/views.py +++ b/pytask/taskapp/views.py @@ -476,11 +476,19 @@ def view_textbook(request, task_id): context.update(csrf(request)) - can_edit = True if user == textbook.created_by and textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]\ - else False + if (user == textbook.created_by and + textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]): + can_edit = True + else: + can_edit = False - can_approve = True if profile.role in [profile_models.ROLES_CHOICES[0][0], profile_models.ROLES_CHOICES[1][0]] and \ - textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0] else False + + if (profile.role in [profile_models.ROLES_CHOICES[0][0], + profile_models.ROLES_CHOICES[1][0]] and + textbook.status == taskapp_models.TB_STATUS_CHOICES[0][0]): + can_approve = True + else: + can_approve = False context.update({"can_edit": can_edit, "can_approve": can_approve}) diff --git a/pytask/templates/task/view_textbook.html b/pytask/templates/task/view_textbook.html index 927352d..d666a6e 100644 --- a/pytask/templates/task/view_textbook.html +++ b/pytask/templates/task/view_textbook.html @@ -1,5 +1,6 @@ {% extends "base.html" %} + {% load form_helpers %} {% load browse_helpers %} @@ -31,15 +32,14 @@ {% endif %} {% if chapters %} - Chapters: <br /> - <table> - {% for chap in chapters %} - <tr> - <td><a href="{% url view_task chap.id %}">{{chap.title}}</a> </td> - <td> {{chap.status}} </td> - </tr> - {% endfor %} - </table> + <table> + {% for chap in chapters %} + <tr> + <td><a href="{% url view_task chap.id %}">{{chap.title}}</a> </td> + <td> {{chap.status}} </td> + </tr> + {% endfor %} + </table> {% else %} There are no chapters in this textbook as of now.<br /> {% endif %} |