Commit 8fb70d924dbb089fdac89125664e3aa73212d8fc
1 parent
61eb650d
Exists in
master
and in
4 other branches
Rename 'notes/create_*' partials
Showing
5 changed files
with
34 additions
and
34 deletions
Show diff stats
app/views/notes/_create_common.js.haml
... | ... | @@ -1,13 +0,0 @@ |
1 | -- if note.valid? | |
2 | - :plain | |
3 | - $(".note-form-holder .error").remove(); | |
4 | - $('.note-form-holder textarea').val(""); | |
5 | - $('.note-form-holder #preview-link').text('Preview'); | |
6 | - $('.note-form-holder #preview-note').hide(); | |
7 | - $('.note-form-holder').show(); | |
8 | - NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/show", note: note)}"); | |
9 | - | |
10 | -- else | |
11 | - :plain | |
12 | - $(".note-form-holder").replaceWith("#{escape_javascript(render 'form')}"); | |
13 | - |
... | ... | @@ -0,0 +1,13 @@ |
1 | +- if note.valid? | |
2 | + :plain | |
3 | + $(".note-form-holder .error").remove(); | |
4 | + $('.note-form-holder textarea').val(""); | |
5 | + $('.note-form-holder #preview-link').text('Preview'); | |
6 | + $('.note-form-holder #preview-note').hide(); | |
7 | + $('.note-form-holder').show(); | |
8 | + NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/show", note: note)}"); | |
9 | + | |
10 | +- else | |
11 | + :plain | |
12 | + $(".note-form-holder").replaceWith("#{escape_javascript(render 'form')}"); | |
13 | + | ... | ... |
app/views/notes/_create_line.js.haml
... | ... | @@ -1,19 +0,0 @@ |
1 | -- if note.valid? | |
2 | - :plain | |
3 | - // hide and reset the form | |
4 | - $(".per_line_form").hide(); | |
5 | - $('.line-note-form-holder textarea').val(""); | |
6 | - | |
7 | - // find the reply button for this line | |
8 | - // (might not be there if this is the first note) | |
9 | - var trRpl = $("a.line_note_reply_link[data-line-code='#{note.line_code}']").closest("tr"); | |
10 | - if (trRpl.size() == 0) { | |
11 | - // find the commented line ... | |
12 | - var trEl = $(".#{note.line_code}").parent(); | |
13 | - // ... and insert the note and the reply button after it | |
14 | - trEl.after("#{escape_javascript(render "notes/reply_button", line_code: note.line_code)}"); | |
15 | - trEl.after("#{escape_javascript(render "notes/per_line_show", note: note)}"); | |
16 | - } else { | |
17 | - // instert new note before reply button | |
18 | - trRpl.before("#{escape_javascript(render "notes/per_line_show", note: note)}"); | |
19 | - } |
... | ... | @@ -0,0 +1,19 @@ |
1 | +- if note.valid? | |
2 | + :plain | |
3 | + // hide and reset the form | |
4 | + $(".per_line_form").hide(); | |
5 | + $('.line-note-form-holder textarea').val(""); | |
6 | + | |
7 | + // find the reply button for this line | |
8 | + // (might not be there if this is the first note) | |
9 | + var trRpl = $("a.line_note_reply_link[data-line-code='#{note.line_code}']").closest("tr"); | |
10 | + if (trRpl.size() == 0) { | |
11 | + // find the commented line ... | |
12 | + var trEl = $(".#{note.line_code}").parent(); | |
13 | + // ... and insert the note and the reply button after it | |
14 | + trEl.after("#{escape_javascript(render "notes/reply_button", line_code: note.line_code)}"); | |
15 | + trEl.after("#{escape_javascript(render "notes/per_line_show", note: note)}"); | |
16 | + } else { | |
17 | + // instert new note before reply button | |
18 | + trRpl.before("#{escape_javascript(render "notes/per_line_show", note: note)}"); | |
19 | + } | ... | ... |
app/views/notes/create.js.haml