Commits

Anonymous committed dbfde3c

Fixed error in admin/member_edit view

Comments (0)

Files changed (2)

app/main/admin/member_edit.lua

   slot.put_into("title", encode.html(_"Register new member"))
 end
 
-local units = Unit:new_selector()
-  :add_field("privilege.voting_right", "voting_right")
-  :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
-  :exec()
+local units_selector = Unit:new_selector()
   
+if member then
+  units_selector
+    :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
+    :add_field("privilege.voting_right", "voting_right")
+end
+
+local units = units_selector:exec()
   
 ui.form{
   attr = { class = "vertical" },

app/main/admin/unit_list.lua

   columns = {
     {
       label = "name",
+      name = "name"
+    },
+    {
       content = function(unit)
-        ui.link{ text = unit.name, module = "admin", view = "area_list", params = { unit_id = unit.id } }
+        ui.link{
+          attr = { class = "action admin_only" },
+          text = _"Edit unit",
+          module = "admin", view = "unit_edit", id = unit.id
+        }
+        ui.link{
+          attr = { class = "action admin_only" },
+          text = _"Edit areas",
+          module = "admin", view = "area_list", params = { unit_id = unit.id }
+        }
       end 
     }
   }