diff --git a/component.json b/component.json index 00b2f94088..b15ba31cbb 100644 --- a/component.json +++ b/component.json @@ -23,6 +23,7 @@ "i18next": "~1.6", "sinon": "~1.7", "sinon-chai": "~2.4", - "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip" + "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip", + "bootstrap-multiselect": "https://github.com/davidstutz/bootstrap-multiselect.git" } } diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index b54f90083d..3ae012ab3b 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -74,31 +74,49 @@ class PhraseaRegisterForm extends AbstractType $builder->add('provider-id', 'hidden'); require_once($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + $choices = array(); $baseIds = array(); foreach (\giveMeBases($this->app) as $sbas_id => $baseInsc) { if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) { if ($baseInsc['Colls']) { foreach ($baseInsc['Colls'] as $collId => $collName) { - $baseIds[\phrasea::baseFromColl($sbas_id, $collId, $this->app)] = $collName; + $baseId = \phrasea::baseFromColl($sbas_id, $collId, $this->app); + $sbasName= \phrasea::sbas_names($sbas_id, $this->app); + + if (!isset($choices[$sbasName])) { + $choices[$sbasName] = array(); + } + + $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); + $baseIds[] = $baseId; } } + if ($baseInsc['CollsCGU']) { foreach ($baseInsc['CollsCGU'] as $collId => $collName) { - $baseIds[\phrasea::baseFromColl($sbas_id, $collId, $this->app)] = $collName; + $baseId = \phrasea::baseFromColl($sbas_id, $collId, $this->app); + $sbasName= \phrasea::sbas_names($sbas_id, $this->app); + + if (!isset($choices[$sbasName])) { + $choices[$sbasName] = array(); + } + + $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); + $baseIds[] = $baseId; } } } } $builder->add('collections', 'choice', array( - 'choices' => $baseIds, + 'choices' => $choices, 'multiple' => true, - 'expanded' => true, + 'expanded' => false, 'constraints' => array( new Assert\Choice(array( - 'choices'=>array_keys($baseIds), - 'minMessage' => _('You must select at least {{ limit }} collection'), + 'choices' => array_flip($baseIds), + 'minMessage' => _('You must select at least {{ limit }} collection'), 'multiple' => true, 'min' => 1, )), diff --git a/lib/conf.d/minifyGroupsConfig.php b/lib/conf.d/minifyGroupsConfig.php index bcf94085af..5911f77778 100644 --- a/lib/conf.d/minifyGroupsConfig.php +++ b/lib/conf.d/minifyGroupsConfig.php @@ -21,6 +21,7 @@ $groups = array( '//assets/angular/angular.js', '//assets/angular-ui/build/angular-ui.js', '//assets/bootstrap-switch/static/js/bootstrapSwitch.js', + '//assets/bootstrap-multiselect/js/bootstrap-multiselect.js', '//assets/underscore/underscore.js' ), 'client' => array( diff --git a/templates/web/login/register-classic.html.twig b/templates/web/login/register-classic.html.twig index 9519f9b8a1..565c472221 100644 --- a/templates/web/login/register-classic.html.twig +++ b/templates/web/login/register-classic.html.twig @@ -1,6 +1,7 @@ {% extends "login/layout/sidebar-layout.html.twig" %} {% import "login/common/macros.html.twig" as auth_macro %} +{% import "common/macros.html.twig" as macro %} {% block title %} {% trans "Register" %} @@ -25,13 +26,10 @@
{{ auth_macro.flashes() }}
@@ -85,11 +83,18 @@
+
+
+ {{ form_row(form.collections) }} +
+
+ {{ form_rest(form) }} + {% if recaptcha_display %}
- {{ macro.captcha() }} + {#{{ macro.captcha() }}#}
{% endif %} diff --git a/www/scripts/apps/login/home/main.js b/www/scripts/apps/login/home/main.js index 55cf1e791d..8c88bf5d31 100644 --- a/www/scripts/apps/login/home/main.js +++ b/www/scripts/apps/login/home/main.js @@ -29,3 +29,17 @@ require.config({ require(["apps/login/home/app"], function(App) { App.initialize(); }); + +// close alerts +$(document).ready(function() { + $(document).on("click", ".alert .alert-block-close a", function(e){ + e.preventDefault(); + $(this).closest('.alert').alert('close'); + return false; + }); + + $("select[multiple='multiple']").multiselect({ + buttonWidth : "100%", + buttonClass: 'btn btn-inverse' + }); +}); diff --git a/www/skins/login/less/skin.less b/www/skins/login/less/skin.less index 2bd9e9e25d..7fd3f9f042 100644 --- a/www/skins/login/less/skin.less +++ b/www/skins/login/less/skin.less @@ -712,6 +712,35 @@ form[name=desktop_code] { margin-top:30px; } +form[name=registerForm] .btn-group { + width: 100%; +} + +form[name=registerForm] .multiselect { + text-align: left; +} + +form[name=registerForm] .multiselect-container { + width: 99%; +} + +form[name=registerForm] .multiselect-container li.active label{ + color: @black; +} + +form[name=registerForm] .multiselect b.caret { + float: right; +} + +form[name=registerForm] .multiselect-group { + font-weight: bold; + text-decoration: underline; +} + +form[name=registerForm] .multiselect-all label { + font-weight: bold; +} + /** IE Fixes */ .lt-ie8 authentication-sidebar-language .caret {