mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 12:03:14 +00:00
Enhance register classic collection multiselect
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
)),
|
||||
|
@@ -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(
|
||||
|
@@ -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 @@
|
||||
<div class="span12">
|
||||
{{ auth_macro.flashes() }}
|
||||
<form
|
||||
ng-controller="registerFormCtrl"
|
||||
novalidate
|
||||
name="registerForm"
|
||||
ng-submit="submit();"
|
||||
method="POST"
|
||||
action="{{ path("login_register_classic") }}"
|
||||
check-form-submission
|
||||
>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
@@ -85,11 +83,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ form_row(form.collections) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ form_rest(form) }}
|
||||
|
||||
{% if recaptcha_display %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{{ macro.captcha() }}
|
||||
{#{{ macro.captcha() }}#}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -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'
|
||||
});
|
||||
});
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user