liquid_feedback_frontend

diff app/main/initiative/show.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents fede09736f2b
children 17e7082c377a
line diff
     1.1 --- a/app/main/initiative/show.lua	Thu Jun 23 03:30:57 2016 +0200
     1.2 +++ b/app/main/initiative/show.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -7,6 +7,8 @@
     1.4    return
     1.5  end
     1.6  
     1.7 +app.current_initiative = initiative
     1.8 +
     1.9  local issue_info
    1.10  
    1.11  if member then
    1.12 @@ -15,541 +17,173 @@
    1.13    issue_info = initiative.issue.member_info
    1.14  end
    1.15  
    1.16 -execute.view {
    1.17 -  module = "issue", view = "_head", 
    1.18 -  params = {
    1.19 -    issue = initiative.issue,
    1.20 -    initiative = initiative,
    1.21 -    member = app.session.member
    1.22 -  }
    1.23 -}
    1.24 -
    1.25  local direct_supporter
    1.26  
    1.27  if app.session.member_id then
    1.28    direct_supporter = initiative.issue.member_info.own_participation and initiative.member_info.supported
    1.29  end
    1.30  
    1.31 -ui.script { script = [[
    1.32 -  function showTab(tabId) {
    1.33 -    $('.tab').hide();
    1.34 -    $('.main').hide();
    1.35 -    $('.main, .slot_extra .section').hide();
    1.36 -    $('.' + tabId).show();
    1.37 -    if (tabId == "main") $('.slot_extra .section').show();
    1.38 -  };
    1.39 -  showTab('main');
    1.40 -]]}
    1.41 -
    1.42 -execute.view{ module = "issue", view = "_sidebar_state", params = {
    1.43 -  initiative = initiative
    1.44 -} }
    1.45 -
    1.46 -execute.view { 
    1.47 -  module = "issue", view = "_sidebar_issue", 
    1.48 -  params = {
    1.49 -    issue = initiative.issue,
    1.50 -    highlight_initiative_id = initiative.id
    1.51 -  }
    1.52 -}
    1.53 +slot.put_into("header", initiative.display_name)
    1.54  
    1.55 -execute.view {
    1.56 -  module = "issue", view = "_sidebar_whatcanido",
    1.57 -  params = { initiative = initiative }
    1.58 -}
    1.59 -
    1.60 -execute.view { 
    1.61 -  module = "issue", view = "_sidebar_members", params = {
    1.62 -    issue = initiative.issue, initiative = initiative
    1.63 -  }
    1.64 -}
    1.65 +execute.view{ module = "issue", view = "_head", params = { issue = initiative.issue, link_issue = true } }
    1.66  
    1.67 -ui.section( function ()
    1.68 -  execute.view{
    1.69 -    module = "initiative", view = "_head", params = {
    1.70 -      initiative = initiative
    1.71 -    }
    1.72 -  }
    1.73 -
    1.74 -  if direct_supporter and not initiative.issue.closed then
    1.75 -    local supporter = app.session.member:get_reference_selector("supporters")
    1.76 -      :add_where{ "initiative_id = ?", initiative.id }
    1.77 -      :optional_object_mode()
    1.78 -      :exec()
    1.79 -      
    1.80 -    if supporter then
    1.81 +ui.grid{ content = function()
    1.82  
    1.83 -      local old_draft_id = supporter.draft_id
    1.84 -      local new_draft_id = initiative.current_draft.id
    1.85 -      
    1.86 -      if old_draft_id ~= new_draft_id then
    1.87 -        ui.sectionRow( "draft_updated_info", function ()
    1.88 -          ui.container{ 
    1.89 -            attr = { class = "info" },
    1.90 -            content = _"The draft of this initiative has been updated!"
    1.91 -          }
    1.92 -          slot.put(" ")
    1.93 -          ui.link{
    1.94 -            content = _"show differences",
    1.95 -            module = "draft",
    1.96 -            view = "diff",
    1.97 -            params = {
    1.98 -              old_draft_id = old_draft_id,
    1.99 -              new_draft_id = new_draft_id
   1.100 -            }
   1.101 -          }
   1.102 -          if not initiative.revoked then
   1.103 -            slot.put(" | ")
   1.104 -            ui.link{
   1.105 -              text   = _"refresh my support",
   1.106 -              module = "initiative",
   1.107 -              action = "add_support",
   1.108 -              id     = initiative.id,
   1.109 -              params = { draft_id = initiative.current_draft.id },
   1.110 -              routing = {
   1.111 -                default = {
   1.112 -                  mode = "redirect",
   1.113 -                  module = "initiative",
   1.114 -                  view = "show",
   1.115 -                  id = initiative.id
   1.116 -                }
   1.117 -              }
   1.118 -            }
   1.119 -            slot.put(" | ")
   1.120 -          end
   1.121 -
   1.122 -          ui.link{
   1.123 -            text   = _"remove my support",
   1.124 -            module = "initiative",
   1.125 -            action = "remove_support",
   1.126 -            id     = initiative.id,
   1.127 -            routing = {
   1.128 -              default = {
   1.129 -                mode = "redirect",
   1.130 -                module = "initiative",
   1.131 -                view = "show",
   1.132 -                id = initiative.id
   1.133 -              }
   1.134 -            }
   1.135 -          }
   1.136 -
   1.137 -        end )
   1.138 -      end
   1.139 -    end
   1.140 -  end
   1.141 -
   1.142 -  if config.render_external_reference and config.render_external_reference.initiative then
   1.143 -    config.render_external_reference.initiative(initiative, function (callback)
   1.144 -      ui.sectionRow(callback)
   1.145 -    end)
   1.146 -  end
   1.147 -  
   1.148 -  ui.sectionRow( function ()
   1.149 -    ui.container {
   1.150 -      attr = { class = "draft" },
   1.151 -      content = function ()
   1.152 -        slot.put ( initiative.current_draft:get_content ( "html" ) )
   1.153 -      end
   1.154 -    }
   1.155 -  end )
   1.156 -
   1.157 -end)
   1.158 -
   1.159 -ui.link { attr = { name = "suggestions" }, text = "" }
   1.160 -
   1.161 -
   1.162 -ui.container {
   1.163 -  attr = { class = "section suggestions" },
   1.164 -  content = function ()
   1.165 -
   1.166 -    if # ( initiative.suggestions ) > 0 then
   1.167 -  
   1.168 -      ui.sectionHead( function ()
   1.169 -        ui.heading { 
   1.170 -          level = 1, 
   1.171 -          content = _("Suggestions for improvement (#{count})", { count = # ( initiative.suggestions ) } ) 
   1.172 +  ui.cell_main{ content = function()
   1.173 +    ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
   1.174 +      execute.view{
   1.175 +        module = "initiative", view = "_head", params = {
   1.176 +          initiative = initiative
   1.177          }
   1.178 -        ui.container { content = _"written and rated by the supportes of this initiative to improve the proposal and its reasons" }
   1.179 -      end )
   1.180 -      
   1.181 -      for i, suggestion in ipairs(initiative.suggestions) do
   1.182 -        
   1.183 -        local opinion = Opinion:by_pk(app.session.member_id, suggestion.id)
   1.184 +      }
   1.185  
   1.186 -        local class = "sectionRow suggestion"
   1.187 -        if suggestion.id == param.get("suggestion_id", atom.number) then
   1.188 -          class = class .. " highlighted"
   1.189 -        end
   1.190 -        if member and not initiative.issue.fully_frozen and not initiative.issue.closed and initiative.member_info.supported then
   1.191 -          class = class .. " rateable"
   1.192 -        end
   1.193 -      
   1.194 -        
   1.195 -        ui.tag { tag = "div", attr = { class = class, id = "s" .. suggestion.id }, content = function ()
   1.196 +      if direct_supporter and not initiative.issue.closed then
   1.197 +        local supporter = app.session.member:get_reference_selector("supporters")
   1.198 +          :add_where{ "initiative_id = ?", initiative.id }
   1.199 +          :optional_object_mode()
   1.200 +          :exec()
   1.201 +          
   1.202 +        if supporter then
   1.203  
   1.204 -          if opinion then
   1.205 -            
   1.206 -            ui.container { attr = { class = "opinion"}, content = function()
   1.207 -              local class = ""
   1.208 -              local text = ""
   1.209 -              
   1.210 -              if opinion.degree == 2 then
   1.211 -                class = "must"
   1.212 -                text = _"must"
   1.213 -              elseif opinion.degree == 1 then
   1.214 -                class = "should"
   1.215 -                text = _"should"
   1.216 -              elseif opinion.degree == 0 then
   1.217 -                class = "neutral"
   1.218 -                text = _"neutral"
   1.219 -              elseif opinion.degree == -1 then
   1.220 -                class = "shouldnot"
   1.221 -                text = _"should not"
   1.222 -              elseif opinion.degree == -2 then
   1.223 -                class = "mustnot"
   1.224 -                text = _"must not"
   1.225 -              end
   1.226 -              
   1.227 -              ui.tag { 
   1.228 -                attr = { class = class }, 
   1.229 -                content = text 
   1.230 -              }
   1.231 -              
   1.232 -              slot.put ( " " )
   1.233 -              
   1.234 -              if 
   1.235 -                (opinion.degree > 0 and not opinion.fulfilled)
   1.236 -                or (opinion.degree < 0 and opinion.fulfilled)
   1.237 -              then
   1.238 -                ui.tag{ content = _"but" }
   1.239 -              else
   1.240 -                ui.tag{ content = _"and" }
   1.241 -              end
   1.242 -                
   1.243 -              slot.put ( " " )
   1.244 -              
   1.245 -              local class = ""
   1.246 -              local text = ""
   1.247 -              
   1.248 -              if opinion.fulfilled then
   1.249 -                class = "implemented"
   1.250 -                text = _"is implemented"
   1.251 -              else
   1.252 -                class = "notimplemented"
   1.253 -                text = _"is not implemented"
   1.254 -              end
   1.255 -
   1.256 -              ui.tag { 
   1.257 -                attr = { class = class }, 
   1.258 -                content = text
   1.259 -              }
   1.260 -
   1.261 -              if 
   1.262 -                (opinion.degree > 0 and not opinion.fulfilled)
   1.263 -                or (opinion.degree < 0 and opinion.fulfilled)
   1.264 -              then
   1.265 -                if math.abs(opinion.degree) > 1 then
   1.266 -                  slot.put(" !!")
   1.267 -                else
   1.268 -                  slot.put(" !")
   1.269 +          local old_draft_id = supporter.draft_id
   1.270 +          local new_draft_id = initiative.current_draft.id
   1.271 +          
   1.272 +          if old_draft_id ~= new_draft_id then
   1.273 +            ui.container {
   1.274 +              attr = { class = "mdl-card__content mdl-card--no-bottom-pad mdl-card--notice" },
   1.275 +              content = _"The draft of this initiative has been updated!"
   1.276 +            }
   1.277 +            ui.container {
   1.278 +              attr = { class = "mdl-card__actions mdl-card--action-border  mdl-card--notice" },
   1.279 +              content = function ()
   1.280 +                if not initiative.revoked then
   1.281 +                  ui.link{
   1.282 +                    attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
   1.283 +                    text   = _"refresh my support",
   1.284 +                    module = "initiative",
   1.285 +                    action = "add_support",
   1.286 +                    id     = initiative.id,
   1.287 +                    params = { draft_id = initiative.current_draft.id },
   1.288 +                    routing = {
   1.289 +                      default = {
   1.290 +                        mode = "redirect",
   1.291 +                        module = "initiative",
   1.292 +                        view = "show",
   1.293 +                        id = initiative.id
   1.294 +                      }
   1.295 +                    }
   1.296 +                  }
   1.297 +                  slot.put(" &nbsp; ")
   1.298 +                  ui.link{
   1.299 +                    attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
   1.300 +                    content = _"show differences",
   1.301 +                    module = "draft",
   1.302 +                    view = "diff",
   1.303 +                    params = {
   1.304 +                      old_draft_id = old_draft_id,
   1.305 +                      new_draft_id = new_draft_id
   1.306 +                    }
   1.307 +                  }
   1.308 +                  slot.put(" &nbsp; ")
   1.309                  end
   1.310 -              else
   1.311 -                slot.put(" ✓")
   1.312 -              end
   1.313 -
   1.314 -            end }
   1.315 -
   1.316 -          end
   1.317 -          
   1.318 -          
   1.319 -          ui.link { attr = { name = "s" .. suggestion.id }, text = "" }
   1.320 -          ui.heading { level = 2, 
   1.321 -            attr = { class = "suggestionHead" },
   1.322 -            content = format.string(suggestion.name, {
   1.323 -            truncate_at = 160, truncate_suffix = true
   1.324 -          }) }
   1.325 -  
   1.326 -
   1.327 -            local plus2  = (suggestion.plus2_unfulfilled_count or 0)
   1.328 -                            + (suggestion.plus2_fulfilled_count or 0)
   1.329 -            local plus1  = (suggestion.plus1_unfulfilled_count  or 0)
   1.330 -                            + (suggestion.plus1_fulfilled_count or 0)
   1.331 -            local minus1 = (suggestion.minus1_unfulfilled_count  or 0)
   1.332 -                            + (suggestion.minus1_fulfilled_count or 0)
   1.333 -            local minus2 = (suggestion.minus2_unfulfilled_count  or 0)
   1.334 -                            + (suggestion.minus2_fulfilled_count or 0)
   1.335 -            
   1.336 -            local with_opinion = plus2 + plus1 + minus1 + minus2
   1.337 -
   1.338 -            local neutral = (suggestion.initiative.supporter_count or 0)
   1.339 -                            - with_opinion
   1.340 -
   1.341 -            local neutral2 = with_opinion 
   1.342 -                              - (suggestion.plus2_fulfilled_count or 0)
   1.343 -                              - (suggestion.plus1_fulfilled_count or 0)
   1.344 -                              - (suggestion.minus1_fulfilled_count or 0)
   1.345 -                              - (suggestion.minus2_fulfilled_count or 0)
   1.346 -            
   1.347 -            ui.container { 
   1.348 -            attr = { class = "suggestionInfo" },
   1.349 -            content = function ()
   1.350 -              
   1.351 -              if with_opinion > 0 then
   1.352 -                ui.container { attr = { class = "suggestion-rating" }, content = function ()
   1.353 -                  ui.tag { content = _"collective rating:" }
   1.354 -                  slot.put("&nbsp;")
   1.355 -                  ui.bargraph{
   1.356 -                    max_value = suggestion.initiative.supporter_count,
   1.357 -                    width = 100,
   1.358 -                    bars = {
   1.359 -                      { color = "#0a0", value = plus2 },
   1.360 -                      { color = "#8a8", value = plus1 },
   1.361 -                      { color = "#eee", value = neutral },
   1.362 -                      { color = "#a88", value = minus1 },
   1.363 -                      { color = "#a00", value = minus2 },
   1.364 +                ui.link{
   1.365 +                  attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
   1.366 +                  text   = _"remove my support",
   1.367 +                  module = "initiative",
   1.368 +                  action = "remove_support",
   1.369 +                  id     = initiative.id,
   1.370 +                  routing = {
   1.371 +                    default = {
   1.372 +                      mode = "redirect",
   1.373 +                      module = "initiative",
   1.374 +                      view = "show",
   1.375 +                      id = initiative.id
   1.376                      }
   1.377                    }
   1.378 -                  slot.put(" | ")
   1.379 -                  ui.tag { content = _"implemented:" }
   1.380 -                  slot.put ( "&nbsp;" )
   1.381 -                  ui.bargraph{
   1.382 -                    max_value = with_opinion,
   1.383 -                    width = 100,
   1.384 -                    bars = {
   1.385 -                      { color = "#0a0", value = suggestion.plus2_fulfilled_count },
   1.386 -                      { color = "#8a8", value = suggestion.plus1_fulfilled_count },
   1.387 -                      { color = "#eee", value = neutral2 },
   1.388 -                      { color = "#a88", value = suggestion.minus1_fulfilled_count },
   1.389 -                      { color = "#a00", value = suggestion.minus2_fulfilled_count },
   1.390 -                    }
   1.391 -                  }
   1.392 -                end }
   1.393 -              end
   1.394 -
   1.395 -              if app.session:has_access("authors_pseudonymous") then
   1.396 -                util.micro_avatar ( suggestion.author )
   1.397 -              else
   1.398 -                slot.put("<br />")
   1.399 -              end
   1.400 -              
   1.401 -              ui.container {
   1.402 -                attr = { class = "suggestion-text" },
   1.403 -                content = function ()
   1.404 -                  slot.put ( suggestion:get_content( "html" ) )
   1.405 -                  
   1.406 -
   1.407 -              if direct_supporter then
   1.408 -                
   1.409 -                ui.container {
   1.410 -                  attr = { class = "rating" },
   1.411 -                  content = function ()
   1.412 -
   1.413 -                    if not opinion then
   1.414 -                      opinion = {}
   1.415 -                    end
   1.416 -                    ui.form { 
   1.417 -                      module = "opinion", action = "update", params = {
   1.418 -                        suggestion_id = suggestion.id
   1.419 -                      },
   1.420 -                      routing = { default = {
   1.421 -                        mode = "redirect", 
   1.422 -                        module = "initiative", view = "show", id = suggestion.initiative_id,
   1.423 -                        params = { suggestion_id = suggestion.id },
   1.424 -                        anchor = "s" .. suggestion.id -- TODO webmcp
   1.425 -                      } },
   1.426 -                      content = function ()
   1.427 -                      
   1.428 -                        
   1.429 -                        ui.heading { level = 3, content = _"Should the initiator implement this suggestion?" }
   1.430 -                        ui.container { content = function ()
   1.431 -                        
   1.432 -                          local active = opinion.degree == 2
   1.433 -                          ui.tag { tag = "input", attr = {
   1.434 -                            type = "radio", name = "degree", value = 2, 
   1.435 -                            id = "s" .. suggestion.id .. "_degree2",
   1.436 -                            checked = active and "checked" or nil
   1.437 -                          } }
   1.438 -                          ui.tag { 
   1.439 -                            tag = "label", 
   1.440 -                            attr = {
   1.441 -                              ["for"] = "s" .. suggestion.id .. "_degree2",
   1.442 -                              class = active and "active-plus2" or nil,
   1.443 -                            },
   1.444 -                            content = _"must"
   1.445 -                          }
   1.446 -                          
   1.447 -                          local active = opinion.degree == 1
   1.448 -                          ui.tag { tag = "input", attr = {
   1.449 -                            type = "radio", name = "degree", value = 1,
   1.450 -                            id = "s" .. suggestion.id .. "_degree1",
   1.451 -                            checked = active and "checked" or nil
   1.452 -                          } }
   1.453 -                          ui.tag { 
   1.454 -                            tag = "label", 
   1.455 -                            attr = {
   1.456 -                              ["for"] = "s" .. suggestion.id .. "_degree1",
   1.457 -                              class = active and "active-plus1" or nil,
   1.458 -                            },
   1.459 -                            content = _"should"
   1.460 -                          }
   1.461 -
   1.462 -                          local active = not opinion.member_id
   1.463 -                          ui.tag { tag = "input", attr = {
   1.464 -                            type = "radio", name = "degree", value = 0,
   1.465 -                            id = "s" .. suggestion.id .. "_degree0",
   1.466 -                            checked = active and "checked" or nil
   1.467 -                          } }
   1.468 -                          ui.tag { 
   1.469 -                            tag = "label", 
   1.470 -                            attr = {
   1.471 -                              ["for"] = "s" .. suggestion.id .. "_degree0",
   1.472 -                              class = active and "active-neutral" or nil,
   1.473 -                            },
   1.474 -                            content = _"neutral"
   1.475 -                          }
   1.476 -
   1.477 -                          local active = opinion.degree == -1
   1.478 -                          ui.tag { tag = "input", attr = {
   1.479 -                            type = "radio", name = "degree", value = -1,
   1.480 -                            id = "s" .. suggestion.id .. "_degree-1",
   1.481 -                            checked = active and "checked" or nil
   1.482 -                          } }
   1.483 -                          ui.tag { 
   1.484 -                            tag = "label", 
   1.485 -                            attr = {
   1.486 -                              ["for"] = "s" .. suggestion.id .. "_degree-1",
   1.487 -                              class = active and "active-minus1" or nil,
   1.488 -                            },
   1.489 -                            content = _"should not"
   1.490 -                          }
   1.491 -
   1.492 -                          local active = opinion.degree == -2
   1.493 -                          ui.tag { tag = "input", attr = {
   1.494 -                            type = "radio", name = "degree", value = -2,
   1.495 -                            id = "s" .. suggestion.id .. "_degree-2",
   1.496 -                            checked = active and "checked" or nil
   1.497 -                          } }
   1.498 -                          ui.tag { 
   1.499 -                            tag = "label", 
   1.500 -                            attr = {
   1.501 -                              ["for"] = "s" .. suggestion.id .. "_degree-2",
   1.502 -                              class = active and "active-minus2" or nil,
   1.503 -                            },
   1.504 -                            content = _"must not"
   1.505 -                          }
   1.506 -                        end }
   1.507 -                        
   1.508 -                        slot.put("<br />")
   1.509 -
   1.510 -                        ui.heading { level = 3, content = _"Did the initiator implement this suggestion?" }
   1.511 -                        ui.container { content = function ()
   1.512 -                          local active = opinion.fulfilled == false
   1.513 -                          ui.tag { tag = "input", attr = {
   1.514 -                            type = "radio", name = "fulfilled", value = "false",
   1.515 -                            id = "s" .. suggestion.id .. "_notfulfilled",
   1.516 -                            checked = active and "checked" or nil
   1.517 -                          } }
   1.518 -                          ui.tag { 
   1.519 -                            tag = "label", 
   1.520 -                            attr = {
   1.521 -                              ["for"] = "s" .. suggestion.id .. "_notfulfilled",
   1.522 -                              class = active and "active-notfulfilled" or nil,
   1.523 -                            },
   1.524 -                            content = _"No (not yet)"
   1.525 -                          }
   1.526 -
   1.527 -                          local active = opinion.fulfilled
   1.528 -                          ui.tag { tag = "input", attr = {
   1.529 -                            type = "radio", name = "fulfilled", value = "true",
   1.530 -                            id = "s" .. suggestion.id .. "_fulfilled",
   1.531 -                            checked = active and "checked" or nil
   1.532 -                          } }
   1.533 -                          ui.tag { 
   1.534 -                            tag = "label", 
   1.535 -                            attr = {
   1.536 -                              ["for"] = "s" .. suggestion.id .. "_fulfilled",
   1.537 -                              class = active and "active-fulfilled" or nil,
   1.538 -                            },
   1.539 -                            content = _"Yes, it's implemented"
   1.540 -                          }
   1.541 -                        end }
   1.542 -                        slot.put("<br />")
   1.543 -                        
   1.544 -                        ui.tag{
   1.545 -                          tag = "input",
   1.546 -                          attr = {
   1.547 -                            type = "submit",
   1.548 -                            class = "btn btn-default",
   1.549 -                            value = _"publish my rating"
   1.550 -                          },
   1.551 -                          content = ""
   1.552 -                        }
   1.553 -                        
   1.554 -                      end 
   1.555 -                    }
   1.556 -
   1.557 -                  end -- if not issue,fully_frozen or closed
   1.558 -                }
   1.559 -              end 
   1.560 -                
   1.561 -                local text = _"Read more"
   1.562 -                
   1.563 -                if direct_supporter then
   1.564 -                  text = _"Show more and rate this"
   1.565 -                end
   1.566 -                  
   1.567 -                ui.link{
   1.568 -                  attr = { class = "suggestion-details" },
   1.569 -                  content = _"Details",
   1.570 -                  module = "suggestion", view = "show", id = suggestion.id
   1.571                  }
   1.572  
   1.573 -                ui.link { 
   1.574 -                  attr = { 
   1.575 -                    class = "suggestion-more",
   1.576 -                    onclick = "$('#s" .. suggestion.id .. "').removeClass('folded').addClass('unfolded'); return false;"
   1.577 -                  },
   1.578 -                  text = text
   1.579 -                }
   1.580 -                
   1.581 -                ui.link { 
   1.582 -                  attr = { 
   1.583 -                    class = "suggestion-less",
   1.584 -                    onclick = "$('#s" .. suggestion.id .. "').addClass('folded').removeClass('unfolded'); return false;"
   1.585 -                  },
   1.586 -                  text = _"Show less"
   1.587 -                }
   1.588 -                end
   1.589 -              }
   1.590 -              
   1.591 -              ui.script{ script = [[
   1.592 -                var textEl = $('#s]] .. suggestion.id .. [[ .suggestion-text');
   1.593 -                var height = textEl.height();
   1.594 -                if (height > 150) $('#s]] .. suggestion.id .. [[').addClass('folded');
   1.595 -              ]] }
   1.596 -               
   1.597 +              end
   1.598 +            }
   1.599 +          end
   1.600 +        end
   1.601 +      end
   1.602 +
   1.603 +      if config.render_external_reference and config.render_external_reference.initiative then
   1.604 +        config.render_external_reference.initiative(initiative, function (callback)
   1.605 +          ui.sectionRow(callback)
   1.606 +        end)
   1.607 +      end
   1.608 +      local draft_content = initiative.current_draft.content
   1.609 +      if config.initiative_abstract then
   1.610 +        local abstract = string.match(draft_content, "(.+)<!%--END_OF_ABSTRACT%-->")
   1.611 +        if abstract then
   1.612 +          draft_content = string.match(draft_content, "<!%--END_OF_ABSTRACT%-->(.*)")
   1.613 +        end
   1.614 +      end
   1.615 +      ui.container {
   1.616 +        attr = { class = "draft mdl-card__content mdl-card--border" },
   1.617 +        content = function ()
   1.618 +          if initiative.current_draft.formatting_engine == "html" or not initiative.current_draft.formatting_engine then
   1.619 +            if config.draft_filter then
   1.620 +              slot.put(config.draft_filter(draft_content))
   1.621 +            else
   1.622 +              slot.put(draft_content)
   1.623              end
   1.624 -          } -- ui.paragraph
   1.625 -          
   1.626 -              
   1.627 -
   1.628 -        end } -- ui.tag "li"
   1.629 -        
   1.630 -      end -- for i, suggestion
   1.631 +          else
   1.632 +            slot.put ( initiative.current_draft:get_content ( "html" ) )
   1.633 +          end
   1.634 +        end
   1.635 +      }
   1.636        
   1.637 -    else -- if #initiative.suggestions > 0
   1.638 +      local drafts_count = initiative:get_reference_selector("drafts"):count()
   1.639        
   1.640 -      local text
   1.641 -      if initiative.issue.closed then
   1.642 -        text = _"No suggestions"
   1.643 -      else
   1.644 -        text = _"No suggestions yet"
   1.645 +      if not config.voting_only then
   1.646 +        ui.container {
   1.647 +          attr = { class = "mdl-card__actions" },
   1.648 +          content = function()
   1.649 +            ui.link{
   1.650 +              attr = { class = "mdl-button mdl-js-button" },
   1.651 +              module = "initiative", view = "history", id = initiative.id,
   1.652 +              content = _("draft history (#{count})", { count = drafts_count })
   1.653 +            }
   1.654 +          end
   1.655 +        }
   1.656        end
   1.657 -      ui.sectionHead( function()
   1.658 -        ui.heading { level = 1, content = text }
   1.659 -      end)
   1.660 -      
   1.661 -    end -- if #initiative.suggestions > 0
   1.662 +    
   1.663 +    end }
   1.664 +
   1.665 +    execute.view{ module = "initiative", view = "_suggestions", params = { initiative = initiative } }
   1.666      
   1.667 -  end
   1.668 -}
   1.669 +  end }
   1.670 +
   1.671 +  ui.cell_sidebar{ content = function()
   1.672 +    if config.logo then
   1.673 +      config.logo()
   1.674 +    end
   1.675 +    execute.view {
   1.676 +      module = "issue", view = "_sidebar", 
   1.677 +      params = {
   1.678 +        issue = initiative.issue,
   1.679 +        initiative = initiative,
   1.680 +        member = app.session.member
   1.681 +      }
   1.682 +    }
   1.683 +
   1.684 +    execute.view {
   1.685 +      module = "issue", view = "_sidebar_whatcanido", 
   1.686 +      params = {
   1.687 +        issue = initiative.issue,
   1.688 +        initiative = initiative,
   1.689 +        member = app.session.member
   1.690 +      }
   1.691 +    }
   1.692 +
   1.693 +    execute.view { 
   1.694 +      module = "issue", view = "_sidebar_members", params = {
   1.695 +        issue = initiative.issue, initiative = initiative
   1.696 +      }
   1.697 +    }
   1.698 +
   1.699 +  end }
   1.700 +
   1.701 +end }

Impressum / About Us