bsw/jbe@19: local initiative_id = param.get("initiative_id") bsw/jbe@19: bsw/jbe@19: slot.put_into("title", _"Add new suggestion") bsw/jbe@19: bsw/jbe@19: slot.select("actions", function() bsw/jbe@19: ui.link{ bsw/jbe@19: content = function() bsw/jbe@19: ui.image{ static = "icons/16/cancel.png" } bsw/jbe@19: slot.put(_"Cancel") bsw/jbe@19: end, bsw/jbe@19: module = "initiative", bsw/jbe@19: view = "show", bsw/jbe@19: id = initiative_id, bsw/jbe@19: params = { tab = "suggestions" } bsw/jbe@19: } bsw/jbe@19: end) bsw/jbe@19: bsw/jbe@19: ui.form{ bsw/jbe@19: module = "suggestion", bsw/jbe@19: action = "add", bsw/jbe@19: params = { initiative_id = initiative_id }, bsw/jbe@19: routing = { bsw/jbe@19: default = { bsw/jbe@19: mode = "redirect", bsw/jbe@19: module = "initiative", bsw/jbe@19: view = "show", bsw/jbe@19: id = initiative_id, bsw/jbe@19: params = { tab = "suggestions" } bsw/jbe@19: } bsw/jbe@19: }, bsw/jbe@19: attr = { class = "vertical" }, bsw/jbe@19: content = function() bsw/jbe@19: local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false bsw/jbe@19: if not supported then bsw/jbe@19: ui.field.text{ bsw/jbe@19: attr = { class = "warning" }, poelzi@135: value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter." bsw/jbe@19: } bsw/jbe@19: end bsw/jbe@19: ui.field.select{ bsw/jbe@19: label = _"Degree", bsw/jbe@19: name = "degree", bsw/jbe@19: foreign_records = { bsw/jbe@19: { id = 1, name = _"should"}, bsw/jbe@19: { id = 2, name = _"must"}, bsw/jbe@19: }, bsw/jbe@19: foreign_id = "id", bsw/jbe@19: foreign_name = "name" bsw/jbe@19: } bsw@279: ui.field.text{ label = _"Title (80 chars max)", name = "name" } bsw@279: ui.field.select{ bsw@279: label = _"Wiki engine", bsw@279: name = "formatting_engine", bsw@279: foreign_records = { bsw@279: { id = "rocketwiki", name = "RocketWiki" }, bsw@279: { id = "compat", name = _"Traditional wiki syntax" } bsw@279: }, bsw@279: attr = {id = "formatting_engine"}, bsw@279: foreign_id = "id", bsw@279: foreign_name = "name", bsw@279: value = param.get("formatting_engine") bsw@279: } bsw@279: ui.tag{ bsw@279: tag = "div", bsw@279: content = function() bsw@279: ui.tag{ bsw@279: tag = "label", bsw@279: attr = { class = "ui_field_label" }, bsw@279: content = function() slot.put(" ") end, bsw@279: } bsw@279: ui.tag{ bsw@279: content = function() bsw@279: ui.link{ bsw@279: text = _"Syntax help", bsw@279: module = "help", bsw@279: view = "show", bsw@279: id = "wikisyntax", bsw@279: attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} bsw@279: } bsw@279: slot.put(" ") bsw@279: ui.link{ bsw@279: text = _"(new window)", bsw@279: module = "help", bsw@279: view = "show", bsw@279: id = "wikisyntax", bsw@279: attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"} bsw@279: } bsw@279: end bsw@279: } bsw@279: end bsw@279: } bsw@279: ui.field.text{ bsw@279: label = _"Description", bsw@279: name = "content", bsw@279: multiline = true, bsw@279: attr = { style = "height: 50ex;" }, bsw@279: value = param.get("content") bsw@279: } bsw@279: bsw@279: bsw/jbe@19: ui.submit{ text = _"Commit suggestion" } bsw/jbe@19: end bsw/jbe@19: }