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
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
notes.js
app/assets/javascripts/notes.js
+1
-1
notes_helper.rb
app/helpers/notes_helper.rb
+0
-6
_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 = {
updateVotes
:
function
()
{
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
if
(
votes
.
size
())
{
...
...
app/helpers/notes_helper.rb
View file @
fb0279f3
...
...
@@ -12,11 +12,5 @@ module NotesHelper
!
@mixed_targets
||
@main_target_type
==
note
.
noteable_type
end
def
note_vote_class
(
note
)
if
note
.
upvote?
"vote upvote"
elsif
note
.
downvote?
"vote downvote"
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"
%div
.note-author
%strong
=
note
.
author_name
...
...
@@ -6,14 +6,19 @@
%cite
.cgray
=
time_ago_in_words
(
note
.
updated_at
)
ago
-
if
note
.
upvote?
%span
.label.label-success
%i
.icon-thumbs-up
\+1
-
if
note
.
downvote?
%span
.label.label-error
%i
.icon-thumbs-down
\-1
-# only show vote if it's a note for the main target
-
if
note_for_main_target?
(
note
)
-
if
note
.
upvote?
%span
.vote.upvote.label.label-success
%i
.icon-thumbs-up
\+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
)
=
link_to
[
@project
,
note
],
confirm:
'Are you sure?'
,
method: :delete
,
remote:
true
,
class:
"cred delete-note btn very_small"
do
%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