liquid_feedback_frontend

diff app/main/initiative/new.lua @ 95:6a12fb7e4963

Suggestion API, draft preview, word based diff, multiple fixes
- Added suggestion API
- Initiative API: Drafts optionally delivered as rendered html fragment
- Initiative API: Fixed wrong output of revoked timestamp when using JSON
- Preview added for initiative drafts
- Improved (word based) diff added
- Improved suggestion list
- Added missing sorting of initiative in vote list
- Filter state for member page initiative lists
- Fixed wrong status output in member history
- Fixed wrongly closed div in layout
author bsw
date Mon Aug 30 21:52:19 2010 +0200 (2010-08-30)
parents 3ec1dea6eefb
children fa55c8ded9fd
line diff
     1.1 --- a/app/main/initiative/new.lua	Thu Aug 19 15:37:51 2010 +0200
     1.2 +++ b/app/main/initiative/new.lua	Mon Aug 30 21:52:19 2010 +0200
     1.3 @@ -41,7 +41,7 @@
     1.4          foreign_records = tmp,
     1.5          foreign_id = "id",
     1.6          foreign_name = "name",
     1.7 -        value = (area.default_policy or {}).id
     1.8 +        value = area.default_policy and area.default_policy.id or param.get("policy_id", atom.integer)
     1.9        }
    1.10        ui.tag{
    1.11          tag = "div",
    1.12 @@ -70,9 +70,57 @@
    1.13          end
    1.14        }
    1.15      end
    1.16 +    
    1.17 +    if param.get("preview") then
    1.18 +      ui.heading{ level = 1, content = encode.html(param.get("name")) }
    1.19 +      local discussion_url = param.get("discussion_url")
    1.20 +      ui.container{
    1.21 +        attr = { class = "ui_field_label" },
    1.22 +        content = _"Discussion with initiators"
    1.23 +      }
    1.24 +      ui.tag{
    1.25 +        tag = "span",
    1.26 +        content = function()
    1.27 +          if discussion_url:find("^https?://") then
    1.28 +            if discussion_url and #discussion_url > 0 then
    1.29 +              ui.link{
    1.30 +                attr = {
    1.31 +                  class = "actions",
    1.32 +                  target = "_blank",
    1.33 +                  title = discussion_url
    1.34 +                },
    1.35 +                content = discussion_url,
    1.36 +                external = discussion_url
    1.37 +              }
    1.38 +            end
    1.39 +          else
    1.40 +            slot.put(encode.html(discussion_url))
    1.41 +          end
    1.42 +        end
    1.43 +      }
    1.44 +      ui.container{
    1.45 +        attr = { class = "draft_content wiki" },
    1.46 +        content = function()
    1.47 +          slot.put(format.wiki_text(param.get("draft"), param.get("formatting_engine")))
    1.48 +        end
    1.49 +      }
    1.50 +      slot.put("<br />")
    1.51 +      ui.submit{ text = _"Save" }
    1.52 +      slot.put("<br />")
    1.53 +      slot.put("<br />")
    1.54 +    end
    1.55      slot.put("<br />")
    1.56 -    ui.field.text{ label = _"Title of initiative", name = "name" }
    1.57 -    ui.field.text{ label = _"Discussion URL", name = "discussion_url" }
    1.58 +
    1.59 +    ui.field.text{
    1.60 +      label = _"Title of initiative",
    1.61 +      name  = "name",
    1.62 +      value = param.get("name")
    1.63 +    }
    1.64 +    ui.field.text{
    1.65 +      label = _"Discussion URL",
    1.66 +      name = "discussion_url",
    1.67 +      value = param.get("discussion_url")
    1.68 +    }
    1.69      ui.field.select{
    1.70        label = _"Wiki engine",
    1.71        name = "formatting_engine",
    1.72 @@ -81,9 +129,17 @@
    1.73          { id = "compat", name = _"Traditional wiki syntax" }
    1.74        },
    1.75        foreign_id = "id",
    1.76 -      foreign_name = "name"
    1.77 +      foreign_name = "name",
    1.78 +      value = param.get("formatting_engine")
    1.79      }
    1.80 -    ui.field.text{ label = _"Draft", name = "draft", multiline = true, attr = { style = "height: 50ex;" } }
    1.81 +    ui.field.text{
    1.82 +      label = _"Draft",
    1.83 +      name = "draft",
    1.84 +      multiline = true, 
    1.85 +      attr = { style = "height: 50ex;" },
    1.86 +      value = param.get("draft")
    1.87 +    }
    1.88 +    ui.submit{ name = "preview", text = _"Preview" }
    1.89      ui.submit{ text = _"Save" }
    1.90    end
    1.91  }
    1.92 \ No newline at end of file

Impressum / About Us