mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Enhance register classic collection multiselect
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
"i18next": "~1.6",
|
"i18next": "~1.6",
|
||||||
"sinon": "~1.7",
|
"sinon": "~1.7",
|
||||||
"sinon-chai": "~2.4",
|
"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');
|
$builder->add('provider-id', 'hidden');
|
||||||
|
|
||||||
require_once($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
|
require_once($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
|
||||||
|
$choices = array();
|
||||||
$baseIds = array();
|
$baseIds = array();
|
||||||
|
|
||||||
foreach (\giveMeBases($this->app) as $sbas_id => $baseInsc) {
|
foreach (\giveMeBases($this->app) as $sbas_id => $baseInsc) {
|
||||||
if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) {
|
if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) {
|
||||||
if ($baseInsc['Colls']) {
|
if ($baseInsc['Colls']) {
|
||||||
foreach ($baseInsc['Colls'] as $collId => $collName) {
|
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']) {
|
if ($baseInsc['CollsCGU']) {
|
||||||
foreach ($baseInsc['CollsCGU'] as $collId => $collName) {
|
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(
|
$builder->add('collections', 'choice', array(
|
||||||
'choices' => $baseIds,
|
'choices' => $choices,
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'expanded' => true,
|
'expanded' => false,
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
new Assert\Choice(array(
|
new Assert\Choice(array(
|
||||||
'choices'=>array_keys($baseIds),
|
'choices' => array_flip($baseIds),
|
||||||
'minMessage' => _('You must select at least {{ limit }} collection'),
|
'minMessage' => _('You must select at least {{ limit }} collection'),
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'min' => 1,
|
'min' => 1,
|
||||||
)),
|
)),
|
||||||
|
@@ -21,6 +21,7 @@ $groups = array(
|
|||||||
'//assets/angular/angular.js',
|
'//assets/angular/angular.js',
|
||||||
'//assets/angular-ui/build/angular-ui.js',
|
'//assets/angular-ui/build/angular-ui.js',
|
||||||
'//assets/bootstrap-switch/static/js/bootstrapSwitch.js',
|
'//assets/bootstrap-switch/static/js/bootstrapSwitch.js',
|
||||||
|
'//assets/bootstrap-multiselect/js/bootstrap-multiselect.js',
|
||||||
'//assets/underscore/underscore.js'
|
'//assets/underscore/underscore.js'
|
||||||
),
|
),
|
||||||
'client' => array(
|
'client' => array(
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
{% extends "login/layout/sidebar-layout.html.twig" %}
|
{% extends "login/layout/sidebar-layout.html.twig" %}
|
||||||
|
|
||||||
{% import "login/common/macros.html.twig" as auth_macro %}
|
{% import "login/common/macros.html.twig" as auth_macro %}
|
||||||
|
{% import "common/macros.html.twig" as macro %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% trans "Register" %}
|
{% trans "Register" %}
|
||||||
@@ -25,13 +26,10 @@
|
|||||||
<div class="span12">
|
<div class="span12">
|
||||||
{{ auth_macro.flashes() }}
|
{{ auth_macro.flashes() }}
|
||||||
<form
|
<form
|
||||||
ng-controller="registerFormCtrl"
|
|
||||||
novalidate
|
novalidate
|
||||||
name="registerForm"
|
name="registerForm"
|
||||||
ng-submit="submit();"
|
|
||||||
method="POST"
|
method="POST"
|
||||||
action="{{ path("login_register_classic") }}"
|
action="{{ path("login_register_classic") }}"
|
||||||
check-form-submission
|
|
||||||
>
|
>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
@@ -85,11 +83,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
{{ form_row(form.collections) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ form_rest(form) }}
|
{{ form_rest(form) }}
|
||||||
|
|
||||||
{% if recaptcha_display %}
|
{% if recaptcha_display %}
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
{{ macro.captcha() }}
|
{#{{ macro.captcha() }}#}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -29,3 +29,17 @@ require.config({
|
|||||||
require(["apps/login/home/app"], function(App) {
|
require(["apps/login/home/app"], function(App) {
|
||||||
App.initialize();
|
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;
|
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 */
|
/** IE Fixes */
|
||||||
|
|
||||||
.lt-ie8 authentication-sidebar-language .caret {
|
.lt-ie8 authentication-sidebar-language .caret {
|
||||||
|
Reference in New Issue
Block a user