summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-example/htdocs/luci-static/resources/view/example/htmlview.js
blob: feae899a1729e85f7a459a5df9e16b2813cfa6ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
'require uci';
'require view';

return view.extend({
  handleSaveApply: null,
  handleSave: null,
  handleReset: null,
  load: function() {
    return Promise.all([
      uci.load('example')
    ]);
  },
  render: function(data) {
    var body = E([
      E('h2', _('Example HTML Page'))
    ]);
    var sections = uci.sections('example');
    var listContainer = E('div');
    var list = E('ul');
    list.appendChild(E('li', { 'class': 'css-class' }, ['First Option in first section: ', E('em', {}, [sections[0].first_option])]));
    list.appendChild(E('li', { 'class': 'css-class' }, ['Flag in second section: ', E('em', {}, [sections[1].flag])]));
    list.appendChild(E('li', { 'class': 'css-class' }, ['Select in second section: ', E('em', {}, [sections[1].select])]));
    listContainer.appendChild(list);
    body.appendChild(listContainer);
    console.log(sections);
    return body;
  }
  });