summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-08-24 13:07:14 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-08-24 13:07:14 +0300
commit919cd60216d0216dde73a4e17553a149b41593ff (patch)
treee1d9968744c439014cd8e9f82b01ec04a010cdae
parent14bd9c9228c50d2a9c5914394603d7ff2b2aa145 (diff)
parent3dd7703b8083d44c64a03cef6b72d161aed04239 (diff)
downloadgitlab-ce-919cd60216d0216dde73a4e17553a149b41593ff.tar.gz
Merge branch 'feature/labels'
-rw-r--r--app/controllers/labels_controller.rb25
-rw-r--r--app/views/issues/_head.html.haml3
-rw-r--r--app/views/labels/_label.html.haml4
-rw-r--r--app/views/labels/index.html.haml14
-rw-r--r--config/routes.rb2
-rw-r--r--features/projects/issues/labels.feature13
-rw-r--r--features/step_definitions/project/project_issues_steps.rb21
7 files changed, 81 insertions, 1 deletions
diff --git a/app/controllers/labels_controller.rb b/app/controllers/labels_controller.rb
new file mode 100644
index 00000000000..f52fc2d8180
--- /dev/null
+++ b/app/controllers/labels_controller.rb
@@ -0,0 +1,25 @@
+class LabelsController < ApplicationController
+ before_filter :authenticate_user!
+ before_filter :project
+ before_filter :module_enabled
+
+ layout "project"
+
+ # Authorize
+ before_filter :add_project_abilities
+
+ # Allow read any issue
+ before_filter :authorize_read_issue!
+
+ respond_to :js, :html
+
+ def index
+ @labels = Issue.tag_counts_on(:labels)
+ end
+
+ protected
+
+ def module_enabled
+ return render_404 unless @project.issues_enabled
+ end
+end
diff --git a/app/views/issues/_head.html.haml b/app/views/issues/_head.html.haml
index 1f6e7d7f81f..8ebe3e057bc 100644
--- a/app/views/issues/_head.html.haml
+++ b/app/views/issues/_head.html.haml
@@ -5,6 +5,9 @@
%li{class: "#{'active' if current_page?(project_milestones_path(@project))}"}
= link_to project_milestones_path(@project), class: "tab" do
Milestones
+ %li{class: "#{'active' if current_page?(project_labels_path(@project))}"}
+ = link_to project_labels_path(@project), class: "tab" do
+ Labels
%li.right
%span.rss-icon
= link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do
diff --git a/app/views/labels/_label.html.haml b/app/views/labels/_label.html.haml
new file mode 100644
index 00000000000..32158c20adc
--- /dev/null
+++ b/app/views/labels/_label.html.haml
@@ -0,0 +1,4 @@
+%li.wll
+ %strong= label.name
+ .right
+ %span= pluralize label.count, 'issue'
diff --git a/app/views/labels/index.html.haml b/app/views/labels/index.html.haml
new file mode 100644
index 00000000000..4e41d375d6a
--- /dev/null
+++ b/app/views/labels/index.html.haml
@@ -0,0 +1,14 @@
+= render "issues/head"
+
+%h3.page_title
+ Labels
+%br
+%div.ui-box
+ %ul.unstyled.labels-table
+ - @labels.each do |label|
+ = render 'label', label: label
+
+ - unless @labels.present?
+ %li
+ %h3.nothing_here_message Nothing to show here
+
diff --git a/config/routes.rb b/config/routes.rb
index 97594d577a7..f895478fb12 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -197,7 +197,9 @@ Gitlab::Application.routes.draw do
end
resources :team_members
resources :milestones
+ resources :labels, :only => [:index]
resources :issues do
+
collection do
post :sort
post :bulk_update
diff --git a/features/projects/issues/labels.feature b/features/projects/issues/labels.feature
new file mode 100644
index 00000000000..5a20bfd6d14
--- /dev/null
+++ b/features/projects/issues/labels.feature
@@ -0,0 +1,13 @@
+Feature: Labels
+ Background:
+ Given I signin as a user
+ And I own project "Shop"
+ And project "Shop" have issues tags:
+ | name |
+ | bug |
+ | feature |
+ Given I visit project "Shop" labels page
+
+ Scenario: I should see active milestones
+ Then I should see label "bug"
+ And I should see label "feature"
diff --git a/features/step_definitions/project/project_issues_steps.rb b/features/step_definitions/project/project_issues_steps.rb
index 00a1721f8de..27de03d5489 100644
--- a/features/step_definitions/project/project_issues_steps.rb
+++ b/features/step_definitions/project/project_issues_steps.rb
@@ -33,6 +33,25 @@ Given /^I visit issue page "(.*?)"$/ do |arg1|
end
Given /^I submit new issue "(.*?)"$/ do |arg1|
- fill_in "issue_title", :with => arg1
+ fill_in "issue_title", with: arg1
click_button "Submit new issue"
end
+
+Given /^project "(.*?)" have issues tags:$/ do |arg1, table|
+ project = Project.find_by_name(arg1)
+ table.hashes.each do |hash|
+ Factory :issue,
+ project: project,
+ label_list: [hash[:name]]
+ end
+end
+
+Given /^I visit project "(.*?)" labels page$/ do |arg1|
+ visit project_labels_path(Project.find_by_name(arg1))
+end
+
+Then /^I should see label "(.*?)"$/ do |arg1|
+ within ".labels-table" do
+ page.should have_content arg1
+ end
+end