Commit a8e4fb61442569e75f00eb5a05faa73d8e484f6f
Exists in
master
and in
4 other branches
Merge branch 'feature/issue_with_branch'
Showing
8 changed files
with
110 additions
and
49 deletions
Show diff stats
app/assets/stylesheets/issues.css.scss
app/assets/stylesheets/projects.css.scss
app/controllers/issues_controller.rb
| ... | ... | @@ -9,7 +9,7 @@ class IssuesController < ApplicationController |
| 9 | 9 | before_filter :authorize_read_issue! |
| 10 | 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 | 14 | def index |
| 15 | 15 | @issues = case params[:f].to_i |
| ... | ... | @@ -41,6 +41,13 @@ class IssuesController < ApplicationController |
| 41 | 41 | @notes = @issue.notes.inc_author.order("created_at DESC").limit(20) |
| 42 | 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 | 51 | respond_to do |format| |
| 45 | 52 | format.html |
| 46 | 53 | format.js { respond_with_notes } | ... | ... |
app/models/issue.rb
| ... | ... | @@ -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" | |
| 1 | +.issue-show-holder.ui-box | |
| 2 | + %h3 | |
| 3 | + = "Issue ##{@issue.id}" | |
| 4 | + .right | |
| 5 | + - if @issue.closed | |
| 6 | + %span.tag.high Resolved | |
| 7 | + - else | |
| 8 | + %span.tag.today Open | |
| 9 | 9 | |
| 10 | - .loading{ :style => "display:none;"} | |
| 11 | - %center= image_tag "ajax-loader.gif" | |
| 12 | -.right.width-30p | |
| 13 | - .span-8 | |
| 14 | - %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 | |
| 10 | + .data | |
| 11 | + %p= @issue.title | |
| 32 | 12 | |
| 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) | |
| 13 | + - if @issue.author == @issue.assignee | |
| 14 | + = image_tag gravatar_icon(@issue.assignee_email), :width => 20, :style => "padding:0 5px;" | |
| 15 | + = @issue.assignee_name | |
| 16 | + - else | |
| 17 | + = image_tag gravatar_icon(@issue.author_email), :width => 20, :style => "padding:0 5px;" | |
| 18 | + = @issue.author_name | |
| 19 | + → | |
| 20 | + = image_tag gravatar_icon(@issue.assignee_email), :width => 20, :style => "padding:0 5px;" | |
| 21 | + = @issue.assignee_name | |
| 22 | + .right | |
| 23 | + %cite.cgray= @issue.created_at.stamp("21 Aug 2011, 11:15pm") | |
| 46 | 24 | .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}" | |
| 25 | + | |
| 26 | + .buttons | |
| 27 | + - if can? current_user, :write_issue, @issue | |
| 28 | + - if @issue.closed | |
| 29 | + = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "grey-button" | |
| 30 | + - else | |
| 31 | + = link_to 'Resolve', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "grey-button" | |
| 32 | + .right | |
| 33 | + = link_to 'Edit', edit_project_issue_path(@project, @issue), :class => "grey-button positive" | |
| 34 | + | |
| 35 | +.clear | |
| 36 | +%br | |
| 37 | +%br | |
| 38 | + | |
| 39 | +.issue_notes= render "notes/notes" | |
| 40 | +.loading{ :style => "display:none;"} | |
| 41 | + %center= image_tag "ajax-loader.gif" | |
| 50 | 42 | .clear | ... | ... |
db/schema.rb
| ... | ... | @@ -11,7 +11,17 @@ |
| 11 | 11 | # |
| 12 | 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 | 26 | create_table "issues", :force => true do |t| |
| 17 | 27 | t.string "title" |
| ... | ... | @@ -23,6 +33,7 @@ ActiveRecord::Schema.define(:version => 20111115063954) do |
| 23 | 33 | t.boolean "closed", :default => false, :null => false |
| 24 | 34 | t.integer "position", :default => 0 |
| 25 | 35 | t.boolean "critical", :default => false, :null => false |
| 36 | + t.string "branch_name" | |
| 26 | 37 | end |
| 27 | 38 | |
| 28 | 39 | create_table "keys", :force => true do |t| | ... | ... |