summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-21 11:31:50 +0000
committerPhil Hughes <me@iamphill.com>2016-03-21 11:31:50 +0000
commit59e51e3cabfb960f5b78b8f8cda7478c79846de5 (patch)
treeb0fa4de4b00e2ee1cfbd4a59463c606a5d9b4592
parentb9fb48bc4597984710532e20f057920b0915d0c3 (diff)
downloadgitlab-ce-merge-request-sidebar.tar.gz
Fixed bug where participants would not work correctly on merge requestsmerge-request-sidebar
Also fixed alignment bug with can't merge badge
-rw-r--r--app/assets/javascripts/issuable_context.js.coffee28
-rw-r--r--app/assets/javascripts/issue.js.coffee25
-rw-r--r--app/views/shared/issuable/_participants.html.haml2
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml6
4 files changed, 30 insertions, 31 deletions
diff --git a/app/assets/javascripts/issuable_context.js.coffee b/app/assets/javascripts/issuable_context.js.coffee
index e52b73f94f6..d6d09b36d8d 100644
--- a/app/assets/javascripts/issuable_context.js.coffee
+++ b/app/assets/javascripts/issuable_context.js.coffee
@@ -1,7 +1,7 @@
-#= require jquery.waitforimages
-
class @IssuableContext
constructor: ->
+ @initParticipants()
+
new UsersSelect()
$('select.select2').select2({width: 'resolve', dropdownAutoWidth: true})
@@ -17,3 +17,27 @@ class @IssuableContext
block.find('.js-select2').select2("open")
$(".right-sidebar").niceScroll()
+
+ initParticipants: ->
+ _this = @
+ $(document).on "click", ".js-participants-more", @toggleHiddenParticipants
+
+ $(".js-participants-author").each (i) ->
+ if i >= _this.PARTICIPANTS_ROW_COUNT
+ $(@)
+ .addClass "js-participants-hidden"
+ .hide()
+
+ toggleHiddenParticipants: (e) ->
+ e.preventDefault()
+
+ currentText = $(this).text().trim()
+ lessText = $(this).data("less-text")
+ originalText = $(this).data("original-text")
+
+ if currentText is originalText
+ $(this).text(lessText)
+ else
+ $(this).text(originalText)
+
+ $(".js-participants-hidden").toggle()
diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee
index f50df1f5ea3..d663e34871c 100644
--- a/app/assets/javascripts/issue.js.coffee
+++ b/app/assets/javascripts/issue.js.coffee
@@ -7,7 +7,6 @@ class @Issue
# Prevent duplicate event bindings
@disableTaskList()
@fixAffixScroll()
- @initParticipants()
if $('a.btn-close').length
@initTaskList()
@initIssueBtnEventListeners()
@@ -85,27 +84,3 @@ class @Issue
type: 'PATCH'
url: $('form.js-issuable-update').attr('action')
data: patchData
-
- initParticipants: ->
- _this = @
- $(document).on "click", ".js-participants-more", @toggleHiddenParticipants
-
- $(".js-participants-author").each (i) ->
- if i >= _this.PARTICIPANTS_ROW_COUNT
- $(@)
- .addClass "js-participants-hidden"
- .hide()
-
- toggleHiddenParticipants: (e) ->
- e.preventDefault()
-
- currentText = $(this).text().trim()
- lessText = $(this).data("less-text")
- originalText = $(this).data("original-text")
-
- if currentText is originalText
- $(this).text(lessText)
- else
- $(this).text(originalText)
-
- $(".js-participants-hidden").toggle()
diff --git a/app/views/shared/issuable/_participants.html.haml b/app/views/shared/issuable/_participants.html.haml
index 3fb409ff727..33a9a494857 100644
--- a/app/views/shared/issuable/_participants.html.haml
+++ b/app/views/shared/issuable/_participants.html.haml
@@ -17,4 +17,4 @@
%a.js-participants-more{href: "#", data: {original_text: "+ #{participants_size - 7} more", less_text: "- show less"}}
+ #{participants_extra} more
:javascript
- Issue.prototype.PARTICIPANTS_ROW_COUNT = #{participants_row};
+ IssuableContext.prototype.PARTICIPANTS_ROW_COUNT = #{participants_row};
diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml
index 2b95b19facc..5b2772de3f1 100644
--- a/app/views/shared/issuable/_sidebar.html.haml
+++ b/app/views/shared/issuable/_sidebar.html.haml
@@ -33,11 +33,11 @@
.value.bold.hide-collapsed
- if issuable.assignee
= link_to_member(@project, issuable.assignee, size: 32) do
+ - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
+ %span.pull-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: 'Not allowed to merge' }
+ = icon('exclamation-triangle')
%span.username
= issuable.assignee.to_reference
- - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
- %a.pull-right.cannot-be-merged{href: '#', data: {toggle: 'tooltip'}, title: 'Not allowed to merge'}
- = icon('exclamation-triangle')
- else
.light None