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
Boxiang Sun
gitlab-ce
Commits
c4a7824a
Commit
c4a7824a
authored
Nov 22, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wall notes
parent
140652e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
4 deletions
+29
-4
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+18
-2
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+2
-1
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+2
-1
app/models/note.rb
app/models/note.rb
+4
-0
app/views/notes/_create_common_note.js.haml
app/views/notes/_create_common_note.js.haml
+3
-0
No files found.
app/assets/javascripts/notes.js
View file @
c4a7824a
...
...
@@ -267,6 +267,7 @@ var NoteList = {
NoteList
.
bottom_id
=
newNoteIds
.
last
();
$
(
"
#notes-list
"
).
html
(
html
);
// for the wall
if
(
NoteList
.
reversed
)
{
// init infinite scrolling
NoteList
.
initLoadMore
();
...
...
@@ -352,6 +353,8 @@ var NoteList = {
/**
* Initializes getting new notes every n seconds.
*
* Note: only used on wall.
*/
initRefreshNew
:
function
()
{
setInterval
(
"
NoteList.getNew()
"
,
10000
);
...
...
@@ -359,6 +362,8 @@ var NoteList = {
/**
* Gets the new set of notes.
*
* Note: only used on wall.
*/
getNew
:
function
()
{
$
.
ajax
({
...
...
@@ -371,6 +376,8 @@ var NoteList = {
/**
* Called in response to getNew().
* Replaces the content of #new-notes-list with the given html.
*
* Note: only used on wall.
*/
replaceNewNotes
:
function
(
newNoteIds
,
html
)
{
$
(
"
#new-notes-list
"
).
html
(
html
);
...
...
@@ -378,7 +385,7 @@ var NoteList = {
},
/**
* Adds a single common note to #
(new-)
notes-list.
* Adds a single common note to #notes-list.
*/
appendNewNote
:
function
(
id
,
html
)
{
$
(
"
#notes-list
"
).
append
(
html
);
...
...
@@ -386,7 +393,7 @@ var NoteList = {
},
/**
* Adds a single discussion note to #
(new-)
notes-list.
* Adds a single discussion note to #notes-list.
*/
appendNewDiscussionNote
:
function
(
discussionId
,
diffRowHtml
,
noteHtml
)
{
// is this the first note of discussion?
...
...
@@ -402,6 +409,15 @@ var NoteList = {
$
(
"
.notes[rel='
"
+
discussionId
+
"
']
"
).
append
(
noteHtml
);
},
/**
* Adds a single wall note to #new-notes-list.
*
* Note: only used on wall.
*/
appendNewWallNote
:
function
(
id
,
html
)
{
$
(
"
#new-notes-list
"
).
prepend
(
html
);
},
/**
* Recalculates the votes and updates them (if they are displayed at all).
*
...
...
app/controllers/notes_controller.rb
View file @
c4a7824a
...
...
@@ -71,6 +71,7 @@ class NotesController < ProjectResourceController
# Helps to distinguish e.g. commit notes in mr notes list
def
note_for_main_target?
(
note
)
@target_type
.
camelize
==
note
.
noteable_type
&&
!
note
.
for_diff_line?
note
.
for_wall?
||
(
@target_type
.
camelize
==
note
.
noteable_type
&&
!
note
.
for_diff_line?
)
end
end
app/helpers/notes_helper.rb
View file @
c4a7824a
module
NotesHelper
# Helps to distinguish e.g. commit notes in mr notes list
def
note_for_main_target?
(
note
)
@target_type
.
camelize
==
note
.
noteable_type
&&
!
note
.
for_diff_line?
note
.
for_wall?
||
(
@target_type
.
camelize
==
note
.
noteable_type
&&
!
note
.
for_diff_line?
)
end
def
note_target_fields
...
...
app/models/note.rb
View file @
c4a7824a
...
...
@@ -115,6 +115,10 @@ class Note < ActiveRecord::Base
for_merge_request?
&&
for_diff_line?
end
def
for_wall?
noteable_type
.
blank?
end
# override to return commits, which are not active record
def
noteable
if
for_commit?
...
...
app/views/notes/_create_common_note.js.haml
View file @
c4a7824a
-
if
note
.
valid?
-
if
note
.
for_wall?
NoteList.appendNewWallNote(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
-
else
NoteList.appendNewNote(
#{
note
.
id
}
, "
#{
escape_javascript
(
render
"notes/note"
,
note:
note
)
}
");
-
else
...
...
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