diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/acf_www-controller.lua | 11 | ||||
-rw-r--r-- | app/template-html.lsp | 6 |
2 files changed, 7 insertions, 10 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 4e89db3..6b4bfdf 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -179,13 +179,10 @@ view_resolver = function(self) m=require("menubuilder") local menu = m.get_menuitems(self.conf.appdir) - -- A quick hack - submenu = {} - for k,v in pairs ( self.worker ) do - if type ( self.worker[k] ) == "function" then - table.insert (submenu, k) - end - end + -- Build the submenu table + local submenu = m.get_submenuitems(self.conf.appdir) + -- Show only tabs for current controller + submenu = submenu[pageinfo.controller] return function (viewtable) local template = haserl.loadfile (template) diff --git a/app/template-html.lsp b/app/template-html.lsp index f042e23..884c5cc 100644 --- a/app/template-html.lsp +++ b/app/template-html.lsp @@ -116,13 +116,13 @@ Content-Type: text/html </div> <? local class="" ?> - <? for k,v in pairs(submenu) do - if v == pageinfo.action then + <? for k,v in pairs(submenu or {}) do + if submenu[k]["action"] == pageinfo.action then class="class='selected'" else class="" end - io.write (string.format('\t\t\t<a %s href="%s">%s</a>\n',class,v,v )) + io.write (string.format('\t\t\t<a %s href="%s">%s</a>\n',class,submenu[k]["action"],submenu[k]["tab"] )) end ?> |