Commit 292a41cb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fixed comments for snippets. Tests fixed

parent d41d8ffb
...@@ -13,6 +13,8 @@ class NotesController < ApplicationController ...@@ -13,6 +13,8 @@ class NotesController < ApplicationController
@notes = case params[:target_type] @notes = case params[:target_type]
when "commit" when "commit"
then project.commit_notes(project.commit((params[:target_id]))).fresh.limit(20) then project.commit_notes(project.commit((params[:target_id]))).fresh.limit(20)
when "snippet"
then project.snippets.find(params[:target_id]).notes
when "wall" when "wall"
then project.common_notes.order("created_at DESC").fresh.limit(20) then project.common_notes.order("created_at DESC").fresh.limit(20)
when "issue" when "issue"
......
...@@ -55,7 +55,6 @@ class SnippetsController < ApplicationController ...@@ -55,7 +55,6 @@ class SnippetsController < ApplicationController
end end
def show def show
@notes = @snippet.notes
@note = @project.notes.new(:noteable => @snippet) @note = @project.notes.new(:noteable => @snippet)
render_full_content render_full_content
end end
......
- if note.valid?
:plain
$("#new_note .errors").remove();
$('#new_note textarea').val("");
NoteList.prepend(#{note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => note})}");
- else
:plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}");
- if note.valid?
:plain
$(".per_line_form").hide();
$('#new_note textarea').val("");
$("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})}");
- if @note.valid? - if @note.line_code
- if @note.line_code = render "create_line", :note => @note
:plain
$(".per_line_form").hide();
$('#new_note textarea').val("");
$("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();
$('#new_note textarea').val("");
NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}");
- else - else
- unless @note.line_code = render "create_common", :note => @note
:plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}");
-# Enable submit button
:plain :plain
$("#submit_note").removeAttr("disabled"); $("#submit_note").removeAttr("disabled");
...@@ -14,8 +14,5 @@ ...@@ -14,8 +14,5 @@
.data.no-padding .data.no-padding
:erb :erb
<%= raw @snippet.colorize %> <%= raw @snippet.colorize %>
.clear
%br
.snippet_notes= render "notes/notes"
.clear = render "notes/notes", :tid => @snippet.id, :tt => "snippet"
...@@ -8,7 +8,7 @@ describe "Projects", "Wall" do ...@@ -8,7 +8,7 @@ describe "Projects", "Wall" do
project.add_access(@user, :read, :write) project.add_access(@user, :read, :write)
end end
describe "View notes on wall" do describe "View notes on wall", :js => true do
before do before do
Factory :note, :project => project, :note => "Project specs", :author => @user Factory :note, :project => project, :note => "Project specs", :author => @user
visit wall_project_path(project) visit wall_project_path(project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment