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
fdd5a8f2
Commit
fdd5a8f2
authored
Nov 19, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addressing comments
parent
92943580
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
9 deletions
+15
-9
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+4
-0
app/models/note.rb
app/models/note.rb
+2
-2
app/views/votes/_votes_block.html.haml
app/views/votes/_votes_block.html.haml
+5
-5
db/migrate/20151106000015_add_is_award_to_notes.rb
db/migrate/20151106000015_add_is_award_to_notes.rb
+2
-1
db/schema.rb
db/schema.rb
+2
-1
No files found.
app/helpers/issues_helper.rb
View file @
fdd5a8f2
...
@@ -104,6 +104,10 @@ module IssuesHelper
...
@@ -104,6 +104,10 @@ module IssuesHelper
::
AwardEmoji
::
EMOJI_LIST
::
AwardEmoji
::
EMOJI_LIST
end
end
def
note_active_class
(
notes
,
current_user
)
notes
.
pluck
(
:author_id
).
include?
(
current_user
.
id
)
?
"active"
:
""
end
# Required for Gitlab::Markdown::IssueReferenceFilter
# Required for Gitlab::Markdown::IssueReferenceFilter
module_function
:url_for_issue
module_function
:url_for_issue
end
end
app/models/note.rb
View file @
fdd5a8f2
...
@@ -50,8 +50,8 @@ class Note < ActiveRecord::Base
...
@@ -50,8 +50,8 @@ class Note < ActiveRecord::Base
mount_uploader
:attachment
,
AttachmentUploader
mount_uploader
:attachment
,
AttachmentUploader
# Scopes
# Scopes
scope
:awards
,
->
{
where
(
"is_award IS TRUE"
)
}
scope
:awards
,
->
{
where
(
is_award:
true
)
}
scope
:nonawards
,
->
{
where
(
"is_award IS FALSE"
)
}
scope
:nonawards
,
->
{
where
(
is_award:
false
)
}
scope
:for_commit_id
,
->
(
commit_id
)
{
where
(
noteable_type:
"Commit"
,
commit_id:
commit_id
)
}
scope
:for_commit_id
,
->
(
commit_id
)
{
where
(
noteable_type:
"Commit"
,
commit_id:
commit_id
)
}
scope
:inline
,
->
{
where
(
"line_code IS NOT NULL"
)
}
scope
:inline
,
->
{
where
(
"line_code IS NOT NULL"
)
}
scope
:not_inline
,
->
{
where
(
line_code:
[
nil
,
''
])
}
scope
:not_inline
,
->
{
where
(
line_code:
[
nil
,
''
])
}
...
...
app/views/votes/_votes_block.html.haml
View file @
fdd5a8f2
.awards.votes-block
.awards.votes-block
-
votable
.
notes
.
awards
.
grouped_awards
.
each
do
|
v
ote
|
-
votable
.
notes
.
awards
.
grouped_awards
.
each
do
|
n
ote
|
.
award
{
class:
(
"active"
if
vote
.
last
.
pluck
(
:author_id
).
include?
(
current_user
.
id
)),
title:
emoji_author_list
(
v
ote
.
last
,
current_user
)}
.
award
{
class:
(
note_active_class
(
note
.
last
,
current_user
)),
title:
emoji_author_list
(
n
ote
.
last
,
current_user
)}
.icon
{
"data-emoji"
=>
"#{
v
ote.first}"
}
.icon
{
"data-emoji"
=>
"#{
n
ote.first}"
}
=
image_tag
url_to_emoji
(
v
ote
.
first
),
height:
"20px"
,
width:
"20px"
=
image_tag
url_to_emoji
(
n
ote
.
first
),
height:
"20px"
,
width:
"20px"
.counter
.counter
=
v
ote
.
last
.
count
=
n
ote
.
last
.
count
.dropdown.awards-controls
.dropdown.awards-controls
%a
.add-award
{
"data-toggle"
=>
"dropdown"
,
"data-target"
=>
"#"
,
"href"
=>
"#"
}
%a
.add-award
{
"data-toggle"
=>
"dropdown"
,
"data-target"
=>
"#"
,
"href"
=>
"#"
}
...
...
db/migrate/20151106000015_add_is_award_to_notes.rb
View file @
fdd5a8f2
class
AddIsAwardToNotes
<
ActiveRecord
::
Migration
class
AddIsAwardToNotes
<
ActiveRecord
::
Migration
def
change
def
change
add_column
:notes
,
:is_award
,
:boolean
,
default:
false
add_column
:notes
,
:is_award
,
:boolean
,
default:
false
,
null:
false
add_index
:notes
,
:is_award
end
end
end
end
db/schema.rb
View file @
fdd5a8f2
...
@@ -554,13 +554,14 @@ ActiveRecord::Schema.define(version: 20151116144118) do
...
@@ -554,13 +554,14 @@ ActiveRecord::Schema.define(version: 20151116144118) do
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
text
"st_diff"
t
.
text
"st_diff"
t
.
integer
"updated_by_id"
t
.
integer
"updated_by_id"
t
.
boolean
"is_award"
,
default:
false
t
.
boolean
"is_award"
,
default:
false
,
null:
false
end
end
add_index
"notes"
,
[
"author_id"
],
name:
"index_notes_on_author_id"
,
using: :btree
add_index
"notes"
,
[
"author_id"
],
name:
"index_notes_on_author_id"
,
using: :btree
add_index
"notes"
,
[
"commit_id"
],
name:
"index_notes_on_commit_id"
,
using: :btree
add_index
"notes"
,
[
"commit_id"
],
name:
"index_notes_on_commit_id"
,
using: :btree
add_index
"notes"
,
[
"created_at"
,
"id"
],
name:
"index_notes_on_created_at_and_id"
,
using: :btree
add_index
"notes"
,
[
"created_at"
,
"id"
],
name:
"index_notes_on_created_at_and_id"
,
using: :btree
add_index
"notes"
,
[
"created_at"
],
name:
"index_notes_on_created_at"
,
using: :btree
add_index
"notes"
,
[
"created_at"
],
name:
"index_notes_on_created_at"
,
using: :btree
add_index
"notes"
,
[
"is_award"
],
name:
"index_notes_on_is_award"
,
using: :btree
add_index
"notes"
,
[
"line_code"
],
name:
"index_notes_on_line_code"
,
using: :btree
add_index
"notes"
,
[
"line_code"
],
name:
"index_notes_on_line_code"
,
using: :btree
add_index
"notes"
,
[
"noteable_id"
,
"noteable_type"
],
name:
"index_notes_on_noteable_id_and_noteable_type"
,
using: :btree
add_index
"notes"
,
[
"noteable_id"
,
"noteable_type"
],
name:
"index_notes_on_noteable_id_and_noteable_type"
,
using: :btree
add_index
"notes"
,
[
"noteable_type"
],
name:
"index_notes_on_noteable_type"
,
using: :btree
add_index
"notes"
,
[
"noteable_type"
],
name:
"index_notes_on_noteable_type"
,
using: :btree
...
...
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