Commit ee2d3de1a634611a1c660516c955be0d3000904b
1 parent
b4c40c21
Exists in
master
and in
4 other branches
ability to attach branch to issue
Showing
7 changed files
with
151 additions
and
50 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
@@ -160,6 +160,7 @@ input.ssh_project_url { | @@ -160,6 +160,7 @@ input.ssh_project_url { | ||
160 | .new_issue, | 160 | .new_issue, |
161 | .new_note, | 161 | .new_note, |
162 | .edit_user, | 162 | .edit_user, |
163 | +.edit_issue, | ||
163 | .new_project, | 164 | .new_project, |
164 | .new_snippet, | 165 | .new_snippet, |
165 | .edit_snippet, | 166 | .edit_snippet, |
app/controllers/issues_controller.rb
@@ -9,7 +9,7 @@ class IssuesController < ApplicationController | @@ -9,7 +9,7 @@ class IssuesController < ApplicationController | ||
9 | before_filter :authorize_read_issue! | 9 | before_filter :authorize_read_issue! |
10 | before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] | 10 | before_filter :authorize_write_issue!, :only => [:new, :create, :close, :edit, :update, :sort] |
11 | 11 | ||
12 | - respond_to :js | 12 | + respond_to :js, :html |
13 | 13 | ||
14 | def index | 14 | def index |
15 | @issues = case params[:f].to_i | 15 | @issues = case params[:f].to_i |
@@ -41,6 +41,13 @@ class IssuesController < ApplicationController | @@ -41,6 +41,13 @@ class IssuesController < ApplicationController | ||
41 | @notes = @issue.notes.inc_author.order("created_at DESC").limit(20) | 41 | @notes = @issue.notes.inc_author.order("created_at DESC").limit(20) |
42 | @note = @project.notes.new(:noteable => @issue) | 42 | @note = @project.notes.new(:noteable => @issue) |
43 | 43 | ||
44 | + @commits = if @issue.branch_name && @project.repo.heads.map(&:name).include?(@issue.branch_name) | ||
45 | + @project.repo.commits_between("master", @issue.branch_name) | ||
46 | + else | ||
47 | + [] | ||
48 | + end | ||
49 | + | ||
50 | + | ||
44 | respond_to do |format| | 51 | respond_to do |format| |
45 | format.html | 52 | format.html |
46 | format.js { respond_with_notes } | 53 | format.js { respond_with_notes } |
app/models/issue.rb
@@ -15,6 +15,11 @@ class Issue < ActiveRecord::Base | @@ -15,6 +15,11 @@ class Issue < ActiveRecord::Base | ||
15 | :to => :author, | 15 | :to => :author, |
16 | :prefix => true | 16 | :prefix => true |
17 | 17 | ||
18 | + delegate :name, | ||
19 | + :email, | ||
20 | + :to => :assignee, | ||
21 | + :prefix => true | ||
22 | + | ||
18 | validates :title, | 23 | validates :title, |
19 | :presence => true, | 24 | :presence => true, |
20 | :length => { :within => 0..255 } | 25 | :length => { :within => 0..255 } |
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +%div.issue-form-holder | ||
2 | + = form_for [@project, @issue] do |f| | ||
3 | + -if @issue.errors.any? | ||
4 | + %ul | ||
5 | + - @issue.errors.full_messages.each do |msg| | ||
6 | + %li= msg | ||
7 | + | ||
8 | + %table | ||
9 | + %thead | ||
10 | + %th Name | ||
11 | + %th Value | ||
12 | + %tr | ||
13 | + %td= f.label :title | ||
14 | + %td= f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255 | ||
15 | + %tr | ||
16 | + %td= f.label :assignee_id | ||
17 | + %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) | ||
18 | + %tr | ||
19 | + %td= f.label :branch_name | ||
20 | + %td= f.select(:branch_name, @project.heads.map(&:name), { :include_blank => "Select git branch" }) | ||
21 | + %tr | ||
22 | + %td | ||
23 | + = f.label :critical, "Critical" | ||
24 | + %br | ||
25 | + %td= f.check_box :critical | ||
26 | + - unless @issue.new_record? | ||
27 | + %tr | ||
28 | + %td= f.label :closed | ||
29 | + %td= f.check_box :closed | ||
30 | + = f.submit 'Save', :class => "grey-button" | ||
31 | + | ||
32 | +:javascript | ||
33 | + $(function(){ | ||
34 | + $('select#issue_branch_name').selectmenu({width:300}); | ||
35 | + $('select#issue_assignee_id').selectmenu({width:300}); | ||
36 | + }); | ||
37 | + |
app/views/issues/show.html.haml
1 | -%h2 | ||
2 | - %strong | ||
3 | - Issue | ||
4 | - = "##{@issue.id}" | ||
5 | - – | ||
6 | - = html_escape(@issue.title) | ||
7 | -.left.width-65p | ||
8 | - .issue_notes= render "notes/notes" | ||
9 | - | ||
10 | - .loading{ :style => "display:none;"} | ||
11 | - %center= image_tag "ajax-loader.gif" | ||
12 | -.right.width-30p | ||
13 | - .span-8 | 1 | +%h2.icon |
2 | + %span | ||
3 | + %d | ||
4 | + = "Issue ##{@issue.id}" | ||
5 | + – | ||
6 | + = truncate(@issue.title, :length => 50) | ||
7 | + | ||
8 | +- unless @commits.blank? | ||
9 | + .right | ||
10 | + = link_to 'Browse Code', tree_project_ref_path(@project, @issue.branch_name), :class => "browse-code button yellow", :style => "margin-right:10px;" | ||
11 | + = link_to 'Commits', project_commits_path(@project, :ref => @issue.branch_name), :class => "browse-code button" | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | +.clear | ||
16 | + | ||
17 | +%table.round-borders | ||
18 | + %thead | ||
19 | + %th | ||
20 | + %center Author | ||
21 | + %th | ||
22 | + %th | ||
23 | + %center | ||
24 | + Assignee | ||
25 | + %tr | ||
26 | + %td | ||
27 | + %center | ||
28 | + = image_tag gravatar_icon(@issue.author_email), :width => 40, :style => "padding:0 5px;" | ||
29 | + %br | ||
30 | + %br | ||
31 | + = @issue.author_name | ||
32 | + %td | ||
33 | + %center | ||
34 | + - if @issue.closed | ||
35 | + Resolved | ||
36 | + %br | ||
37 | + %span{:style => "font-size:36px;"} ← | ||
38 | + - else | ||
39 | + Open | ||
40 | + %br | ||
41 | + %span{:style => "font-size:36px;"} → | ||
42 | + %br | ||
43 | + = @issue.created_at.stamp("21 Aug 2011, 11:15pm") | ||
44 | + | ||
45 | + %td | ||
46 | + %center | ||
47 | + = image_tag gravatar_icon(@issue.assignee_email), :width => 40, :style => "padding:0 5px;" | ||
48 | + %br | ||
49 | + %br | ||
50 | + = @issue.assignee_name | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | +- if can? current_user, :write_issue, @issue | ||
55 | + - if @issue.closed | ||
56 | + = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "grey-button" | ||
57 | + - else | ||
58 | + = link_to 'Resolve', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "grey-button" | ||
59 | + .right | ||
60 | + = link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "grey-button positive" | ||
61 | + | ||
62 | + = link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-issue negative", :id => "destroy_issue_#{@issue.id}" | ||
63 | + | ||
64 | +%br | ||
65 | +%br | ||
66 | +- unless @commits.blank? | ||
14 | %table.round-borders | 67 | %table.round-borders |
15 | - %tr | ||
16 | - %td Author: | ||
17 | - %td | ||
18 | - = image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" | ||
19 | - = @issue.author.name | ||
20 | - %tr | ||
21 | - %td Assignee: | ||
22 | - %td | ||
23 | - = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;" | ||
24 | - = @issue.assignee.name | ||
25 | - %tr | ||
26 | - %td Tags | ||
27 | - %td | ||
28 | - - if @issue.critical | ||
29 | - %span.tag.high critical | ||
30 | - - else | ||
31 | - %span.tag.normal normal | ||
32 | - | ||
33 | - - if @issue.today? | ||
34 | - %span.tag.today today | ||
35 | - %tr | ||
36 | - %td Closed? | ||
37 | - %td | ||
38 | - - if can? current_user, :write_issue, @issue | ||
39 | - = form_for([@project, @issue]) do |f| | ||
40 | - = f.check_box :closed, :onclick => "$(this).parent().submit();" | ||
41 | - = hidden_field_tag :status_only, true | ||
42 | - - else | ||
43 | - = check_box_tag "closed", 1, @issue.closed, :disabled => true | ||
44 | - | ||
45 | - - if can?(current_user, :write_issue, @issue) | ||
46 | - .clear | ||
47 | - %br | ||
48 | - = link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "grey-button positive", :remote => true | ||
49 | - .right= link_to 'Destroy', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "grey-button delete-issue negative", :id => "destroy_issue_#{@issue.id}" | 68 | + %thead |
69 | + %th Unmerged Commits | ||
70 | + - @commits.each do |commit| | ||
71 | + %tr | ||
72 | + %td | ||
73 | + = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 20, :style => "padding-right:5px;" | ||
74 | + = link_to commit.id.to_s, project_commit_path(@project, :id => commit.id) | ||
75 | + .right | ||
76 | + = time_ago_in_words(commit.created_at) | ||
77 | + ago | ||
78 | + | ||
79 | + | ||
80 | +.issue_notes= render "notes/notes" | ||
81 | + | ||
82 | +.loading{ :style => "display:none;"} | ||
83 | + %center= image_tag "ajax-loader.gif" | ||
84 | + | ||
50 | .clear | 85 | .clear |
db/schema.rb
@@ -11,7 +11,17 @@ | @@ -11,7 +11,17 @@ | ||
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 => 20111115063954) do | 14 | +ActiveRecord::Schema.define(:version => 20111124115339) do |
15 | + | ||
16 | + create_table "features", :force => true do |t| | ||
17 | + t.string "name" | ||
18 | + t.string "branch_name" | ||
19 | + t.integer "assignee_id" | ||
20 | + t.integer "author_id" | ||
21 | + t.integer "project_id" | ||
22 | + t.datetime "created_at" | ||
23 | + t.datetime "updated_at" | ||
24 | + end | ||
15 | 25 | ||
16 | create_table "issues", :force => true do |t| | 26 | create_table "issues", :force => true do |t| |
17 | t.string "title" | 27 | t.string "title" |
@@ -23,6 +33,7 @@ ActiveRecord::Schema.define(:version => 20111115063954) do | @@ -23,6 +33,7 @@ ActiveRecord::Schema.define(:version => 20111115063954) do | ||
23 | t.boolean "closed", :default => false, :null => false | 33 | t.boolean "closed", :default => false, :null => false |
24 | t.integer "position", :default => 0 | 34 | t.integer "position", :default => 0 |
25 | t.boolean "critical", :default => false, :null => false | 35 | t.boolean "critical", :default => false, :null => false |
36 | + t.string "branch_name" | ||
26 | end | 37 | end |
27 | 38 | ||
28 | create_table "keys", :force => true do |t| | 39 | create_table "keys", :force => true do |t| |