diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee
index e69a9e3e4b1..408cba33cb3 100644
--- a/app/assets/javascripts/labels_select.js.coffee
+++ b/app/assets/javascripts/labels_select.js.coffee
@@ -16,6 +16,7 @@ class @LabelsSelect
abilityName = $dropdown.data('ability-name')
$selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block')
+ $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon span')
$value = $block.find('.value')
$loading = $block.find('.block-loading').fadeOut()
@@ -151,13 +152,17 @@ class @LabelsSelect
$loading.fadeOut()
$selectbox.hide()
data.issueURLSplit = issueURLSplit
- if not data.labels.length
- template = labelNoneHTMLTemplate()
- else
+ labelCount = 0
+ if data.labels.length
template = labelHTMLTemplate(data)
- href = $value
- .show()
- .html(template)
+ labelCount = data.labels.length
+ else
+ template = labelNoneHTMLTemplate()
+ $value
+ .removeAttr('style')
+ .html(template)
+ $sidebarCollapsedValue.text(labelCount)
+
$value
.find('a')
.each((i) ->
@@ -226,7 +231,8 @@ class @LabelsSelect
hidden: ->
$selectbox.hide()
- $value.show()
+ # display:block overrides the hide-collapse rule
+ $value.removeAttr('style')
if $dropdown.hasClass 'js-multiselect'
saveLabelData()
diff --git a/app/assets/javascripts/milestone_select.js.coffee b/app/assets/javascripts/milestone_select.js.coffee
index d61d03791fa..2b292c387a5 100644
--- a/app/assets/javascripts/milestone_select.js.coffee
+++ b/app/assets/javascripts/milestone_select.js.coffee
@@ -18,6 +18,7 @@ class @MilestoneSelect
abilityName = $dropdown.data('ability-name')
$selectbox = $dropdown.closest('.selectbox')
$block = $selectbox.closest('.block')
+ $sidebarCollapsedValue = $block.find('.sidebar-collapsed-icon span')
$value = $block.find('.value')
$loading = $block.find('.block-loading').fadeOut()
@@ -80,18 +81,14 @@ class @MilestoneSelect
milestone.name is selectedMilestone
hidden: ->
$selectbox.hide()
- $value.show()
- clicked: (selected) ->
+
+ # display:block overrides the hide-collapse rule
+ $value.removeAttr('style')
+ clicked: (e) ->
if $dropdown.hasClass 'js-filter-bulk-update'
return
- if $dropdown.hasClass('js-filter-submit')
- if selected.name?
- selectedMilestone = selected.name
- else if selected.title?
- selectedMilestone = selected.title
- else
- selectedMilestone = ''
+ if $dropdown.hasClass 'js-filter-submit'
$dropdown.parents('form').submit()
else
selected = $selectbox
@@ -109,13 +106,12 @@ class @MilestoneSelect
).done (data) ->
$loading.fadeOut()
$selectbox.hide()
- $milestoneLink = $value
- .show()
- .find('a')
+ $value.removeAttr('style')
if data.milestone?
data.milestone.namespace = _this.currentProject.namespace
data.milestone.path = _this.currentProject.path
$value.html(milestoneLinkTemplate(data.milestone))
+ $sidebarCollapsedValue.text(data.milestone.title)
else
$value.html(milestoneLinkNoneTemplate)
- )
+ )
\ No newline at end of file
diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee
index aec13e54c98..1ed552270a6 100644
--- a/app/assets/javascripts/users_select.js.coffee
+++ b/app/assets/javascripts/users_select.js.coffee
@@ -19,6 +19,7 @@ class @UsersSelect
$block = $selectbox.closest('.block')
abilityName = $dropdown.data('ability-name')
$value = $block.find('.value')
+ $collapsedSidebar = $block.find('.sidebar-collapsed-user')
$loading = $block.find('.block-loading').fadeOut()
$block.on('click', '.js-assign-yourself', (e) =>
@@ -51,11 +52,21 @@ class @UsersSelect
name: 'Unassigned'
username: ''
avatar: ''
+ $value.html(assigneeTemplate(user))
+ $collapsedSidebar.html(collapsedAssigneeTemplate(user))
- $value.html(noAssigneeTemplate(user))
- $value.find('a').attr('href')
+ collapsedAssigneeTemplate = _.template(
+ '<% if( avatar ) { %>
+
+
+ Toni Boehm
+
+ <% } else { %>
+
+ <% } %>'
+ )
- noAssigneeTemplate = _.template(
+ assigneeTemplate = _.template(
'<% if (username) { %>
<% if( avatar ) { %>
@@ -131,7 +142,8 @@ class @UsersSelect
hidden: (e) ->
$selectbox.hide()
- $value.show()
+ # display:block overrides the hide-collapse rule
+ $value.removeAttr('style')
clicked: (user) ->
page = $('body').data 'page'