# HG changeset patch # User Daniel Poelzleithner # Date 1286591111 -7200 # Node ID cc7650c7053fc3788f6a316d7a7afc04fc60df70 # Parent 5d797c6706d5d2d9c5672f26524c5efed90cd5af better title for draft/show add source view mode into show draft fixes bug #298 diff -r 5d797c6706d5 -r cc7650c7053f app/main/draft/_head.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/draft/_head.lua Sat Oct 09 04:25:11 2010 +0200 @@ -0,0 +1,26 @@ +local draft = param.get("draft", "table") +local initiative = draft.initiative +local issue = initiative.issue + +slot.select("title", function() + ui.link{ + content = issue.area.name, + module = "area", + view = "show", + id = issue.area.id + } + slot.put(" · ") + ui.link{ + content = _("Issue ##{id}", { id = issue.id }), + module = "issue", + view = "show", + id = issue.id + } + slot.put(" · ") + ui.link{ + content = _("Initiative: ")..initiative.name, + module = "initiative", + view = "show", + id = initiative.id + } +end) \ No newline at end of file diff -r 5d797c6706d5 -r cc7650c7053f app/main/draft/_show.lua --- a/app/main/draft/_show.lua Sat Oct 09 03:42:48 2010 +0200 +++ b/app/main/draft/_show.lua Sat Oct 09 04:25:11 2010 +0200 @@ -1,4 +1,5 @@ local draft = param.get("draft", "table") +local source = param.get("source", atom.boolean) ui.form{ attr = { class = "vertical" }, @@ -46,7 +47,14 @@ ui.container{ attr = { class = "draft_content wiki" }, content = function() - slot.put(draft:get_content("html")) + if source then + ui.tag{ + tag = "pre", + content = draft.content + } + else + slot.put(draft:get_content("html")) + end end } end diff -r 5d797c6706d5 -r cc7650c7053f app/main/draft/diff.lua --- a/app/main/draft/diff.lua Sat Oct 09 03:42:48 2010 +0200 +++ b/app/main/draft/diff.lua Sat Oct 09 04:25:11 2010 +0200 @@ -20,34 +20,13 @@ local old_draft = Draft:by_id(old_draft_id) local new_draft = Draft:by_id(new_draft_id) -local initiative = new_draft.initiative -local issue = initiative.issue +execute.view{ + module = "draft", + view = "_head", + params = { draft = new_draft} +} -slot.select("title", function() - ui.link{ - content = issue.area.name, - module = "area", - view = "show", - id = issue.area.id - } - slot.put(" · ") - ui.link{ - content = _("Issue ##{id}", { id = issue.id }), - module = "issue", - view = "show", - id = issue.id - } - slot.put(" · ") - ui.link{ - content = _("Initiative: ")..initiative.name, - module = "initiative", - view = "show", - id = initiative.id - } - slot.put(" · ") - slot.put_into("title", _"Diff") - -end) +slot.put_into("title", " · " .. _"Diff") if app.session.member_id and not new_draft.initiative.revoked then local supporter = Supporter:new_selector():add_where{"member_id = ?", app.session.member_id}:count() diff -r 5d797c6706d5 -r cc7650c7053f app/main/draft/show.lua --- a/app/main/draft/show.lua Sat Oct 09 03:42:48 2010 +0200 +++ b/app/main/draft/show.lua Sat Oct 09 04:25:11 2010 +0200 @@ -1,7 +1,40 @@ local draft = Draft:new_selector():add_where{ "id = ?", param.get_id() }:single_object_mode():exec() +local source = param.get("source", atom.boolean) + +execute.view{ + module = "draft", + view = "_head", + params = { draft = draft} +} + +slot.put_into("title", " · " .. _"History") + +if source then + slot.select("actions", function() + ui.link{ + content = _"Rendered", + module = "draft", + view = "show", + id = param.get_id(), + params = { source = false } + } + end + ) +else + slot.select("actions", function() + ui.link{ + content = _"Source", + module = "draft", + view = "show", + id = param.get_id(), + params = { source = true } + } + end + ) +end execute.view{ module = "draft", view = "_show", - params = { draft = draft } + params = { draft = draft, source = source } } \ No newline at end of file