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
Tatuya Kamada
gitlab-ce
Commits
fb0279f3
Commit
fb0279f3
authored
Oct 10, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vote counting to only count main target notes (not mixed in ones)
parent
3f72af99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+1
-1
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+0
-6
app/views/notes/_note.html.haml
app/views/notes/_note.html.haml
+14
-9
No files found.
app/assets/javascripts/notes.js
View file @
fb0279f3
...
@@ -230,7 +230,7 @@ var NoteList = {
...
@@ -230,7 +230,7 @@ var NoteList = {
updateVotes
:
updateVotes
:
function
()
{
function
()
{
var
votes
=
$
(
"
#votes .votes
"
);
var
votes
=
$
(
"
#votes .votes
"
);
var
notes
=
$
(
"
#notes-list, #new-notes-list
"
).
find
(
"
.note.vote
"
);
var
notes
=
$
(
"
#notes-list, #new-notes-list
"
).
find
(
"
.note
.vote
"
);
// only update if there is a vote display
// only update if there is a vote display
if
(
votes
.
size
())
{
if
(
votes
.
size
())
{
...
...
app/helpers/notes_helper.rb
View file @
fb0279f3
...
@@ -12,11 +12,5 @@ module NotesHelper
...
@@ -12,11 +12,5 @@ module NotesHelper
!
@mixed_targets
||
@main_target_type
==
note
.
noteable_type
!
@mixed_targets
||
@main_target_type
==
note
.
noteable_type
end
end
def
note_vote_class
(
note
)
if
note
.
upvote?
"vote upvote"
elsif
note
.
downvote?
"vote downvote"
end
end
end
end
end
app/views/notes/_note.html.haml
View file @
fb0279f3
%li
{
id:
dom_id
(
note
),
class:
"note
#{note_vote_class(note)}
"
}
%li
{
id:
dom_id
(
note
),
class:
"note"
}
=
image_tag
gravatar_icon
(
note
.
author
.
email
),
class:
"avatar s32"
=
image_tag
gravatar_icon
(
note
.
author
.
email
),
class:
"avatar s32"
%div
.note-author
%div
.note-author
%strong
=
note
.
author_name
%strong
=
note
.
author_name
...
@@ -6,14 +6,19 @@
...
@@ -6,14 +6,19 @@
%cite
.cgray
%cite
.cgray
=
time_ago_in_words
(
note
.
updated_at
)
=
time_ago_in_words
(
note
.
updated_at
)
ago
ago
-
if
note
.
upvote?
%span
.label.label-success
-# only show vote if it's a note for the main target
%i
.icon-thumbs-up
-
if
note_for_main_target?
(
note
)
\+1
-
if
note
.
upvote?
-
if
note
.
downvote?
%span
.vote.upvote.label.label-success
%span
.label.label-error
%i
.icon-thumbs-up
%i
.icon-thumbs-down
\+1
\-1
-
if
note
.
downvote?
%span
.vote.downvote.label.label-error
%i
.icon-thumbs-down
\-1
-# remove button
-
if
(
note
.
author_id
==
current_user
.
id
)
||
can?
(
current_user
,
:admin_note
,
@project
)
-
if
(
note
.
author_id
==
current_user
.
id
)
||
can?
(
current_user
,
:admin_note
,
@project
)
=
link_to
[
@project
,
note
],
confirm:
'Are you sure?'
,
method: :delete
,
remote:
true
,
class:
"cred delete-note btn very_small"
do
=
link_to
[
@project
,
note
],
confirm:
'Are you sure?'
,
method: :delete
,
remote:
true
,
class:
"cred delete-note btn very_small"
do
%i
.icon-trash
%i
.icon-trash
...
...
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