diff mbox

[36/51] series: Only show the edit icon when the series is editable

Message ID 1441986924-26689-37-git-send-email-damien.lespiau@intel.com
State Superseded
Headers show

Commit Message

Damien Lespiau Sept. 11, 2015, 3:55 p.m. UTC
While the permissions are enforced at the API level, people will be
upset if allow them to see the edition widget but deny the edit when
saving the new field.

So let's not show any edit icon when we're not allowed to edit an
object.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 patchwork/templates/patchwork/series.html | 2 ++
 patchwork/views/series.py                 | 1 +
 2 files changed, 3 insertions(+)
diff mbox

Patch

diff --git a/patchwork/templates/patchwork/series.html b/patchwork/templates/patchwork/series.html
index 3826647..0691354 100644
--- a/patchwork/templates/patchwork/series.html
+++ b/patchwork/templates/patchwork/series.html
@@ -55,7 +55,9 @@  $(function () {
         <em class="text-muted">None</em>
 {% endif %}
         </span>
+{% if is_editable %}
         <span class="glyphicon glyphicon-pencil" ></span>
+{% endif %}
       </span>
       <div id="edit-reviewer" class="form-inline" style="display:none;">
         <div class="form-group">
diff --git a/patchwork/views/series.py b/patchwork/views/series.py
index 785c3a9..27c6aab 100644
--- a/patchwork/views/series.py
+++ b/patchwork/views/series.py
@@ -37,6 +37,7 @@  class SeriesView(View):
         return render(request, 'patchwork/series.html', {
             'series': series,
             'project': series.project,
+            'is_editable': series.project.is_editable(request.user),
             'cover_letter': revision.cover_letter,
             'patches': revision.patches.all(),
         })