Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+14
-0
app/views/notes/_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 = {
...
@@ -377,6 +377,20 @@ var NoteList = {
this
.
updateVotes
();
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).
* 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?
-
if
note
.
valid?
:plain
:plain
// is this the first note of discussion?
NoteList.appendNewDiscussionNote("
#{
note
.
discussion_id
}
",
var row = $("form[rel='
#{
note
.
discussion_id
}
']").closest("tr");
"
#{
escape_javascript
(
render
"notes/diff_notes_with_reply"
,
notes:
[
note
])
}
",
if (row.is(".js-temp-notes-holder")) {
"
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
// 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
)
}
");
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