From b4e4e61184b017ecbe3c3664ba916388947b49d2 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 3 Jun 2016 01:36:09 -0500 Subject: [PATCH] Show functionality only for users with the ability to edit labels --- app/views/projects/labels/index.html.haml | 26 ++++++++++++----------- app/views/shared/_label_row.html.haml | 13 ++++++------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index 82fb602983..0450f51204 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -1,4 +1,5 @@ - page_title "Labels" +- hide_class = '' .top-area .nav-text @@ -10,19 +11,20 @@ New label .labels - - hide_class = '' - -# Only show it in the first page - - if (params[:page].present? and params[:page] != '1') or @project.labels.blank? or (params[:page] == nil and @project.labels.blank?) - - hide_class = 'hide' - .prioritized-labels{ class: hide_class } - %h5 Prioritized Labels - %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } - - if @prioritized_labels.present? - = render @prioritized_labels - - else - %p.empty-message No prioritized labels yet + - if can?(current_user, :admin_label, @project) + -# Only show it in the first page + - if (params[:page].present? and params[:page] != '1') or @project.labels.blank? or (params[:page] == nil and @project.labels.blank?) + - hide_class = 'hide' + .prioritized-labels{ class: hide_class } + %h5 Prioritized Labels + %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } + - if @prioritized_labels.present? + = render @prioritized_labels + - else + %p.empty-message No prioritized labels yet .other-labels - %h5{ class: hide_class } Other Labels + - if can?(current_user, :admin_label, @project) + %h5{ class: hide_class } Other Labels - if @labels.present? %ul.content-list.manage-labels-list.js-other-labels = render @labels diff --git a/app/views/shared/_label_row.html.haml b/app/views/shared/_label_row.html.haml index 41d7411f3f..c53f32d97e 100644 --- a/app/views/shared/_label_row.html.haml +++ b/app/views/shared/_label_row.html.haml @@ -1,10 +1,11 @@ %span.label-row - .js-toggle-priority.toggle-priority{ data: { url: remove_priority_namespace_project_label_path(@project.namespace, @project, label), - dom_id: dom_id(label) } } - %button.add-priority.btn.has-tooltip{ title: 'Prioritize', :'data-placement' => 'top' } - = icon('star-o') - %button.remove-priority.btn.has-tooltip{ title: 'Remove priority', :'data-placement' => 'top' } - = icon('star') + - if can? current_user, :admin_label, @project + .js-toggle-priority.toggle-priority{ data: { url: remove_priority_namespace_project_label_path(@project.namespace, @project, label), + dom_id: dom_id(label) } } + %button.add-priority.btn.has-tooltip{ title: 'Prioritize', :'data-placement' => 'top' } + = icon('star-o') + %button.remove-priority.btn.has-tooltip{ title: 'Remove priority', :'data-placement' => 'top' } + = icon('star') %span.label-name = link_to_label(label, tooltip: false) %span.prepend-left-10