瀏覽代碼

module ot_customizer ok

Olivier Massot 5 年之前
父節點
當前提交
57e780c08e
共有 23 個文件被更改,包括 300 次插入81 次删除
  1. 52 15
      ot_templating/Classes/Controller/OtCustomizerController.php
  2. 40 1
      ot_templating/Classes/Utilities/OtPageRepository.php
  3. 16 8
      ot_templating/Classes/ViewHelpers/Events/GetNextViewHelper.php
  4. 4 5
      ot_templating/Classes/ViewHelpers/Template/CurrentViewHelper.php
  5. 64 0
      ot_templating/Classes/ViewHelpers/Template/GetPreferenceViewHelper.php
  6. 46 0
      ot_templating/Classes/ViewHelpers/Template/GetPreferencesViewHelper.php
  7. 2 1
      ot_templating/Resources/Private/Partials/Classic/Assets.html
  8. 3 1
      ot_templating/Resources/Private/Partials/Classic/Header.html
  9. 10 8
      ot_templating/Resources/Private/Partials/Modern/Assets.html
  10. 2 1
      ot_templating/Resources/Private/Partials/Modern/Header.html
  11. 30 27
      ot_templating/Resources/Private/Templates/OtCustomizer/Index.html
  12. 1 1
      ot_templating/Resources/Private/Templates/Page/1Col.html
  13. 1 1
      ot_templating/Resources/Private/Templates/Page/3Col.html
  14. 1 1
      ot_templating/Resources/Private/Templates/Page/Contact.html
  15. 1 1
      ot_templating/Resources/Private/Templates/Page/Events.html
  16. 1 1
      ot_templating/Resources/Private/Templates/Page/Home.html
  17. 1 1
      ot_templating/Resources/Private/Templates/Page/Members.html
  18. 1 1
      ot_templating/Resources/Private/Templates/Page/MembersCa.html
  19. 1 1
      ot_templating/Resources/Private/Templates/Page/Structures.html
  20. 1 1
      ot_templating/Resources/Private/Templates/Page/StructuresEvents.html
  21. 19 2
      ot_templating/Resources/Public/assets/Backend/style/ot_customizer.css
  22. 2 2
      ot_templating/ext_tables.php
  23. 1 1
      ot_templating/ext_tables.sql

+ 52 - 15
ot_templating/Classes/Controller/OtCustomizerController.php

@@ -16,19 +16,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  */
 class OtCustomizerController extends ActionController {
 
-    CONST templates = [
-        'Classic' => [
-            'name' => 'Classique',
-            'description' => 'Le thème classique, simple et complet.',
-            'picture' => 'EXT:ot_templating/Resources/Public/media/theme_classic.png'
-        ],
-        'Modern' => [
-            'name' => 'Moderne',
-            'description' => '[Nouveau] Un thème moderne et intuitif.',
-            'picture' => 'EXT:ot_templating/Resources/Public/media/theme_modern.png'
-        ]
-    ];
-
     /**
      * Index action (default action)
      * Displays the customize page on the backend
@@ -46,7 +33,15 @@ class OtCustomizerController extends ActionController {
         }
 
         $this->view->assign('rootPage', $rootPageUid);
-        $this->view->assign('templates', self::templates);
+        $this->view->assign('templates', OtPageRepository::templates);
+
+        $pageRepository = new OtPageRepository();
+        $this->view->assign('currentTemplate', $pageRepository->getCurrentTemplate($rootPageUid));
+        $this->view->assign('preferences', $pageRepository->getTemplatePreferences($rootPageUid));
+
+        $args = $this->request->getArguments();
+        $this->view->assign('preferencesUpdated', $args['preferencesUpdated']);
+
     }
 
     /**
@@ -74,7 +69,49 @@ class OtCustomizerController extends ActionController {
         // Clear the page cache
         $this->cleanCache();
 
-        $this->redirect('index');
+        $this->forward('index');
+    }
+
+    /**
+     * Update the site's preferences
+     */
+    public function updatePreferencesAction() {
+        $args = $this->request->getArguments();
+
+        $prefs = OtPageRepository::defaultPreferences;
+
+        if (isset($args['themeColor'])) {
+            $prefs['themeColor'] = $args['themeColor'];
+        }
+        if (isset($args['displayCarousel'])) {
+            $prefs['displayCarousel'] = $args['displayCarousel'];
+        }
+
+        // Get the current root page's uid
+        $rootPageUid = $this->getCurrentRootPageUid();
+
+        // applies the change in the database
+        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
+        $queryBuilder->update('pages')
+            ->where(
+                $queryBuilder->expr()->eq(
+                    'uid',
+                    $queryBuilder->createNamedParameter($rootPageUid, PDO::PARAM_INT)
+                )
+            )
+            ->set('tx_opentalent_template_preferences', json_encode($prefs))
+            ->execute()
+        ;
+
+        // Clear the page cache
+        $this->cleanCache();
+
+        $this->forward(
+            'index',
+            'OtCustomizer',
+            'OtTemplating',
+            ['preferencesUpdated'=>'1']
+        );
     }
 
 

+ 40 - 1
ot_templating/Classes/Utilities/OtPageRepository.php

@@ -16,6 +16,25 @@ use TYPO3\CMS\Frontend\Page\PageRepository;
  */
 class OtPageRepository extends PageRepository
 {
+    CONST templates = [
+        'Classic' => [
+            'name' => 'Classique',
+            'description' => 'Le thème classique, simple et complet.',
+            'picture' => 'EXT:ot_templating/Resources/Public/media/theme_classic.png'
+        ],
+        'Modern' => [
+            'name' => 'Moderne',
+            'description' => '[Nouveau] Un thème moderne et intuitif.',
+            'picture' => 'EXT:ot_templating/Resources/Public/media/theme_modern.png'
+        ]
+    ];
+
+    CONST defaultTemplate = 'Classic';
+
+    CONST defaultPreferences = [
+        'themeColor' => 'lightblue',
+        'displayCarousel' => '1'
+    ];
 
     /**
      * Returns the root page of the given page,
@@ -82,10 +101,30 @@ class OtPageRepository extends PageRepository
         $templateName = $rootPage['tx_opentalent_template'];
 
         if ($templateName==='') {
-            return 'Classic';
+            return self::defaultTemplate;
         }
         return $templateName;
     }
 
+    /**
+     * Returns the current site template's name
+     * @param $pageUid
+     * @return array
+     */
+    public function getTemplatePreferences($pageUid) {
+        $rootPageUid = $this->getRootPageFor($pageUid)['uid'];
+        if (!($rootPageUid >= 0)) {
+            return [];
+        }
+
+        $rootPage = $this->getPage($rootPageUid);
+        $templatePreferences = $rootPage['tx_opentalent_template_preferences'];
+
+        if ($templatePreferences==='') {
+            return self::defaultPreferences;
+        }
+        return json_decode($templatePreferences, true);
+    }
+
 
 }

+ 16 - 8
ot_templating/Classes/ViewHelpers/Events/GetNextViewHelper.php

@@ -6,6 +6,8 @@ use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait;
 use FluidTYPO3\Vhs\Utility\ErrorUtility;
 use Opentalent\OtTemplating\Domain\Repository\EventRepository;
 use Opentalent\OtTemplating\Exception\ApiRequestException;
+use TYPO3\CMS\Core\TimeTracker\TimeTracker;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
 
 /**
@@ -126,14 +128,20 @@ class GetNextViewHelper extends AbstractViewHelper {
         }
 
         // Get next events of the structure
-        if ($fromChildren) {
-            // Network: Get the next events of the parent structures
-            $events = $this->eventRepository->findChildrenByOrganizationId($organizationId, $fromDate, $toDate, $limit);
-        } else if ($fromParents) {
-            // Simple structure: Get the next events of the parent structures
-            $events = $this->eventRepository->findParentsByOrganizationId($organizationId, $fromDate, $toDate, $limit);
-        } else {
-            $events = $this->eventRepository->findByOrganizationId($organizationId, $fromDate, $toDate, $limit);
+        try {
+            if ($fromChildren) {
+                // Network: Get the next events of the parent structures
+                $events = $this->eventRepository->findChildrenByOrganizationId($organizationId, $fromDate, $toDate, $limit);
+            } else if ($fromParents) {
+                // Simple structure: Get the next events of the parent structures
+                $events = $this->eventRepository->findParentsByOrganizationId($organizationId, $fromDate, $toDate, $limit);
+            } else {
+                $events = $this->eventRepository->findByOrganizationId($organizationId, $fromDate, $toDate, $limit);
+            }
+        } catch (ApiRequestException $e) {
+            $timeTracker = GeneralUtility::makeInstance(TimeTracker::class);
+            $timeTracker->setTSlogMessage('Error while requesting the API: ', 3);
+            $events = [];
         }
 
         $variables = [$as => $events];

+ 4 - 5
ot_templating/Classes/ViewHelpers/CurrentTemplateViewHelper.php → ot_templating/Classes/ViewHelpers/Template/CurrentViewHelper.php

@@ -1,11 +1,10 @@
 <?php
 
-namespace Opentalent\OtTemplating\ViewHelpers;
+namespace Opentalent\OtTemplating\ViewHelpers\Template;
 
 
 use Closure;
 use Opentalent\OtTemplating\Utilities\OtPageRepository;
-use Opentalent\OtTemplating\ViewHelpers\RootPage\GetIdViewHelper;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
@@ -15,11 +14,11 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
  *
  *     {namespace ot=Opentalent\OtTemplating\ViewHelpers}
  *
- *     {ot:currentTemplate()}
+ *     {ot:template.current()}
  *
- * @package Opentalent\OtTemplating\ViewHelpers
+ * @package Opentalent\OtTemplating\ViewHelpers\Template
  */
-class CurrentTemplateViewHelper extends AbstractViewHelper
+class CurrentViewHelper extends AbstractViewHelper
 {
     /**
      * -- This method is expected by Fluid --

+ 64 - 0
ot_templating/Classes/ViewHelpers/Template/GetPreferenceViewHelper.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace Opentalent\OtTemplating\ViewHelpers\Template;
+
+
+use Closure;
+use Opentalent\OtTemplating\Utilities\OtPageRepository;
+use Opentalent\OtTemplating\ViewHelpers\RootPage\GetIdViewHelper;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
+
+/**
+ * Returns the value of the requested preference
+ *
+ *     {namespace ot=Opentalent\OtTemplating\ViewHelpers}
+ *
+ *     {ot:template.preference('themeColor')}
+ *
+ * @package Opentalent\OtTemplating\ViewHelpers\Template
+ */
+class GetPreferenceViewHelper extends AbstractViewHelper
+{
+    /**
+     * -- This method is expected by Fluid --
+     * Declares the viewhelper's parameters
+     */
+    public function initializeArguments()
+    {
+        $this->registerArgument(
+            'key',
+            'string',
+            'The name of the requested preference',
+            true
+        );
+    }
+
+    /**
+     * -- This method is expected by Fluid --
+     * Renders the content as html
+     *
+     * @param array $arguments
+     * @param Closure $renderChildrenClosure
+     * @param RenderingContextInterface $renderingContext
+     * @return array
+     */
+    public static function renderStatic(
+        array $arguments,
+        Closure $renderChildrenClosure,
+        RenderingContextInterface $renderingContext
+    ) {
+        if (TYPO3_MODE == 'FE') {
+            $pageUid = (int) $GLOBALS['TSFE']->id;
+        } else {
+            $pageUid = (int) GeneralUtility::_GP('id');
+        }
+
+        $pageRepository = new OtPageRepository();
+        $preferences = $pageRepository->getTemplatePreferences($pageUid);
+        $key = $arguments['key'];
+        return $preferences[$key];
+    }
+
+}

+ 46 - 0
ot_templating/Classes/ViewHelpers/Template/GetPreferencesViewHelper.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace Opentalent\OtTemplating\ViewHelpers\Template;
+
+use Closure;
+use Opentalent\OtTemplating\Utilities\OtPageRepository;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
+
+/**
+ * Returns the recorded preferences
+ *
+ *     {namespace ot=Opentalent\OtTemplating\ViewHelpers}
+ *
+ *     {ot:template.preferences()}
+ *
+ * @package Opentalent\OtTemplating\ViewHelpers\Template
+ */
+class PreferencesViewHelper extends AbstractViewHelper
+{
+    /**
+     * -- This method is expected by Fluid --
+     * Renders the content as html
+     *
+     * @param array $arguments
+     * @param Closure $renderChildrenClosure
+     * @param RenderingContextInterface $renderingContext
+     * @return array
+     */
+    public static function renderStatic(
+        array $arguments,
+        Closure $renderChildrenClosure,
+        RenderingContextInterface $renderingContext
+    ) {
+        if (TYPO3_MODE == 'FE') {
+            $pageUid = (int) $GLOBALS['TSFE']->id;
+        } else {
+            $pageUid = (int) GeneralUtility::_GP('id');
+        }
+
+        $pageRepository = new OtPageRepository();
+        return $pageRepository->getTemplatePreferences($pageUid);
+    }
+
+}

+ 2 - 1
ot_templating/Resources/Private/Partials/Classic/Assets.html

@@ -1,4 +1,5 @@
 {namespace v=FluidTYPO3\Vhs\ViewHelpers}
+{namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!--
 Assets included with the VHS viewhelpers
@@ -29,7 +30,7 @@ Assets included with the VHS viewhelpers
                standalone="1"/>
 
 <v:asset.style name="theme"
-               path="{assets_dir}/style/theme-{f:if(condition: settings.themeColor, then: settings.themeColor, else: 'light-blue')}.css"
+               path="{assets_dir}/style/theme-{ot:template.getPreference(key: 'themeColor')}.css"
                dependencies="fontAwesome,slick,slick-theme,leaflet"
                standalone="1"/>
 

+ 3 - 1
ot_templating/Resources/Private/Partials/Classic/Header.html

@@ -1,4 +1,6 @@
 {namespace v=FluidTYPO3\Vhs\ViewHelpers}
+{namespace ot=Opentalent\OtTemplating\ViewHelpers}
+
 <f:comment><!--Header partial: contains various partials, like topbar, cariousel, breadcrumb...--></f:comment>
 
 <f:comment><!-- Render the assets' includes --></f:comment>
@@ -11,7 +13,7 @@
     <f:comment><!-- Render the no-script warning box defined in partial/NoScriptWarning.html--></f:comment>
     <f:render partial="Classic/NoScriptWarning" />
 
-    <f:if condition="{settings.displayCarousel}==1">
+    <f:if condition="{ot:template.getPreference(key: 'displayCarousel')}==1">
         <f:comment><!-- Render the carousel defined in partial/Carousel.html--></f:comment>
         <f:render partial="Classic/Carousel" />
     </f:if>

+ 10 - 8
ot_templating/Resources/Private/Partials/Modern/Assets.html

@@ -98,43 +98,45 @@ Assets included with the VHS viewhelpers
 
 
 <f:comment><!-- Chosen theme --></f:comment>
-<f:if condition="{settings.themeColor}=='light-blue'">
+<v:variable.set name="themeColor" value ="{ot:template.getPreference(key: 'themeColor')}"/>
+
+<f:if condition="{themeColor}=='light-blue'">
     <f:then>
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-blue.css"
                        standalone="1"/>
     </f:then>
-    <f:else if="{settings.themeColor}=='blue'">
+    <f:else if="{themeColor}=='blue'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-steelblue.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='green'">
+    <f:else if="{themeColor}=='green'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-green.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='orange'">
+    <f:else if="{themeColor}=='orange'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-orange.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='grey'">
+    <f:else if="{themeColor}=='grey'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-grey.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='red'">
+    <f:else if="{themeColor}=='red'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-red.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='light-red'">
+    <f:else if="{themeColor}=='light-red'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-red-light.css"
                        standalone="1"/>
     </f:else>
-    <f:else if="{settings.themeColor}=='purple'">
+    <f:else if="{themeColor}=='purple'">
         <v:asset.style name="theme"
                        path="{assets_dir}/style/skins/skin-purple.css"
                        standalone="1"/>

+ 2 - 1
ot_templating/Resources/Private/Partials/Modern/Header.html

@@ -1,3 +1,4 @@
+{namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- Render the topbar defined in partial/Topbar.html--></f:comment>
 <f:render partial="Modern/Assets" arguments="{_all}" />
@@ -13,6 +14,6 @@
 
 </header>
 
-<f:if condition="{settings.displayCarousel}==1">
+<f:if condition="{ot:template.getPreference(key: 'displayCarousel')}==1">
     <f:render partial="Modern/Carousel" arguments="{_all}" />
 </f:if>

+ 30 - 27
ot_templating/Resources/Private/Templates/OtCustomizer/Index.html

@@ -5,14 +5,12 @@
 
 <f:section name="content">
 
-    <v:variable.set name="currentTemplate"
-                    value="{ot:currentTemplate()}"/>
-
     <div class="ot-customizer">
         <f:if condition="{pageSelected}">
             <f:then>
 
                 <div class="templates">
+                    <h3>Choisir un thème:</h3>
                     <f:for each="{templates}" as="template" key="template_key">
 
                         <div class="template-card">
@@ -36,7 +34,7 @@
                                                 action="selectTemplate"
                                                 arguments="{template_key: template_key}"
                                                 title="select"
-                                                class="btn"
+                                                class="ot-btn"
                                         >
                                             Utiliser ce thème
                                         </f:link.action>
@@ -49,44 +47,49 @@
                 </div>
 
                 <div class="customizer">
-                    <form>
 
+                    <f:form action="updatePreferences">
                         <div class="form-group">
                             <label>Couleur du thème</label>
-                            <select class="form-control form-control-adapt" size="1">
-                                <option value="light-blue" selected="selected">Bleu ciel</option>
-                                <option value="blue">Bleu</option>
-                                <option value="green">Vert</option>
-                                <option value="orange">Orange</option>
-                                <option value="grey">Gris</option>
-                                <option value="red">Rouge</option>
-                                <option value="light-red">Rouge cerise</option>
-                                <option value="purple">Violet</option>
-                            </select>
+                            <f:form.select class="form-control"
+                                           name="themeColor"
+                                           options="{light-blue: 'Bleu ciel',
+                                                       blue: 'Bleu',
+                                                       green: 'Vert',
+                                                       orange: 'Orange',
+                                                       grey: 'Gris',
+                                                       red: 'Rouge',
+                                                       light-red: 'Rouge cerise',
+                                                       purple: 'Violet'}"
+                                           value="{preferences.themeColor}">
+                            </f:form.select>
                         </div>
 
                         <div class="form-group">
                             <label>Afficher le caroussel d'images</label>
-                            <input type="checkbox"
-                                   class="checkbox-input"
-                                   value="1">
+                            <f:form.checkbox name="displayCarousel"
+                                             value="1"
+                                             checked="{preferences.displayCarousel}"
+                            />
                         </div>
 
                         <div class="actions">
-                            <f:link.action
-                                    action="selectTemplate"
-                                    arguments="{template_key: template_key}"
-                                    title="select"
-                                    class="btn">
+                            <f:form.button type="submit" class="ot-btn">
                                 Appliquer
-                            </f:link.action>
+                            </f:form.button>
                         </div>
-                    </form>
+
+                        <f:if condition="{preferencesUpdated}==1">
+                            <p class="success-msg">Préférences mises à jour</p>
+                        </f:if>
+                    </f:form>
                 </div>
             </f:then>
             <f:else>
-                <f:comment><!-- No page selected --></f:comment>
-                <f:translate key="noPageSelected" />
+                <div class="no-page-warning">
+                    <f:comment><!-- No page selected --></f:comment>
+                    <f:translate key="noPageSelected" />
+                </div>
             </f:else>
         </f:if>
     </div>

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/1Col.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout 1Col, defined in layouts/[templateName]/1Col.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/1Col" />
+<f:layout name="{ot:template.current()}/1Col" />
 
 <f:section name='Configuration'>
     <flux:form id="1col" label="Gabarit simple" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/3Col.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout 3Col, defined in layouts/[templateName]/3Col.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/3Col" />
+<f:layout name="{ot:template.current()}/3Col" />
 
 <f:section name='Configuration'>
     <flux:form id="3col" label="Gabarit 3 Colonnes" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/Contact.html

@@ -1,7 +1,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Contact, defined in layouts/[templateName]/Contact.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/Contact" />
+<f:layout name="{ot:template.current()}/Contact" />
 
 <f:section name='Configuration'>
     <flux:form id="contact" label="Gabarit Formulaire de contact" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/Events.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Events, defined in layouts/[templateName]/Events.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/Events" />
+<f:layout name="{ot:template.current()}/Events" />
 
 <f:section name='Configuration'>
     <flux:form id="events" label="Gabarit Evènements" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/Home.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Home, defined in layouts/[templateName]/Home.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/Home" />
+<f:layout name="{ot:template.current()}/Home" />
 
 <f:section name='Configuration'>
     <flux:form id="home" label="Gabarit Accueil" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/Members.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Members, defined in layouts/[templateName]/Members.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/Members" />
+<f:layout name="{ot:template.current()}/Members" />
 
 <f:section name='Configuration'>
     <flux:form id="members" label="Gabarit Adherents" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/MembersCa.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Members, defined in layouts/[templateName]/Members.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/MembersCa" />
+<f:layout name="{ot:template.current()}/MembersCa" />
 
 <f:section name='Configuration'>
     <flux:form id="members_ca" label="Gabarit Membres CA" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/Structures.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Members, defined in layouts/[templateName]/Structures.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/Structures" />
+<f:layout name="{ot:template.current()}/Structures" />
 
 <f:section name='Configuration'>
     <flux:form id="structures" label="Gabarit Structures adhérentes" extensionName="Opentalent.OtTemplating">

+ 1 - 1
ot_templating/Resources/Private/Templates/Page/StructuresEvents.html

@@ -3,7 +3,7 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
 
 <f:comment><!-- uses the layout Events, defined in layouts/[templateName]/Events.html --></f:comment>
-<f:layout name="{ot:currentTemplate()}/StructuresEvents" />
+<f:layout name="{ot:template.current()}/StructuresEvents" />
 
 <f:section name='Configuration'>
     <flux:form id="structuresEvents" label="Gabarit Evènements des structures" extensionName="Opentalent.OtTemplating">

+ 19 - 2
ot_templating/Resources/Public/assets/Backend/style/ot_customizer.css

@@ -58,7 +58,7 @@
     padding: 6px;
 }
 
-.ot-customizer a.btn {
+.ot-customizer .ot-btn {
     padding: 6px;
 
     border: solid 1px #bbb;
@@ -67,7 +67,7 @@
     font-weight: 600;
 }
 
-.ot-customizer a.btn:hover {
+.ot-customizer .ot-btn:hover {
     text-decoration: none;
     cursor: pointer;
 
@@ -110,3 +110,20 @@
     flex-direction: row;
     justify-content: flex-end;
 }
+
+.ot-customizer .success-msg {
+    color: #009933;
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    justify-content: center;
+    font-size: 14px;
+}
+
+.ot-customizer .no-page-warning {
+    margin: 36px;
+    padding: 12px;
+    background-color: #e6e6e6;
+    border: solid 1px #666666;
+}
+

+ 2 - 2
ot_templating/ext_tables.php

@@ -22,9 +22,9 @@ call_user_func(
                 'Opentalent.OtTemplating',
                 'web', // Make module a submodule of 'web'
                 'ot_customizer', // Submodule key
-                'top', // Position
+                '', // Position
                 array(
-                    'OtCustomizer' => 'index,selectTemplate',
+                    'OtCustomizer' => 'index,selectTemplate,updatePreferences',
                 ),
                 array(
                     'access' => 'user,group',

+ 1 - 1
ot_templating/ext_tables.sql

@@ -6,5 +6,5 @@
 CREATE TABLE pages (
 	tx_opentalent_structure_id bigint,
     tx_opentalent_template varchar(100) DEFAULT '',
-    tx_opentalent_template_color varchar(100) DEFAULT ''
+    tx_opentalent_template_preferences text DEFAULT ''
 );