luci2: adapt views to changed luci2 framework
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 4 Nov 2013 15:17:15 +0000 (15:17 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 4 Nov 2013 15:17:15 +0000 (15:17 +0000)
15 files changed:
luci2/htdocs/luci2/template/network.diagnostics.htm
luci2/htdocs/luci2/template/status.dmesg.htm
luci2/htdocs/luci2/template/status.syslog.htm
luci2/htdocs/luci2/template/system.software.htm
luci2/htdocs/luci2/template/system.startup.htm
luci2/htdocs/luci2/template/system.upgrade.htm
luci2/htdocs/luci2/view/network.routes.js
luci2/htdocs/luci2/view/network.switch.js
luci2/htdocs/luci2/view/status.processes.js
luci2/htdocs/luci2/view/system.admin.js
luci2/htdocs/luci2/view/system.leds.js
luci2/htdocs/luci2/view/system.software.js
luci2/htdocs/luci2/view/system.startup.js
luci2/htdocs/luci2/view/system.upgrade.js
luci2/htdocs/luci2/view/system.users.js

index 4c82c7f186874799f14facfcd513694098668e4f..a04e5a9d3930539a106b0bbcad9b018967b5cf58 100644 (file)
@@ -3,13 +3,15 @@
        <table style="width:auto">
                <tr>
                        <td>
-                               <select id="tool"></select>
+                               <input type="text" id="host" value="openwrt.org" class="form-control" />
                        </td>
                        <td>
-                               <input type="text" id="host" value="openwrt.org" />
-                       </td>
-                       <td>
-                               <input type="button" class="cbi-button cbi-button-apply" id="run" value="<%:Test%>" />
+                               <div class="input-group">
+                                       <select id="tool" class="form-control"></select>
+                                       <div class="input-group-btn">
+                                               <button type="button" class="btn btn-primary" id="run"><%:Test%></button>
+                                       </div>
+                               </div>
                        </td>
                </tr>
        </table>
index 592b1f0b611641e85b277ae09c8db9514d94dfd4..ae05d0303b3f0e2475d9e0a98c7443b6e2ba4e9e 100644 (file)
@@ -1 +1 @@
-<textarea readonly="readonly" wrap="off" id="syslog"><%:Collecting data...%></textarea>
+<textarea readonly="readonly" wrap="off" id="syslog" class="form-control"><%:Collecting data...%></textarea>
index 592b1f0b611641e85b277ae09c8db9514d94dfd4..ae05d0303b3f0e2475d9e0a98c7443b6e2ba4e9e 100644 (file)
@@ -1 +1 @@
-<textarea readonly="readonly" wrap="off" id="syslog"><%:Collecting data...%></textarea>
+<textarea readonly="readonly" wrap="off" id="syslog" class="form-control"><%:Collecting data...%></textarea>
index f34e2c4f4d81011683c0d261cef6a0c31f8bc7b6..5e27a9318b6f77091abe8abe7fca50631056a0e8 100644 (file)
@@ -1,52 +1,71 @@
-<div class="cbi-form" id="tabs" style="display:none">
-       <ul class="cbi-tabmenu">
-               <li><a href="#status"><%:Packages%></a></li>
-               <li><a href="#config"><%:Configuration%></a></li>
-       </ul>
-       <fieldset id="status" class="cbi-section-node">
-               <div class="cbi-value">
-                       <label class="cbi-value-title"><%:Used space%></label>
-                       <div class="cbi-value-field">
-                               <div id="package_space" style="padding-top: 7px"></div>
+<ul class="nav nav-tabs">
+       <li class="active"><a href="#status" data-toggle="tab"><%:Packages%></a></li>
+       <li><a href="#config" data-toggle="tab"><%:Configuration%></a></li>
+</ul>
+
+<div class="tab-content">
+       <div class="tab-pane active" id="status">
+               <div class="form-horizontal">
+                       <div class="form-group">
+                               <label class="col-lg-2 control-label"><%:Used space%></label>
+                               <div class="col-lg-5">
+                                       <div id="package_space" class="form-control-static"></div>
+                               </div>
+                               <div class="col-lg-5"></div>
                        </div>
-               </div>
-               <div class="cbi-value">
-                       <label class="cbi-value-title"><%:Update package lists%></label>
-                       <div class="cbi-value-field">
-                               <input id="package_update" type="button" class="cbi-button cbi-button-reload" value="<%:Start update …%>" />
+                       <div class="form-group">
+                               <label class="col-lg-2 control-label"><%:Update package lists%></label>
+                               <div class="col-lg-5">
+                                       <button id="package_update" type="button" class="btn btn-default"><%:Start update …%></button>
+                               </div>
+                               <div class="col-lg-5"></div>
                        </div>
-               </div>
-               <div class="cbi-value">
-                       <label class="cbi-value-title"><%:Install package directly%></label>
-                       <div class="cbi-value-field">
-                               <div class="cbi-splitbutton">
-                                       <input id="package_url" type="text" class="cbi-input-text" placeholder="<%:Enter URL or name …%>"
-                                       /><img id="package_install" src="<%=resource%>/icons/cbi/apply.gif" class="cbi-button" title="<%:Install …%>" />
+                       <div class="form-group">
+                               <label class="col-lg-2 control-label"><%:Install package directly%></label>
+                               <div class="col-lg-5">
+                                       <div class="input-group">
+                                               <input id="package_url" type="text" class="form-control" placeholder="<%:Enter URL or name …%>" />
+                                               <span class="input-group-btn">
+                                                       <button id="package_install" type="button" class="btn btn-info">»</button>
+                                               </span>
+                                       </div>
                                </div>
+                               <div class="col-lg-5"></div>
                        </div>
-               </div>
-               <div class="cbi-value">
-                       <label class="cbi-value-title"><%:Filter packages%></label>
-                       <div class="cbi-value-field">
-                               <div class="cbi-splitbutton">
-                                       <input id="package_filter" type="text" class="cbi-input-text" placeholder="<%:Filter packages …%>"
-                                       /><img src="<%=resource%>/icons/cbi/find.gif" class="cbi-button" />
+                       <div class="form-group">
+                               <label class="col-lg-2 control-label"><%:Filter packages%></label>
+                               <div class="col-lg-5">
+                                       <div class="input-group">
+                                               <input id="package_filter" type="text" class="form-control" placeholder="<%:Filter packages …%>" />
+                                               <span class="input-group-btn">
+                                                       <button" type="button" class="btn btn-default">×</button>
+                                               </span>
+                                       </div>
+                                       <label><input type="checkbox" id="package_which" style="vertical-align: middle; margin-top: 0" /> <%:Display only installed packages%></label>
                                </div>
-                               <label><input type="checkbox" id="package_which" style="vertical-align: middle; margin-top: 0" /> <%:Display only installed packages%></label>
+                               <div class="col-lg-5"></div>
                        </div>
                </div>
 
-               <div>
-                       <input id="package_prev" type="button" class="cbi-button" value="« 0 - 0" />
-                       <input id="package_next" type="button" class="cbi-button" value="0 - 0 »" />
+               <div class="panel panel-default">
+                       <div class="panel-heading">
+                               <div class="btn-group">
+                                       <button id="package_prev" type="button" class="btn btn-default">« 0 - 0</button>
+                                       <button id="package_next" type="button" class="btn btn-default">0 - 0 »</button>
+                               </div>
+                       </div>
+
+                       <div class="panel-body" id="package_table"></div>
                </div>
+       </div>
 
-               <div id="package_table"></div>
-       </fieldset>
-       <div id="config">
-               <textarea style="width:100%"></textarea>
-               <div class="cbi-page-actions">
-                       <input class="cbi-button cbi-button-save" type="button" value="<%:Save%>" />
+       <div class="tab-pane" id="config">
+               <div class="panel panel-default">
+                       <textarea class="form-control"></textarea>
+               </div>
+               <div class="text-right">
+                       <button class="btn btn-primary" type="button"><%:Save%></button>
                </div>
        </div>
+
 </div>
index 6edf2901b8116939b30d4ffb92cf2aa65d511454..0d7ca804f5c5436105a8e6a66de38b1bf5afa566 100644 (file)
@@ -1,18 +1,21 @@
-<fieldset class="cbi-map" id="maps">
-       <div>
-               <legend><%:Local Startup%></legend>
-               <div class="cbi-map-descr"><%:This is the content of /etc/rc.local. Insert your own commands here (in front of 'exit 0') to execute them at the end of the boot process.%></div>
-       </div>
-       <div>
-               <textarea id="rc_local" class="cbi-input-textarea" style="width:100%" rows="10"></textarea>
-               <div class="cbi-page-actions">
-                       <input class="cbi-button cbi-button-save" type="button" value="<%:Save%>" />
+<ul class="nav nav-tabs">
+       <li class="active"><a href="#rclocal" data-toggle="tab"><%:Local Startup%></a></li>
+       <li><a href="#initscripts" data-toggle="tab"><%:Initscripts%></a></li>
+</ul>
+
+<div class="tab-content">
+       <div class="tab-pane active" id="rclocal">
+               <p><%:This is the content of /etc/rc.local. Insert your own commands here (in front of 'exit 0') to execute them at the end of the boot process.%></p>
+               <div class="panel panel-default">
+                       <textarea id="rc_local" class="form-control" style="width:100%" rows="10"></textarea>
+               </div>
+               <div class="text-right">
+                       <button type="button" class="btn btn-primary"><%:Save%></button>
                </div>
        </div>
 
-       <div>
-               <legend><%:Initscripts%></legend>
-               <div class="cbi-map-descr"><%:You can enable or disable installed init scripts here. Changes will applied after a device reboot. Warning: If you disable essential init scripts like "network", your device might become inaccessible!%></div>
+       <div class="tab-pane" id="initscripts">
+               <p><%:You can enable or disable installed init scripts here. Changes will applied after a device reboot. Warning: If you disable essential init scripts like "network", your device might become inaccessible!%></p>
+               <div id="init_table"></div>
        </div>
-       <div id="init_table"></div>
-</fieldset>
+</div>
index 6541c22af249bf3c83fa1666bb9d729855268849..2dfe5b486fd0f5e8f7fb973cf9b6898ad3c5233b 100644 (file)
@@ -1,39 +1,53 @@
 <div class="cbi-form" id="tabs" style="display:none">
-       <ul class="cbi-tabmenu">
-               <li><a href="#actions"><%:Actions%></a></li>
-               <li><a href="#config"><%:Configuration%></a></li>
+       <ul class="nav nav-tabs">
+               <li class="active"><a data-toggle="tab" href="#actions"><%:Actions%></a></li>
+               <li><a data-toggle="tab" href="#config"><%:Configuration%></a></li>
        </ul>
 
-       <div id="actions">
-               <h3><%:Backup / Restore%></h3>
-               <p><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></p>
-               <p>
-                       <form action="/cgi-bin/luci-backup" method="post" style="display:inline">
-                               <input type="hidden" name="sessionid" />
-                               <input class="cbi-button cbi-button-apply" type="button" id="btn_backup" value="<%:Generate archive%>" />
-                       </form>
-                       <input class="cbi-button cbi-button-reset" type="button" id="btn_reset" value="<%:Perform reset%>" />
-               </p>
-               <br />
+       <div class="tab-content">
+               <div class="tab-pane active" id="actions">
+                       <div class="panel panel-default">
+                               <div class="panel-heading">
+                                       <h3 class="panel-title"><%:Backup / Restore%></h3>
+                               </div>
+                               <div class="panel-body">
+                                       <p><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></p>
+                                       <p>
+                                               <form action="/cgi-bin/luci-backup" method="post" style="display:inline">
+                                                       <input type="hidden" name="sessionid" />
+                                                       <input class="btn btn-primary" type="button" id="btn_backup" value="<%:Generate archive%>" />
+                                               </form>
+                                               <input class="btn btn-danger" type="button" id="btn_reset" value="<%:Perform reset%>" />
+                                       </p>
 
-               <p><%:To restore configuration files, you can upload a previously generated backup archive here.%></p>
-               <p>
-                       <input class="cbi-button cbi-input-apply" type="button" id="btn_restore" value="<%:Upload archive...%>" />
-               </p>
-               <br />
+                                       <p><%:To restore configuration files, you can upload a previously generated backup archive here.%></p>
+                                       <p>
+                                               <input class="btn btn-primary" type="button" id="btn_restore" value="<%:Upload archive...%>" />
+                                       </p>
+                               </div>
+                       </div>
 
-               <h3><%:Flash new firmware image%></h3>
-               <p><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires an OpenWrt compatible firmware image).%></p>
-               <p>
-                       <input class="cbi-button cbi-input-apply" type="button" id="btn_flash" value="<%:Flash image...%>" />
-               </p>
-       </div>
+                       <div class="panel panel-default">
+                               <div class="panel-heading">
+                                       <h3 class="panel-title"><%:Flash new firmware image%></h3>
+                               </div>
+                               <div class="panel-body">
+                                       <p><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires an OpenWrt compatible firmware image).%></p>
+                                       <p>
+                                               <input class="btn btn-primary" type="button" id="btn_flash" value="<%:Flash image...%>" />
+                                       </p>
+                               </div>
+                       </div>
+               </div>
 
-       <div id="config">
-               <textarea style="width:100%"></textarea>
-               <div class="cbi-page-actions">
-                       <input class="cbi-button cbi-button-save" type="button" id="btn_save" value="<%:Save%>" />
-                       <input class="cbi-button cbi-button-apply" type="button" id="btn_list" value="<%:Show current backup file list …%>" />
+               <div class="tab-pane" id="config">
+                       <div class="panel">
+                               <textarea class="form-control"></textarea>
+                       </div>
+                       <div class="pull-right">
+                               <input class="btn btn-primary" type="button" id="btn_save" value="<%:Save%>" />
+                               <input class="btn btn-default" type="button" id="btn_list" value="<%:Show current backup file list …%>" />
+                       </div>
                </div>
        </div>
 </div>
index 4c23a699d648a39b66bc040c98d019d9e4ca9930..a1ed560b59ab2a5a3062881952c91b0a079d3cb2 100644 (file)
@@ -13,6 +13,7 @@ L.ui.view.extend({
                 caption:     L.tr('Static IPv4 Routes'),
                 anonymous:   true,
                 addremove:   true,
+                sortable:    true,
                 add_caption: L.tr('Add new route'),
                 remove_caption: L.tr('Remove route')
             });
@@ -61,6 +62,7 @@ L.ui.view.extend({
                 caption:     L.tr('Static IPv6 Routes'),
                 anonymous:   true,
                 addremove:   true,
+                sortable:    true,
                 add_caption: L.tr('Add new route'),
                 remove_caption: L.tr('Remove route')
             });
index fa431340b84ec59ee060798b84ec69f71bbd65c0..bfe27c6b46fe4779db98de35427a3e089a8e8e51 100644 (file)
@@ -220,13 +220,13 @@ L.ui.view.extend({
                                                        used_vids[v] = true;
                                                }
 
-                                               v = parseInt(v, 10);
-
-                                               if (isNaN(v))
+                                               if (val.match(/[^0-9]/))
                                                        return L.tr('Invalid VLAN ID');
 
-                                               if (v < 1 || v > max_vid)
-                                                       return L.tr('VLAN ID must be value between %u and %u').format(1, max_vid);
+                                               val = parseInt(val, 10);
+
+                                               if (val < 1 || val > max_vid)
+                                                       return L.tr('VLAN ID must be a value between %u and %u').format(1, max_vid);
 
                                                return true;
                                        }
@@ -282,26 +282,26 @@ L.ui.view.extend({
                                }
                        }
 
-                       m.insertInto('#map');
-
-                       self.repeat(function() {
-                               return L.network.getSwitchStatus(swname).then(function(ports) {
-                                       for (var j = 0; j < ports.length; j++)
-                                       {
-                                               var s = L.tr('No link');
-                                               var d = '&#160;';
-
-                                               if (ports[j].link)
-                                               {
-                                                       s = '%dbaseT'.format(ports[j].speed);
-                                                       d = ports[j].full_duplex ? L.tr('Full-duplex') : L.tr('Half-duplex');
-                                               }
-
-                                               $('#portstatus-%s-%d'.format(swname, j))
-                                                       .empty().append(s + '<br />' + d);
-                                       }
-                               });
-                       }, 5000);
+                       return m.insertInto('#map').then(function() {
+                self.repeat(function() {
+                    return L.network.getSwitchStatus(swname).then(function(ports) {
+                        for (var j = 0; j < ports.length; j++)
+                        {
+                            var s = L.tr('No link');
+                            var d = '&#160;';
+
+                            if (ports[j].link)
+                            {
+                                s = '%dbaseT'.format(ports[j].speed);
+                                d = ports[j].full_duplex ? L.tr('Full-duplex') : L.tr('Half-duplex');
+                            }
+
+                            $('#portstatus-%s-%d'.format(swname, j))
+                                .empty().append(s + '<br />' + d);
+                        }
+                    });
+                }, 5000);
+            });
                });
        }
 });
index a30a09278bdc7b2d78fa732c298348e2abb374a3..9c80d89a0a2fa40f0f7626ff9595af9f68474a61 100644 (file)
@@ -25,32 +25,29 @@ L.ui.view.extend({
                 }, {
                     key:    'pid',
                     format: function(v, n) {
-                        return $('<button />')
-                            .attr('disabled', !allow_signals)
-                            .addClass('cbi-button')
-                            .addClass('cbi-button-reload')
-                            .text(L.tr('Hang Up'))
-                            .click(function() { L.system.sendSignal(v, 1).then(status) });
-                    }
-                }, {
-                    key:    'pid',
-                    format: function(v, n) {
-                        return $('<button />')
-                            .attr('disabled', !allow_signals)
-                            .addClass('cbi-button')
-                            .addClass('cbi-button-remove')
-                            .text(L.tr('Terminate'))
-                            .click(function() { L.system.sendSignal(v, 15).then(status) });
-                    }
-                }, {
-                    key:    'pid',
-                    format: function(v, n) {
-                        return $('<button />')
-                            .attr('disabled', !allow_signals)
-                            .addClass('cbi-button')
-                            .addClass('cbi-button-reset')
-                            .text(L.tr('Kill'))
-                            .click(function() { L.system.sendSignal(v, 9).then(status); });
+                        return $('<div />')
+                            .addClass('btn-group')
+                            .append($('<button />')
+                                .addClass('btn btn-primary btn-sm dropdown-toggle')
+                                .attr('data-toggle', 'dropdown')
+                                .text(L.tr('Signal…')))
+                            .append($('<ul />')
+                                .addClass('dropdown-menu pull-right')
+                                .append($('<li />')
+                                    .append($('<a />')
+                                        .attr('href', '#')
+                                        .html('%s (<code>%s</code>)'.format(L.trc('UNIX signal', 'Reload'), 'HUP'))
+                                        .click(function(ev) { L.system.sendSignal(v, 1).then(status); ev.preventDefault(); })))
+                                .append($('<li />')
+                                    .append($('<a />')
+                                        .attr('href', '#')
+                                        .html('%s (<code>%s</code>)'.format(L.trc('UNIX signal', 'Terminate'), 'TERM'))
+                                        .click(function(ev) { L.system.sendSignal(v, 15).then(status); ev.preventDefault(); })))
+                                .append($('<li />')
+                                    .append($('<a />')
+                                        .attr('href', '#')
+                                        .html('%s (<code>%s</code>)'.format(L.trc('UNIX signal', 'Kill immediately'), 'KILL'))
+                                        .click(function(ev) { L.system.sendSignal(v, 9).then(status); ev.preventDefault(); }))))
                     }
                 } ]
             });
index 55826882894c90781768f15ed7a47c19389b42f1..c10cb3cc1024592b16bdca405f4abc5340ad43af 100644 (file)
@@ -125,15 +125,15 @@ L.ui.view.extend({
             var form = $('<div />')
                 .append($('<p />')
                     .text(L.tr('Paste the public key line into the field below and press "%s" to continue.').format(L.tr('Ok'))))
+                .append($('<p />')
+                    .text(L.tr('Unrecognized public key! Please add only RSA or DSA keys.'))
+                    .addClass('alert alert-danger')
+                    .hide())
                 .append($('<p />')
                     .append($('<input />')
                         .attr('type', 'text')
                         .attr('placeholder', L.tr('Paste key here'))
-                        .css('width', '100%')))
-                .append($('<p />')
-                    .text(L.tr('Unrecognized public key! Please add only RSA or DSA keys.'))
-                    .addClass('alert-message')
-                    .hide());
+                        .addClass('form-control')));
 
             L.ui.dialog(L.tr('Add new public key'), form, {
                 style: 'confirm',
@@ -148,7 +148,7 @@ L.ui.view.extend({
                     if (!key)
                     {
                         form.find('input').val('');
-                        form.find('.alert-message').show();
+                        form.find('.alert').show();
                         return;
                     }
 
@@ -183,29 +183,28 @@ L.ui.view.extend({
                     continue;
 
                 $('<div />')
-                    .addClass('cbi-input-dynlist')
+                    .addClass('input-group')
                     .append($('<input />')
+                        .addClass('form-control')
                         .attr('type', 'text')
                         .prop('readonly', true)
                         .click({ self: this, index: i }, this._show)
                         .val('%dBit %s - %s'.format(k.bits, k.type, k.comment || '?')))
-                    .append($('<img />')
-                        .attr('src', L.globals.resource + '/icons/cbi/remove.gif')
-                        .attr('title', L.tr('Remove public key'))
-                        .click({ self: this, div: div, index: i }, this._remove)
-                        .addClass('cbi-button'))
+                    .append($('<span />')
+                        .addClass('input-group-btn')
+                        .append($('<button />')
+                            .addClass('btn btn-danger')
+                            .attr('title', L.tr('Remove public key'))
+                            .text('–')
+                            .click({ self: this, div: div, index: i }, this._remove)))
                     .appendTo(div);
             }
 
             if (this._keys.length > 0)
                 $('<br />').appendTo(div);
 
-            $('<input />')
-                .attr('type', 'button')
-                .val(L.tr('Add public key …'))
+            L.ui.button(L.tr('Add public key …'), 'success')
                 .click({ self: this, div: div }, this._add)
-                .addClass('cbi-button')
-                .addClass('cbi-button-apply')
                 .appendTo(div);
         },
 
@@ -257,7 +256,8 @@ L.ui.view.extend({
         return L.system.getSSHKeys().then(function(keys) {
             var m = new L.cbi.Map('dropbear', {
                 caption:     L.tr('SSH Access'),
-                description: L.tr('Dropbear offers SSH network shell access and an integrated SCP server')
+                description: L.tr('Dropbear offers SSH network shell access and an integrated SCP server'),
+                tabbed:      true
             });
 
             var s1 = m.section(L.cbi.DummySection, '__password', {
index b0d31ea2faa848a6a19a2416ac1824e03b3012bc..c19462dd915a3ba597f261e57c35363a458eb656 100644 (file)
@@ -33,8 +33,8 @@ L.ui.view.extend({
         });
 
         var s = m.section(L.cbi.TypedSection, 'led', {
-            caption:     function(sid) { return sid ? (this.fields.name.textvalue(sid) || L.tr('Unnamed LED')) : '' },
-            teasers:     [ 'sysfs', 'default', 'trigger', '_net_dev', 'mode', '_usb_dev', 'delayon', 'delayoff' ],
+            caption:     L.tr('LED Definitions'),
+            teasers:     [ 'name', 'sysfs', 'default', 'trigger', '_net_dev', 'mode', '_usb_dev', 'delayon', 'delayoff' ],
             collabsible: true,
             addremove:   true,
             add_caption: L.tr('Add new LED defintion'),
index 9f208d3255dd1cd1e7f096d3f21ed22512a614bf..65a86eafc121eef400473a43a8067036b495e7a7 100644 (file)
@@ -1,4 +1,6 @@
 L.ui.view.extend({
+       title: L.tr('Package management'),
+
        updateDiskSpace: function()
        {
                return L.system.getDiskInfo().then(function(info) {
@@ -109,14 +111,11 @@ L.ui.view.extend({
                                        width:   '120px',
                                        format: function(v, n) {
                                                var inst = self.installedList[list[n][0]];
-                                               return $('<button />')
+                                               return L.ui.button(inst ? L.trc('Package state', 'Installed') : L.trc('Package state', 'Not installed'), inst ? 'success' : 'danger')
                                                        .css('width', '100%')
                                                        .attr('disabled', install_disabled)
                                                        .attr('pkgname', list[n][0])
                                                        .attr('installed', inst)
-                                                       .addClass('cbi-button')
-                                                       .addClass(inst ? 'cbi-button-apply' : 'cbi-button-reset')
-                                                       .text(inst ? L.trc('Package state', 'Installed') : L.trc('Package state', 'Not installed'))
                                                        .click(function() {
                                                                self.installRemovePackage(this.getAttribute('pkgname'), this.getAttribute('installed') == 'true');
                                                        });
@@ -131,21 +130,21 @@ L.ui.view.extend({
                                $('#package_prev')
                                        .attr('offset', offset - 100)
                                        .attr('disabled', false)
-                                       .val('« %d - %d'.format(offset - 100 + 1, offset));
+                                       .text('« %d - %d'.format(offset - 100 + 1, offset));
                        else
                                $('#package_prev')
                                        .attr('disabled', true)
-                                       .val('« %d - %d'.format(1, Math.min(100, list.total)));
+                                       .text('« %d - %d'.format(1, Math.min(100, list.total)));
 
                        if ((offset + 100) < list.total)
                                $('#package_next')
                                        .attr('offset', offset + 100)
                                        .attr('disabled', false)
-                                       .val('%d - %d »'.format(offset + 100 + 1, Math.min(offset + 200, list.total)));
+                                       .text('%d - %d »'.format(offset + 100 + 1, Math.min(offset + 200, list.total)));
                        else
                                $('#package_next')
                                        .attr('disabled', true)
-                                       .val('%d - %d »'.format(list.total - (list.total % 100) + 1, list.total));
+                                       .text('%d - %d »'.format(list.total - (list.total % 100) + 1, list.total));
 
                        if (interactive)
                                L.ui.loading(false);
@@ -161,16 +160,16 @@ L.ui.view.extend({
 
                return $.when(
                        L.opkg.getConfig().then(function(config) {
-                               $('textarea')
+                               $('#config textarea')
                                        .attr('rows', (config.match(/\n/g) || [ ]).length + 1)
                                        .val(config);
 
-                               $('input.cbi-button-save')
+                               $('#config button')
                                        .click(function() {
-                                               var data = ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
+                                               var data = ($('#config textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
                                                L.ui.loading(true);
                                                L.opkg.setConfig(data).then(function() {
-                                                       $('textarea')
+                                                       $('#config textarea')
                                                                .attr('rows', (data.match(/\n/g) || [ ]).length + 1)
                                                                .val(data);
 
@@ -181,8 +180,6 @@ L.ui.view.extend({
                        self.fetchInstalledList(),
                        self.updateDiskSpace()
                ).then(function() {
-                       $('#tabs').show().tabs();
-
                        $('#package_prev, #package_next').click(function(ev) {
                                if (!this.getAttribute('disabled'))
                                {
@@ -192,9 +189,7 @@ L.ui.view.extend({
                        });
 
                        $('#package_filter').next().click(function(ev) {
-                               if (this.getAttribute('src').indexOf('remove.gif') > -1)
-                                       $('#package_filter').val('');
-
+                               $('#package_filter').val('');
                                self.fetchPackageList(0, true);
                        });
 
index 7b5259375062f0c7a85a9e5b7fda1f5643c78bc1..e00e74a4d9afad1036824bac2efaecb018a75b3e 100644 (file)
@@ -22,55 +22,49 @@ L.ui.view.extend({
                         key:     'start'
                     }, {
                         caption: L.tr('Initscript'),
-                        key:     'name',
-                        width:   '90%'
+                        key:     'name'
                     }, {
-                        caption: L.trc('Init script table heading', 'Enable'),
                         key:     'enabled',
-                        format: function(v, n) {
-                            return $('<button />')
-                                .attr('disabled', !allow_write)
-                                .attr('name', list[n].name)
-                                .addClass('cbi-button')
-                                .addClass(v ? 'cbi-button-apply' : 'cbi-button-reset')
-                                .text(v ? L.trc('Init script state', 'Enabled') : L.trc('Init script state', 'Disabled'))
-                                .click(function() {
-                                    L.ui.loading(true);
-                                    if (v)
-                                        L.system.initDisable(this.getAttribute('name')).then(redraw);
-                                    else
-                                        L.system.initEnable(this.getAttribute('name')).then(redraw);
-                                });
-                        }
-                    }, {
-                        caption: L.trc('Init script table heading', 'Restart'),
-                        key:     'enabled',
-                        format: function(v, n) {
-                            return $('<button />')
-                                .attr('disabled', !allow_write)
-                                .attr('name', list[n].name)
-                                .addClass('cbi-button')
-                                .addClass('cbi-button-reload')
-                                .text(L.trc('Init script action', 'Restart'))
-                                .click(function() {
-                                    L.ui.loading(true);
-                                    L.system.initRestart(this.getAttribute('name')).then(redraw)
-                                });
-                        }
-                    }, {
-                        caption: L.trc('Init script table heading', 'Stop'),
-                        key:     'enabled',
-                        format: function(v, n) {
-                            return $('<button />')
-                                .attr('disabled', !allow_write)
-                                .attr('name', list[n].name)
-                                .addClass('cbi-button')
-                                .addClass('cbi-button-remove')
-                                .text(L.trc('Init script action', 'Stop'))
-                                .click(function() {
-                                    L.ui.loading(true);
-                                    L.system.initStop(this.getAttribute('name')).then(redraw)
-                                });
+                        format:  function(v, n) {
+                            return [
+                                $('<div />')
+                                    .addClass('btn-group pull-right')
+                                    .append($('<button />')
+                                        .attr('disabled', !allow_write)
+                                        .attr('name', list[n].name)
+                                        .addClass('btn btn-sm')
+                                        .addClass(v ? 'btn-success' : 'btn-danger')
+                                        .text(v ? L.trc('Init script state', 'Enabled') : L.trc('Init script state', 'Disabled'))
+                                        .click(function() {
+                                            L.ui.loading(true);
+                                            if (v)
+                                                L.system.initDisable(this.getAttribute('name')).then(redraw);
+                                            else
+                                                L.system.initEnable(this.getAttribute('name')).then(redraw);
+                                        }))
+                                    .append($('<button />')
+                                        .addClass('btn btn-primary btn-sm dropdown-toggle')
+                                        .attr('data-toggle', 'dropdown')
+                                        .attr('disabled', !allow_write)
+                                        .text(L.tr('Action…')))
+                                    .append($('<ul />')
+                                        .addClass('dropdown-menu pull-right')
+                                        .append($('<li />')
+                                            .append($('<a />')
+                                                .attr('href', '#')
+                                                .text(L.tr('Reload'))
+                                                .click(function(ev) { L.system.initReload(v).then(redraw); ev.preventDefault(); })))
+                                        .append($('<li />')
+                                            .append($('<a />')
+                                                .attr('href', '#')
+                                                .text(L.tr('Restart'))
+                                                .click(function(ev) { L.system.initRestart(v).then(redraw); ev.preventDefault(); })))
+                                        .append($('<li />')
+                                            .append($('<a />')
+                                                .attr('href', '#')
+                                                .text(L.tr('Stop'))
+                                                .click(function(ev) { L.system.initStop(v).then(redraw); ev.preventDefault(); }))))
+                            ];
                         }
                     } ]
                 });
@@ -81,8 +75,6 @@ L.ui.view.extend({
                 L.ui.loading(false);
             }),
             L.system.getRcLocal().then(function(data) {
-                $('#maps').accordion({ heightStyle: 'content' });
-
                 $('textarea').val(data).attr('disabled', !allow_write);
                 $('input.cbi-button-save').attr('disabled', !allow_write).click(function() {
                     var data = ($('textarea').val() || '').replace(/\r/g, '').replace(/\n?$/, '\n');
index 2df7f832a11e651c0007e72a021fb20f84825d4a..be8885b5ffb636784652136d43da37dd219ff94a 100644 (file)
@@ -222,6 +222,7 @@ L.ui.view.extend({
                                                                .css('width', '100%')
                                                                .attr('rows', list.length)
                                                                .prop('readonly', true)
+                                                               .addClass('form-control')
                                                                .val(list.join('\n')),
                                                        { style: 'close' }
                                                );
index ebf375187758f210f16fbdfc73f48114849582f2..6b30d300b11f5cd43b63a4e2bb562a398dc38b2a 100644 (file)
@@ -94,6 +94,7 @@ L.ui.view.extend({
                widget: function(sid)
                {
             var t = $('<table />')
+                .addClass('table table-condensed table-hover')
                 .attr('id', this.id(sid))
                 .append($('<tr />')
                     .append($('<th />')
@@ -131,6 +132,7 @@ L.ui.view.extend({
                     {
                         $(r.insertCell(-1))
                             .append($('<input />')
+                                .addClass('form-control')
                                 .attr('type', 'radio')
                                 .attr('name', '%s_%s'.format(this.id(sid), this.choices[i][0]))
                                 .attr('value', j)
@@ -219,7 +221,7 @@ L.ui.view.extend({
 
     execute: function() {
         var self = this;
-        L.ui.listAvailableACLs().then(function(acls) {
+        return L.ui.listAvailableACLs().then(function(acls) {
             var m = new L.cbi.Map('rpcd', {
                 caption:     L.tr('Guest Logins'),
                 description: L.tr('Manage user accounts and permissions for accessing the LuCI ui.'),
@@ -227,14 +229,11 @@ L.ui.view.extend({
             });
 
             var s = m.section(L.cbi.TypedSection, 'login', {
-                caption:      function(sid) {
-                    var u = sid ? this.fields.username.textvalue(sid) : undefined;
-                    return u ? L.tr('Login "%s"').format(u) : L.tr('New login');
-                },
+                caption:      L.tr('Accounts'),
                 collabsible:  true,
                 addremove:    true,
-                add_caption:  L.tr('Add new user …'),
-                teasers:      [ '__shadow', '__acls' ]
+                add_caption:  L.tr('Add account …'),
+                teasers:      [ 'username', '__shadow', '__acls' ]
             });
 
             s.option(L.cbi.InputValue, 'username', {