Dotclear

source: admin/js/_plugins.js @ 3762:e5c18a9ead6a

Revision 3762:e5c18a9ead6a, 1.9 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

scope="row" obsolete in HTML5 for td, switch to th for module name (plugins list), closes #2272

Line 
1/*global $, dotclear */
2'use strict';
3
4$(function() {
5  // expand a module line
6  $('table.modules.expandable tr.line').each(function() {
7    $('td.module-name, th.module-name', this).toggleWithLegend($(this).next('.module-more'), {
8      img_on_src: dotclear.img_plus_src,
9      img_on_alt: dotclear.img_plus_alt,
10      img_off_src: dotclear.img_minus_src,
11      img_off_alt: dotclear.img_minus_alt,
12      legend_click: true
13    });
14  });
15
16  // checkboxes selection
17  $('.checkboxes-helpers').each(function() {
18    dotclear.checkboxesHelpers(this);
19  });
20
21  // actions tests
22  $('.modules-form-actions').each(function() {
23    var rxActionType = /^[^\[]+/;
24    var rxActionValue = /([^\[]+)\]$/;
25    var checkboxes = $(this).find('input[type=checkbox]');
26
27    // check if submit is a global action or one line action
28    $('input[type=submit]', this).click(function() {
29      var keyword = $(this).attr('name');
30      var maction = keyword.match(rxActionType);
31      var action = maction[0];
32      var mvalues = keyword.match(rxActionValue);
33
34      // action on multiple modules
35      if (!mvalues) {
36        var checked = false;
37
38        // check if there is checkboxes in form
39        if (checkboxes.length > 0) {
40          // check if there is at least one checkbox checked
41          $(checkboxes).each(function() {
42            if (this.checked) {
43              checked = true;
44            }
45          });
46          if (!checked) {
47            //alert(dotclear.msg.no_selection);
48            return false;
49          }
50        }
51
52        // confirm delete
53        if (action == 'delete') {
54          return window.confirm(dotclear.msg.confirm_delete_plugins);
55        }
56
57        // action on one module
58      } else {
59        var module = mvalues[1];
60
61        // confirm delete
62        if (action == 'delete') {
63          return window.confirm(dotclear.msg.confirm_delete_plugin.replace('%s', module));
64        }
65      }
66
67      return true;
68    });
69  });
70});
Note: See TracBrowser for help on using the repository browser.

Sites map