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
app/assets/stylesheets/notes.scss
| ... | ... | @@ -24,8 +24,8 @@ |
| 24 | 24 | |
| 25 | 25 | /* Note textare */ |
| 26 | 26 | #note_note { |
| 27 | - height:100px; | |
| 28 | - width:97%; | |
| 27 | + height:80px; | |
| 28 | + width:99%; | |
| 29 | 29 | font-size:14px; |
| 30 | 30 | } |
| 31 | 31 | |
| ... | ... | @@ -100,8 +100,25 @@ tr.line_notes_row { |
| 100 | 100 | td { |
| 101 | 101 | border-bottom:1px solid #ddd; |
| 102 | 102 | } |
| 103 | - .actions { | |
| 103 | + .note_actions { | |
| 104 | 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
app/models/commit.rb
| ... | ... | @@ -114,6 +114,10 @@ class Commit |
| 114 | 114 | @head = head |
| 115 | 115 | end |
| 116 | 116 | |
| 117 | + def short_id(length = 10) | |
| 118 | + id.to_s[0..length] | |
| 119 | + end | |
| 120 | + | |
| 117 | 121 | def safe_message |
| 118 | 122 | utf8 message |
| 119 | 123 | end |
| ... | ... | @@ -150,4 +154,8 @@ class Commit |
| 150 | 154 | def prev_commit_id |
| 151 | 155 | prev_commit.try :id |
| 152 | 156 | end |
| 157 | + | |
| 158 | + def parents_count | |
| 159 | + parents && parents.count || 0 | |
| 160 | + end | |
| 153 | 161 | end | ... | ... |
app/views/commits/_commit_box.html.haml
app/views/notes/_form.html.haml
app/views/notes/_per_line_form.html.haml
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | %tr.per_line_form |
| 3 | 3 | %td{:colspan => 3 } |
| 4 | 4 | = form_for [@project, @note], :remote => "true", :multipart => true do |f| |
| 5 | - %h3 Leave a note | |
| 5 | + %h3.page_title Leave a note | |
| 6 | 6 | %div.span10 |
| 7 | 7 | -if @note.errors.any? |
| 8 | 8 | .alert-message.block-message.error |
| ... | ... | @@ -13,19 +13,21 @@ |
| 13 | 13 | = f.hidden_field :noteable_type |
| 14 | 14 | = f.hidden_field :line_code |
| 15 | 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 | 32 | :javascript |
| 31 | 33 | $(function(){ | ... | ... |