Commit 50fdb2e7dffd80265bc604ec8f9071e12f99af30

Authored by Dmitriy Zaporozhets
1 parent 1b1e77c7

Remove critical status from Issue. Move sort instead

app/assets/stylesheets/common.scss
... ... @@ -622,10 +622,6 @@ li.note {
622 622 margin-right:5px;
623 623 margin-top: 2px;
624 624 @include border-radius(4px);
625   - &.critical {
626   - background: #EAA;
627   - border:1px solid #B88;
628   - }
629 625 &.today{
630 626 background: #ADA;
631 627 border:1px solid #8B8;
... ... @@ -664,14 +660,6 @@ li.note {
664 660 }
665 661 }
666 662  
667   - &.critical {
668   - background: #FEE;
669   - border-color:#ECC;
670   - .icon {
671   - background: #EAA;
672   - border:1px solid #B88;
673   - }
674   - }
675 663 &.today{
676 664 background: #EFE;
677 665 border-color:#CEC;
... ...
app/controllers/issues_controller.rb
... ... @@ -140,7 +140,7 @@ class IssuesController < ApplicationController
140 140 @issues = @issues.where(:assignee_id => params[:assignee_id]) if params[:assignee_id].present?
141 141 @issues = @issues.where(:milestone_id => params[:milestone_id]) if params[:milestone_id].present?
142 142 @issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
143   - @issues = @issues.includes(:author, :project).order("critical, updated_at")
  143 + @issues = @issues.includes(:author, :project).order("updated_at")
144 144 @issues
145 145 end
146 146 end
... ...
app/controllers/merge_requests_controller.rb
... ... @@ -30,7 +30,7 @@ class MergeRequestsController < ApplicationController
30 30 else @merge_requests.opened
31 31 end.page(params[:page]).per(20)
32 32  
33   - @merge_requests = @merge_requests.includes(:author, :project).order("created_at desc")
  33 + @merge_requests = @merge_requests.includes(:author, :project).order("closed, created_at desc")
34 34 end
35 35  
36 36 def show
... ...
app/helpers/issues_helper.rb
... ... @@ -28,7 +28,6 @@ module IssuesHelper
28 28  
29 29 def issue_css_classes issue
30 30 classes = "issue"
31   - classes << " critical" if issue.critical
32 31 classes << " closed" if issue.closed
33 32 classes << " today" if issue.today?
34 33 classes
... ...
app/models/issue.rb
... ... @@ -33,9 +33,6 @@ class Issue &lt; ActiveRecord::Base
33 33 validates :description,
34 34 :length => { :within => 0..2000 }
35 35  
36   - scope :critical, where(:critical => true)
37   - scope :non_critical, where(:critical => false)
38   -
39 36 scope :opened, where(:closed => false)
40 37 scope :closed, where(:closed => true)
41 38 scope :assigned, lambda { |u| where(:assignee_id => u.id)}
... ...
app/models/project.rb
... ... @@ -13,7 +13,7 @@ class Project &lt; ActiveRecord::Base
13 13 has_many :users, :through => :users_projects
14 14 has_many :events, :dependent => :destroy
15 15 has_many :merge_requests, :dependent => :destroy
16   - has_many :issues, :dependent => :destroy, :order => "position"
  16 + has_many :issues, :dependent => :destroy, :order => "closed, position"
17 17 has_many :milestones, :dependent => :destroy
18 18 has_many :users_projects, :dependent => :destroy
19 19 has_many :notes, :dependent => :destroy
... ...
app/views/dashboard/issues.html.haml
... ... @@ -3,15 +3,6 @@
3 3 %small (assigned to you)
4 4 %small.right #{@issues.total_count} issues
5 5  
6   -%br
7   -.issues_legend
8   - .list_legend
9   - .icon.critical
10   - .text Critical
11   -
12   - .list_legend
13   - .icon.today
14   - .text Today
15 6 .clearfix
16 7 - if @issues.any?
17 8 - @issues.group_by(&:project).each do |group|
... ...
app/views/issues/_form.html.haml
... ... @@ -9,37 +9,37 @@
9 9 .issue_form_box
10 10 .issue_title
11 11 .clearfix
12   - = f.label :title, "Issue Subject *"
  12 + = f.label :title do
  13 + %strong= "Subject *"
13 14 .input
14 15 = f.text_field :title, :maxlength => 255, :class => "xxlarge"
15 16 .issue_middle_block
16 17 .issue_assignee
17   - = f.label :assignee_id, "Assign to"
18   - .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Assign to user" })
  18 + = f.label :assignee_id do
  19 + %i.icon-user
  20 + Assign to
  21 + .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select a user" })
19 22 .issue_milestone
20   - = f.label :milestone_id
  23 + = f.label :milestone_id do
  24 + %i.icon-time
  25 + Milestone
21 26 .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { :include_blank => "Select milestone" })
22 27  
23 28 .issue_description
24 29 .clearfix
25   - = f.label :critical, "Critical"
26   - .input= f.check_box :critical
  30 + = f.label :label_list do
  31 + %i.icon-tag
  32 + Labels
  33 + .input
  34 + = f.text_field :label_list, :maxlength => 2000, :class => "xxlarge"
  35 + %p.hint Separate with comma.
27 36  
28   - - unless @issue.new_record?
29   - .clearfix
30   - = f.label :closed
31   - .input= f.check_box :closed
32 37 .clearfix
33   - = f.label :description, "Issue Details"
  38 + = f.label :description, "Details"
34 39 .input
35 40 = f.text_area :description, :maxlength => 2000, :class => "xxlarge", :rows => 14
36 41 %p.hint Markdown is enabled.
37 42  
38   - .clearfix
39   - = f.label :label_list, "Labels"
40   - .input
41   - = f.text_field :label_list, :maxlength => 2000, :class => "xxlarge"
42   - %p.hint Separate with comma.
43 43  
44 44 .actions
45 45 - if @issue.new_record?
... ...
app/views/issues/_issues.html.haml
1   -- @issues.select(&:critical).each do |issue|
2   - = render(:partial => 'issues/show', :locals => {:issue => issue})
3   -
4   -- @issues.reject(&:critical).each do |issue|
  1 +- @issues.each do |issue|
5 2 = render(:partial => 'issues/show', :locals => {:issue => issue})
6 3  
7 4 - if @issues.present?
... ...
app/views/issues/index.html.haml
... ... @@ -13,22 +13,7 @@
13 13 = hidden_field_tag :status, params[:f]
14 14 = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' }
15 15  
16   - %br
17   -
18   - .issues_legend
19   - .list_legend
20   - .icon.today
21   - .text Today
22   -
23   - .list_legend
24   - .icon.critical
25   - .text Critical
26   -
27   - .list_legend
28   - .icon.closed
29   - .text Closed
30 16 .clearfix
31   -
32 17 %div#issues-table-holder.ui-box
33 18 .title
34 19 .left
... ...
db/migrate/20120627145613_remove_critical_from_issue.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class RemoveCriticalFromIssue < ActiveRecord::Migration
  2 + def up
  3 + remove_column :issues, :critical
  4 + end
  5 +
  6 + def down
  7 + add_column :issues, :critical, :boolean, :null => true, :default => false
  8 + end
  9 +end
... ...
db/schema.rb
... ... @@ -11,7 +11,7 @@
11 11 #
12 12 # It's strongly recommended to check this file into your version control system.
13 13  
14   -ActiveRecord::Schema.define(:version => 20120413135904) do
  14 +ActiveRecord::Schema.define(:version => 20120627145613) do
15 15  
16 16 create_table "events", :force => true do |t|
17 17 t.string "target_type"
... ... @@ -34,7 +34,6 @@ ActiveRecord::Schema.define(:version =&gt; 20120413135904) do
34 34 t.datetime "updated_at", :null => false
35 35 t.boolean "closed", :default => false, :null => false
36 36 t.integer "position", :default => 0
37   - t.boolean "critical", :default => false, :null => false
38 37 t.string "branch_name"
39 38 t.text "description"
40 39 t.integer "milestone_id"
... ...