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

This commit is contained in:
Dmitriy Zaporozhets 2013-05-07 17:57:29 +03:00
parent af5d0e9e92
commit 9d66875069
3 changed files with 17 additions and 4 deletions

View file

@ -10,6 +10,12 @@ class LabelsController < ProjectResourceController
@labels = @project.issues_labels.order('count DESC')
end
def generate
Gitlab::Labels.generate(@project)
redirect_to project_labels_path(@project)
end
protected
def module_enabled

View file

@ -3,12 +3,13 @@
%h3.page_title
Labels
%br
%div.ui-box
%ul.well-list.labels-table
.light-well
%ul.bordered-list.labels-table
- @labels.each do |label|
= render 'label', label: label
- unless @labels.present?
%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

View file

@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do
resources :team, controller: 'team_members', only: [:index]
resources :milestones, except: [:destroy]
resources :labels, only: [:index]
resources :labels, only: [:index] do
collection do
post :generate
end
end
resources :issues, except: [:destroy] do
collection do
post :bulk_update