projects
/
project
/
luci2
/
ui.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8d23497
)
luci2: fix package install / removal on button click in system/software view
author
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 2 Oct 2013 16:05:35 +0000
(16:05 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 2 Oct 2013 16:05:35 +0000
(16:05 +0000)
luci2/htdocs/luci2/view/system.software.js
patch
|
blob
|
history
diff --git
a/luci2/htdocs/luci2/view/system.software.js
b/luci2/htdocs/luci2/view/system.software.js
index
fc4d692
..
9f208d3
100644
(file)
--- a/
luci2/htdocs/luci2/view/system.software.js
+++ b/
luci2/htdocs/luci2/view/system.software.js
@@
-11,16
+11,12
@@
L.ui.view.extend({
});
},
});
},
- installRemovePackage: function(
name
)
+ installRemovePackage: function(
pkgname, installed
)
{
{
- if (typeof(name) != 'string')
- name = undefined;
-
- var pkgname = (name || this.getAttribute('name')).replace(/^.*\//, '');
- var installed = name ? false : !!this.getAttribute('installed');
+ var dspname = pkgname.replace(/^.+\//, '');
var action = installed ? L.opkg.removePackage : L.opkg.installPackage;
var action = installed ? L.opkg.removePackage : L.opkg.installPackage;
- var title = (installed ? L.tr('Removing package "%s" …') : L.tr('Installing package "%s" …')).format(
pkg
name);
- var confirm = (installed ? L.tr('Really remove package "%h" ?') : L.tr('Really install package "%h" ?')).format(
pkg
name);
+ var title = (installed ? L.tr('Removing package "%s" …') : L.tr('Installing package "%s" …')).format(
dsp
name);
+ var confirm = (installed ? L.tr('Really remove package "%h" ?') : L.tr('Really install package "%h" ?')).format(
dsp
name);
var self = this;
var self = this;
@@
-29,7
+25,7
@@
L.ui.view.extend({
confirm: function() {
L.ui.dialog(title, L.tr('Waiting for package manager …'), { style: 'wait' });
confirm: function() {
L.ui.dialog(title, L.tr('Waiting for package manager …'), { style: 'wait' });
- action(
name ||
pkgname).then(function(res) {
+ action(pkgname).then(function(res) {
self.fetchInstalledList().then(function() { return self.fetchPackageList(); }).then(function() {
var output = [ ];
self.fetchInstalledList().then(function() { return self.fetchPackageList(); }).then(function() {
var output = [ ];
@@
-116,12
+112,14
@@
L.ui.view.extend({
return $('<button />')
.css('width', '100%')
.attr('disabled', install_disabled)
return $('<button />')
.css('width', '100%')
.attr('disabled', install_disabled)
- .attr('name', list[n][0])
+ .attr('
pkg
name', 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'))
.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(self.installRemovePackage);
+ .click(function() {
+ self.installRemovePackage(this.getAttribute('pkgname'), this.getAttribute('installed') == 'true');
+ });
}
} ]
});
}
} ]
});
@@
-221,13
+219,13
@@
L.ui.view.extend({
ev.preventDefault();
if (this.value)
ev.preventDefault();
if (this.value)
- self.installRemovePackage(this.value);
+ self.installRemovePackage(this.value
, false
);
});
$('#package_install').click(function(ev) {
var name = $('#package_url').val();
if (name)
});
$('#package_install').click(function(ev) {
var name = $('#package_url').val();
if (name)
- self.installRemovePackage(name);
+ self.installRemovePackage(name
, false
);
});
$('#package_update').click(function(ev) {
});
$('#package_update').click(function(ev) {