Dotclear

source: admin/js/_posts_list.js @ 4007:d08f9c5e38db

Revision 4007:d08f9c5e38db, 1.7 KB checked in by franck <carnet.franck.paul@…>, 6 years ago (diff)

Responsive tables (not yet applied for plugins), thanks Adrian Roselli for code (js/css)  http://adrianroselli.com/2018/02/tables-css-display-properties-and-aria.html

Line 
1/*global $, dotclear */
2'use strict';
3
4dotclear.viewPostContent = function(line, action, e) {
5  action = action || 'toggle';
6  if ($(line).attr('id') == undefined) {
7    return;
8  }
9
10  const postId = $(line).attr('id').substr(1);
11  const lineId = `pe${postId}`;
12  let tr = document.getElementById(lineId);
13
14  if (!tr) {
15    // Get post content if possible
16    dotclear.getEntryContent(postId, function(content) {
17      if (content) {
18        // Content found
19        tr = document.createElement('tr');
20        tr.id = lineId;
21        const td = document.createElement('td');
22        td.colSpan = $(line).children('td').length;
23        td.className = 'expand';
24        tr.appendChild(td);
25        $(td).append(content);
26        $(line).addClass('expand');
27        line.parentNode.insertBefore(tr, line.nextSibling);
28      } else {
29        $(line).toggleClass('expand');
30      }
31    }, {
32      clean: (e.metaKey)
33    });
34  } else {
35    $(tr).toggle();
36    $(line).toggleClass('expand');
37  }
38};
39
40$(function() {
41  // Entry type switcher
42  $('#type').change(function() {
43    this.form.submit();
44  });
45
46  $.expandContent({
47    line: $('#form-entries tr:not(.line)'),
48    lines: $('#form-entries tr.line'),
49    callback: dotclear.viewPostContent
50  });
51  $('.checkboxes-helpers').each(function() {
52    dotclear.checkboxesHelpers(this, undefined, '#form-entries td input[type=checkbox]', '#form-entries #do-action');
53  });
54  $('#form-entries td input[type=checkbox]').enableShiftClick();
55  dotclear.condSubmit('#form-entries td input[type=checkbox]', '#form-entries #do-action');
56  dotclear.postsActionsHelper();
57  dotclear.responsiveCellHeaders(document.querySelector('#form-entries table'), '#form-entries table', 1);
58});
Note: See TracBrowser for help on using the repository browser.

Sites map