luci2: revert uci changes when closing cbi.Model dialog
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 13 Apr 2014 20:20:51 +0000 (22:20 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 13 Apr 2014 20:20:51 +0000 (22:20 +0200)
luci2/htdocs/luci2/luci2.js

index dac499f3732597a70fc150afbed0257bb5ae6f9d..95d3516e10c7b2e63ab997eafcd58695f8558028 100644 (file)
@@ -7273,9 +7273,8 @@ function LuCI2()
                        });
                },
 
-               reset: function()
+               revert: function()
                {
-                       var self = this;
                        var packages = { };
 
                        for (var i = 0; i < this.sections.length; i++)
@@ -7284,6 +7283,13 @@ function LuCI2()
                        packages[this.uci_package] = true;
 
                        L.uci.unload(L.toArray(packages));
+               },
+
+               reset: function()
+               {
+                       var self = this;
+
+                       self.revert();
 
                        return self.insertInto(self.target);
                },
@@ -7329,6 +7335,7 @@ function LuCI2()
                        var self = ev.data.self;
 
                        self.trigger('close', ev);
+                       self.revert();
                        self.close();
                },