Commit efc69b4c authored by Sebastian Castro's avatar Sebastian Castro

Adds contribution options on project creation

parent 3ee18a40
......@@ -89,6 +89,18 @@
}
})
};
$(document).ready(function() {
checkCollaborativeVoteActivated();
$('.collaborative-feature .sonata-ba-field.sonata-ba-field-inline-natural > .form-group:first-child .icheckbox_square-blue .iCheck-helper').click(checkCollaborativeVoteActivated);
});
function checkCollaborativeVoteActivated() {
var collabActive = $('.collaborative-feature .sonata-ba-field.sonata-ba-field-inline-natural > .form-group:first-child .icheckbox_square-blue').hasClass('checked');
var opacity = collabActive ? '1' : '0.4';
console.log("collab pacitu", opacity);
$('.collaborative-moderation-box').css('opacity', opacity);
}
var formBuilder;
var formBuilderInitialized = false;
......
......@@ -58,9 +58,9 @@ class ConfigurationFormContributionsAdmin extends AbstractAdmin
->add('deleteFeature','sonata_type_admin', $featureFormOption, $featureFormTypeOption)->end()
->with('Modération directe', $contributionStyle)
->add('directModerationFeature','sonata_type_admin', $featureFormOption, $featureFormTypeOption)->end()
->with('Modération collaborative (votes)', $contributionStyle)
->with('Modération collaborative (votes)', array('class' => 'col-md-6 col-lg-4 collaborative-feature'))
->add('collaborativeModerationFeature','sonata_type_admin', $featureFormOption, $featureFormTypeOption)->end()
->with('Paramètres pour la modération collaborative' , array('class' => 'col-md-4'))
->with('Paramètres pour la modération collaborative' , array('class' => 'col-md-4 collaborative-moderation-box'))
->add('minVoteToChangeStatus', null, ['required'=>false, 'label' => "Nombre votes pour valider/refuser automatiquement"])
->add('maxOppositeVoteTolerated', null, ['required'=>false, 'label' => "Nombres maximum de vos contradictoires tolérés"])
->add('minDayBetweenContributionAndCollaborativeValidation', null, ['required'=>false, 'label' => "Nombre de jours minimum avant une validation/refus collaboratif"])
......
......@@ -18,7 +18,7 @@ use Biopen\CoreBundle\Document\TileLayer;
class LoadConfiguration implements FixtureInterface
{
public function load(ObjectManager $manager, $container = null, $configToCopy = null)
public function load(ObjectManager $manager, $container = null, $configToCopy = null, $contribConfig = null)
{
$configuration = new Configuration();
$tileLayersToCopy = null;
......@@ -85,8 +85,7 @@ class LoadConfiguration implements FixtureInterface
$configuration->setFavoriteFeature( new FeatureConfiguration(true, false, true, true, true));
$configuration->setShareFeature( new FeatureConfiguration(true, true, true, true, true));
$configuration->setExportIframeFeature( new FeatureConfiguration(true, false, true, true, true));
$configuration->setDirectionsFeature(new FeatureConfiguration(true, true, true, true, true));
$configuration->setReportFeature( new FeatureConfiguration(true, false, true, true, false));
$configuration->setDirectionsFeature(new FeatureConfiguration(true, true, true, true, true));
$configuration->setPendingFeature( new FeatureConfiguration(true, false, true, true, true));
$configuration->setSendMailFeature( new InteractionConfiguration(true, false, true, true, true, true));
$configuration->setCustomPopupFeature( new FeatureConfiguration());
......@@ -98,12 +97,6 @@ class LoadConfiguration implements FixtureInterface
$configuration->setListModeFeature( new FeatureConfiguration(true, true, true, true, true));
$configuration->setSearchElementsFeature( new FeatureConfiguration(true, true, true, true, true));
$configuration->setAddFeature( new InteractionConfiguration(true, true, false, true, true, true));
$configuration->setEditFeature( new InteractionConfiguration(true, true, false, true, true, true));
$configuration->setDeleteFeature( new InteractionConfiguration(true, false, false, false, false, true));
$configuration->setCollaborativeModerationFeature( new InteractionConfiguration(true, false, false, false, true, true));
$configuration->setDirectModerationFeature( new InteractionConfiguration(true, false, false, false, false, true));
// default bounds to France
$configuration->setDefaultNorthEastBoundsLat(52);
$configuration->setDefaultNorthEastBoundsLng(10);
......@@ -128,6 +121,33 @@ class LoadConfiguration implements FixtureInterface
$configuration->setCustomCSS('');
}
switch ($contribConfig) {
case 'open':
$configuration->setAddFeature( new InteractionConfiguration(true, true, true, true, true, true));
$configuration->setEditFeature( new InteractionConfiguration(true, true, true, true, true, true));
$configuration->setDeleteFeature( new InteractionConfiguration(true, true, true, true, true, true));
$configuration->setCollaborativeModerationFeature( new InteractionConfiguration(false, false, false, false, false, false));
$configuration->setDirectModerationFeature( new InteractionConfiguration(true, true, true, true, true, true));
$configuration->setReportFeature( new FeatureConfiguration(false, false, false, false, false));
break;
case 'intermediate':
$configuration->setAddFeature( new InteractionConfiguration(true, true, false, true, true, true));
$configuration->setEditFeature( new InteractionConfiguration(true, true, false, true, true, true));
$configuration->setDeleteFeature( new InteractionConfiguration(true, false, false, false, false, true));
$configuration->setCollaborativeModerationFeature( new InteractionConfiguration(true, false, false, false, true, true));
$configuration->setDirectModerationFeature( new InteractionConfiguration(true, false, false, false, false, true));
$configuration->setReportFeature( new FeatureConfiguration(true, false, true, true, false));
break;
case 'closed':
$configuration->setAddFeature( new InteractionConfiguration(true, true, false, false, false, true));
$configuration->setEditFeature( new InteractionConfiguration(true, true, false, false, false, true));
$configuration->setDeleteFeature( new InteractionConfiguration(true, true, false, false, false, true));
$configuration->setCollaborativeModerationFeature( new InteractionConfiguration(false, false, false, false, false, false));
$configuration->setDirectModerationFeature( new InteractionConfiguration(true, false, false, false, false, true));
$configuration->setReportFeature( new FeatureConfiguration(false, false, false, false, false));
break;
}
$defaultTileLayerName = $configToCopy ? $configToCopy->defaultTileLayer : null;
$defaultLayer = $this->loadTileLayers($manager, $tileLayersToCopy, $defaultTileLayerName);
$configuration->setDefaultTileLayer($defaultLayer);
......
......@@ -164,12 +164,8 @@
{# SAAS / PROJECT #}
{# ------------------ #}
.project-create ul li {
text-align: left;
color: {{ error }};
padding-left: 3.5rem;
}
.project-create ul li { color: {{ error }}; }
.project-create .contrib-option .hint { color: {{ disable }}; }
.project-create .overlay { background-color: {{ text }}; opacity: .9; }
.project-create .overlay .message { color: {{ contentBgd }}; }
......
......@@ -79,7 +79,7 @@ class ProjectController extends AbstractSaasController
$rootConfigToCopy->dbName = $project->getDbName();
// Duplicate configuration
$confLoader = new LoadConfiguration();
$configuration = $confLoader->load($projectOdm, $this->container, $rootConfigToCopy);
$configuration = $confLoader->load($projectOdm, $this->container, $rootConfigToCopy, $request->request->get('contrib'));
// Generate basic categories
$mainCategory = new Category();
......
.project-create {
h2 {
font-size: 1.5rem;
}
// Symfony errors
.project-create ul li {
text-align: left;
padding-left: 3.5rem;
}
.contrib-config-section {
padding-left: 1.4rem;
}
.btn[type=submit] { margin-top: 1rem; }
}
\ No newline at end of file
@import '../../../CoreBundle/Resources/scss/partials/base';
@import 'home';
@import 'create';
body
{
......
......@@ -7,9 +7,11 @@
<section class="project-create">
{{ form_start(form, {'id': 'project-form'}) }}
{{ form_errors(form.name) }}
<div class="row">
<h2>Nom du projet</h2>
{# NAME #}
{{ form_errors(form.name) }}
<div class="input-field col s12">
<i class="material-icons gogo-icon-description prefix"></i>
{{ form_widget(form.name, {'id': 'input-name',
......@@ -17,6 +19,7 @@
<label for="input-name" class="gogo-form-label" data-error="Oups, ce nom est trop long !">Nom du projet</label>
</div>
{# DOMAIN #}
{{ form_errors(form.domainName, {'class': 'form-error'}) }}
<div class="input-field col s12">
<i class="material-icons gogo-icon-internet prefix"></i>
......@@ -24,7 +27,26 @@
'attr': {'class': 'validate required', 'length':'80'}}) }}
<label for="input-domain" class="gogo-form-label" data-error="">Nom du domaine <i>( ****.{{ base_url }} )</i></label>
</div>
</div>
<div class="col s12 contrib-config-section">
{# CONTRIBUTION_CONFIG #}
<h2>Ouverture à la contribution publique</h2>
{% set contribOptions = [
['open', 'Ouvert', 'Tous les utilisateurs peuvent ajouter/modifier/supprimer librement'],
['intermediate', 'Intermédiaire', 'Tous les utilisateurs peuvent contribuer, mais les contributions doivent être modérées par des administrateurs'],
['closed', 'Fermé', 'Seuls les administrateurs peuvent contribuer'],
['inherit', 'Défaut', 'Utiliser les paramètres par défaut de ' ~ base_url]
]
%}
{% for option in contribOptions %}
<p>
<input name="contrib" type="radio" id="contribOption{{ loop.index }}" value="{{option[0]}}" />
<label class="contrib-option" for="contribOption{{ loop.index }}">{{ option[1] }} <span class="hint">- {{ option[2] }}</span></label>
</p>
{% endfor %}
</div>
</div>
<button class="btn" type="submit" onclick="performSubmit();">Créer</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment