diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-20 06:09:57 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 19:58:24 +0300 |
commit | bdb7bf4b5188ffd68e54cbf671ba9ce1a4ffb1d1 (patch) | |
tree | 3f53930ff56ab0cfeceb0ab3af75fe9b75fefebd /app/views | |
parent | bf9d928b45516e716b0f7f099361ca03aa1454f8 (diff) |
List group labels on project labels page
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/groups/labels/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/groups/labels/_label.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/labels/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/labels/_label.html.haml | 23 | ||||
-rw-r--r-- | app/views/projects/labels/destroy.js.haml | 2 | ||||
-rw-r--r-- | app/views/projects/labels/edit.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/labels/index.html.haml | 53 | ||||
-rw-r--r-- | app/views/projects/labels/new.html.haml | 3 | ||||
-rw-r--r-- | app/views/shared/_label_row.html.haml | 3 |
9 files changed, 56 insertions, 37 deletions
diff --git a/app/views/groups/labels/_form.html.haml b/app/views/groups/labels/_form.html.haml index 008b5fb9ba1..a0b44b0dcfb 100644 --- a/app/views/groups/labels/_form.html.haml +++ b/app/views/groups/labels/_form.html.haml @@ -30,4 +30,4 @@ = f.submit 'Save changes', class: 'btn btn-save js-save-button' - else = f.submit 'Create Label', class: 'btn btn-create js-save-button' - = link_to "Cancel", group_labels_path(@group), class: 'btn btn-cancel' + = link_to 'Cancel', @previous_labels_path, class: 'btn btn-cancel' diff --git a/app/views/groups/labels/_label.html.haml b/app/views/groups/labels/_label.html.haml index b9aab76f057..9faf90c303e 100644 --- a/app/views/groups/labels/_label.html.haml +++ b/app/views/groups/labels/_label.html.haml @@ -1,6 +1,6 @@ - label_css_id = dom_id(label) - open_issues_count = label.open_issues_count(current_user) -- open_merge_requests_count = label.open_merge_requests_count +- open_merge_requests_count = label.open_merge_requests_count(current_user) %li{id: label_css_id, data: { id: label.id } } = render 'label_row', label: label diff --git a/app/views/projects/labels/_form.html.haml b/app/views/projects/labels/_form.html.haml index 6ab6ae50389..5f7be074f25 100644 --- a/app/views/projects/labels/_form.html.haml +++ b/app/views/projects/labels/_form.html.haml @@ -30,4 +30,4 @@ = f.submit 'Save changes', class: 'btn btn-save js-save-button' - else = f.submit 'Create Label', class: 'btn btn-create js-save-button' - = link_to "Cancel", namespace_project_labels_path(@project.namespace, @project), class: 'btn btn-cancel' + = link_to 'Cancel', namespace_project_labels_path(@project.namespace, @project), class: 'btn btn-cancel' diff --git a/app/views/projects/labels/_label.html.haml b/app/views/projects/labels/_label.html.haml index 71f7f354d72..2b7b79390f7 100644 --- a/app/views/projects/labels/_label.html.haml +++ b/app/views/projects/labels/_label.html.haml @@ -1,4 +1,7 @@ - label_css_id = dom_id(label) +- open_issues_count = label.open_issues_count(current_user, @project) +- open_merge_requests_count = label.open_merge_requests_count(current_user, @project) + %li{id: label_css_id, data: { id: label.id } } = render "shared/label_row", label: label @@ -10,25 +13,25 @@ %ul %li = link_to_label(label, type: :merge_request) do - = pluralize label.open_merge_requests_count, 'merge request' + = pluralize open_merge_requests_count, 'merge request' %li = link_to_label(label) do - = pluralize label.open_issues_count(current_user), 'open issue' + = pluralize open_issues_count, 'open issue' - if current_user %li.label-subscription{ data: { url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label) } } %a.js-subscribe-button.label-subscribe-button.subscription-status{ role: "button", href: "#", data: { toggle: "tooltip", status: label_subscription_status(label) } } %span= label_subscription_toggle_button_text(label) - - if can? current_user, :admin_label, @project + - if can_admin_label(label) %li - = link_to "Edit", edit_namespace_project_label_path(@project.namespace, @project, label) + = link_to 'Edit', edit_label_path(label) %li - = link_to "Delete", namespace_project_label_path(@project.namespace, @project, label), title: "Delete", method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?"} + = link_to 'Delete', destroy_label_path(label), title: 'Delete', method: :delete, remote: true, data: {confirm: 'Remove this label? Are you sure?'} .pull-right.hidden-xs.hidden-sm.hidden-md = link_to_label(label, type: :merge_request, css_class: 'btn btn-transparent btn-action') do - = pluralize label.open_merge_requests_count, 'merge request' + = pluralize open_merge_requests_count, 'merge request' = link_to_label(label, css_class: 'btn btn-transparent btn-action') do - = pluralize label.open_issues_count(current_user), 'open issue' + = pluralize open_issues_count, 'open issue' - if current_user .label-subscription.inline{ data: { url: toggle_subscription_namespace_project_label_path(@project.namespace, @project, label) } } @@ -37,11 +40,11 @@ = icon('eye', class: 'label-subscribe-button-icon') = icon('spinner spin', class: 'label-subscribe-button-loading') - - if can? current_user, :admin_label, @project - = link_to edit_namespace_project_label_path(@project.namespace, @project, label), title: "Edit", class: 'btn btn-transparent btn-action', data: {toggle: "tooltip"} do + - if can_admin_label(label) + = link_to edit_label_path(label), title: "Edit", class: 'btn btn-transparent btn-action', data: {toggle: "tooltip"} do %span.sr-only Edit = icon('pencil-square-o') - = link_to namespace_project_label_path(@project.namespace, @project, label), title: "Delete", class: 'btn btn-transparent btn-action remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?", toggle: "tooltip"} do + = link_to destroy_label_path(label), title: "Delete", class: 'btn btn-transparent btn-action remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?", toggle: "tooltip"} do %span.sr-only Delete = icon('trash-o') diff --git a/app/views/projects/labels/destroy.js.haml b/app/views/projects/labels/destroy.js.haml index d59563b122a..0b9937c4808 100644 --- a/app/views/projects/labels/destroy.js.haml +++ b/app/views/projects/labels/destroy.js.haml @@ -1,2 +1,2 @@ -- if @project.labels.size == 0 +- if @project_labels.none? $('.labels').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000) diff --git a/app/views/projects/labels/edit.html.haml b/app/views/projects/labels/edit.html.haml index 52b187e7e58..c9ec371c3e1 100644 --- a/app/views/projects/labels/edit.html.haml +++ b/app/views/projects/labels/edit.html.haml @@ -4,6 +4,7 @@ %div{ class: container_class } %h3.page-title - Edit Label + = icon('bookmark') + Edit Project Label %hr = render 'form' diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml index db66a0edbd8..286b58f57c2 100644 --- a/app/views/projects/labels/index.html.haml +++ b/app/views/projects/labels/index.html.haml @@ -14,25 +14,38 @@ New label .labels - - if can?(current_user, :admin_label, @project) + - unless @project_labels.empty? -# Only show it in the first page - - hide = @project.labels.empty? || (params[:page].present? && params[:page] != '1') - .prioritized-labels{ class: ('hide' if hide) } - %h5 Prioritized Labels - %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } - %p.empty-message{ class: ('hidden' unless @prioritized_labels.empty?) } No prioritized labels yet - - if @prioritized_labels.present? - = render @prioritized_labels - .other-labels + - hide = params[:page].present? && params[:page] != '1' - if can?(current_user, :admin_label, @project) - %h5{ class: ('hide' if hide) } Other Labels - - if @labels.present? - %ul.content-list.manage-labels-list.js-other-labels - = render @labels - = paginate @labels, theme: 'gitlab' - - else - .nothing-here-block - - if can?(current_user, :admin_label, @project) - Create a label or #{link_to 'generate a default set of labels', generate_namespace_project_labels_path(@project.namespace, @project), method: :post}. - - else - No labels created + .prioritized-labels{ class: ('hide' if hide) } + %h5 Prioritized Labels + %ul.content-list.manage-labels-list.js-prioritized-labels{ "data-url" => set_priorities_namespace_project_labels_path(@project.namespace, @project) } + %p.empty-message{ class: ('hidden' unless @prioritized_labels.empty?) } No prioritized labels yet + - if @prioritized_labels.present? + = render partial: 'label', collection: @prioritized_labels, as: :label + + .group-labels{ class: ('hide' if hide || @project.group.blank?) } + %h5 + = icon('folder-open') + Group Labels + %ul.content-list.manage-labels-list.js-group-labels + %p.empty-message{ class: ('hidden' unless @group_labels.empty?) } No group labels + - if @group_labels.present? + = render partial: 'label', collection: @group_labels, as: :label + + .project-labels + %h5{ class: ('hide' if hide) } + = icon('bookmark') + Project Labels + %ul.content-list.manage-labels-list.js-project-labels + %p.empty-message{ class: ('hidden' unless @labels.empty?) } No project labels + - if @labels.present? + = render @labels + = paginate @labels, theme: 'gitlab' + - else + .nothing-here-block + - if can?(current_user, :admin_label, @project) + Create a label or #{link_to 'generate a default set of labels', generate_namespace_project_labels_path(@project.namespace, @project), method: :post}. + - else + No labels created yet. diff --git a/app/views/projects/labels/new.html.haml b/app/views/projects/labels/new.html.haml index a1bb66cfb6c..a1e2df6c55d 100644 --- a/app/views/projects/labels/new.html.haml +++ b/app/views/projects/labels/new.html.haml @@ -4,6 +4,7 @@ %div{ class: container_class } %h3.page-title - New Label + = icon('bookmark') + New Project Label %hr = render 'form' diff --git a/app/views/shared/_label_row.html.haml b/app/views/shared/_label_row.html.haml index 6f593e8dff9..751b2d1c158 100644 --- a/app/views/shared/_label_row.html.haml +++ b/app/views/shared/_label_row.html.haml @@ -3,13 +3,14 @@ .draggable-handler = icon('bars') .js-toggle-priority.toggle-priority{ data: { url: remove_priority_namespace_project_label_path(@project.namespace, @project, label), - dom_id: dom_id(label) } } + dom_id: dom_id(label), type: label.type } } %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) + = label_type_icon(label, class: "#{'hidden' if label.priority.blank?}" ) - if label.description %span.label-description = markdown_field(label, :description) |