Commit 1d69788099f4c28c8b6795cacc9a1ffaa8600ee0
1 parent
016012b1
Exists in
master
and in
4 other branches
fix encoding error, issues critical status added
Showing
15 changed files
with
99 additions
and
21 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,3 +647,37 @@ tbody tr:nth-child(2n) td, tbody tr.even td { | ||
647 | background: none repeat scroll 0 0 #FFBBBB | 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,7 +12,7 @@ class IssuesController < ApplicationController | ||
12 | 12 | ||
13 | def index | 13 | def index |
14 | @issues = case params[:f].to_i | 14 | @issues = case params[:f].to_i |
15 | - when 1 then @project.issues.all | 15 | + when 1 then @project.issues |
16 | when 2 then @project.issues.closed | 16 | when 2 then @project.issues.closed |
17 | when 3 then @project.issues.opened.assigned(current_user) | 17 | when 3 then @project.issues.opened.assigned(current_user) |
18 | else @project.issues.opened | 18 | else @project.issues.opened |
app/models/issue.rb
@@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base | @@ -18,11 +18,22 @@ class Issue < ActiveRecord::Base | ||
18 | :presence => true, | 18 | :presence => true, |
19 | :length => { :within => 0..2000 } | 19 | :length => { :within => 0..2000 } |
20 | 20 | ||
21 | + scope :critical, where(:critical => true) | ||
22 | + scope :non_critical, where(:critical => false) | ||
23 | + | ||
21 | scope :opened, where(:closed => false) | 24 | scope :opened, where(:closed => false) |
22 | scope :closed, where(:closed => true) | 25 | scope :closed, where(:closed => true) |
23 | scope :assigned, lambda { |u| where(:assignee_id => u.id)} | 26 | scope :assigned, lambda { |u| where(:assignee_id => u.id)} |
24 | 27 | ||
25 | acts_as_list | 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 | end | 37 | end |
27 | # == Schema Information | 38 | # == Schema Information |
28 | # | 39 | # |
app/views/commits/_commits.html.haml
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | 11 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" |
12 | %p | 12 | %p |
13 | %strong | 13 | %strong |
14 | - = commit.truncated_message | 14 | + = truncate(commit.safe_message, :length => 60) |
15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" | 15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" |
16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" | 16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" |
17 | %span | 17 | %span |
app/views/commits/show.html.haml
1 | %h3 | 1 | %h3 |
2 | - = "[ #{@commit.committer} ] #{@commit.truncated_message(40)}" | 2 | + = "[ #{@commit.committer} ] #{truncate(@commit.safe_message)}" |
3 | -#= link_to 'Back', project_commits_path(@project), :class => "button" | 3 | -#= link_to 'Back', project_commits_path(@project), :class => "button" |
4 | %table.round-borders | 4 | %table.round-borders |
5 | %tr | 5 | %tr |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | %td= @commit.committed_date | 16 | %td= @commit.committed_date |
17 | %tr | 17 | %tr |
18 | %td Message | 18 | %td Message |
19 | - %td= @commit.message | 19 | + %td= @commit.safe_message |
20 | %tr | 20 | %tr |
21 | %td Tree | 21 | %td Tree |
22 | %td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id) | 22 | %td= link_to 'Browse Code', tree_project_path(@project, :commit_id => @commit.id) |
app/views/issues/_form.html.haml
@@ -5,17 +5,21 @@ | @@ -5,17 +5,21 @@ | ||
5 | - @issue.errors.full_messages.each do |msg| | 5 | - @issue.errors.full_messages.each do |msg| |
6 | %li= msg | 6 | %li= msg |
7 | 7 | ||
8 | - .span-6 | 8 | + .span-8 |
9 | = f.label :title | 9 | = f.label :title |
10 | = f.text_field :title, :style => "width:450px" | 10 | = f.text_field :title, :style => "width:450px" |
11 | - .span-6 | 11 | + .span-8 |
12 | = f.label :content | 12 | = f.label :content |
13 | = f.text_area :content, :style => "width:450px; height:130px" | 13 | = f.text_area :content, :style => "width:450px; height:130px" |
14 | - .span-6.append-bottom | 14 | + .span-8.append-bottom |
15 | = f.label :assignee_id | 15 | = f.label :assignee_id |
16 | = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) | 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 | - unless @issue.new_record? | 21 | - unless @issue.new_record? |
18 | - .span-3.right | 22 | + .span-2.right |
19 | = f.label :closed | 23 | = f.label :closed |
20 | %br | 24 | %br |
21 | = f.check_box :closed | 25 | = f.check_box :closed |
app/views/issues/_issues.html.haml
1 | %table.round-borders#issues-table | 1 | %table.round-borders#issues-table |
2 | %tr | 2 | %tr |
3 | + - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0" | ||
4 | + %th | ||
3 | %th Assignee | 5 | %th Assignee |
4 | %th ID | 6 | %th ID |
5 | %th Title | 7 | %th Title |
6 | %th Closed? | 8 | %th Closed? |
7 | %th | 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 | = render(:partial => 'show', :locals => {:issue => issue}) | 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 | %td | 5 | %td |
3 | - = image_tag "move.png" , :class => [:handle, :left] | ||
4 | = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" | 6 | = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" |
5 | = truncate issue.assignee.name, :lenght => 20 | 7 | = truncate issue.assignee.name, :lenght => 20 |
6 | %td ##{issue.id} | 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 | %td | 22 | %td |
9 | - if can? current_user, :write_issue, @project | 23 | - if can? current_user, :write_issue, @project |
10 | = form_for([@project, issue], :remote => true) do |f| | 24 | = form_for([@project, issue], :remote => true) do |f| |
app/views/projects/_recent_commits.html.haml
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | 6 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" |
7 | %p{:style => "margin-bottom: 3px;"} | 7 | %p{:style => "margin-bottom: 3px;"} |
8 | %strong | 8 | %strong |
9 | - = link_to commit.truncated_message(60), project_commit_path(@project, :id => commit.id) | 9 | + = link_to truncate(commit.safe_message, :length => 60), project_commit_path(@project, :id => commit.id) |
10 | 10 | ||
11 | %span | 11 | %span |
12 | %span.author | 12 | %span.author |
app/views/projects/_recent_messages.html.haml
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | - css_class = "dash_commit" | 19 | - css_class = "dash_commit" |
20 | - commit = parent | 20 | - commit = parent |
21 | - item_code = commit.author.email | 21 | - item_code = commit.author.email |
22 | - - link_item_name = commit.truncated_message(50) | 22 | + - link_item_name = truncate(commit.safe_message, :length => 50) |
23 | - link_to_item = project_commit_path(@project, :id => commit.id) | 23 | - link_to_item = project_commit_path(@project, :id => commit.id) |
24 | - else | 24 | - else |
25 | - css_class = "dash_wall" | 25 | - css_class = "dash_wall" |
app/views/projects/_tree_item.html.haml
@@ -12,4 +12,4 @@ | @@ -12,4 +12,4 @@ | ||
12 | = time_ago_in_words(content_commit.committed_date) | 12 | = time_ago_in_words(content_commit.committed_date) |
13 | ago | 13 | ago |
14 | %td | 14 | %td |
15 | - = link_to content_commit.truncated_message(40), project_commit_path(@project, content_commit) | 15 | + = link_to truncate(content_commit.safe_message, :length => 40), project_commit_path(@project, content_commit) |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended to check this file into your version control system. | 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 | create_table "issues", :force => true do |t| | 16 | create_table "issues", :force => true do |t| |
17 | t.string "title" | 17 | t.string "title" |
@@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do | @@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20111021101550) do | ||
23 | t.datetime "updated_at" | 23 | t.datetime "updated_at" |
24 | t.boolean "closed", :default => false, :null => false | 24 | t.boolean "closed", :default => false, :null => false |
25 | t.integer "position", :default => 0 | 25 | t.integer "position", :default => 0 |
26 | + t.boolean "critical", :default => false, :null => false | ||
26 | end | 27 | end |
27 | 28 | ||
28 | create_table "keys", :force => true do |t| | 29 | create_table "keys", :force => true do |t| |
lib/commit_ext.rb
1 | module CommitExt | 1 | module CommitExt |
2 | - # Cause of encoding rails truncate raise error | ||
3 | - # this method is temporary decision | ||
4 | - def truncated_message(size = 80) | ||
5 | - message.length > size ? (message[0..(size - 1)] + "...") : message | 2 | + def safe_message |
3 | + message.encode("UTF-8", | ||
4 | + :invalid => :replace, | ||
5 | + :undef => :replace, | ||
6 | + :universal_newline => true, | ||
7 | + :replace => "") | ||
6 | rescue | 8 | rescue |
7 | "-- invalid encoding for commit message" | 9 | "-- invalid encoding for commit message" |
8 | end | 10 | end |
spec/requests/team_members_spec.rb
@@ -10,7 +10,9 @@ describe "TeamMembers" do | @@ -10,7 +10,9 @@ describe "TeamMembers" do | ||
10 | describe "View profile" do | 10 | describe "View profile" do |
11 | it "should be available" do | 11 | it "should be available" do |
12 | visit(team_project_path(@project)) | 12 | visit(team_project_path(@project)) |
13 | - find(:xpath, "//table[@id='team-table']//a[1]").click | 13 | + within "#team-table" do |
14 | + click_link(@user.name) | ||
15 | + end | ||
14 | page.should have_content @user.skype | 16 | page.should have_content @user.skype |
15 | page.should_not have_content 'Twitter' | 17 | page.should_not have_content 'Twitter' |
16 | end | 18 | end |