Commit 0590aa9d6073e79ba47c4fe5c34318f6889c44d8
1 parent
67ef96ea
Exists in
master
and in
4 other branches
commit.short_id as model method. Styled inline comment form
Showing
7 changed files
with
46 additions
and
23 deletions
Show diff stats
app/assets/javascripts/note.js
@@ -33,7 +33,7 @@ init: | @@ -33,7 +33,7 @@ init: | ||
33 | }) | 33 | }) |
34 | 34 | ||
35 | $("#note_note").live("focus", function(){ | 35 | $("#note_note").live("focus", function(){ |
36 | - $(this).css("height", "100px"); | 36 | + $(this).css("height", "80px"); |
37 | $('.note_advanced_opts').show(); | 37 | $('.note_advanced_opts').show(); |
38 | }); | 38 | }); |
39 | 39 |
app/assets/stylesheets/notes.scss
@@ -24,8 +24,8 @@ | @@ -24,8 +24,8 @@ | ||
24 | 24 | ||
25 | /* Note textare */ | 25 | /* Note textare */ |
26 | #note_note { | 26 | #note_note { |
27 | - height:100px; | ||
28 | - width:97%; | 27 | + height:80px; |
28 | + width:99%; | ||
29 | font-size:14px; | 29 | font-size:14px; |
30 | } | 30 | } |
31 | 31 | ||
@@ -100,8 +100,25 @@ tr.line_notes_row { | @@ -100,8 +100,25 @@ tr.line_notes_row { | ||
100 | td { | 100 | td { |
101 | border-bottom:1px solid #ddd; | 101 | border-bottom:1px solid #ddd; |
102 | } | 102 | } |
103 | - .actions { | 103 | + .note_actions { |
104 | margin:0; | 104 | margin:0; |
105 | + padding-top: 10px; | ||
106 | + | ||
107 | + .buttons { | ||
108 | + float:left; | ||
109 | + width:300px; | ||
110 | + } | ||
111 | + .options { | ||
112 | + .labels { | ||
113 | + float:left; | ||
114 | + padding-left:10px; | ||
115 | + label { | ||
116 | + padding: 6px 0; | ||
117 | + margin: 0; | ||
118 | + width:120px; | ||
119 | + } | ||
120 | + } | ||
121 | + } | ||
105 | } | 122 | } |
106 | } | 123 | } |
107 | 124 |
app/decorators/commit_decorator.rb
1 | class CommitDecorator < ApplicationDecorator | 1 | class CommitDecorator < ApplicationDecorator |
2 | decorates :commit | 2 | decorates :commit |
3 | 3 | ||
4 | - def short_id(length = 10) | ||
5 | - id.to_s[0..length] | ||
6 | - end | ||
7 | - | ||
8 | # Returns the commits title. | 4 | # Returns the commits title. |
9 | # | 5 | # |
10 | # Usually, the commit title is the first line of the commit message. | 6 | # Usually, the commit title is the first line of the commit message. |
app/models/commit.rb
@@ -114,6 +114,10 @@ class Commit | @@ -114,6 +114,10 @@ class Commit | ||
114 | @head = head | 114 | @head = head |
115 | end | 115 | end |
116 | 116 | ||
117 | + def short_id(length = 10) | ||
118 | + id.to_s[0..length] | ||
119 | + end | ||
120 | + | ||
117 | def safe_message | 121 | def safe_message |
118 | utf8 message | 122 | utf8 message |
119 | end | 123 | end |
@@ -150,4 +154,8 @@ class Commit | @@ -150,4 +154,8 @@ class Commit | ||
150 | def prev_commit_id | 154 | def prev_commit_id |
151 | prev_commit.try :id | 155 | prev_commit.try :id |
152 | end | 156 | end |
157 | + | ||
158 | + def parents_count | ||
159 | + parents && parents.count || 0 | ||
160 | + end | ||
153 | end | 161 | end |
app/views/commits/_commit_box.html.haml
app/views/notes/_form.html.haml
1 | = form_for [@project, @note], :remote => "true", :multipart => true do |f| | 1 | = form_for [@project, @note], :remote => "true", :multipart => true do |f| |
2 | - %h3 Leave a comment | 2 | + %h3.page_title Leave a comment |
3 | -if @note.errors.any? | 3 | -if @note.errors.any? |
4 | .alert-message.block-message.error | 4 | .alert-message.block-message.error |
5 | - @note.errors.full_messages.each do |msg| | 5 | - @note.errors.full_messages.each do |msg| |
app/views/notes/_per_line_form.html.haml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | %tr.per_line_form | 2 | %tr.per_line_form |
3 | %td{:colspan => 3 } | 3 | %td{:colspan => 3 } |
4 | = form_for [@project, @note], :remote => "true", :multipart => true do |f| | 4 | = form_for [@project, @note], :remote => "true", :multipart => true do |f| |
5 | - %h3 Leave a note | 5 | + %h3.page_title Leave a note |
6 | %div.span10 | 6 | %div.span10 |
7 | -if @note.errors.any? | 7 | -if @note.errors.any? |
8 | .alert-message.block-message.error | 8 | .alert-message.block-message.error |
@@ -13,19 +13,21 @@ | @@ -13,19 +13,21 @@ | ||
13 | = f.hidden_field :noteable_type | 13 | = f.hidden_field :noteable_type |
14 | = f.hidden_field :line_code | 14 | = f.hidden_field :line_code |
15 | = f.text_area :note, :size => 255 | 15 | = f.text_area :note, :size => 255 |
16 | - %h5 Notify via email: | ||
17 | - .clearfix | ||
18 | - = label_tag :notify do | ||
19 | - = check_box_tag :notify, 1, @note.noteable_type != "Commit" | ||
20 | - %span Project team | 16 | + .note_actions |
17 | + .buttons | ||
18 | + = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note" | ||
19 | + = link_to "Cancel", "#", :class => "btn hide-button" | ||
20 | + .options | ||
21 | + %h6.left Notify via email: | ||
22 | + .labels | ||
23 | + = label_tag :notify do | ||
24 | + = check_box_tag :notify, 1, @note.noteable_type != "Commit" | ||
25 | + %span Project team | ||
21 | 26 | ||
22 | - - if @note.notify_only_author?(current_user) | ||
23 | - = label_tag :notify_author do | ||
24 | - = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" | ||
25 | - %span Commit author | ||
26 | - .actions | ||
27 | - = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note" | ||
28 | - = link_to "Close", "#", :class => "btn hide-button" | 27 | + - if @note.notify_only_author?(current_user) |
28 | + = label_tag :notify_author do | ||
29 | + = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" | ||
30 | + %span Commit author | ||
29 | 31 | ||
30 | :javascript | 32 | :javascript |
31 | $(function(){ | 33 | $(function(){ |