summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-10 17:09:57 +0000
committerPhil Hughes <me@iamphill.com>2016-03-18 09:46:20 +0000
commit38ea9c6cf7c7c063f841ebe95477e9f48d7bc430 (patch)
treeb01a4ab50f2e78c8f7e39e54e03f2aac79f28120
parent021d79e3ac1cfcac875866f1d70176552d1bf159 (diff)
downloadgitlab-ce-38ea9c6cf7c7c063f841ebe95477e9f48d7bc430.tar.gz
Reused some variables
Set global JS variable to sync view up
-rw-r--r--app/assets/javascripts/issue.js.coffee4
-rw-r--r--app/views/shared/issuable/_participants.html.haml7
2 files changed, 7 insertions, 4 deletions
diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee
index 47db7c63ec6..424c354b755 100644
--- a/app/assets/javascripts/issue.js.coffee
+++ b/app/assets/javascripts/issue.js.coffee
@@ -91,7 +91,7 @@ class @Issue
# hide any participants from number 6
$(".js-participants-author").each (i) ->
- if i > 6
+ if i >= PARTICIPANTS_ROW
$(@)
.addClass "js-participants-hidden hidden"
@@ -101,7 +101,7 @@ class @Issue
currentText = $(this).text().trim()
lessText = $(this).data("less-text")
originalText = $(this).data("original-text")
-
+
if currentText is originalText
$(this).text(lessText)
else
diff --git a/app/views/shared/issuable/_participants.html.haml b/app/views/shared/issuable/_participants.html.haml
index 8fe1c9af118..75a330c9e5f 100644
--- a/app/views/shared/issuable/_participants.html.haml
+++ b/app/views/shared/issuable/_participants.html.haml
@@ -1,5 +1,8 @@
+- participants_row = 7
- participants_size = participants.size
-- participants_extra = participants_size - 7
+- participants_extra = participants_size - participants_row
+:javascript
+ var PARTICIPANTS_ROW = #{participants_row};
.block.participants
.sidebar-collapsed-icon
= icon('users')
@@ -14,4 +17,4 @@
- if participants_extra > 0
%div.participants-more
%a.js-participants-more{href: "#", data: {original_text: "+ #{participants_size - 7} more", less_text: "- show less"}}
- + #{participants_size - 7} more
+ + #{participants_extra} more