luci-mod-freifunk: fix lookup of community-name 707/head
authorSven Roederer <freifunk@it-solutions.geroedel.de>
Sun, 24 Apr 2016 20:38:26 +0000 (22:38 +0200)
committerSven Roederer <freifunk@it-solutions.geroedel.de>
Thu, 28 Apr 2016 00:41:35 +0000 (02:41 +0200)
restore the lookup of the freifunk community-name stored in
uci "freifunk.community.name".
In https://github.com/openwrt/luci/commit/9780ee382e72f8a5fb69e337a3fcc51fc0914883
the value changed to the complete path of the community-profile, e.g.
"/etc/config/profile_berlin". This causes lookup problems on other
pages, like "mod-freifunk -> overview -> index" (view/freifunk/index.htm line37, line 54).
And as the option suggests it's the community-name not the community-profile path.

Signed-off-by: Sven Roederer devel-sven@geroedel.de
modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua

index 0d3d971..b08366d 100644 (file)
@@ -16,7 +16,7 @@ community.rmempty = false
 local profile
 for profile in fs.glob(profiles) do
        local name = uci:get_first(profile, "community", "name") or "?"
 local profile
 for profile in fs.glob(profiles) do
        local name = uci:get_first(profile, "community", "name") or "?"
-       community:value(profile, name)
+       community:value(string.gsub(profile, "/etc/config/profile_", ""), name)
 end
 
 
 end