Commit 292a41cbe295f16f7148913b31eb0fb91f3251c3
1 parent
d41d8ffb
Exists in
master
and in
4 other branches
Fixed comments for snippets. Tests fixed
Showing
7 changed files
with
26 additions
and
24 deletions
Show diff stats
app/controllers/notes_controller.rb
... | ... | @@ -13,6 +13,8 @@ class NotesController < ApplicationController |
13 | 13 | @notes = case params[:target_type] |
14 | 14 | when "commit" |
15 | 15 | then project.commit_notes(project.commit((params[:target_id]))).fresh.limit(20) |
16 | + when "snippet" | |
17 | + then project.snippets.find(params[:target_id]).notes | |
16 | 18 | when "wall" |
17 | 19 | then project.common_notes.order("created_at DESC").fresh.limit(20) |
18 | 20 | when "issue" | ... | ... |
app/controllers/snippets_controller.rb
... | ... | @@ -0,0 +1,9 @@ |
1 | +- if note.valid? | |
2 | + :plain | |
3 | + $("#new_note .errors").remove(); | |
4 | + $('#new_note textarea').val(""); | |
5 | + NoteList.prepend(#{note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => note})}"); | |
6 | +- else | |
7 | + :plain | |
8 | + $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); | |
9 | + | ... | ... |
... | ... | @@ -0,0 +1,8 @@ |
1 | +- if note.valid? | |
2 | + :plain | |
3 | + $(".per_line_form").hide(); | |
4 | + $('#new_note textarea').val(""); | |
5 | + $("a.line_note_reply_link[line_code='#{note.line_code}']").closest("tr").remove(); | |
6 | + var trEl = $(".#{note.line_code}").parent(); | |
7 | + trEl.after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => note})}"); | |
8 | + trEl.after("#{escape_javascript(render :partial => "notes/reply_button", :locals => {:line_code => note.line_code})}"); | ... | ... |
app/views/notes/create.js.haml
1 | -- if @note.valid? | |
2 | - - if @note.line_code | |
3 | - :plain | |
4 | - $(".per_line_form").hide(); | |
5 | - $('#new_note textarea').val(""); | |
6 | - $("a.line_note_reply_link[line_code='#{@note.line_code}']").closest("tr").remove(); | |
7 | - var trEl = $(".#{@note.line_code}").parent(); | |
8 | - trEl.after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => @note})}"); | |
9 | - trEl.after("#{escape_javascript(render :partial => "notes/reply_button", :locals => {:line_code => @note.line_code})}"); | |
10 | - - else | |
11 | - :plain | |
12 | - $("#new_note .errors").remove(); | |
13 | - $('#new_note textarea').val(""); | |
14 | - NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}"); | |
15 | -- else | |
16 | - - unless @note.line_code | |
17 | - :plain | |
18 | - $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); | |
1 | +- if @note.line_code | |
2 | + = render "create_line", :note => @note | |
3 | +- else | |
4 | + = render "create_common", :note => @note | |
19 | 5 | |
6 | +-# Enable submit button | |
20 | 7 | :plain |
21 | 8 | $("#submit_note").removeAttr("disabled"); | ... | ... |
app/views/snippets/show.html.haml
spec/requests/projects_wall_spec.rb
... | ... | @@ -8,7 +8,7 @@ describe "Projects", "Wall" do |
8 | 8 | project.add_access(@user, :read, :write) |
9 | 9 | end |
10 | 10 | |
11 | - describe "View notes on wall" do | |
11 | + describe "View notes on wall", :js => true do | |
12 | 12 | before do |
13 | 13 | Factory :note, :project => project, :note => "Project specs", :author => @user |
14 | 14 | visit wall_project_path(project) | ... | ... |