L.ui.view.extend({
+ title: L.tr('Package management'),
+
updateDiskSpace: function()
{
return L.system.getDiskInfo().then(function(info) {
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');
});
$('#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);
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);
self.fetchInstalledList(),
self.updateDiskSpace()
).then(function() {
- $('#tabs').show().tabs();
-
$('#package_prev, #package_next').click(function(ev) {
if (!this.getAttribute('disabled'))
{
});
$('#package_filter').next().click(function(ev) {
- if (this.getAttribute('src').indexOf('remove.gif') > -1)
- $('#package_filter').val('');
-
+ $('#package_filter').val('');
self.fetchPackageList(0, true);
});