liquid_feedback_frontend

diff app/main/delegation/new.lua @ 4:80c215dbf076

Version alpha5

Many optical changes and improved usability

Support for different wiki-formatting-engines

Help system
author bsw/jbe
date Thu Dec 10 12:00:00 2009 +0100 (2009-12-10)
parents 3bfb2fcf7ab9
children 72c5e0ee7c98
line diff
     1.1 --- a/app/main/delegation/new.lua	Mon Nov 30 12:00:00 2009 +0100
     1.2 +++ b/app/main/delegation/new.lua	Thu Dec 10 12:00:00 2009 +0100
     1.3 @@ -1,18 +1,59 @@
     1.4  local area = Area:by_id(param.get("area_id", atom.integer))
     1.5  if area then
     1.6    slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name)))
     1.7 +  util.help("delegation.new.area")
     1.8  end
     1.9  
    1.10  local issue = Issue:by_id(param.get("issue_id", atom.integer))
    1.11  if issue then
    1.12    slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name)))
    1.13 +  util.help("delegation.new.issue")
    1.14  end
    1.15  
    1.16 +if not area and not issue then
    1.17 +  slot.put_into("title", encode.html(_"Set global delegation"))
    1.18 +  util.help("delegation.new.global")
    1.19 +end
    1.20 +
    1.21 +slot.select("actions", function()
    1.22 +  if issue then
    1.23 +    ui.link{
    1.24 +      module = "issue",
    1.25 +      view = "show",
    1.26 +      id = issue.id,
    1.27 +      content = function()
    1.28 +          ui.image{ static = "icons/16/cancel.png" }
    1.29 +          slot.put(_"Cancel")
    1.30 +      end,
    1.31 +    }
    1.32 +  elseif area then
    1.33 +    ui.link{
    1.34 +      module = "area",
    1.35 +      view = "show",
    1.36 +      id = area.id,
    1.37 +      content = function()
    1.38 +          ui.image{ static = "icons/16/cancel.png" }
    1.39 +          slot.put(_"Cancel")
    1.40 +      end,
    1.41 +    }
    1.42 +  else
    1.43 +    ui.link{
    1.44 +      module = "index",
    1.45 +      view = "index",
    1.46 +      content = function()
    1.47 +          ui.image{ static = "icons/16/cancel.png" }
    1.48 +          slot.put(_"Cancel")
    1.49 +      end,
    1.50 +    }
    1.51 +  end
    1.52 +end)
    1.53 +
    1.54 +
    1.55  
    1.56  local contact_members = Member:new_selector()
    1.57    :add_where{ "contact.member_id = ?", app.session.member.id }
    1.58    :join("contact", nil, "member.id = contact.other_member_id")
    1.59 -  :add_order_by("member.login")
    1.60 +  :add_order_by("member.name")
    1.61    :exec()
    1.62  
    1.63  
    1.64 @@ -27,19 +68,29 @@
    1.65    routing = {
    1.66      default = {
    1.67        mode = "redirect",
    1.68 -      module = area and "area" or "issue",
    1.69 -      view = "show",
    1.70 -      id = area and area.id or issue.id,
    1.71 +      module = area and "area" or issue and "issue" or "index",
    1.72 +      view = (area or issue) and "show" or "index",
    1.73 +      id = area and area.id or issue and issue.id or nil,
    1.74      }
    1.75    },
    1.76    content = function()
    1.77 +    records = {
    1.78 +      {
    1.79 +        id = "-1",
    1.80 +        name = _"No delegation"
    1.81 +      }
    1.82 +    }
    1.83 +    for i, record in ipairs(contact_members) do
    1.84 +      records[#records+1] = record
    1.85 +    end
    1.86 +
    1.87      ui.field.select{
    1.88        label = _"Trustee",
    1.89        name = "trustee_id",
    1.90 -      foreign_records = contact_members,
    1.91 +      foreign_records = records,
    1.92        foreign_id = "id",
    1.93 -      foreign_name = "name"
    1.94 +      foreign_name = "name",
    1.95      }
    1.96      ui.submit{ text = _"Save" }
    1.97    end
    1.98 -}
    1.99 \ No newline at end of file
   1.100 +}

Impressum / About Us