Commit 0c945082 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: use more domsugar API instead of appendChild from DOM API

parent ffdc1a45
Pipeline #17121 failed with stage
in 0 seconds
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_form_content_provider.html"> <link rel="http://www.renderjs.org/rel/interface" href="interface_erp5_form_content_provider.html">
<!-- renderjs --> <!-- renderjs -->
<script src="domsugar.js" type="text/javascript"></script>
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script> <script src="jiodev.js" type="text/javascript"></script>
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>george</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>986.65426.46809.56012</string> </value> <value> <string>993.55171.44758.6877</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1601544175.96</float> <float>1628545474.29</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, document, rJS, URI, RSVP, isEmpty, console*/ /*global window, document, rJS, URI, RSVP, isEmpty, console, domsugar*/
(function (window, document, rJS, URI, RSVP, isEmpty, console) { (function (window, document, rJS, URI, RSVP, isEmpty, console, domsugar) {
"use strict"; "use strict";
var variable = {}, var variable = {},
...@@ -85,102 +85,118 @@ ...@@ -85,102 +85,118 @@
{{/each}} {{/each}}
</tbody> </tbody>
*/ */
var tbody_element = document.createElement('tbody'), var i,
i,
j, j,
row, row,
cell, cell,
tr_element, element_data,
td_element,
sub_element, sub_element,
a_element; a_element,
sub_element_list,
td_element_list,
tr_element_list = [];
for (i = 0; i < options.row_list.length; i += 1) { for (i = 0; i < options.row_list.length; i += 1) {
tr_element = document.createElement('tr'); td_element_list = [];
row = options.row_list[i]; row = options.row_list[i];
if (options.show_anchor) { if (options.show_anchor) {
td_element = document.createElement('td'); td_element_list.push(domsugar('td', [
sub_element = document.createElement('a'); domsugar('a', {
sub_element.setAttribute('class', 'ui-icon-carat-r ui-btn-icon-notext'); "class": 'ui-icon-carat-r ui-btn-icon-notext',
sub_element.href = row.jump; "href": row.jump,
sub_element.textContent = ' '; "text": ' '
td_element.appendChild(sub_element); })
tr_element.appendChild(td_element); ]));
} }
for (j = 0; j < row.cell_list.length; j += 1) { for (j = 0; j < row.cell_list.length; j += 1) {
cell = row.cell_list[j]; cell = row.cell_list[j];
td_element = document.createElement('td'); sub_element_list = [];
if (options.show_line_selector || (options.form_id === 'form_dialog' && options.show_select)) { if (options.show_line_selector || (options.form_id === 'form_dialog' && options.show_select)) {
if (j === 0) { if (j === 0) {
// If first cell, show a checkbox to select the line element_data = {
sub_element = document.createElement('input'); "data-uid": row.uid,
sub_element.setAttribute('data-uid', row.uid); "type": "checkbox",
sub_element.setAttribute('type', 'checkbox'); "class": "hide_element",
sub_element.setAttribute('class', 'hide_element'); "id": 'listbox_line_' + row.uid
sub_element.setAttribute('id', 'listbox_line_' + row.uid); };
if (row.checked) { if (row.checked) {
sub_element.setAttribute('checked', 'checked'); element_data.checked = 'checked';
} }
td_element.appendChild(sub_element);
// If first cell, show a checkbox to select the line
sub_element_list.push(domsugar('input', element_data));
} }
element_data = {
"for": 'listbox_line_' + row.uid
};
// Create a label, to update the checkbox when clicking the text // Create a label, to update the checkbox when clicking the text
sub_element = document.createElement('label');
sub_element.setAttribute('for', 'listbox_line_' + row.uid);
if (cell.type) { if (cell.type) {
sub_element.setAttribute('class', 'editable_div'); element_data["class"] = 'editable_div';
sub_element.setAttribute('data-column', cell.column); element_data['data-column'] = cell.column;
sub_element.setAttribute('data-line', cell.line); element_data['data-line'] = cell.line;
} else { } else {
sub_element.textContent = cell.default; element_data.text = cell["default"];
} }
td_element.appendChild(sub_element); sub_element_list.push(
domsugar('label', element_data)
);
} else { } else {
if (cell.type) { if (cell.type) {
sub_element = document.createElement('div'); sub_element = domsugar('div', {
sub_element.setAttribute('class', 'editable_div'); 'class': 'editable_div',
sub_element.setAttribute('data-column', cell.column); 'data-column': cell.column,
sub_element.setAttribute('data-line', cell.line); 'data-line': cell.line
});
if (cell.editable || !cell.href) { if (cell.editable || !cell.href) {
td_element.appendChild(sub_element); sub_element_list.push(sub_element);
} else { } else {
a_element = document.createElement('a'); a_element = domsugar('a', {
a_element.href = cell.href; "href": cell.href
a_element.appendChild(sub_element); }, [sub_element]);
td_element.appendChild(a_element); sub_element_list.push(a_element);
} }
} else { } else {
if (cell.href) { if (cell.href) {
sub_element = document.createElement('a'); sub_element = domsugar('a', {
sub_element.href = cell.href; "href": cell.href,
"text": cell["default"]
});
} else { } else {
sub_element = document.createElement('p'); sub_element = domsugar('p', {
"text": cell["default"]
});
} }
sub_element.textContent = cell.default; sub_element_list.push(sub_element);
td_element.appendChild(sub_element);
} }
} }
td_element_list.push(
tr_element.appendChild(td_element); domsugar('td', sub_element_list)
);
} }
if (row.line_icon) { if (row.line_icon) {
td_element = document.createElement('td'); td_element_list.push(
sub_element = document.createElement('a'); domsugar('td', [
sub_element.setAttribute('class', 'ui-btn-icon-right ui-icon-sign-in'); domsugar('a', {
sub_element.href = row.jump; 'class': 'ui-btn-icon-right ui-icon-sign-in',
td_element.appendChild(sub_element); 'href': row.jump
tr_element.appendChild(td_element); })
])
);
} }
tbody_element.appendChild(tr_element); tr_element_list.push(
domsugar('tr', td_element_list)
);
} }
return tbody_element; return domsugar('tbody', tr_element_list);
} }
function listbox_tfoot_template(options) { function listbox_tfoot_template(options) {
...@@ -212,43 +228,55 @@ ...@@ -212,43 +228,55 @@
{{/each}} {{/each}}
</tfoot> </tfoot>
*/ */
var tfoot_element = document.createElement('tfoot'), var i,
i,
j, j,
row, row,
cell, cell,
tr_element, sub_element_list,
td_element, tfoot_element_list = [],
div_element; div_element,
td_element_list,
td_data;
for (i = 0; i < options.row_list.length; i += 1) { for (i = 0; i < options.row_list.length; i += 1) {
tr_element = document.createElement('tr'); td_element_list = [];
if (options.show_anchor) { if (options.show_anchor) {
td_element = document.createElement('td'); td_element_list.push(
td_element.textContent = 'Total'; domsugar('td', {
tr_element.appendChild(td_element); "text": 'Total'
})
);
} }
row = options.row_list[i]; row = options.row_list[i];
for (j = 0; j < row.cell_list.length; j += 1) { for (j = 0; j < row.cell_list.length; j += 1) {
sub_element_list = [];
td_data = {};
cell = row.cell_list[j]; cell = row.cell_list[j];
td_element = document.createElement('td');
if (cell.type) { if (cell.type) {
div_element = document.createElement('div'); div_element = domsugar('div', {
div_element.setAttribute('class', 'editable_div'); 'class': 'editable_div',
div_element.setAttribute('data-column', cell.column); 'data-column': cell.column,
div_element.setAttribute('data-line', cell.line); 'data-line': cell.line
td_element.appendChild(div_element); });
sub_element_list.push(div_element);
} else { } else {
if (cell.default) { if (cell["default"]) {
td_element.textContent = cell.default; td_data.text = cell["default"];
} else if ((!options.show_anchor) && (j === 0)) { } else if ((!options.show_anchor) && (j === 0)) {
td_element.textContent = 'Total'; td_data.text = 'Total';
} }
} }
tr_element.appendChild(td_element); td_element_list.push(
domsugar('td', td_data, sub_element_list)
);
} }
tfoot_element.appendChild(tr_element); tfoot_element_list.push(
domsugar('tr', td_element_list)
);
} }
return tfoot_element; return domsugar('tfoot', tfoot_element_list);
} }
function renderSubField(gadget, element, sub_field_json) { function renderSubField(gadget, element, sub_field_json) {
...@@ -582,30 +610,20 @@ ...@@ -582,30 +610,20 @@
</a> </a>
</div> </div>
*/ */
var container = gadget.element.querySelector(".document_table"), return domsugar(gadget.element.querySelector(".document_table"), [
div_element = document.createElement('div'), domsugar('div', [
a_element = document.createElement('a'), domsugar('a', {
span_element; "href": result_list[0]
a_element.href = result_list[0]; }, [
domsugar('span', {
span_element = document.createElement('span'); 'class': 'ui-info-error',
span_element.setAttribute('class', 'ui-info-error'); 'text': result_list[1][0]
span_element.textContent = result_list[1][0]; }),
a_element.appendChild(span_element); domsugar('span', {"text": '-'}),
domsugar('span', {"text": result_list[1][1]})
span_element = document.createElement('span'); ])
span_element.textContent = '-'; ])
a_element.appendChild(span_element); ]);
span_element = document.createElement('span');
span_element.textContent = result_list[1][1];
a_element.appendChild(span_element);
div_element.appendChild(a_element);
while (container.firstChild) {
container.removeChild(container.firstChild);
}
container.appendChild(div_element);
}); });
} }
...@@ -707,139 +725,142 @@ ...@@ -707,139 +725,142 @@
url_for_index = 0, url_for_index = 0,
column, column,
current_sort, current_sort,
fragment = document.createDocumentFragment(), div_element_list = [
div_element = document.createElement('div'), domsugar('h1', {
table_element = document.createElement('table'),
button_element,
h1_element = document.createElement('h1'),
span_element = document.createElement('span'),
tr_element,
th_element,
a_element;
div_element.setAttribute('class', 'ui-table-header ui-header');
// For an unknown reason, the title used to be translated previously, // For an unknown reason, the title used to be translated previously,
// which is unexpected, as the value can't be hardcoded in the gadget // which is unexpected, as the value can't be hardcoded in the gadget
// <h1>{{title}} <span class="listboxloader ui-icon-spinner ui-btn-icon-left"></span></h1> // <h1>{{title}} <span class="listboxloader ui-icon-spinner ui-btn-icon-left"></span></h1>
h1_element.textContent = gadget.state.title + ' '; "text": gadget.state.title + ' '
span_element.setAttribute('class', 'listboxloader ui-icon-spinner ui-btn-icon-left'); }, [
h1_element.appendChild(span_element); domsugar('span', {
div_element.appendChild(h1_element); "class": 'listboxloader ui-icon-spinner ui-btn-icon-left'
})
])
],
table_element = domsugar('table', [
domsugar("thead", {"class": "thead"}, [
domsugar("tr")
]),
domsugar("tbody"),
domsugar("tfoot")
]),
th_element_list = [],
tr_element,
th_element;
if (gadget.state.show_select_action) { if (gadget.state.show_select_action) {
for (k = 0; k < select_option_list.length; k += 1) { for (k = 0; k < select_option_list.length; k += 1) {
// Add include button // Add include button
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button> // <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.setAttribute('data-rel', 'hide'); 'data-rel': 'hide',
button_element.setAttribute('data-select-action', select_option_list[k].action); 'data-select-action': select_option_list[k].action,
button_element.setAttribute('name', 'SelectAction'); 'name': 'SelectAction',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-' + select_option_list[k].icon + ' ui-btn-icon-left'); 'class': 'ui-icon-' + select_option_list[k].icon + ' ui-btn-icon-left',
button_element.textContent = select_option_list[k].title; 'text': select_option_list[k].title
div_element.appendChild(button_element); }));
} }
// Add cancel button // Add cancel button
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button> // <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.setAttribute('data-rel', 'hide'); 'data-rel': 'hide',
button_element.setAttribute('name', 'CancelSelect'); 'name': 'CancelSelect',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-times ui-btn-icon-left'); 'class': 'ui-icon-times ui-btn-icon-left',
button_element.textContent = translation_list[4]; 'text': translation_list[4]
div_element.appendChild(button_element); }));
} else if (gadget.state.show_clipboard_action) { } else if (gadget.state.show_clipboard_action) {
for (k = 0; k < select_option_list.length; k += 1) { for (k = 0; k < select_option_list.length; k += 1) {
// Add include button // Add include button
// <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button> // <button data-rel="hide" data-i18n="Include" name="IncludeRows" type="button" class="ui-icon-eye ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.setAttribute('data-rel', 'clipboard'); 'data-rel': 'clipboard',
button_element.setAttribute('data-clipboard-action', select_option_list[k].action); 'data-clipboard-action': select_option_list[k].action,
button_element.setAttribute('name', 'ClipboardAction'); 'name': 'ClipboardAction',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-' + select_option_list[k].icon + ' ui-btn-icon-left'); 'class': 'ui-icon-' + select_option_list[k].icon + ' ui-btn-icon-left',
button_element.textContent = select_option_list[k].title; 'text': select_option_list[k].title
div_element.appendChild(button_element); }));
} }
// Add cancel button // Add cancel button
// <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button> // <button data-rel="cancel" data-i18n="Cancel" name="ExcludeRows" type="button" class="ui-icon-times ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.setAttribute('data-rel', 'hide'); 'data-rel': 'hide',
button_element.setAttribute('name', 'CancelSelect'); 'name': 'CancelSelect',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-times ui-btn-icon-left'); 'class': 'ui-icon-times ui-btn-icon-left',
button_element.textContent = translation_list[4]; 'text': translation_list[4]
div_element.appendChild(button_element); }));
} else { } else {
// Add Configure button // Add Configure button
// <button {{disabled}} data-rel="configure_columns" data-i18n="Configure" name="Configure" type="button" class="ui-icon-wrench ui-btn-icon-left {{configure_class}}"></button> // <button {{disabled}} data-rel="configure_columns" data-i18n="Configure" name="Configure" type="button" class="ui-icon-wrench ui-btn-icon-left {{configure_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.disabled = gadget.state.disabled; 'disabled': gadget.state.disabled,
button_element.setAttribute('data-rel', 'configure_columns'); 'data-rel': 'configure_columns',
button_element.setAttribute('name', 'Configure'); 'name': 'Configure',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-wrench ui-btn-icon-left ' + gadget.state.configure_class); 'class': 'ui-icon-wrench ui-btn-icon-left ' + gadget.state.configure_class,
button_element.textContent = translation_list[2]; 'text': translation_list[2]
div_element.appendChild(button_element); }));
// Add Sort button // Add Sort button
// <button {{disabled}} data-rel="Sort" data-i18n="Sort" name="Sort" type="button" class="ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}"></button> // <button {{disabled}} data-rel="Sort" data-i18n="Sort" name="Sort" type="button" class="ui-icon-sort-amount-desc ui-btn-icon-left {{sort_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.disabled = gadget.state.disabled; 'disabled': gadget.state.disabled,
button_element.setAttribute('data-rel', 'Sort'); 'data-rel': 'Sort',
button_element.setAttribute('name', 'Sort'); 'name': 'Sort',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-sort-amount-desc ui-btn-icon-left ' + gadget.state.sort_class); 'class': 'ui-icon-sort-amount-desc ui-btn-icon-left ' + gadget.state.sort_class,
button_element.textContent = translation_list[3]; 'text': translation_list[3]
div_element.appendChild(button_element); }));
// Add Do button // Add Do button
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button> // <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.setAttribute('data-rel', 'clipboard'); 'disabled': gadget.state.disabled,
button_element.setAttribute('name', 'Clipboard'); 'data-rel': 'clipboard',
button_element.type = 'button'; 'name': 'Clipboard',
button_element.setAttribute('class', 'ui-icon-list-ul ui-btn-icon-left '); 'type': 'button',
button_element.textContent = translation_list[5]; 'class': 'ui-icon-list-ul ui-btn-icon-left ',
div_element.appendChild(button_element); 'text': translation_list[5]
}));
// Add Select button // Add Select button
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button> // <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
button_element = document.createElement('button'); div_element_list.push(domsugar('button', {
button_element.disabled = gadget.state.disabled; 'disabled': gadget.state.disabled,
button_element.setAttribute('data-rel', 'hide'); 'data-rel': 'hide',
button_element.setAttribute('name', 'Hide'); 'name': 'Hide',
button_element.type = 'button'; 'type': 'button',
button_element.setAttribute('class', 'ui-icon-check-square-o ui-btn-icon-left ' + gadget.state.hide_class); 'class': 'ui-icon-check-square-o ui-btn-icon-left ' + gadget.state.hide_class,
button_element.textContent = translation_list[1]; 'text': translation_list[1]
div_element.appendChild(button_element); }));
} }
fragment.appendChild(div_element);
table_element.innerHTML = '<thead class="thead"><tr></tr></thead><tbody></tbody><tfoot></tfoot>';
tr_element = table_element.querySelector('tr');
if (gadget.state.show_anchor) { if (gadget.state.show_anchor) {
th_element = document.createElement('th'); th_element_list.push(
th_element.textContent = translation_list[0]; domsugar('th', {
tr_element.appendChild(th_element); "text": translation_list[0]
})
);
} }
for (k = 0; k < column_list.length; k += 1) { for (k = 0; k < column_list.length; k += 1) {
column = column_list[k]; column = column_list[k];
th_element = document.createElement('th'); th_element = domsugar('th');
current_sort = sort_list.find(hasSameFirstItem(column)); current_sort = sort_list.find(hasSameFirstItem(column));
if (current_sort !== undefined) { if (current_sort !== undefined) {
if (current_sort[1] === 'ascending') { if (current_sort[1] === 'ascending') {
th_element.setAttribute('class', "ui-icon ui-icon-sort-amount-asc"); th_element.classList.add("ui-icon", "ui-icon-sort-amount-asc");
} else if (current_sort[1] === 'descending') { } else if (current_sort[1] === 'descending') {
th_element.setAttribute('class', "ui-icon ui-icon-sort-amount-desc"); th_element.classList.add("ui-icon", "ui-icon-sort-amount-desc");
} }
} }
...@@ -850,33 +871,34 @@ ...@@ -850,33 +871,34 @@
if (is_sortable_list[k]) { if (is_sortable_list[k]) {
// <th class="{{class_value}}"><a href="{{sort_link}}">{{text}}</a></th> // <th class="{{class_value}}"><a href="{{sort_link}}">{{text}}</a></th>
a_element = document.createElement('a'); domsugar(th_element, [
a_element.textContent = column[1]; domsugar('a', {
a_element.href = url_for_list[url_for_index]; "text": column[1],
th_element.appendChild(a_element); "href": url_for_list[url_for_index]
})
]);
url_for_index += 1; url_for_index += 1;
} else { } else {
// <th class="{{class_value}}">{{text}}</th> // <th class="{{class_value}}">{{text}}</th>
th_element.textContent = column[1]; th_element.textContent = column[1];
} }
} }
th_element_list.push(th_element);
tr_element.appendChild(th_element);
} }
if (gadget.state.line_icon) { if (gadget.state.line_icon) {
th_element = document.createElement('th'); th_element_list.push(domsugar('th'));
tr_element.appendChild(th_element);
} }
fragment.appendChild(table_element); domsugar(table_element.querySelector('tr'), th_element_list);
fragment.appendChild(document.createElement('nav'));
while (container.firstChild) { domsugar(container, [
container.removeChild(container.firstChild); domsugar('div', {
} "class": 'ui-table-header ui-header'
container.appendChild(fragment); }, div_element_list),
table_element,
domsugar('nav')
]);
}); });
} }
...@@ -1046,8 +1068,6 @@ ...@@ -1046,8 +1068,6 @@
next_url = url_list[1], next_url = url_list[1],
previous_classname = "ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child", previous_classname = "ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child",
next_classname = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child", next_classname = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child",
fragment = document.createDocumentFragment(),
sub_element,
nav_element = gadget.element.querySelector('nav'), nav_element = gadget.element.querySelector('nav'),
from_index; from_index;
...@@ -1080,27 +1100,22 @@ ...@@ -1080,27 +1100,22 @@
// <a class="{{previous_classname}}" data-i18n="Previous" href="{{previous_url}}">Previous</a> // <a class="{{previous_classname}}" data-i18n="Previous" href="{{previous_url}}">Previous</a>
// <a class="{{next_classname}}" data-i18n="Next" href="{{next_url}}">Next</a> // <a class="{{next_classname}}" data-i18n="Next" href="{{next_url}}">Next</a>
// <span class="ui-disabled">{{record}}</span> // <span class="ui-disabled">{{record}}</span>
sub_element = document.createElement('a'); domsugar(nav_element, [
sub_element.setAttribute('class', previous_classname); domsugar('a', {
sub_element.href = previous_url; 'class': previous_classname,
sub_element.textContent = result_list[0][1]; 'href': previous_url,
fragment.appendChild(sub_element); 'text': result_list[0][1]
}),
sub_element = document.createElement('a'); domsugar('a', {
sub_element.setAttribute('class', next_classname); 'class': next_classname,
sub_element.href = next_url; 'href': next_url,
sub_element.textContent = result_list[0][2]; 'text': result_list[0][2]
fragment.appendChild(sub_element); }),
domsugar('span', {
sub_element = document.createElement('span'); 'class': 'ui-disabled',
sub_element.setAttribute('class', 'ui-disabled'); 'text': record
sub_element.textContent = record; })
fragment.appendChild(sub_element); ]);
while (nav_element.firstChild) {
nav_element.removeChild(nav_element.firstChild);
}
nav_element.appendChild(fragment);
}) })
.push(function () { .push(function () {
var result_sum = (allDocs_result.sum || {}).rows || [], // render summary footer if available var result_sum = (allDocs_result.sum || {}).rows || [], // render summary footer if available
...@@ -1424,4 +1439,4 @@ ...@@ -1424,4 +1439,4 @@
return; return;
}); });
}(window, document, rJS, URI, RSVP, isEmpty, console)); }(window, document, rJS, URI, RSVP, isEmpty, console, domsugar));
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.17151.25214.12134</string> </value> <value> <string>994.13949.44825.36573</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1614290750.17</float> <float>1629394496.1</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment