luci-app-adblock: support new workflow
[project/luci.git] / applications / luci-app-adblock / luasrc / model / cbi / adblock / overview_tab.lua
index aef0a9f..ec5a75c 100644 (file)
@@ -7,7 +7,7 @@ local sys      = require("luci.sys")
 local util     = require("luci.util")
 local dump     = util.ubus("network.interface", "dump", {})
 local json     = require("luci.jsonc")
-local adbinput = uci.get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
+local adbinput = uci:get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
 
 if not uci:get("adblock", "extra") then
        m = SimpleForm("", nil, translate("Please update your adblock config file to use this package.<br />")
@@ -24,8 +24,9 @@ m = Map("adblock", translate("Adblock"),
        .. translatef("For further information "
        .. "<a href=\"%s\" target=\"_blank\">"
        .. "check the online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md"))
+m.apply_on_parse = true
 
-function m.on_after_commit(self)
+function m.on_apply(self)
        luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1")
        luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock"))
 end