Fix CSS in load more participants

This commit is contained in:
Filipa Lacerda 2017-10-23 15:45:09 +03:00
parent 3f9022cf78
commit d2848f9da6
No known key found for this signature in database
GPG Key ID: 9CA3FDE4D1E2F1C8
2 changed files with 10 additions and 11 deletions

View File

@ -51,20 +51,19 @@ const PARTICIPANTS_ROW_COUNT = 7;
}
IssuableContext.prototype.initParticipants = function() {
$(document).on("click", ".js-participants-more", this.toggleHiddenParticipants);
return $(".js-participants-author").each(function(i) {
$(document).on('click', '.js-participants-more', this.toggleHiddenParticipants);
return $('.js-participants-author').each(function(i) {
if (i >= PARTICIPANTS_ROW_COUNT) {
return $(this).addClass("js-participants-hidden").hide();
return $(this).addClass('js-participants-hidden').hide();
}
});
};
IssuableContext.prototype.toggleHiddenParticipants = function(e) {
var currentText, lessText, originalText;
e.preventDefault();
currentText = $(this).text().trim();
lessText = $(this).data("less-text");
originalText = $(this).data("original-text");
IssuableContext.prototype.toggleHiddenParticipants = function() {
const currentText = $(this).text().trim();
const lessText = $(this).data('less-text');
const originalText = $(this).data('original-text');
if (currentText === originalText) {
$(this).text(lessText);
@ -73,7 +72,7 @@ const PARTICIPANTS_ROW_COUNT = 7;
$(this).text(originalText);
}
$(".js-participants-hidden").toggle();
$('.js-participants-hidden').toggle();
};
return IssuableContext;

View File

@ -14,5 +14,5 @@
= link_to_member(@project, participant, name: false, size: 24, lazy_load: true)
- if participants_extra > 0
.hide-collapsed.participants-more
%a.js-participants-more{ href: "#", data: { original_text: "+ #{participants_size - 7} more", less_text: "- show less" } }
%button.btn-transparent.btn-blank.js-participants-more{ data: { original_text: "+ #{participants_size - 7} more", less_text: "- show less", type: 'button' } }
+ #{participants_extra} more