Dotclear

Changeset 3947:3bb644edfc18


Ignore:
Timestamp:
12/19/18 14:05:44 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Switching from inline JS variables to JSON script. last step for dashboard page

Location:
admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/index.php

    r3918 r3947  
    149149# Dashboard drag'n'drop switch for its elements 
    150150$core->auth->user_prefs->addWorkspace('accessibility'); 
    151 $dragndrop = ''; 
     151$dragndrop      = ''; 
     152$dragndrop_head = ''; 
     153$dragndrop_msg  = [ 
     154    'dragndrop_off' => __('Dashboard area\'s drag and drop is disabled'), 
     155    'dragndrop_on'  => __('Dashboard area\'s drag and drop is enabled') 
     156]; 
    152157if (!$core->auth->user_prefs->accessibility->nodragdrop) { 
    153     $dragndrop = 
    154     '<script type="text/javascript">' . "\n" . 
    155     dcPage::jsVar('dotclear.dragndrop_off', __('Dashboard area\'s drag and drop is disabled')) . "\n" . 
    156     dcPage::jsVar('dotclear.dragndrop_on', __('Dashboard area\'s drag and drop is enabled')) . "\n" . 
    157     "</script>\n" . 
    158     '<input type="checkbox" id="dragndrop" class="sr-only" title="' . 
    159         __('Dashboard area\'s drag and drop is disabled') . '" />' . 
     158    $dragndrop_head = dcPage::jsJson('dotclear_dragndrop', $dragndrop_msg); 
     159    $dragndrop      = 
     160    '<input type="checkbox" id="dragndrop" class="sr-only" title="' . $dragndrop_msg['dragndrop_off'] . '" />' . 
    160161    '<label for="dragndrop">' . 
    161162    '<svg aria-hidden="true" focusable="false" class="dragndrop-svg">' . 
    162163    '<use xlink:href="images/dragndrop.svg#mask"></use>' . 
    163164    '</svg>' . 
    164     '<span id="dragndrop-label" class="sr-only">' . __('Dashboard area\'s drag and drop is disabled') . '</span>' . 
    165     '</label>'; 
     165    '<span id="dragndrop-label" class="sr-only">' . $dragndrop_msg['dragndrop_off'] . '</span>' . 
     166        '</label>'; 
    166167} 
    167168 
     
    172173    dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') . 
    173174    dcPage::jsLoad('js/_index.js') . 
     175    $dragndrop_head . 
    174176    $admin_post_behavior . 
    175177    # --BEHAVIOR-- adminDashboardHeaders 
  • admin/js/_index.js

    r3936 r3947  
    1 /*global $, dotclear, jsToolBar */ 
     1/*global $, dotclear, jsToolBar, getData */ 
    22'use strict'; 
    33 
     
    249249    // Set or reset sortable depending on #dragndrop checbkox value 
    250250    $('#dragndrop').click(function() { 
     251      Object.assign(dotclear, getData('dotclear_dragndrop')); 
    251252      if ($(this).is(':checked')) { 
    252253        // Activate sorting feature 
Note: See TracChangeset for help on using the changeset viewer.

Sites map