luci2: add primitive initial support for applying uci changes
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jan 2014 22:03:21 +0000 (22:03 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jan 2014 22:03:21 +0000 (22:03 +0000)
luci2/htdocs/luci2/luci2.js

index 6f40b777bafe88952af5cd0dfb8a20dde116ef24..220e040273f448db3aa90835987e0788360e83d2 100644 (file)
@@ -3860,20 +3860,23 @@ function LuCI2()
 
                                if (n > 0)
                                        $('#changes')
-                                               .empty()
-                                               .show()
-                                               .append($('<a />')
-                                                       .attr('href', '#')
-                                                       .addClass('label')
-                                                       .addClass('notice')
-                                                       .text(_luci2.trcp('Pending configuration changes', '1 change', '%d changes', n).format(n))
-                                                       .click(function(ev) {
-                                                               _luci2.ui.dialog(_luci2.tr('Staged configuration changes'), html, { style: 'close' });
-                                                               ev.preventDefault();
-                                                       }));
+                                               .click(function(ev) {
+                                                       _luci2.ui.dialog(_luci2.tr('Staged configuration changes'), html, {
+                                                               style: 'confirm',
+                                                               confirm: function() {
+                                                                       _luci2.uci.apply().then(
+                                                                               function(code) { alert('Success with code ' + code); },
+                                                                               function(code) { alert('Error with code ' + code); }
+                                                                       );
+                                                               }
+                                                       });
+                                                       ev.preventDefault();
+                                               })
+                                               .children('span')
+                                                       .show()
+                                                       .text(_luci2.trcp('Pending configuration changes', '1 change', '%d changes', n).format(n));
                                else
-                                       $('#changes')
-                                               .hide();
+                                       $('#changes').children('span').hide();
                        });
                },