Commits

Daniel Poelzleithner committed eaf3db8

implement initiative pager in content_navigation

this allows you to swtich between the initiatives very quickly

  • Participants
  • Parent commits d87097d

Comments (0)

Files changed (2)

File app/main/issue/_show_head.lua

 slot.select("content_navigation", function()
 
   if app.session.member_id then
-
+    local records
     local this = 0
     local issues_selector = Issue:new_selector()
 
     }
 
 
-    local mk_link = function(index, text, icon, ltr)
+    local mk_link = function(index, text, icon, module)
        content = function()
-          if ltr then
+          if index > 0 then
             slot.put(text)
             ui.image{ static = "icons/16/"..icon }
           else
       if records[this+index] then
         ui.link{
           content = content,
-          module = "issue",
+          module = module,
           view = "show",
           id = records[this+index].id,
         }
       end
     end
 
-    mk_link(-1, _("Previous issue"), "resultset_previous.png")
+    mk_link(-1, _("Previous issue"), "resultset_previous.png", "issue")
     if issue.area then
       ui.link{
         content = function()
         }
       }
     end
-    mk_link(1, _("Next issue"), "resultset_next.png", 1)
+    mk_link(1, _("Next issue"), "resultset_next.png", "issue")
+
+    -- show pager for initiatives if available
+    if initiative then
+      ui.container{ content = function() end, attr = {class = "content_navigation_seperator"}}
+
+      records = issue:get_reference_selector("initiatives"):exec()
+      for i,cissue in ipairs(records) do
+        if cissue.id == initiative.id then
+          this = i
+          break
+        end
+      end
+      mk_link(-1, _("Previous initiative"), "resultset_previous.png", "initiative")
+      mk_link(1, _("Next initiative"), "resultset_next.png", "initiative")
+    end
   end
 end
 

File static/style.css

   background-color: #d7d7d7;
 }
 
+.content_navigation_seperator {
+  height: 1.4em;
+  border-left: 1px solid black;
+}
+
 .actions a:hover {
   background-color: #d7d7d7;
 }