diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index b06f97a715..07a2731b57 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -189,6 +189,9 @@ class Login implements ControllerProviderInterface 'validation_length_min' => _('This value is too short. It should have %s character or more'), 'password_match' => _('The passwords do not match.'), 'accept_tou' => _('You must accept the terms of use.'), + 'none_selected' => _('None selected'), + 'collections' => _('Collections'), + 'collection' => _('Collection'), )); $date = new \DateTime(); diff --git a/www/scripts/apps/login/home/common.js b/www/scripts/apps/login/home/common.js index 948ab92078..888204279c 100644 --- a/www/scripts/apps/login/home/common.js +++ b/www/scripts/apps/login/home/common.js @@ -10,10 +10,11 @@ define([ "jquery", "underscore", + "i18n", "backbone", "bootstrap", "multiselect" -], function($, _, Backbone, bootstrap, multiselect) { +], function($, _, i18n, Backbone, bootstrap, multiselect) { var initialize = function() { // close alerts $(document).on("click", ".alert .alert-block-close a", function(e){ @@ -24,7 +25,22 @@ define([ $("select[multiple='multiple']").multiselect({ buttonWidth : "100%", - buttonClass: 'btn btn-inverse' + buttonClass: 'btn btn-inverse', + buttonText: function(options, select) { + if (options.length === 0) { + return i18n.t("none_selected") + ''; + } + else if (options.length > 4) { + return options.length + (options.length > 1 ? i18n.t("collections") : i18n.t("collection")) + ' '; + } + else { + var selected = ''; + options.each(function() { + selected += $(this).text() + ', '; + }); + return selected.substr(0, selected.length -2) + ' '; + } + } }); };