BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
918dc873
Commit
918dc873
authored
Nov 22, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move code for appending a discussion note to notes JS
parent
fac4e3f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
notes.js
app/assets/javascripts/notes.js
+14
-0
_create_discussion_note.js.haml
app/views/notes/_create_discussion_note.js.haml
+3
-11
No files found.
app/assets/javascripts/notes.js
View file @
918dc873
...
...
@@ -377,6 +377,20 @@ var NoteList = {
this
.
updateVotes
();
},
appendNewDiscussionNote
:
function
(
discussionId
,
diffRowHtml
,
noteHtml
)
{
// is this the first note of discussion?
var
row
=
$
(
"form[rel='"
+
discussionId
+
"']"
).
closest
(
"tr"
);
if
(
row
.
is
(
".js-temp-notes-holder"
))
{
// insert the note and the reply button after it
row
.
after
(
diffRowHtml
);
// will be added again below
row
.
next
().
find
(
".note"
).
remove
();
}
// append new note to all matching discussions
$
(
".notes[rel='"
+
discussionId
+
"']"
).
append
(
noteHtml
);
},
/**
* Recalculates the votes and updates them (if they are displayed at all).
*
...
...
app/views/notes/_create_discussion_note.js.haml
View file @
918dc873
-
if
note
.
valid?
:plain
// is this the first note of discussion?
var row = $("form[rel='
#{
note
.
discussion_id
}
']").closest("tr");
if (row.is(".js-temp-notes-holder")) {
// insert the note and the reply button after it
row.after("
#{
escape_javascript
(
render
"notes/diff_notes_with_reply"
,
notes:
[
note
])
}
");
// will be added again below
row.next().find(".note").remove();
}
// append new note to all discussions
$(".notes[rel='
#{
note
.
discussion_id
}
']").append("
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
NoteList.appendNewDiscussionNote("
#{
note
.
discussion_id
}
",
"
#{
escape_javascript
(
render
"notes/diff_notes_with_reply"
,
notes:
[
note
])
}
",
"
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment