From 5dd6be451372f44363bd0428c2e44cf912540e50 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Tue, 25 Jul 2017 07:24:59 +0200 Subject: luci-app-travelmate: enhancements & fixes * add re-ordering buttons in Station Overview * fix possible nil error during wifi scan Signed-off-by: Dirk Brenken --- .../luasrc/model/cbi/travelmate/wifi_order.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua (limited to 'applications/luci-app-travelmate/luasrc/model') diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua new file mode 100644 index 0000000000..5734841030 --- /dev/null +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua @@ -0,0 +1,22 @@ +-- Copyright 2017 Dirk Brenken (dev@brenken.org) +-- This is free software, licensed under the Apache License, Version 2.0 + +local uci = require("luci.model.uci").cursor() +local http = require("luci.http") +local cfg = http.formvalue("cfg") +local pos = http.formvalue("pos") +local dir = http.formvalue("dir") + +if cfg ~= nil then + if dir == "up" then + pos = pos - 1 + uci:reorder("wireless", cfg, pos) + elseif dir == "down" then + pos = pos + 1 + uci:reorder("wireless", cfg, pos) + end + uci:save("wireless") + uci:commit("wireless") +end + +http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations")) -- cgit v1.2.3