Commit 9d668750 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add generate action to labels controller which allow creation of default labels set for project

parent af5d0e9e
...@@ -10,6 +10,12 @@ class LabelsController < ProjectResourceController ...@@ -10,6 +10,12 @@ class LabelsController < ProjectResourceController
@labels = @project.issues_labels.order('count DESC') @labels = @project.issues_labels.order('count DESC')
end end
def generate
Gitlab::Labels.generate(@project)
redirect_to project_labels_path(@project)
end
protected protected
def module_enabled def module_enabled
......
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
%h3.page_title %h3.page_title
Labels Labels
%br %br
%div.ui-box
%ul.well-list.labels-table .light-well
%ul.bordered-list.labels-table
- @labels.each do |label| - @labels.each do |label|
= render 'label', label: label = render 'label', label: label
- unless @labels.present? - unless @labels.present?
%li %li
%h3.nothing_here_message Nothing to show here %h3.nothing_here_message Add first label to your issues or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
...@@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do ...@@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do
resources :team, controller: 'team_members', only: [:index] resources :team, controller: 'team_members', only: [:index]
resources :milestones, except: [:destroy] resources :milestones, except: [:destroy]
resources :labels, only: [:index]
resources :labels, only: [:index] do
collection do
post :generate
end
end
resources :issues, except: [:destroy] do resources :issues, except: [:destroy] do
collection do collection do
post :bulk_update post :bulk_update
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment