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
7edc1bc3
Commit
7edc1bc3
authored
Jul 08, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement awarding emoji from emoji dropdown.
parent
575544f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
2 deletions
+41
-2
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+23
-0
app/assets/javascripts/notes/components/issue_note_awards_list.vue
...s/javascripts/notes/components/issue_note_awards_list.vue
+6
-2
app/assets/javascripts/notes/components/issue_notes.vue
app/assets/javascripts/notes/components/issue_notes.vue
+9
-0
app/assets/javascripts/notes/event_hub.js
app/assets/javascripts/notes/event_hub.js
+3
-0
No files found.
app/assets/javascripts/awards_handler.js
View file @
7edc1bc3
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global Flash */
/* global Flash */
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
issueNotesEventHub
from
'
./notes/event_hub
'
;
const
animationEndEventString
=
'
animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd
'
;
const
animationEndEventString
=
'
animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd
'
;
const
transitionEndEventString
=
'
transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd
'
;
const
transitionEndEventString
=
'
transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd
'
;
...
@@ -234,12 +235,23 @@ class AwardsHandler {
...
@@ -234,12 +235,23 @@ class AwardsHandler {
}
}
addAward
(
votesBlock
,
awardUrl
,
emoji
,
checkMutuality
,
callback
)
{
addAward
(
votesBlock
,
awardUrl
,
emoji
,
checkMutuality
,
callback
)
{
if
(
this
.
isInIssuePage
())
{
const
id
=
votesBlock
[
0
].
id
.
replace
(
'
note_
'
,
''
);
$
(
'
.emoji-menu
'
).
removeClass
(
'
is-visible
'
);
$
(
'
.js-add-award.is-active
'
).
removeClass
(
'
is-active
'
);
return
issueNotesEventHub
.
$emit
(
'
toggleAward
'
,
{
awardName
:
emoji
,
noteId
:
id
});
}
const
normalizedEmoji
=
this
.
emoji
.
normalizeEmojiName
(
emoji
);
const
normalizedEmoji
=
this
.
emoji
.
normalizeEmojiName
(
emoji
);
const
$emojiButton
=
this
.
findEmojiIcon
(
votesBlock
,
normalizedEmoji
).
parent
();
const
$emojiButton
=
this
.
findEmojiIcon
(
votesBlock
,
normalizedEmoji
).
parent
();
this
.
postEmoji
(
$emojiButton
,
awardUrl
,
normalizedEmoji
,
()
=>
{
this
.
postEmoji
(
$emojiButton
,
awardUrl
,
normalizedEmoji
,
()
=>
{
this
.
addAwardToEmojiBar
(
votesBlock
,
normalizedEmoji
,
checkMutuality
);
this
.
addAwardToEmojiBar
(
votesBlock
,
normalizedEmoji
,
checkMutuality
);
return
typeof
callback
===
'
function
'
?
callback
()
:
undefined
;
return
typeof
callback
===
'
function
'
?
callback
()
:
undefined
;
});
});
$
(
'
.emoji-menu
'
).
removeClass
(
'
is-visible
'
);
$
(
'
.emoji-menu
'
).
removeClass
(
'
is-visible
'
);
$
(
'
.js-add-award.is-active
'
).
removeClass
(
'
is-active
'
);
$
(
'
.js-add-award.is-active
'
).
removeClass
(
'
is-active
'
);
}
}
...
@@ -267,7 +279,18 @@ class AwardsHandler {
...
@@ -267,7 +279,18 @@ class AwardsHandler {
}
}
}
}
isInIssuePage
()
{
const
page
=
gl
.
utils
.
getPagePath
(
1
);
const
action
=
gl
.
utils
.
getPagePath
(
2
);
return
page
===
'
issues
'
&&
action
===
'
show
'
;
}
getVotesBlock
()
{
getVotesBlock
()
{
if
(
this
.
isInIssuePage
())
{
return
$
(
'
.js-add-award.is-active
'
).
closest
(
'
.note.timeline-entry
'
);
}
const
currentBlock
=
$
(
'
.js-awards-block.current
'
);
const
currentBlock
=
$
(
'
.js-awards-block.current
'
);
let
resultantVotesBlock
=
currentBlock
;
let
resultantVotesBlock
=
currentBlock
;
if
(
currentBlock
.
length
===
0
)
{
if
(
currentBlock
.
length
===
0
)
{
...
...
app/assets/javascripts/notes/components/issue_note_awards_list.vue
View file @
7edc1bc3
...
@@ -73,6 +73,9 @@ export default {
...
@@ -73,6 +73,9 @@ export default {
return
orderedAwards
;
return
orderedAwards
;
},
},
isAuthoredByMe
()
{
return
this
.
noteAuthorId
===
window
.
gon
.
current_user_id
;
},
},
},
methods
:
{
methods
:
{
getAwardHTML
(
name
)
{
getAwardHTML
(
name
)
{
...
@@ -178,10 +181,11 @@ export default {
...
@@ -178,10 +181,11 @@ export default {
v-if=
"canAward"
v-if=
"canAward"
class=
"award-menu-holder"
>
class=
"award-menu-holder"
>
<button
<button
:class=
"
{ 'js-user-authored': isAuthoredByMe }"
class="award-control btn has-tooltip js-add-award"
title="Add reaction"
aria-label="Add reaction"
aria-label="Add reaction"
class=
"award-control btn has-tooltip"
data-placement="bottom"
data-placement="bottom"
title=
"Add reaction"
type="button">
type="button">
<span
<span
v-html=
"emojiSmiling"
v-html=
"emojiSmiling"
...
...
app/assets/javascripts/notes/components/issue_notes.vue
View file @
7edc1bc3
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
storeOptions
from
'
../stores/issue_notes_store
'
;
import
storeOptions
from
'
../stores/issue_notes_store
'
;
import
eventHub
from
'
../event_hub
'
;
import
IssueNote
from
'
./issue_note.vue
'
;
import
IssueNote
from
'
./issue_note.vue
'
;
import
IssueDiscussion
from
'
./issue_discussion.vue
'
;
import
IssueDiscussion
from
'
./issue_discussion.vue
'
;
import
IssueSystemNote
from
'
./issue_system_note.vue
'
;
import
IssueSystemNote
from
'
./issue_system_note.vue
'
;
...
@@ -29,6 +30,7 @@ export default {
...
@@ -29,6 +30,7 @@ export default {
computed
:
{
computed
:
{
...
Vuex
.
mapGetters
([
...
Vuex
.
mapGetters
([
'
notes
'
,
'
notes
'
,
'
notesById
'
,
]),
]),
},
},
methods
:
{
methods
:
{
...
@@ -87,6 +89,13 @@ export default {
...
@@ -87,6 +89,13 @@ export default {
new
Flash
(
'
Something went wrong while fetching latest comments.
'
);
// eslint-disable-line
new
Flash
(
'
Something went wrong while fetching latest comments.
'
);
// eslint-disable-line
});
});
},
6000
);
},
6000
);
eventHub
.
$on
(
'
toggleAward
'
,
(
data
)
=>
{
const
{
awardName
,
noteId
}
=
data
;
const
endpoint
=
this
.
notesById
[
noteId
].
toggle_award_path
;
this
.
$store
.
dispatch
(
'
toggleAward
'
,
{
endpoint
,
awardName
,
noteId
});
});
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/notes/event_hub.js
0 → 100644
View file @
7edc1bc3
import
Vue
from
'
vue
'
;
export
default
new
Vue
();
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