OSDN Git Service

Remove critical status from Issue. Move sort instead
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Wed, 27 Jun 2012 18:30:35 +0000 (21:30 +0300)
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Wed, 27 Jun 2012 18:30:35 +0000 (21:30 +0300)
12 files changed:
app/assets/stylesheets/common.scss
app/controllers/issues_controller.rb
app/controllers/merge_requests_controller.rb
app/helpers/issues_helper.rb
app/models/issue.rb
app/models/project.rb
app/views/dashboard/issues.html.haml
app/views/issues/_form.html.haml
app/views/issues/_issues.html.haml
app/views/issues/index.html.haml
db/migrate/20120627145613_remove_critical_from_issue.rb [new file with mode: 0644]
db/schema.rb

index b880252..8b76fe5 100644 (file)
@@ -622,10 +622,6 @@ li.note {
     margin-right:5px;
     margin-top: 2px;
     @include border-radius(4px);
-    &.critical { 
-      background: #EAA;
-      border:1px solid #B88;
-    }
     &.today{ 
       background: #ADA;
       border:1px solid #8B8;
@@ -664,14 +660,6 @@ li.note {
     }
   }
 
-  &.critical { 
-    background: #FEE;
-    border-color:#ECC;
-    .icon { 
-      background: #EAA;
-      border:1px solid #B88;
-    }
-  }
   &.today{ 
     background: #EFE;
     border-color:#CEC;
index 35a30ca..e095c4d 100644 (file)
@@ -140,7 +140,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 = @issues.includes(:author, :project).order("updated_at")
     @issues
   end
 end
index b0d122b..b8643dc 100644 (file)
@@ -30,7 +30,7 @@ class MergeRequestsController < ApplicationController
                       else @merge_requests.opened
                       end.page(params[:page]).per(20)
 
-    @merge_requests = @merge_requests.includes(:author, :project).order("created_at desc")
+    @merge_requests = @merge_requests.includes(:author, :project).order("closed, created_at desc")
   end
 
   def show
index 148048a..0982aac 100644 (file)
@@ -28,7 +28,6 @@ module IssuesHelper
 
   def issue_css_classes issue
     classes = "issue"
-    classes << " critical" if issue.critical
     classes << " closed" if issue.closed
     classes << " today" if issue.today?
     classes
index c961bbe..7f93590 100644 (file)
@@ -33,9 +33,6 @@ class Issue < ActiveRecord::Base
   validates :description,
             :length   => { :within => 0..2000 }
 
-  scope :critical, where(:critical => true)
-  scope :non_critical, where(:critical => false)
-
   scope :opened, where(:closed => false)
   scope :closed, where(:closed => true)
   scope :assigned, lambda { |u| where(:assignee_id => u.id)}
index 9a4da19..5611eb6 100644 (file)
@@ -13,7 +13,7 @@ class Project < ActiveRecord::Base
   has_many :users,          :through => :users_projects
   has_many :events,         :dependent => :destroy
   has_many :merge_requests, :dependent => :destroy
-  has_many :issues,         :dependent => :destroy, :order => "position"
+  has_many :issues,         :dependent => :destroy, :order => "closed, position"
   has_many :milestones,     :dependent => :destroy
   has_many :users_projects, :dependent => :destroy
   has_many :notes,          :dependent => :destroy
index c9cc048..6f623b2 100644 (file)
@@ -3,15 +3,6 @@
   %small (assigned to you)
   %small.right #{@issues.total_count} issues
 
-%br
-.issues_legend
-  .list_legend
-    .icon.critical
-    .text Critical
-
-  .list_legend
-    .icon.today
-    .text Today
 .clearfix
 - if @issues.any?
   - @issues.group_by(&:project).each do |group|
index 94a621c..4f6f839 100644 (file)
@@ -9,37 +9,37 @@
     .issue_form_box
       .issue_title
         .clearfix
-          = f.label :title, "Issue Subject *"
+          = f.label :title do 
+            %strong= "Subject *"
           .input
             = f.text_field :title, :maxlength => 255, :class => "xxlarge"
       .issue_middle_block
         .issue_assignee
-          = f.label :assignee_id, "Assign to"
-          .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Assign to user" })
+          = f.label :assignee_id do 
+            %i.icon-user
+            Assign to
+          .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select a user" })
         .issue_milestone
-          = f.label :milestone_id
+          = f.label :milestone_id do 
+            %i.icon-time
+            Milestone
           .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { :include_blank => "Select milestone" })
 
       .issue_description
         .clearfix
-          = f.label :critical, "Critical"
-          .input= f.check_box :critical
+          = f.label :label_list do 
+            %i.icon-tag 
+            Labels
+          .input
+            = f.text_field :label_list, :maxlength => 2000, :class => "xxlarge"
+            %p.hint Separate with comma.
 
-        - unless @issue.new_record?
-          .clearfix
-            = f.label :closed
-            .input= f.check_box :closed
         .clearfix
-          = f.label :description, "Issue Details"
+          = f.label :description, "Details"
           .input
             = 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?
index e1d0be0..a20df17 100644 (file)
@@ -1,7 +1,4 @@
-- @issues.select(&:critical).each do |issue|
-  = render(:partial => 'issues/show', :locals => {:issue => issue})
-
-- @issues.reject(&:critical).each do |issue|
+- @issues.each do |issue|
   = render(:partial => 'issues/show', :locals => {:issue => issue})
 
 - if @issues.present?
index ebe432b..e3480f6 100644 (file)
           = hidden_field_tag :status, params[:f]
           = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' }
 
-  %br
-
-  .issues_legend
-    .list_legend
-      .icon.today
-      .text Today
-
-    .list_legend
-      .icon.critical
-      .text Critical
-
-    .list_legend
-      .icon.closed
-      .text Closed
   .clearfix
-
   %div#issues-table-holder.ui-box
     .title
       .left
diff --git a/db/migrate/20120627145613_remove_critical_from_issue.rb b/db/migrate/20120627145613_remove_critical_from_issue.rb
new file mode 100644 (file)
index 0000000..f8d0797
--- /dev/null
@@ -0,0 +1,9 @@
+class RemoveCriticalFromIssue < ActiveRecord::Migration
+  def up
+    remove_column :issues, :critical
+  end
+
+  def down
+    add_column :issues, :critical, :boolean, :null => true, :default => false
+  end
+end
index 59098d7..7ce89c6 100644 (file)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20120413135904) do
+ActiveRecord::Schema.define(:version => 20120627145613) do
 
   create_table "events", :force => true do |t|
     t.string   "target_type"
@@ -34,7 +34,6 @@ ActiveRecord::Schema.define(:version => 20120413135904) do
     t.datetime "updated_at",                      :null => false
     t.boolean  "closed",       :default => false, :null => false
     t.integer  "position",     :default => 0
-    t.boolean  "critical",     :default => false, :null => false
     t.string   "branch_name"
     t.text     "description"
     t.integer  "milestone_id"