Commit ae416a76ff235ad5be5aeb41e8f5d207a9c0d95b
1 parent
6473977a
Exists in
master
and in
4 other branches
per line comments improved. replaced from dbclick to link
Showing
5 changed files
with
76 additions
and
29 deletions
Show diff stats
1.16 KB
app/assets/stylesheets/notes.css.scss
| ... | ... | @@ -62,3 +62,36 @@ tr.line_notes_row { |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | +.line_notes_row, .per_line_form { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } | |
| 66 | + | |
| 67 | +.per_line_form { | |
| 68 | + background:#f5f5f5; | |
| 69 | + form { margin: 0; } | |
| 70 | + td { | |
| 71 | + border-bottom:1px solid #ddd; | |
| 72 | + } | |
| 73 | +} | |
| 74 | + | |
| 75 | +td .line_note_link { | |
| 76 | + position:absolute; | |
| 77 | + margin-left:-70px; | |
| 78 | + margin-top:-10px; | |
| 79 | + z-index:10; | |
| 80 | + background: url("comment_add.png") no-repeat left 0; | |
| 81 | + width:32px; | |
| 82 | + height:32px; | |
| 83 | + | |
| 84 | + opacity: 0.0; | |
| 85 | + filter: alpha(opacity=0); | |
| 86 | + | |
| 87 | + &:hover { | |
| 88 | + opacity: 1.0; | |
| 89 | + filter: alpha(opacity=100); | |
| 90 | + } | |
| 91 | +} | |
| 92 | + | |
| 93 | +.diff_file_content tr.line_holder:hover > td { background: $hover !important; } | |
| 94 | +.diff_file_content tr.line_holder:hover > td .line_note_link { | |
| 95 | + opacity: 1.0; | |
| 96 | + filter: alpha(opacity=100); | |
| 97 | +} | ... | ... |
app/views/commits/_text_file.html.haml
| 1 | 1 | %table |
| 2 | 2 | - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| |
| 3 | 3 | %tr.line_holder |
| 4 | - - if type == "match" | |
| 5 | - %td.old_line= "..." | |
| 6 | - %td.new_line= "..." | |
| 7 | - %td.line_content.matched= line | |
| 8 | - - else | |
| 9 | - %td.old_line= link_to raw(type == "new" ? " " : line_old), "##{line_code}", :id => line_code | |
| 10 | - %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", :id => line_code | |
| 11 | - %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | |
| 4 | + - if type == "match" | |
| 5 | + %td.old_line= "..." | |
| 6 | + %td.new_line= "..." | |
| 7 | + %td.line_content.matched= line | |
| 8 | + - else | |
| 9 | + %td.old_line | |
| 10 | + = link_to raw(type == "new" ? " " : line_old), "##{line_code}", :id => line_code | |
| 11 | + = link_to "", "#", :class => "line_note_link", "line_code" => line_code, :title => "Add note for this line" | |
| 12 | + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", :id => line_code | |
| 13 | + %td.line_content{:class => "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | |
| 12 | 14 | |
| 13 | - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse | |
| 14 | - - unless comments.empty? | |
| 15 | - - comments.each do |note| | |
| 16 | - = render "notes/per_line_show", :note => note | |
| 17 | - - @line_notes.reject!{ |n| n == note } | |
| 15 | + - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse | |
| 16 | + - unless comments.empty? | |
| 17 | + - comments.each do |note| | |
| 18 | + = render "notes/per_line_show", :note => note | |
| 19 | + - @line_notes.reject!{ |n| n == note } | ... | ... |
app/views/commits/show.html.haml
| ... | ... | @@ -22,10 +22,11 @@ |
| 22 | 22 | |
| 23 | 23 | :javascript |
| 24 | 24 | $(document).ready(function(){ |
| 25 | - $(".noteable_line").live("dblclick", function(e) { | |
| 25 | + $(".line_note_link").live("click", function(e) { | |
| 26 | 26 | var form = $(".per_line_form"); |
| 27 | - $(this).parent().after(form); | |
| 27 | + $(this).parent().parent().after(form); | |
| 28 | 28 | form.find("#note_line_code").val($(this).attr("line_code")); |
| 29 | 29 | form.show(); |
| 30 | + return false; | |
| 30 | 31 | }); |
| 31 | 32 | }); | ... | ... |
app/views/notes/_per_line_form.html.haml
| 1 | 1 | %table{:style => "display:none;"} |
| 2 | 2 | %tr.per_line_form |
| 3 | 3 | %td{:colspan => 3 } |
| 4 | - %div.well | |
| 5 | - = form_for [@project, @note], :remote => "true", :multipart => true do |f| | |
| 6 | - %h3 Leave a note | |
| 7 | - -if @note.errors.any? | |
| 8 | - .alert-message.block-message.error | |
| 9 | - - @note.errors.full_messages.each do |msg| | |
| 10 | - %div= msg | |
| 4 | + = form_for [@project, @note], :remote => "true", :multipart => true do |f| | |
| 5 | + %h3 Leave a note | |
| 6 | + .row | |
| 7 | + .span16 | |
| 8 | + -if @note.errors.any? | |
| 9 | + .alert-message.block-message.error | |
| 10 | + - @note.errors.full_messages.each do |msg| | |
| 11 | + %div= msg | |
| 11 | 12 | |
| 12 | - = f.hidden_field :noteable_id | |
| 13 | - = f.hidden_field :noteable_type | |
| 14 | - = f.hidden_field :line_code | |
| 15 | - = f.text_area :note, :size => 255 | |
| 16 | - .prepend-top-10 | |
| 17 | - = f.submit 'Add note', :class => "btn primary", :id => "submit_note" | |
| 18 | - .right | |
| 13 | + = f.hidden_field :noteable_id | |
| 14 | + = f.hidden_field :noteable_type | |
| 15 | + = f.hidden_field :line_code | |
| 16 | + = f.text_area :note, :size => 255 | |
| 17 | + .actions | |
| 18 | + = f.submit 'Add note', :class => "btn primary", :id => "submit_note" | |
| 19 | 19 | = link_to "Close", "#", :class => "btn hide-button" |
| 20 | + .span6.entry | |
| 21 | + %h5 Notify via email: | |
| 22 | + .clearfix | |
| 23 | + = label_tag :notify do | |
| 24 | + = check_box_tag :notify, 1, @note.noteable_type != "Commit" | |
| 25 | + %span Project team | |
| 26 | + | |
| 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 | |
| 20 | 31 | |
| 21 | 32 | :javascript |
| 22 | 33 | $(function(){ | ... | ... |