Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-02-25 00:19:47 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-02-25 00:19:47 +0400
commitd41d8ffb02fa74fd4571603548bd7e401ec99e0c (patch)
treeb70b500d914367efbb39fe822053a6c141276975
parent215a01f63ccdc085f75a48f6f7ab6f2b15b5852c (diff)
Reply button, Comments for Merge Request diff
-rw-r--r--app/assets/stylesheets/common.scss7
-rw-r--r--app/assets/stylesheets/notes.css.scss19
-rw-r--r--app/controllers/merge_requests_controller.rb4
-rw-r--r--app/views/commits/_text_file.html.haml3
-rw-r--r--app/views/commits/show.html.haml2
-rw-r--r--app/views/commits/show.js.haml1
-rw-r--r--app/views/issues/show.html.haml1
-rw-r--r--app/views/merge_requests/show.html.haml15
-rw-r--r--app/views/notes/_notes.html.haml2
-rw-r--r--app/views/notes/_reply_button.html.haml3
-rw-r--r--app/views/notes/_show.html.haml2
-rw-r--r--app/views/notes/create.js.haml5
-rw-r--r--app/views/projects/wall.html.haml4
13 files changed, 53 insertions, 15 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 9fd0f2eac20..2ae0217abf7 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -374,3 +374,10 @@ table a code {
.btn.padded {
margin-right:3px;
}
+
+.loading {
+ margin:20px auto;
+ background: url(ajax-loader-facebook.gif) no-repeat center center;
+ width:40px;
+ height:40px;
+}
diff --git a/app/assets/stylesheets/notes.css.scss b/app/assets/stylesheets/notes.css.scss
index d264e5cfac9..b13ffcda88f 100644
--- a/app/assets/stylesheets/notes.css.scss
+++ b/app/assets/stylesheets/notes.css.scss
@@ -30,7 +30,10 @@
}
}
-.note .delete-note { display:none; }
+.note .delete-note {
+ display:none;
+ float:right;
+}
.note:hover .delete-note { display:block; }
.note {padding: 10px 0; border-bottom: 1px solid #eee; overflow: hidden; display: block;}
.note img{float: left; margin-right: 10px;}
@@ -53,6 +56,20 @@ p.notify_controls span{
tr.line_notes_row {
border-bottom:1px solid #DDD;
+ &.reply {
+ background:#eee;
+
+ td {
+ padding:7px 10px;
+ }
+ a.line_note_reply_link {
+ @include round-borders-all(4px);
+ border-color:#aaa;
+ background: #bbb;
+ padding: 3px 20px;
+ color: white;
+ }
+ }
ul {
margin:0;
li {
diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb
index 3ae25940378..cfb9e6dcbb7 100644
--- a/app/controllers/merge_requests_controller.rb
+++ b/app/controllers/merge_requests_controller.rb
@@ -58,7 +58,9 @@ class MergeRequestsController < ApplicationController
def diffs
@diffs = @merge_request.diffs
@commit = @merge_request.last_commit
- @line_notes = []
+
+ @comments_allowed = true
+ @line_notes = @merge_request.notes.where("line_code is not null")
end
def new
diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml
index a9b3f65aa81..441bdf2c210 100644
--- a/app/views/commits/_text_file.html.haml
+++ b/app/views/commits/_text_file.html.haml
@@ -16,6 +16,7 @@
- if @comments_allowed
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at).reverse
- unless comments.empty?
- - comments.each do |note|
+ - comments.each_with_index do |note, i|
+ = render "notes/reply_button", :line_code => line_code if i.zero?
= render "notes/per_line_show", :note => note
- @line_notes.reject!{ |n| n == note }
diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml
index 5f055c28576..9c1df54ea70 100644
--- a/app/views/commits/show.html.haml
+++ b/app/views/commits/show.html.haml
@@ -27,7 +27,7 @@
:javascript
$(document).ready(function(){
- $(".line_note_link").live("click", function(e) {
+ $(".line_note_link, .line_note_reply_link").live("click", function(e) {
var form = $(".per_line_form");
$(this).parent().parent().after(form);
form.find("#note_line_code").val($(this).attr("line_code"));
diff --git a/app/views/commits/show.js.haml b/app/views/commits/show.js.haml
deleted file mode 100644
index ee31c0b8d3c..00000000000
--- a/app/views/commits/show.js.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render "notes/load"
diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml
index ace1d1e369e..cba08650b02 100644
--- a/app/views/issues/show.html.haml
+++ b/app/views/issues/show.html.haml
@@ -42,4 +42,3 @@
.issue_notes= render "notes/notes", :tid => @issue.id, :tt => "issue"
-
diff --git a/app/views/merge_requests/show.html.haml b/app/views/merge_requests/show.html.haml
index 4acc748e94c..e725c1981ad 100644
--- a/app/views/merge_requests/show.html.haml
+++ b/app/views/merge_requests/show.html.haml
@@ -64,9 +64,6 @@
.merge-request-notes
.merge_request_notes= render "notes/notes", :tid => @merge_request.id, :tt => "merge_request"
- .loading{ :style => "display:none;"}
- %center= image_tag "ajax-loader.gif"
- .clear
.merge-request-diffs
@@ -75,3 +72,15 @@
$(function(){
MergeRequest.init();
})
+
+= render "notes/per_line_form"
+:javascript
+ $(document).ready(function(){
+ $(".line_note_link, .line_note_reply_link").live("click", function(e) {
+ var form = $(".per_line_form");
+ $(this).parent().parent().after(form);
+ form.find("#note_line_code").val($(this).attr("line_code"));
+ form.show();
+ return false;
+ });
+ });
diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml
index fb589c3238f..51c861ab5c7 100644
--- a/app/views/notes/_notes.html.haml
+++ b/app/views/notes/_notes.html.haml
@@ -3,6 +3,8 @@
.clear
%hr
%ul#notes-list
+.loading
+
:javascript
$('.delete-note').live('ajax:success', function() {
diff --git a/app/views/notes/_reply_button.html.haml b/app/views/notes/_reply_button.html.haml
new file mode 100644
index 00000000000..f53b8c8d364
--- /dev/null
+++ b/app/views/notes/_reply_button.html.haml
@@ -0,0 +1,3 @@
+%tr.line_notes_row.reply
+ %td{:colspan => 3}
+ = link_to "Reply", "#", :class => "line_note_reply_link", "line_code" => line_code, :title => "Add note for this line"
diff --git a/app/views/notes/_show.html.haml b/app/views/notes/_show.html.haml
index d91fea04b5b..6da1d5904bf 100644
--- a/app/views/notes/_show.html.haml
+++ b/app/views/notes/_show.html.haml
@@ -6,7 +6,7 @@
= time_ago_in_words(note.updated_at)
ago
- if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
- = link_to "Remove", [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-note right"
+ %strong= link_to "Remove", [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "cred delete-note btn small"
%div.note-title
= markdown(note.note)
diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml
index b81ea5b03e7..646b491d636 100644
--- a/app/views/notes/create.js.haml
+++ b/app/views/notes/create.js.haml
@@ -3,7 +3,10 @@
:plain
$(".per_line_form").hide();
$('#new_note textarea').val("");
- $(".#{@note.line_code}").parent().after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => @note})}");
+ $("a.line_note_reply_link[line_code='#{@note.line_code}']").closest("tr").remove();
+ var trEl = $(".#{@note.line_code}").parent();
+ trEl.after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => @note})}");
+ trEl.after("#{escape_javascript(render :partial => "notes/reply_button", :locals => {:line_code => @note.line_code})}");
- else
:plain
$("#new_note .errors").remove();
diff --git a/app/views/projects/wall.html.haml b/app/views/projects/wall.html.haml
index f6c59e47a23..bd538e8f971 100644
--- a/app/views/projects/wall.html.haml
+++ b/app/views/projects/wall.html.haml
@@ -1,6 +1,2 @@
%div.wall_page
= render "notes/notes", :tid => nil, :tt => "wall"
-
-.loading{ :style => "display:none;"}
- %center= image_tag "ajax-loader.gif"
-