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

RevLine 
[3706]1/*global $, dotclear */
2'use strict';
[2566]3
[3878]4dotclear.viewPostContent = function(line, action, e) {
[3706]5  action = action || 'toggle';
[3878]6  if ($(line).attr('id') == undefined) {
7    return;
8  }
9
[3880]10  const postId = $(line).attr('id').substr(1);
11  const lineId = `pe${postId}`;
12  let tr = document.getElementById(lineId);
[2566]13
[3878]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');
[3880]20        tr.id = lineId;
21        const td = document.createElement('td');
[3878]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);
[3706]28      } else {
[3878]29        $(line).toggleClass('expand');
[3706]30      }
[3878]31    }, {
32      clean: (e.metaKey)
[3706]33    });
[3878]34  } else {
35    $(tr).toggle();
36    $(line).toggleClass('expand');
[3706]37  }
[0]38};
39
40$(function() {
[3706]41  // Entry type switcher
42  $('#type').change(function() {
43    this.form.submit();
44  });
[995]45
[3706]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();
[4007]57  dotclear.responsiveCellHeaders(document.querySelector('#form-entries table'), '#form-entries table', 1);
[2525]58});
Note: See TracBrowser for help on using the repository browser.

Sites map