liquid_feedback_frontend

diff app/main/draft/new.lua @ 1045:701a5cf6b067

Imported LiquidFeedback Frontend 3.0 branch
author bsw
date Thu Jul 10 01:19:48 2014 +0200 (2014-07-10)
parents 99852ec8ee37
children abee3e49cd44
line diff
     1.1 --- a/app/main/draft/new.lua	Thu Jul 10 01:02:43 2014 +0200
     1.2 +++ b/app/main/draft/new.lua	Thu Jul 10 01:19:48 2014 +0200
     1.3 @@ -1,24 +1,27 @@
     1.4 -slot.put_into("title", _"Edit draft")
     1.5 +local initiative = Initiative:by_id(param.get("initiative_id"))
     1.6 +initiative:load_everything_for_member_id(app.session.member_id)
     1.7 +initiative.issue:load_everything_for_member_id(app.session.member_id)
     1.8  
     1.9 -local initiative = Initiative:by_id(param.get("initiative_id"))
    1.10  
    1.11 -ui.actions(function()
    1.12 -  ui.link{
    1.13 -    content = function()
    1.14 -        ui.image{ static = "icons/16/cancel.png" }
    1.15 -        slot.put(_"Cancel")
    1.16 -    end,
    1.17 -    module = "initiative",
    1.18 -    view = "show",
    1.19 -    id = initiative.id
    1.20 +execute.view{
    1.21 +  module = "issue", view = "_head", params = {
    1.22 +    issue = initiative.issue,
    1.23 +    initiative = initiative
    1.24    }
    1.25 -end)
    1.26 +}
    1.27 +
    1.28 +execute.view { 
    1.29 +  module = "issue", view = "_sidebar_issue", 
    1.30 +  params = {
    1.31 +    issue = initiative.issue,
    1.32 +  }
    1.33 +}
    1.34  
    1.35  
    1.36  
    1.37  ui.form{
    1.38    record = initiative.current_draft,
    1.39 -  attr = { class = "vertical" },
    1.40 +  attr = { class = "vertical section" },
    1.41    module = "draft",
    1.42    action = "add",
    1.43    params = { initiative_id = initiative.id },
    1.44 @@ -31,78 +34,103 @@
    1.45      }
    1.46    },
    1.47    content = function()
    1.48 -
    1.49 -    ui.field.text{ label = _"Unit", value = initiative.issue.area.unit.name, readonly = true }
    1.50 -    ui.field.text{ label = _"Area", value = initiative.issue.area.name, readonly = true }
    1.51 -    ui.field.text{ label = _"Policy", value = initiative.issue.policy.name, readonly = true }
    1.52 -    ui.field.text{ label = _"Issue", value = _("Issue ##{id}", { id = initiative.issue.id } ), readonly = true }
    1.53 -    slot.put("<br />")
    1.54 -    ui.field.text{ label = _"Initiative", value = initiative.name, readonly = true }
    1.55 -
    1.56 +  
    1.57 +    ui.sectionHead( function()
    1.58 +      ui.heading { level = 1, content = initiative.display_name }
    1.59 +    end)
    1.60 +    
    1.61      if param.get("preview") then
    1.62 -      ui.container{
    1.63 -        attr = { class = "draft_content wiki" },
    1.64 -        content = function()
    1.65 -          slot.put(format.wiki_text(param.get("content"), param.get("formatting_engine")))
    1.66 +      ui.sectionRow( function()
    1.67 +        ui.field.hidden{ name = "formatting_engine", value = param.get("formatting_engine") }
    1.68 +        ui.field.hidden{ name = "content", value = param.get("content") }
    1.69 +        if config.enforce_formatting_engine then
    1.70 +          formatting_engine = config.enforce_formatting_engine
    1.71 +        else
    1.72 +          formatting_engine = param.get("formatting_engine")
    1.73          end
    1.74 -      }
    1.75 -      slot.put("<br />")
    1.76 -      ui.submit{ text = _"Save" }
    1.77 -      slot.put("<br />")
    1.78 -      slot.put("<br />")
    1.79 -    end
    1.80 -    slot.put("<br />")
    1.81 +        ui.container{
    1.82 +          attr = { class = "draft" },
    1.83 +          content = function()
    1.84 +            slot.put(format.wiki_text(param.get("content"), formatting_engine))
    1.85 +          end
    1.86 +        }
    1.87  
    1.88 +        slot.put("<br />")
    1.89 +        ui.tag{
    1.90 +          tag = "input",
    1.91 +          attr = {
    1.92 +            type = "submit",
    1.93 +            class = "btn btn-default",
    1.94 +            value = _'Publish now'
    1.95 +          },
    1.96 +          content = ""
    1.97 +        }
    1.98 +        slot.put("<br />")
    1.99 +        slot.put("<br />")
   1.100  
   1.101 -    ui.field.select{
   1.102 -      label = _"Wiki engine",
   1.103 -      name = "formatting_engine",
   1.104 -      foreign_records = {
   1.105 -        { id = "rocketwiki", name = "RocketWiki" },
   1.106 -        { id = "compat", name = _"Traditional wiki syntax" }
   1.107 -      },
   1.108 -      attr = {id = "formatting_engine"},
   1.109 -      foreign_id = "id",
   1.110 -      foreign_name = "name"
   1.111 -    }
   1.112 -    ui.tag{
   1.113 -      tag = "div",
   1.114 -      content = function()
   1.115          ui.tag{
   1.116 -          tag = "label",
   1.117 -          attr = { class = "ui_field_label" },
   1.118 -          content = function() slot.put("&nbsp;") end,
   1.119 +          tag = "input",
   1.120 +          attr = {
   1.121 +            type = "submit",
   1.122 +            name = "edit",
   1.123 +            class = "btn-link",
   1.124 +            value = _'Edit again'
   1.125 +          },
   1.126 +          content = ""
   1.127 +        }
   1.128 +        slot.put(" | ")
   1.129 +        ui.link{
   1.130 +          content = _"Cancel",
   1.131 +          module = "initiative",
   1.132 +          view = "show",
   1.133 +          id = initiative.id
   1.134 +        }
   1.135 +      end )
   1.136 +
   1.137 +    else
   1.138 +      ui.sectionRow( function()
   1.139 +        execute.view{ module = "initiative", view = "_sidebar_wikisyntax" }
   1.140 +      
   1.141 +        if not config.enforce_formatting_engine then
   1.142 +          ui.field.select{
   1.143 +            label = _"Wiki engine",
   1.144 +            name = "formatting_engine",
   1.145 +            foreign_records = config.formatting_engines,
   1.146 +            attr = {id = "formatting_engine"},
   1.147 +            foreign_id = "id",
   1.148 +            foreign_name = "name"
   1.149 +          }
   1.150 +        end
   1.151 +
   1.152 +        ui.heading{ level = 2, content = _"Enter your proposal and/or reasons" }
   1.153 +
   1.154 +        ui.field.text{
   1.155 +          name = "content",
   1.156 +          multiline = true,
   1.157 +          attr = { style = "height: 50ex; width: 100%;" },
   1.158 +          value = param.get("content")
   1.159          }
   1.160          ui.tag{
   1.161 -          content = function()
   1.162 -            ui.link{
   1.163 -              text = _"Syntax help",
   1.164 -              module = "help",
   1.165 -              view = "show",
   1.166 -              id = "wikisyntax",
   1.167 -              attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
   1.168 -            }
   1.169 -            slot.put(" ")
   1.170 -            ui.link{
   1.171 -              text = _"(new window)",
   1.172 -              module = "help",
   1.173 -              view = "show",
   1.174 -              id = "wikisyntax",
   1.175 -              attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
   1.176 -            }
   1.177 -          end
   1.178 +          tag = "input",
   1.179 +          attr = {
   1.180 +            type = "submit",
   1.181 +            name = "preview",
   1.182 +            class = "btn btn-default",
   1.183 +            value = _'Preview'
   1.184 +          },
   1.185 +          content = ""
   1.186          }
   1.187 -      end
   1.188 -    }
   1.189 -    ui.field.text{
   1.190 -      label = _"Content",
   1.191 -      name = "content",
   1.192 -      multiline = true,
   1.193 -      attr = { style = "height: 50ex;" },
   1.194 -      value = param.get("content")
   1.195 -   }
   1.196 -
   1.197 -    ui.submit{ name = "preview", text = _"Preview" }
   1.198 -    ui.submit{ text = _"Save" }
   1.199 +        slot.put("<br />")
   1.200 +        slot.put("<br />")
   1.201 +        
   1.202 +        ui.link{
   1.203 +          content = _"Cancel",
   1.204 +          module = "initiative",
   1.205 +          view = "show",
   1.206 +          id = initiative.id
   1.207 +        }
   1.208 +        
   1.209 +      end )
   1.210 +    end
   1.211    end
   1.212  }

Impressum / About Us