Commit 9afee5ad authored by gitlabhq's avatar gitlabhq

Add critical status to issues

parent afe98ae7
...@@ -647,3 +647,37 @@ tbody tr:nth-child(2n) td, tbody tr.even td { ...@@ -647,3 +647,37 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
background: none repeat scroll 0 0 #FFBBBB background: none repeat scroll 0 0 #FFBBBB
} }
} }
.tag {
@include round-borders-all(4px);
padding:2px 4px;
border:none;
&.high {
background: #D12F19;
color:white;
}
&.today {
background: #44aa22;
color:white;
}
&.yours {
background: #4466cc;
color:white;
}
&.notes {
background: #2c5c66;
color:white;
}
}
#issues-table .issue {
&.critical {
td {
//background: #D12F19;
//color:#fff;
}
}
}
...@@ -12,7 +12,7 @@ class IssuesController < ApplicationController ...@@ -12,7 +12,7 @@ class IssuesController < ApplicationController
def index def index
@issues = case params[:f].to_i @issues = case params[:f].to_i
when 1 then @project.issues.all when 1 then @project.issues
when 2 then @project.issues.closed when 2 then @project.issues.closed
when 3 then @project.issues.opened.assigned(current_user) when 3 then @project.issues.opened.assigned(current_user)
else @project.issues.opened else @project.issues.opened
......
...@@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base ...@@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base
:presence => true, :presence => true,
:length => { :within => 0..2000 } :length => { :within => 0..2000 }
scope :critical, where(:critical => true)
scope :non_critical, where(:critical => false)
scope :opened, where(:closed => false) scope :opened, where(:closed => false)
scope :closed, where(:closed => true) scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)} scope :assigned, lambda { |u| where(:assignee_id => u.id)}
acts_as_list acts_as_list
def today?
Date.today == created_at.to_date
end
def new?
today? && created_at == updated_at
end
end end
# == Schema Information # == Schema Information
# #
......
...@@ -5,17 +5,21 @@ ...@@ -5,17 +5,21 @@
- @issue.errors.full_messages.each do |msg| - @issue.errors.full_messages.each do |msg|
%li= msg %li= msg
.span-6 .span-8
= f.label :title = f.label :title
= f.text_field :title, :style => "width:450px" = f.text_field :title, :style => "width:450px"
.span-6 .span-8
= f.label :content = f.label :content
= f.text_area :content, :style => "width:450px; height:130px" = f.text_area :content, :style => "width:450px; height:130px"
.span-6.append-bottom .span-8.append-bottom
= f.label :assignee_id = f.label :assignee_id
= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
.span-1
= f.label :critical, "Critical"
%br
= f.check_box :critical
- unless @issue.new_record? - unless @issue.new_record?
.span-3.right .span-2.right
= f.label :closed = f.label :closed
%br %br
= f.check_box :closed = f.check_box :closed
......
%table.round-borders#issues-table %table.round-borders#issues-table
%tr %tr
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%th
%th Assignee %th Assignee
%th ID %th ID
%th Title %th Title
%th Closed? %th Closed?
%th %th
- @issues.each do |issue| - @issues.critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue})
- @issues.non_critical.each do |issue|
= render(:partial => 'show', :locals => {:issue => issue}) = render(:partial => 'show', :locals => {:issue => issue})
%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) } %tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) }
- if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"
%td %td
= image_tag "move.png" , :class => [:handle, :left] = image_tag "move.png" , :class => [:handle, :left]
%td
= image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
= truncate issue.assignee.name, :lenght => 20 = truncate issue.assignee.name, :lenght => 20
%td ##{issue.id} %td ##{issue.id}
%td= html_escape issue.title %td
= html_escape issue.title
%br
- if issue.critical
%span.tag.high critical
- if issue.today?
%span.tag.today today
-#- if issue.author == current_user
-#%span.tag.yours yours
-#- if issue.notes.count > 0
-#%span.tag.notes
-#= issue.notes.count
-#notes
%td %td
- if can? current_user, :write_issue, @project - if can? current_user, :write_issue, @project
= form_for([@project, issue], :remote => true) do |f| = form_for([@project, issue], :remote => true) do |f|
......
class AddHighLabelToIssue < ActiveRecord::Migration
def change
add_column :issues, :critical, :boolean, :default => false, :null => false
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111021101550) do ActiveRecord::Schema.define(:version => 20111025134235) do
create_table "issues", :force => true do |t| create_table "issues", :force => true do |t|
t.string "title" t.string "title"
...@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do ...@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "closed", :default => false, :null => false t.boolean "closed", :default => false, :null => false
t.integer "position", :default => 0 t.integer "position", :default => 0
t.boolean "critical", :default => false, :null => false
end end
create_table "keys", :force => true do |t| create_table "keys", :force => true do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment