diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-06-14 16:47:43 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-07-21 22:35:25 +0300 |
commit | 0f6ecaa1a6df1c1b0e0605b367104653653fa090 (patch) | |
tree | 45a93a2076bd450b9e300449ae92e428bdab60ab /app | |
parent | 654355a0f0f3031cbd11bb4dff537ffb5a75b771 (diff) |
Implement canAward.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/notes/components/issue_note_awards_list.vue | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes/components/issue_note_awards_list.vue b/app/assets/javascripts/notes/components/issue_note_awards_list.vue index dd39dcf7ee0..9750f04e207 100644 --- a/app/assets/javascripts/notes/components/issue_note_awards_list.vue +++ b/app/assets/javascripts/notes/components/issue_note_awards_list.vue @@ -16,6 +16,7 @@ export default { emojiSmiling, emojiSmile, emojiSmiley, + canAward: !!window.gon.current_user_id, }; }, computed: { @@ -42,6 +43,12 @@ export default { getAwardHTML(name) { return glEmojiTag(name); }, + getAwardClassBindings(awardList) { + return { + active: this.amIAwarded(awardList), + disabled: !this.canAward, + }; + }, amIAwarded(awardList) { const myUserId = window.gon.current_user_id; const isAwarded = awardList.filter(award => award.user.id === myUserId); @@ -97,7 +104,7 @@ export default { <button v-for="(awardList, awardName) in groupedAwards" class="btn award-control has-tooltip" - :class="{ active: amIAwarded(awardList) }" + :class="getAwardClassBindings(awardList)" :title="awardTitle(awardList)" data-placement="bottom" type="button"> @@ -106,7 +113,9 @@ export default { {{awardList.length}} </span> </button> - <div class="award-menu-holder"> + <div + v-if="canAward" + class="award-menu-holder"> <button aria-label="Add reaction" class="award-control btn has-tooltip" |