Commit 9afee5ad5298dc4c89ec74c5fda44adfc91de1b2
1 parent
afe98ae7
Exists in
master
and in
4 other branches
Add critical status to issues
Showing
8 changed files
with
84 additions
and
10 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
... | ... | @@ -647,3 +647,37 @@ tbody tr:nth-child(2n) td, tbody tr.even td { |
647 | 647 | background: none repeat scroll 0 0 #FFBBBB |
648 | 648 | } |
649 | 649 | } |
650 | + | |
651 | +.tag { | |
652 | + @include round-borders-all(4px); | |
653 | + padding:2px 4px; | |
654 | + border:none; | |
655 | + | |
656 | + &.high { | |
657 | + background: #D12F19; | |
658 | + color:white; | |
659 | + } | |
660 | + | |
661 | + &.today { | |
662 | + background: #44aa22; | |
663 | + color:white; | |
664 | + } | |
665 | + | |
666 | + &.yours { | |
667 | + background: #4466cc; | |
668 | + color:white; | |
669 | + } | |
670 | + &.notes { | |
671 | + background: #2c5c66; | |
672 | + color:white; | |
673 | + } | |
674 | +} | |
675 | + | |
676 | +#issues-table .issue { | |
677 | + &.critical { | |
678 | + td { | |
679 | + //background: #D12F19; | |
680 | + //color:#fff; | |
681 | + } | |
682 | + } | |
683 | +} | ... | ... |
app/controllers/issues_controller.rb
... | ... | @@ -12,7 +12,7 @@ class IssuesController < ApplicationController |
12 | 12 | |
13 | 13 | def index |
14 | 14 | @issues = case params[:f].to_i |
15 | - when 1 then @project.issues.all | |
15 | + when 1 then @project.issues | |
16 | 16 | when 2 then @project.issues.closed |
17 | 17 | when 3 then @project.issues.opened.assigned(current_user) |
18 | 18 | else @project.issues.opened | ... | ... |
app/models/issue.rb
... | ... | @@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base |
18 | 18 | :presence => true, |
19 | 19 | :length => { :within => 0..2000 } |
20 | 20 | |
21 | + scope :critical, where(:critical => true) | |
22 | + scope :non_critical, where(:critical => false) | |
23 | + | |
21 | 24 | scope :opened, where(:closed => false) |
22 | 25 | scope :closed, where(:closed => true) |
23 | 26 | scope :assigned, lambda { |u| where(:assignee_id => u.id)} |
24 | 27 | |
25 | 28 | acts_as_list |
29 | + | |
30 | + def today? | |
31 | + Date.today == created_at.to_date | |
32 | + end | |
33 | + | |
34 | + def new? | |
35 | + today? && created_at == updated_at | |
36 | + end | |
26 | 37 | end |
27 | 38 | # == Schema Information |
28 | 39 | # | ... | ... |
app/views/issues/_form.html.haml
... | ... | @@ -5,17 +5,21 @@ |
5 | 5 | - @issue.errors.full_messages.each do |msg| |
6 | 6 | %li= msg |
7 | 7 | |
8 | - .span-6 | |
8 | + .span-8 | |
9 | 9 | = f.label :title |
10 | 10 | = f.text_field :title, :style => "width:450px" |
11 | - .span-6 | |
11 | + .span-8 | |
12 | 12 | = f.label :content |
13 | 13 | = f.text_area :content, :style => "width:450px; height:130px" |
14 | - .span-6.append-bottom | |
14 | + .span-8.append-bottom | |
15 | 15 | = f.label :assignee_id |
16 | 16 | = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) |
17 | + .span-1 | |
18 | + = f.label :critical, "Critical" | |
19 | + %br | |
20 | + = f.check_box :critical | |
17 | 21 | - unless @issue.new_record? |
18 | - .span-3.right | |
22 | + .span-2.right | |
19 | 23 | = f.label :closed |
20 | 24 | %br |
21 | 25 | = f.check_box :closed | ... | ... |
app/views/issues/_issues.html.haml
1 | 1 | %table.round-borders#issues-table |
2 | 2 | %tr |
3 | + - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" | |
4 | + %th | |
3 | 5 | %th Assignee |
4 | 6 | %th ID |
5 | 7 | %th Title |
6 | 8 | %th Closed? |
7 | 9 | %th |
8 | 10 | |
9 | - - @issues.each do |issue| | |
11 | + - @issues.critical.each do |issue| | |
12 | + = render(:partial => 'show', :locals => {:issue => issue}) | |
13 | + | |
14 | + - @issues.non_critical.each do |issue| | |
10 | 15 | = render(:partial => 'show', :locals => {:issue => issue}) | ... | ... |
app/views/issues/_show.html.haml
1 | -%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) } | |
1 | +%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(@project, issue) } | |
2 | + - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" | |
3 | + %td | |
4 | + = image_tag "move.png" , :class => [:handle, :left] | |
2 | 5 | %td |
3 | - = image_tag "move.png" , :class => [:handle, :left] | |
4 | 6 | = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" |
5 | 7 | = truncate issue.assignee.name, :lenght => 20 |
6 | 8 | %td ##{issue.id} |
7 | - %td= html_escape issue.title | |
9 | + %td | |
10 | + = html_escape issue.title | |
11 | + %br | |
12 | + - if issue.critical | |
13 | + %span.tag.high critical | |
14 | + - if issue.today? | |
15 | + %span.tag.today today | |
16 | + -#- if issue.author == current_user | |
17 | + -#%span.tag.yours yours | |
18 | + -#- if issue.notes.count > 0 | |
19 | + -#%span.tag.notes | |
20 | + -#= issue.notes.count | |
21 | + -#notes | |
8 | 22 | %td |
9 | 23 | - if can? current_user, :write_issue, @project |
10 | 24 | = form_for([@project, issue], :remote => true) do |f| | ... | ... |
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 => 20111021101550) do | |
14 | +ActiveRecord::Schema.define(:version => 20111025134235) do | |
15 | 15 | |
16 | 16 | create_table "issues", :force => true do |t| |
17 | 17 | t.string "title" |
... | ... | @@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do |
23 | 23 | t.datetime "updated_at" |
24 | 24 | t.boolean "closed", :default => false, :null => false |
25 | 25 | t.integer "position", :default => 0 |
26 | + t.boolean "critical", :default => false, :null => false | |
26 | 27 | end |
27 | 28 | |
28 | 29 | create_table "keys", :force => true do |t| | ... | ... |