Commit 9d668750698558ce7864c370e34a06c7a710ff00
1 parent
af5d0e9e
Exists in
master
and in
4 other branches
Add generate action to labels controller which allow creation of default labels set for project
Showing
3 changed files
with
17 additions
and
4 deletions
Show diff stats
app/controllers/labels_controller.rb
@@ -10,6 +10,12 @@ class LabelsController < ProjectResourceController | @@ -10,6 +10,12 @@ class LabelsController < ProjectResourceController | ||
10 | @labels = @project.issues_labels.order('count DESC') | 10 | @labels = @project.issues_labels.order('count DESC') |
11 | end | 11 | end |
12 | 12 | ||
13 | + def generate | ||
14 | + Gitlab::Labels.generate(@project) | ||
15 | + | ||
16 | + redirect_to project_labels_path(@project) | ||
17 | + end | ||
18 | + | ||
13 | protected | 19 | protected |
14 | 20 | ||
15 | def module_enabled | 21 | def module_enabled |
app/views/labels/index.html.haml
@@ -3,12 +3,13 @@ | @@ -3,12 +3,13 @@ | ||
3 | %h3.page_title | 3 | %h3.page_title |
4 | Labels | 4 | Labels |
5 | %br | 5 | %br |
6 | -%div.ui-box | ||
7 | - %ul.well-list.labels-table | 6 | + |
7 | +.light-well | ||
8 | + %ul.bordered-list.labels-table | ||
8 | - @labels.each do |label| | 9 | - @labels.each do |label| |
9 | = render 'label', label: label | 10 | = render 'label', label: label |
10 | 11 | ||
11 | - unless @labels.present? | 12 | - unless @labels.present? |
12 | %li | 13 | %li |
13 | - %h3.nothing_here_message Nothing to show here | 14 | + %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 |
14 | 15 |
config/routes.rb
@@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do | @@ -269,7 +269,13 @@ Gitlab::Application.routes.draw do | ||
269 | 269 | ||
270 | resources :team, controller: 'team_members', only: [:index] | 270 | resources :team, controller: 'team_members', only: [:index] |
271 | resources :milestones, except: [:destroy] | 271 | resources :milestones, except: [:destroy] |
272 | - resources :labels, only: [:index] | 272 | + |
273 | + resources :labels, only: [:index] do | ||
274 | + collection do | ||
275 | + post :generate | ||
276 | + end | ||
277 | + end | ||
278 | + | ||
273 | resources :issues, except: [:destroy] do | 279 | resources :issues, except: [:destroy] do |
274 | collection do | 280 | collection do |
275 | post :bulk_update | 281 | post :bulk_update |