diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2012-06-27 21:20:35 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2012-06-27 21:20:35 +0300 |
commit | 1b1e77c728e575a110e204e142e81bdff2737536 (patch) | |
tree | d0128a4f81844b219ba4fe5e9554342e63a0300e /app | |
parent | 4c1f435ab78e5d4da3d6aaaf20579be13b662d02 (diff) | |
download | gitlab-ce-1b1e77c728e575a110e204e142e81bdff2737536.tar.gz |
Issue Labels: Edit, show, index + filter
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/gitlab_bootstrap.scss | 8 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 4 | ||||
-rw-r--r-- | app/models/issue.rb | 2 | ||||
-rw-r--r-- | app/views/issues/_form.html.haml | 6 | ||||
-rw-r--r-- | app/views/issues/_show.html.haml | 5 | ||||
-rw-r--r-- | app/views/issues/index.html.haml | 46 | ||||
-rw-r--r-- | app/views/issues/show.html.haml | 8 |
8 files changed, 55 insertions, 25 deletions
diff --git a/app/assets/stylesheets/gitlab_bootstrap.scss b/app/assets/stylesheets/gitlab_bootstrap.scss index a347eeb2fc5..c4491b3caed 100644 --- a/app/assets/stylesheets/gitlab_bootstrap.scss +++ b/app/assets/stylesheets/gitlab_bootstrap.scss @@ -177,6 +177,14 @@ a:focus { &.label-important { background-color: #B94A48; } + + &.label-issue { + background-color: #eee; + border: 1px solid #ccc; + padding:4px 6px; + color:#444; + text-shadow:0 0 1px #fff; + } } .nav-tabs > li > a, .nav-pills > li > a { diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 48e8d72ad1e..35a30ca0807 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -139,6 +139,7 @@ class IssuesController < ApplicationController @issues = @issues.where(:assignee_id => params[:assignee_id]) if params[:assignee_id].present? @issues = @issues.where(:milestone_id => params[:milestone_id]) if params[:milestone_id].present? + @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present? @issues = @issues.includes(:author, :project).order("critical, updated_at") @issues end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 31d862ef725..148048a9698 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -33,4 +33,8 @@ module IssuesHelper classes << " today" if issue.today? classes end + + def issue_tags + @project.issues.tag_counts_on(:labels).map(&:name) + end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 40e14dac0d6..c961bbe2eee 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1,6 +1,8 @@ class Issue < ActiveRecord::Base include Upvote + acts_as_taggable_on :labels + belongs_to :project belongs_to :milestone belongs_to :author, :class_name => "User" diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index 444fbd768fe..94a621c2d26 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -35,6 +35,12 @@ = f.text_area :description, :maxlength => 2000, :class => "xxlarge", :rows => 14 %p.hint Markdown is enabled. + .clearfix + = f.label :label_list, "Labels" + .input + = f.text_field :label_list, :maxlength => 2000, :class => "xxlarge" + %p.hint Separate with comma. + .actions - if @issue.new_record? = f.submit 'Submit new issue', :class => "primary btn" diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index fe9b6b37c42..797d2387e31 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -2,6 +2,11 @@ .list_legend .icon .right + - issue.labels.each do |label| + %span.label.label-issue + %i.icon-tag + = label.name + - if issue.notes.any? %span.btn.small.disabled.padded %i.icon-comment diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index e49c9513844..ebe432bc7a8 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -31,28 +31,29 @@ %div#issues-table-holder.ui-box .title - .row - .span4 - %ul.nav.nav-pills.left - %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} - = link_to project_issues_path(@project, :f => 0, :milestone_id => params[:milestone_id]) do - Open - %li{:class => ("active" if params[:f] == "2")} - = link_to project_issues_path(@project, :f => 2, :milestone_id => params[:milestone_id]) do - Closed - %li{:class => ("active" if params[:f] == "3")} - = link_to project_issues_path(@project, :f => 3, :milestone_id => params[:milestone_id]) do - To Me - %li{:class => ("active" if params[:f] == "1")} - = link_to project_issues_path(@project, :f => 1, :milestone_id => params[:milestone_id]) do - All - - .span6.right - = form_tag project_issues_path(@project), :method => :get, :class => :right do - = select_tag(:assignee_id, options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") - = select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") - = hidden_field_tag :f, params[:f] + .left + %ul.nav.nav-pills.left + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))} + = link_to project_issues_path(@project, :f => 0, :milestone_id => params[:milestone_id]) do + Open + %li{:class => ("active" if params[:f] == "2")} + = link_to project_issues_path(@project, :f => 2, :milestone_id => params[:milestone_id]) do + Closed + %li{:class => ("active" if params[:f] == "3")} + = link_to project_issues_path(@project, :f => 3, :milestone_id => params[:milestone_id]) do + To Me + %li{:class => ("active" if params[:f] == "1")} + = link_to project_issues_path(@project, :f => 1, :milestone_id => params[:milestone_id]) do + All + .right + = form_tag project_issues_path(@project), :method => :get, :class => :right do + = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), :prompt => "Labels") + = select_tag(:assignee_id, options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), :prompt => "Assignee") + = select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Milestone") + = hidden_field_tag :f, params[:f] + .clearfix + %ul#issues-table.unstyled.issues_table = render "issues" @@ -60,9 +61,10 @@ $(function(){ initIssuesSearch(); setSortable(); + $("#label_name").chosen(); $("#assignee_id").chosen(); $("#milestone_id").chosen(); - $("#milestone_id, #assignee_id").live("change", function(){ + $("#milestone_id, #assignee_id, #label_name").live("change", function(){ $(this).closest("form").submit(); }); }) diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 1bb4e04d2b6..cd7ad57a7e8 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -51,9 +51,11 @@ = truncate(milestone.title, :length => 20) .right - - if @issue.critical - %span.label.label-important - Critical + - @issue.labels.each do |label| + %span.label.label-issue + %i.icon-tag + = label.name + - if @issue.description.present? .bottom_box_content |