Unverified Commit 188e9654 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Adds saas configuration: create-form-hint and end user licence agreement

parent a9acebd1
.top-form-message {
text-align: center;
font-style: italic;
margin-bottom: 30px;
opacity: .6;
font-weight: bold;
}
.project-create {
h2 {
font-size: 1.5rem;
......@@ -14,4 +22,20 @@
}
.btn[type=submit] { margin-top: 1rem; }
.cgu-config-section {
margin-top: 1.5rem;
.cgu-content {
padding: 1.5rem;
border-radius: 5px;
p {
margin: 0;
}
}
.cgu-checkbox-container {
text-align: center;
}
}
}
\ No newline at end of file
......@@ -41,4 +41,7 @@ sonata_admin:
icon: <i class='fa fa-cogs'></i>
sonata_user:
label: Utilisateurs
icon: <i class='fa fa-users'></i>
\ No newline at end of file
icon: <i class='fa fa-users'></i>
saas:
label: Ferme de Carto
icon: <i class='fa fa-cogs saas-menu'></i>
\ No newline at end of file
......@@ -356,4 +356,10 @@ services:
class: App\Admin\ProjectAdmin
arguments: [~, App\Document\Project, 'App\Controller\Admin\ProjectAdminController']
tags:
- { name: sonata.admin, manager_type: doctrine_mongodb, group: "hide", label: Projets }
- { name: sonata.admin, manager_type: doctrine_mongodb, group: saas, label: Liste des Projets }
admin.saas_config:
class: App\Admin\ConfigurationSaasAdmin
arguments: [~, App\Document\Configuration, 'App\Controller\Admin\ConfigurationAdminController']
tags:
- { name: sonata.admin, manager_type: doctrine_mongodb, group: saas, label: Configuration }
<?php
/**
* @Author: Sebastian Castro
* @Date: 2017-03-28 15:29:03
* @Last Modified by: Sebastian Castro
* @Last Modified time: 2018-04-22 19:45:15
*/
namespace App\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\FormatterBundle\Form\Type\SimpleFormatterType;
class ConfigurationSaasAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'gogo_core_bundle_config_saas_admin_classname';
protected $baseRoutePattern = 'gogo/core/configuration-saas';
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('Configuration')
->add('saas.endUserLicenceAgreement', SimpleFormatterType::class, [
'format' => 'richhtml', 'ckeditor_context' => 'full',
'label' => "Conditions Générales d'Utilisation",
'required' => false
])
->add('saas.newProjectInstructions', SimpleFormatterType::class, [
'format' => 'richhtml', 'ckeditor_context' => 'full',
'label' => "Texte personnalisé affiché en haut du formulaire de création d'un nouveau projet",
'required' => false
])
->end()
;
}
}
......@@ -8,6 +8,7 @@ use App\Document\Configuration\ConfigurationInfobar;
use App\Document\Configuration\ConfigurationMarker;
use App\Document\Configuration\ConfigurationMenu;
use App\Document\Configuration\ConfigurationUser;
use App\Document\Configuration\ConfigurationSaas;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Gedmo\Mapping\Annotation as Gedmo;
use OzdemirBurak\Iris\Color\Hex;
......@@ -416,6 +417,13 @@ class Configuration implements \JsonSerializable
/** @MongoDB\EmbedOne(targetDocument="App\Document\Configuration\ConfigurationApi") */
protected $api;
// ----------------------------
// ---------- SAAS ------------
// ----------------------------
/** @MongoDB\EmbedOne(targetDocument="App\Document\Configuration\ConfigurationSaas") */
protected $saas;
public function __toString()
{
return 'Configuration Générale';
......@@ -2780,6 +2788,22 @@ class Configuration implements \JsonSerializable
return $this->api;
}
public function setSaas(\App\Document\Configuration\ConfigurationSaas $saas)
{
$this->saas = $saas;
return $this;
}
public function getSaas()
{
if (!$this->saas) {
$this->saas = new ConfigurationSaas();
}
return $this->saas;
}
/**
* Set theme.
*
......
<?php
namespace App\Document\Configuration;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/** @MongoDB\EmbeddedDocument */
class ConfigurationSaas
{
/**
* Displayed on top of create project form
*
* @MongoDB\Field(type="string")
*/
public $newProjectInstructions = null;
/**
* If present, users might agree those term when creating a new project
*
* @MongoDB\Field(type="string")
*/
public $endUserLicenceAgreement = null;
function getNewProjectInstructions() {
return $this->newProjectInstructions;
}
function setNewProjectInstructions($value) {
$this->newProjectInstructions = $value;
return $this;
}
function getEndUserLicenceAgreement() {
return $this->endUserLicenceAgreement;
}
function setEndUserLicenceAgreement($value) {
$this->endUserLicenceAgreement = $value;
return $this;
}
}
......@@ -146,6 +146,12 @@
$(object).css('opacity', opacity);
}
// DISABLE SAAS MENU UNLESS FOR ROOT PROJECT IN SAAS MODE
{% if not use_as_saas or not is_root_project() %}
$(document).ready(function() {
$('.saas-menu').closest('.treeview').hide();
})
{% endif %}
// Helpers
var formBuilder;
var formBuilderInitialized = false;
......@@ -203,15 +209,11 @@
<li>
<a href="{{ path('gogo_core_help') }}"><i class="fa fa-question"></i><span>Aide</span></a>
</li>
{% if use_as_saas %}
{% if use_as_saas and is_granted("ROLE_SUPER_ADMIN") and not is_root_project() %}
<li>
{% if is_root_project() %}
<a href="{{ path('admin_app_project_list') }}"><i class="fa fa-folder-open"></i><span>Projets</span></a>
{% elseif is_granted("ROLE_SUPER_ADMIN") %}
<a href="{{ path('gogo_project_delete_my_project') }}" onclick="return confirm('Cette action ne peux pas être annulée. Vous allez supprimer entièrement votre projet. Etes vous sur de vouloir continuer?')">
<button class="btn btn-sm btn-danger"><i class="fa fa-trash"></i><span>Supprimer ce projet</span></button>
</a>
{% endif %}
<a href="{{ path('gogo_project_delete_my_project') }}" onclick="return confirm('Cette action ne peux pas être annulée. Vous allez supprimer entièrement votre projet. Etes vous sur de vouloir continuer?')">
<button class="btn btn-sm btn-danger"><i class="fa fa-trash"></i><span>Supprimer ce projet</span></button>
</a>
</li>
{% endif %}
</ul>
......
......@@ -170,7 +170,7 @@
.project-create .contrib-option .hint { color: {{ disable }}; }
.project-create .overlay { background-color: {{ text }}; opacity: .9; }
.project-create .overlay .message { color: {{ contentBgd }}; }
.project-create .cgu-content { background-color: {{ background }} }
.gogo-load-css .spinner-layer {
border-color: {{ primary }} !important;
}
......
......@@ -4,9 +4,11 @@
{% block body %}
<h1>Créer un projet</h1>
<div style="text-align: center; font-style: italic; margin-bottom: 30px;opacity: .6;font-weight: bold;">
GoGoCarto est encore en version bêta, et cette plateforme de création de carte n'est pas encore officiellement lancée. Ce faisant, nous ne garantissons en aucun cas la fiabilité et la maintenance du service.
<div class="top-form-message">
{{ config.saas.newProjectInstructions|raw }}
</div>
<section class="project-create">
{{ form_start(form, {'id': 'project-form'}) }}
......@@ -49,6 +51,20 @@
</p>
{% endfor %}
</div>
{% if config.saas.endUserLicenceAgreement %}
<div class="col s12 cgu-config-section">
{# CONTRIBUTION_CONFIG #}
<h2>Conditions d'utilisation</h2>
<div class="cgu-content">
{{ config.saas.endUserLicenceAgreement|raw}}
</div>
<p class="cgu-checkbox-container">
<input name="accept-cgu" type="checkbox" id="accept-cgu" class="required" />
<label for="accept-cgu">J'accepte les conditions générales d'utilisation</label>
</p>
</div>
{% endif %}
</div>
<button class="btn" type="submit" onclick="performSubmit(event);">Créer</button>
......@@ -80,6 +96,8 @@
else $(this).removeClass('error');
});
$('label[for="accept-cgu"]').toggleClass('error-label', !$('#accept-cgu').is(':checked'));
if ($('input[name=contrib]:checked').length == 0) {
$('#please-choose-contribution').show();
e.preventDefault();
......
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