Commit 32abaa33f895f154aef126e7ea799aacdf8c6ee8

Authored by Dmitriy Zaporozhets
2 parents 9054f64c 67b9fa51

Merge branch 'issues_restyle' into dev

app/assets/stylesheets/projects.css.scss
@@ -679,6 +679,30 @@ body.project-page table .commit { @@ -679,6 +679,30 @@ body.project-page table .commit {
679 } 679 }
680 } 680 }
681 681
  682 +#notes-list .note .delete-note { display:none; }
  683 +#notes-list .note:hover .delete-note { display:block; }
  684 +
  685 +#issues-table-holder .issue .action-links {
  686 + display:none;
  687 + a {
  688 + margin-left:10px;
  689 + }
  690 +}
  691 +
  692 +.issue-number {
  693 + float: left;
  694 + border-radius: 5px;
  695 + text-shadow: none;
  696 + background: rgba(0, 0, 0, 0.12);
  697 + text-align: center;
  698 + padding: 14px 8px;
  699 + width: 40px;
  700 + margin-right: 10px;
  701 + color: #444;
  702 +}
  703 +
  704 +#issues-table-holder .issue:hover .action-links { display:block; }
  705 +
682 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} 706 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
683 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;} 707 body.project-page #notes-list .note {padding: 10px; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
684 body.project-page #notes-list .note img{float: left; margin-right: 10px;} 708 body.project-page #notes-list .note img{float: left; margin-right: 10px;}
app/controllers/issues_controller.rb
@@ -47,6 +47,7 @@ class IssuesController < ApplicationController @@ -47,6 +47,7 @@ class IssuesController < ApplicationController
47 def create 47 def create
48 @issue = @project.issues.new(params[:issue]) 48 @issue = @project.issues.new(params[:issue])
49 @issue.author = current_user 49 @issue.author = current_user
  50 +
50 if @issue.save && @issue.assignee != current_user 51 if @issue.save && @issue.assignee != current_user
51 Notify.new_issue_email(@issue).deliver 52 Notify.new_issue_email(@issue).deliver
52 end 53 end
app/views/issues/_issues.html.haml
1 -%table.round-borders#issues-table  
2 - %thead  
3 - - if can?(current_user, :admin_issue, @project) && !params[:f] || params[:f] == "0"  
4 - %th  
5 - %th Assignee  
6 - %th ID  
7 - %th Title  
8 - %th Closed? 1 +- @issues.critical.each do |issue|
  2 + = render(:partial => 'show', :locals => {:issue => issue})
9 3
10 - - @issues.critical.each do |issue|  
11 - = render(:partial => 'show', :locals => {:issue => issue})  
12 -  
13 - - @issues.non_critical.each do |issue|  
14 - = render(:partial => 'show', :locals => {:issue => issue}) 4 +- @issues.non_critical.each do |issue|
  5 + = render(:partial => 'show', :locals => {:issue => issue})
app/views/issues/_show.html.haml
1 %tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :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") 2 + -#- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
3 %td 3 %td
4 = image_tag "move.png" , :class => [:handle, :left] 4 = image_tag "move.png" , :class => [:handle, :left]
5 %td 5 %td
6 - = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"  
7 - = issue.assignee.name  
8 - %td ##{issue.id}  
9 - %td  
10 - = truncate(html_escape(issue.title), :length => 200) 6 + %strong.issue-number= "##{issue.id}"
  7 + %span
  8 + = truncate(html_escape(issue.title), :length => fixed_mode? ? 100 : 200)
11 %br 9 %br
12 %br 10 %br
13 - - if issue.critical  
14 - %span.tag.high critical  
15 - - if issue.today?  
16 - %span.tag.today today  
17 -  
18 - .right  
19 - - if can?(current_user, :admin_issue, @project) || issue.author == current_user  
20 - = link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray", :remote => true  
21 - - if can?(current_user, :admin_issue, @project) || issue.author == current_user  
22 -    
23 - = link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}"  
24 -  
25 - -#- if issue.author == current_user  
26 - -#%span.tag.yours yours  
27 - -#- if issue.notes.count > 0  
28 - -#%span.tag.notes  
29 - -#= issue.notes.count  
30 - -#notes  
31 - %td  
32 - - if can? current_user, :write_issue, @project  
33 - = form_for([@project, issue], :remote => true) do |f|  
34 - = f.check_box :closed, :onclick => "$(this).parent().submit();"  
35 - = hidden_field_tag :status_only, true  
36 - - else  
37 - = check_box_tag "closed", 1, issue.closed, :disabled => true 11 + %div.note-author
  12 + %strong= issue.assignee.name
  13 + %cite.cgray
  14 + = time_ago_in_words(issue.updated_at)
  15 + ago
  16 + - if issue.critical
  17 + %span.tag.high critical
  18 + - if issue.today?
  19 + %span.tag.today today
  20 + .right.action-links
  21 + - if can? current_user, :write_issue, issue
  22 + - if issue.closed
  23 + = link_to 'Reopen', project_issue_path(@project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "cgray", :remote => true
  24 + - else
  25 + = link_to 'Resolve', project_issue_path(@project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "cgray", :remote => true
  26 + - if can? current_user, :write_issue, issue
  27 + = link_to 'Edit', edit_project_issue_path(@project, issue), :class => "cgray edit-issue-link", :remote => true
  28 + - if can?(current_user, :admin_issue, @project) || issue.author == current_user
  29 + = link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-issue negative", :id => "destroy_issue_#{issue.id}"
app/views/issues/create.js.haml
1 - if @issue.valid? 1 - if @issue.valid?
2 :plain 2 :plain
3 $("#new_issue_dialog").dialog("close"); 3 $("#new_issue_dialog").dialog("close");
  4 + $("#issues-table").prepend("#{escape_javascript(render(:partial => 'show', :locals => {:issue => @issue} ))}");
4 $.ajax({type: "GET", url: location.href, dataType: "script"}); 5 $.ajax({type: "GET", url: location.href, dataType: "script"});
5 - else 6 - else
6 :plain 7 :plain
app/views/issues/index.html.haml
1 -%div  
2 - .top_panel_issues  
3 - - if can? current_user, :write_issue, @project  
4 - %div{:class => "left", :style => "margin-right: 10px;" }  
5 - = link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"  
6 - = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do  
7 - = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }  
8 - = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } 1 +%div#issues-table-holder
  2 + %table.round-borders#issues-table
  3 + %thead
  4 + %th
  5 + .top_panel_issues
  6 + - if can? current_user, :write_issue, @project
  7 + %div{:class => "left", :style => "margin-right: 10px;" }
  8 + = link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
  9 + = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :left, :id => "issue_search_form" do
  10 + = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
  11 + = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
9 12
10 - .right.issues_filter  
11 - = form_tag project_issues_path(@project), :method => :get do  
12 - .left  
13 - = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"  
14 - = label_tag "open_issues","Open"  
15 - .left  
16 - = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"  
17 - = label_tag "closed_issues","Closed"  
18 - .left  
19 - = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"  
20 - = label_tag "my_issues","To Me"  
21 - .left  
22 - = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"  
23 - = label_tag "all_issues","All" 13 + .right.issues_filter
  14 + = form_tag project_issues_path(@project), :method => :get do
  15 + .left
  16 + = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
  17 + = label_tag "open_issues","Open"
  18 + .left
  19 + = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
  20 + = label_tag "closed_issues","Closed"
  21 + .left
  22 + = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
  23 + = label_tag "my_issues","To Me"
  24 + .left
  25 + = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
  26 + = label_tag "all_issues","All"
24 27
25 - #issues-table-holder= render "issues" 28 + = render "issues"
26 %br 29 %br
27 :javascript 30 :javascript
28 var href = $('.issue_search').parent().attr('action'); 31 var href = $('.issue_search').parent().attr('action');
@@ -37,7 +40,7 @@ @@ -37,7 +40,7 @@
37 40
38 if (terms.length >= 2 || terms.length == 0) { 41 if (terms.length >= 2 || terms.length == 0) {
39 $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) { 42 $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
40 - $('#issues-table').html(response); 43 + $('#issues-table tbody').html(response);
41 setSortable(); 44 setSortable();
42 }); 45 });
43 } 46 }
app/views/issues/index.js.haml
1 :plain 1 :plain
2 - $('#issues-table-holder').html("#{escape_javascript(render('issues'))}"); 2 + $('#issues-table tbody').html("#{escape_javascript(render('issues'))}");
3 setSortable(); 3 setSortable();
spec/requests/issues_spec.rb
@@ -169,6 +169,7 @@ describe "Issues" do @@ -169,6 +169,7 @@ describe "Issues" do
169 :assignee => @user, 169 :assignee => @user,
170 :project => project 170 :project => project
171 visit project_issues_path(project) 171 visit project_issues_path(project)
  172 + page.execute_script("$('.action-links').css('display', 'block');")
172 click_link "Edit" 173 click_link "Edit"
173 end 174 end
174 175