Commit a77c8bf9c3635393064490e752aa99f10bf32722

Authored by Dmitriy Zaporozhets
1 parent d81f0b78

Bootstrap: Issues & MR

app/assets/stylesheets/common.scss
@@ -162,6 +162,10 @@ img.avatar { @@ -162,6 +162,10 @@ img.avatar {
162 p { padding-top:5px;} 162 p { padding-top:5px;}
163 } 163 }
164 164
  165 +.author_link {
  166 + color: $active_link_color;
  167 +}
  168 +
165 @import "reset_bootstrap.scss"; 169 @import "reset_bootstrap.scss";
166 @import "top_panel.scss"; 170 @import "top_panel.scss";
167 @import "projects.css.scss"; 171 @import "projects.css.scss";
app/assets/stylesheets/reset_bootstrap.scss
@@ -6,7 +6,33 @@ a { @@ -6,7 +6,33 @@ a {
6 } 6 }
7 } 7 }
8 8
9 -.alert-message.entry { 9 +.entry {
  10 + position: relative;
  11 + padding: 7px 15px;
  12 + margin-bottom: 18px;
  13 + color: #404040;
  14 + background-color: #eedc94;
  15 + background-repeat: repeat-x;
  16 + background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));
  17 + background-image: -moz-linear-gradient(top, #fceec1, #eedc94);
  18 + background-image: -ms-linear-gradient(top, #fceec1, #eedc94);
  19 + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));
  20 + background-image: -webkit-linear-gradient(top, #fceec1, #eedc94);
  21 + background-image: -o-linear-gradient(top, #fceec1, #eedc94);
  22 + background-image: linear-gradient(top, #fceec1, #eedc94);
  23 + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFCEEC1', endColorstr='#FFEEDC94', GradientType=0);
  24 + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
  25 + border-color: #eedc94 #eedc94 #e4c652;
  26 + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) fadein(rgba(0, 0, 0, 0.1), 15%);
  27 + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  28 + border-width: 1px;
  29 + border-style: solid;
  30 + -webkit-border-radius: 4px;
  31 + -moz-border-radius: 4px;
  32 + border-radius: 4px;
  33 + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  34 + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  35 + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
10 background:#F1F1F1; 36 background:#F1F1F1;
11 border-color:#ccc; 37 border-color:#ccc;
12 } 38 }
app/assets/stylesheets/tree.scss
@@ -119,4 +119,8 @@ table.highlighttable .linenodiv pre { @@ -119,4 +119,8 @@ table.highlighttable .linenodiv pre {
119 background: #FFFFCF; 119 background: #FFFFCF;
120 cursor:pointer; 120 cursor:pointer;
121 } 121 }
  122 +
  123 + .tree-item-file-name {
  124 + font-weight:bold;
  125 + }
122 } 126 }
app/models/commit.rb
@@ -27,7 +27,7 @@ class Commit @@ -27,7 +27,7 @@ class Commit
27 @head = head 27 @head = head
28 end 28 end
29 29
30 - def safe_message() 30 + def safe_message
31 message 31 message
32 end 32 end
33 33
app/views/issues/_form.html.haml
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 .clearfix 24 .clearfix
25 = f.label :title 25 = f.label :title
26 .input= f.text_area :title, :maxlength => 255, :class => "xlarge" 26 .input= f.text_area :title, :maxlength => 255, :class => "xlarge"
27 - .clearfix 27 + .actions
28 = f.submit 'Save', :class => "primary btn" 28 = f.submit 'Save', :class => "primary btn"
29 29
30 - if request.xhr? 30 - if request.xhr?
@@ -36,6 +36,6 @@ @@ -36,6 +36,6 @@
36 = link_to "Cancel", project_issue_path(@project, @issue), :class => "btn" 36 = link_to "Cancel", project_issue_path(@project, @issue), :class => "btn"
37 37
38 38
39 - -#- unless @issue.new_record? 39 + - unless @issue.new_record?
40 .right 40 .right
41 - = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "red-button" 41 + = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "danger btn"
app/views/issues/_show.html.haml
1 -%tr{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) }  
2 - %td  
3 - = image_tag gravatar_icon(issue.assignee_email), :class => "left", :width => 40, :style => "padding-right:5px;"  
4 - %span  
5 - = truncate(html_escape(issue.title), :length => 50)  
6 - %div.note-author  
7 - %strong= issue.assignee.name  
8 - %cite.cgray  
9 - = time_ago_in_words(issue.created_at)  
10 - ago  
11 - - if issue.critical  
12 - %span.tag.high critical  
13 - - if issue.today?  
14 - %span.tag.today today  
15 - .right.action-links  
16 - - if can? current_user, :write_issue, issue  
17 - - if issue.closed  
18 - = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true  
19 - - else  
20 - = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true  
21 - - if can? current_user, :write_issue, issue  
22 - = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true  
23 - - if can?(current_user, :admin_issue, @project) || issue.author == current_user  
24 - = link_to 'Remove', [issue.project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "danger btn small delete-issue", :id => "destroy_issue_#{issue.id}" 1 +%li.wll{ :id => dom_id(issue), :class => "issue #{issue.critical ? "critical" : ""}", :url => project_issue_path(issue.project, issue) }
  2 + = image_tag gravatar_icon(issue.author_email), :class => "avatar"
  3 + %span.update-author
  4 + %strong
  5 + = link_to project_team_member_path(@project, @project.team_member_by_id(issue.author_id)), :class => "author_link" do
  6 + = issue.author_name
  7 + authored
  8 + = time_ago_in_words(issue.created_at)
  9 + ago
  10 + - if issue.critical
  11 + %span.label.important critical
  12 + - if issue.today?
  13 + %span.label.success today
  14 +
  15 + .right
  16 + - if can? current_user, :write_issue, issue
  17 + - if issue.closed
  18 + = link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small", :remote => true
  19 + - else
  20 + = link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small", :remote => true
  21 + - if can? current_user, :write_issue, issue
  22 + = link_to 'Edit', edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true
  23 + -#- if can?(current_user, :admin_issue, @project) || issue.author == current_user
  24 + = link_to 'Remove', [issue.project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "danger btn small delete-issue", :id => "destroy_issue_#{issue.id}"
  25 +
  26 +
  27 + = link_to project_issue_path(issue.project, issue) do
  28 + %p
  29 + Issue ##{issue.id}:
  30 + = truncate(issue.title, :length => 50)
  31 +
  32 +
  33 +
  34 +
app/views/issues/index.html.haml
@@ -13,25 +13,29 @@ @@ -13,25 +13,29 @@
13 New Issue 13 New Issue
14 %hr 14 %hr
15 %div#issues-table-holder 15 %div#issues-table-holder
16 - %ul.pills.left  
17 - %li{:class => ("active" if (params[:f] == "0" || !params[:f]))}  
18 - = link_to project_issues_path(@project, :f => 0) do  
19 - Open  
20 - %li{:class => ("active" if params[:f] == "2")}  
21 - = link_to project_issues_path(@project, :f => 2) do  
22 - Closed  
23 - %li{:class => ("active" if params[:f] == "3")}  
24 - = link_to project_issues_path(@project, :f => 3) do  
25 - To Me  
26 - %li{:class => ("active" if params[:f] == "1")}  
27 - = link_to project_issues_path(@project, :f => 1) do  
28 - All 16 + .row
  17 + .span8
  18 + %ul.pills.left
  19 + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
  20 + = link_to project_issues_path(@project, :f => 0) do
  21 + Open
  22 + %li{:class => ("active" if params[:f] == "2")}
  23 + = link_to project_issues_path(@project, :f => 2) do
  24 + Closed
  25 + %li{:class => ("active" if params[:f] == "3")}
  26 + = link_to project_issues_path(@project, :f => 3) do
  27 + To Me
  28 + %li{:class => ("active" if params[:f] == "1")}
  29 + = link_to project_issues_path(@project, :f => 1) do
  30 + All
29 31
30 - = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do  
31 - = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }  
32 - = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' } 32 + .span2.right
  33 + = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do
  34 + = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
  35 + = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }
33 36
34 - %table#issues-table= render "issues" 37 + %hr
  38 + %ul#issues-table.unstyled= render "issues"
35 39
36 :javascript 40 :javascript
37 var href = $('.issue_search').parent().attr('action'); 41 var href = $('.issue_search').parent().attr('action');
@@ -46,7 +50,7 @@ @@ -46,7 +50,7 @@
46 50
47 if (terms.length >= 2 || terms.length == 0) { 51 if (terms.length >= 2 || terms.length == 0) {
48 $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) { 52 $.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
49 - $('#issues-table tbody').html(response); 53 + $('#issues-table').html(response);
50 setSortable(); 54 setSortable();
51 }); 55 });
52 } 56 }
@@ -57,7 +61,7 @@ @@ -57,7 +61,7 @@
57 $(this).closest('tr').fadeOut(); updatePage();}); 61 $(this).closest('tr').fadeOut(); updatePage();});
58 62
59 function setSortable(){ 63 function setSortable(){
60 - $('#issues-table>tbody').sortable({ 64 + $('#issues-table').sortable({
61 axis: 'y', 65 axis: 'y',
62 dropOnEmpty: false, 66 dropOnEmpty: false,
63 handle: '.handle', 67 handle: '.handle',
@@ -68,10 +72,10 @@ @@ -68,10 +72,10 @@
68 update: function(){ 72 update: function(){
69 $.ajax({ 73 $.ajax({
70 type: 'post', 74 type: 'post',
71 - data: $('#issues-table>tbody').sortable('serialize'), 75 + data: $('#issues-table').sortable('serialize'),
72 dataType: 'script', 76 dataType: 'script',
73 complete: function(request){ 77 complete: function(request){
74 - $('#issues-table>tbody').effect('highlight'); 78 + $('#issues-table').effect('highlight');
75 }, 79 },
76 url: "#{sort_project_issues_path(@project)}"}) 80 url: "#{sort_project_issues_path(@project)}"})
77 } 81 }
app/views/issues/show.html.haml
1 -%div  
2 - %span.entity-info 1 +%h3
  2 + Issue ##{@issue.id}
  3 +
  4 + %span.right
  5 + - if can?(current_user, :admin_project, @project) || @issue.author == current_user
  6 + - if @issue.closed
  7 + = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn"
  8 + - else
  9 + = link_to 'Close', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "btn", :title => "Close merge request"
3 - if can?(current_user, :admin_project, @project) || @issue.author == current_user 10 - if can?(current_user, :admin_project, @project) || @issue.author == current_user
4 - = link_to edit_project_issue_path(@project, @issue) do  
5 - .entity-button  
6 - Edit Issue  
7 - %i  
8 - = image_tag gravatar_icon(@issue.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"  
9 - %span.commit-title  
10 - %strong  
11 - = "Issue ##{@issue.id}:"  
12 - %span.commit-author  
13 - %strong  
14 - = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.author.id)) do  
15 - %span.author= @issue.author_name  
16 - - if @issue.author != @issue.assignee 11 + = link_to edit_project_issue_path(@project, @issue), :class => "btn small" do
  12 + Edit
  13 +
  14 +%hr
  15 +- if @issue.closed
  16 + .alert-message.error Closed
  17 +- else
  18 + .alert-message.success Open
  19 +
  20 +
  21 +%div.well
  22 + %div
  23 + %span.entity-info
  24 + = image_tag gravatar_icon(@issue.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"
  25 + %span.commit-title
  26 + %strong
  27 + %span.commit-author
  28 + %strong
  29 + = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.author.id)) do
  30 + %span.author= @issue.author_name
17 → 31 →
18 = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.assignee.id)) do 32 = link_to project_team_member_path(@project, @project.team_member_by_id(@issue.assignee.id)) do
19 %span.author= @issue.assignee_name 33 %span.author= @issue.assignee_name
20 -    
21 -  
22 -    
23 - = @issue.created_at.stamp("Aug 21, 2011 9:23pm")  
24 -  
25 - %hr  
26 - %br  
27 - %h3  
28 - = simple_format @issue.title  
29 -  
30 -.clear  
31 -%br  
32 -%br  
33 -  
34 -.merge-tabs  
35 - = link_to "#notes", :class => "merge-notes-tab active tab" do  
36 - %span  
37 - Notes  
38 - .right  
39 - - if @issue.closed  
40 - = link_to 'Reopen', project_issue_path(@project, @issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "red-button"  
41 - - else  
42 - = link_to 'Close', project_issue_path(@project, @issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "positive-button"  
43 -  
44 -.merge-request-notes  
45 - .issue_notes= render "notes/notes"  
46 - .loading{ :style => "display:none;"}  
47 - %center= image_tag "ajax-loader.gif"  
48 - .clear 34 + %br
  35 + .cgray= @issue.created_at.stamp("Aug 21, 2011 9:23pm")
  36 +
  37 +
  38 + %div= simple_format @issue.title
  39 +
  40 +
  41 +.issue_notes= render "notes/notes"
49 42
app/views/merge_requests/_commits.html.haml
1 - if @commits.size > 0 1 - if @commits.size > 0
2 - .merge-request-commits.ui-box.width-100p 2 + .merge-request-commits
3 - @commits.each do |commit| 3 - @commits.each do |commit|
4 - %a{ :class => "commit", :href => project_commit_path(@project, :id => commit.id) }  
5 - - if commit.author_email  
6 - = image_tag gravatar_icon(commit.author_email), :class => "left", :width => 40, :style => "padding-right:5px;"  
7 - - else  
8 - = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"  
9 - %span.commit-title  
10 - = truncate commit.safe_message, :length => 60  
11 - %span.commit-author  
12 - %strong= commit.author_name  
13 - authored  
14 - = time_ago_in_words(commit.created_at)  
15 - ago  
16 - .clear 4 + .entry
  5 + = link_to project_commit_path(@project, :id => commit.id) do
  6 + %strong
  7 + = truncate(commit.id.to_s, :length => 10)
  8 + = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16
  9 + %span= truncate(commit.safe_message, :length => 40)
  10 + %span.right
  11 + = time_ago_in_words(commit.committed_date)
  12 + ago
17 13
18 - if @commits.empty? 14 - if @commits.empty?
19 %p.cgray Nothing to merge 15 %p.cgray Nothing to merge
app/views/merge_requests/_merge_request.html.haml
1 -%a.update-item{:href => project_merge_request_path(merge_request.project, merge_request)}  
2 - = image_tag gravatar_icon(merge_request.author_email), :class => "left", :width => 40  
3 - %span.update-title  
4 - = truncate(merge_request.title, :length => 60) 1 +%li.wll
  2 + = image_tag gravatar_icon(merge_request.author_email), :class => "avatar"
5 %span.update-author 3 %span.update-author
6 - %strong= merge_request.author_name 4 + %strong
  5 + = link_to project_team_member_path(@project, @project.team_member_by_id(merge_request.author_id)), :class => "author_link" do
  6 + = merge_request.author_name
7 authored 7 authored
8 = time_ago_in_words(merge_request.created_at) 8 = time_ago_in_words(merge_request.created_at)
9 ago 9 ago
10 .right 10 .right
11 - %span.tag.commit= merge_request.source_branch 11 + %span.label= merge_request.source_branch
12 → 12 →
13 - %span.tag.commit= merge_request.target_branch  
14 - 13 + %span.label= merge_request.target_branch
  14 + = link_to project_merge_request_path(merge_request.project, merge_request) do
  15 + %p
  16 + Merge Request ##{merge_request.id}:
  17 + = truncate(merge_request.title, :length => 50)
app/views/merge_requests/index.html.haml
1 -.left.issues_filter  
2 - = form_tag project_merge_requests_path(@project), :method => :get do  
3 - .left  
4 - = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_merge_requests", :class => "status"  
5 - = label_tag "open_merge_requests" do  
6 - %span.tag.open Open  
7 - .left  
8 - = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_merge_requests", :class => "status"  
9 - = label_tag "closed_merge_requests" do  
10 - %span.tag.closed Closed 1 +%h3
  2 + Merge Requests
  3 + - if can? current_user, :write_issue, @project
  4 + = link_to new_project_merge_request_path(@project), :class => "right btn small", :title => "New Merge Request" do
  5 + New Merge Request
11 6
12 -.clear  
13 %hr 7 %hr
14 8
  9 +%ul.pills
  10 + %li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
  11 + = link_to project_merge_requests_path(@project, :f => 0) do
  12 + Open
  13 + %li{:class => ("active" if params[:f] == "2")}
  14 + = link_to project_merge_requests_path(@project, :f => 2) do
  15 + Closed
  16 +
  17 +%hr
  18 +%ul.unstyled= render @merge_requests
15 19
16 -.row  
17 - .span10  
18 - - if @merge_requests.count > 0  
19 - %div{ :class => "update-data ui-box ui-box-small ui-box-big" }  
20 - .data  
21 - = render @merge_requests  
22 - .span4  
23 - - if can? current_user, :write_merge_request, @project  
24 - .alert-message.block-message.info  
25 - %p You can open a new merge request.  
26 - - if current_page?(project_merge_requests_path(@project))  
27 - = link_to new_project_merge_request_path(@project), :class => "btn small", :title => "New Merge request" do  
28 - Add new