liquid_feedback_frontend

changeset 160:cc7650c7053f

better title for draft/show

add source view mode into show draft fixes bug #298
author Daniel Poelzleithner <poelzi@poelzi.org>
date Sat Oct 09 04:25:11 2010 +0200 (2010-10-09)
parents 5d797c6706d5
children ff6162022615
files app/main/draft/_head.lua app/main/draft/_show.lua app/main/draft/diff.lua app/main/draft/show.lua
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/draft/_head.lua	Sat Oct 09 04:25:11 2010 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +local draft = param.get("draft", "table")
     1.5 +local initiative = draft.initiative
     1.6 +local issue = initiative.issue
     1.7 +
     1.8 +slot.select("title", function()
     1.9 +  ui.link{
    1.10 +    content = issue.area.name,
    1.11 +    module = "area",
    1.12 +    view = "show",
    1.13 +    id = issue.area.id
    1.14 +  }
    1.15 +  slot.put(" &middot; ")
    1.16 +  ui.link{
    1.17 +    content = _("Issue ##{id}", { id = issue.id }),
    1.18 +    module = "issue",
    1.19 +    view = "show",
    1.20 +    id = issue.id
    1.21 +  }
    1.22 +  slot.put(" &middot; ")
    1.23 +  ui.link{
    1.24 +    content = _("Initiative: ")..initiative.name,
    1.25 +    module = "initiative",
    1.26 +    view = "show",
    1.27 +    id = initiative.id
    1.28 +  }
    1.29 +end)
    1.30 \ No newline at end of file
     2.1 --- a/app/main/draft/_show.lua	Sat Oct 09 03:42:48 2010 +0200
     2.2 +++ b/app/main/draft/_show.lua	Sat Oct 09 04:25:11 2010 +0200
     2.3 @@ -1,4 +1,5 @@
     2.4  local draft = param.get("draft", "table")
     2.5 +local source = param.get("source", atom.boolean)
     2.6  
     2.7  ui.form{
     2.8    attr = { class = "vertical" },
     2.9 @@ -46,7 +47,14 @@
    2.10      ui.container{
    2.11        attr = { class = "draft_content wiki" },
    2.12        content = function()
    2.13 -        slot.put(draft:get_content("html"))
    2.14 +        if source then
    2.15 +          ui.tag{
    2.16 +            tag = "pre",
    2.17 +            content = draft.content
    2.18 +          }
    2.19 +        else
    2.20 +          slot.put(draft:get_content("html"))
    2.21 +        end
    2.22        end
    2.23      }
    2.24    end
     3.1 --- a/app/main/draft/diff.lua	Sat Oct 09 03:42:48 2010 +0200
     3.2 +++ b/app/main/draft/diff.lua	Sat Oct 09 04:25:11 2010 +0200
     3.3 @@ -20,34 +20,13 @@
     3.4  local old_draft = Draft:by_id(old_draft_id)
     3.5  local new_draft = Draft:by_id(new_draft_id)
     3.6  
     3.7 -local initiative = new_draft.initiative
     3.8 -local issue = initiative.issue
     3.9 +execute.view{
    3.10 +  module = "draft",
    3.11 +  view = "_head",
    3.12 +  params = { draft = new_draft}
    3.13 +}
    3.14  
    3.15 -slot.select("title", function()
    3.16 -  ui.link{
    3.17 -    content = issue.area.name,
    3.18 -    module = "area",
    3.19 -    view = "show",
    3.20 -    id = issue.area.id
    3.21 -  }
    3.22 -  slot.put(" &middot; ")
    3.23 -  ui.link{
    3.24 -    content = _("Issue ##{id}", { id = issue.id }),
    3.25 -    module = "issue",
    3.26 -    view = "show",
    3.27 -    id = issue.id
    3.28 -  }
    3.29 -  slot.put(" &middot; ")
    3.30 -  ui.link{
    3.31 -    content = _("Initiative: ")..initiative.name,
    3.32 -    module = "initiative",
    3.33 -    view = "show",
    3.34 -    id = initiative.id
    3.35 -  }
    3.36 -  slot.put(" &middot; ")
    3.37 -  slot.put_into("title", _"Diff")
    3.38 -
    3.39 -end)
    3.40 +slot.put_into("title", " &middot; " .. _"Diff")
    3.41  
    3.42  if app.session.member_id and not new_draft.initiative.revoked then
    3.43    local supporter = Supporter:new_selector():add_where{"member_id = ?", app.session.member_id}:count()
     4.1 --- a/app/main/draft/show.lua	Sat Oct 09 03:42:48 2010 +0200
     4.2 +++ b/app/main/draft/show.lua	Sat Oct 09 04:25:11 2010 +0200
     4.3 @@ -1,7 +1,40 @@
     4.4  local draft = Draft:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec()
     4.5 +local source = param.get("source", atom.boolean)
     4.6 +
     4.7 +execute.view{
     4.8 +  module = "draft",
     4.9 +  view = "_head",
    4.10 +  params = { draft = draft}
    4.11 +}
    4.12 +
    4.13 +slot.put_into("title", " &middot; " .. _"History")
    4.14 +
    4.15 +if source then
    4.16 +  slot.select("actions", function()
    4.17 +    ui.link{
    4.18 +      content = _"Rendered",
    4.19 +      module = "draft",
    4.20 +      view = "show",
    4.21 +      id = param.get_id(),
    4.22 +      params = { source = false }
    4.23 +    }
    4.24 +    end
    4.25 +  )
    4.26 +else
    4.27 +  slot.select("actions", function()
    4.28 +    ui.link{
    4.29 +      content = _"Source",
    4.30 +      module = "draft",
    4.31 +      view = "show",
    4.32 +      id = param.get_id(),
    4.33 +      params = { source = true }
    4.34 +    }
    4.35 +    end
    4.36 +  )
    4.37 +end
    4.38  
    4.39  execute.view{
    4.40    module = "draft",
    4.41    view = "_show",
    4.42 -  params = { draft = draft }
    4.43 +  params = { draft = draft, source = source }
    4.44  }
    4.45 \ No newline at end of file

Impressum / About Us