liquid_feedback_frontend
diff app/main/initiative/_action/create.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
author | bsw |
---|---|
date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
parents | c23a25f38c44 |
children | 5b65ea5c24f5 |
line diff
1.1 --- a/app/main/initiative/_action/create.lua Thu Jul 10 01:02:43 2014 +0200 1.2 +++ b/app/main/initiative/_action/create.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -73,23 +73,32 @@ 1.4 local name = util.trim(name) 1.5 1.6 if #name < 3 then 1.7 - slot.put_into("error", _"This name is really too short!") 1.8 + slot.put_into("error", _"Please enter a meaningful title for your initiative!") 1.9 + return false 1.10 +end 1.11 + 1.12 +if #name > 140 then 1.13 + slot.put_into("error", _"This title is too long!") 1.14 return false 1.15 end 1.16 1.17 -local formatting_engine = param.get("formatting_engine") 1.18 - 1.19 -local formatting_engine_valid = false 1.20 -for fe, dummy in pairs(config.formatting_engine_executeables) do 1.21 - if formatting_engine == fe then 1.22 - formatting_engine_valid = true 1.23 +local formatting_engine 1.24 +if config.enforce_formatting_engine then 1.25 + formatting_engine = config.enforce_formatting_engine 1.26 +else 1.27 + formatting_engine = param.get("formatting_engine") 1.28 + local formatting_engine_valid = false 1.29 + for i, fe in ipairs(config.formatting_engines) do 1.30 + if formatting_engine == fe.id then 1.31 + formatting_engine_valid = true 1.32 + end 1.33 + end 1.34 + if not formatting_engine_valid then 1.35 + error("invalid formatting engine!") 1.36 end 1.37 end 1.38 -if not formatting_engine_valid then 1.39 - error("invalid formatting engine!") 1.40 -end 1.41 1.42 -if param.get("preview") then 1.43 +if param.get("preview") or param.get("edit") then 1.44 return 1.45 end 1.46 1.47 @@ -155,7 +164,6 @@ 1.48 end 1.49 initiative.issue_id = issue.id 1.50 initiative.name = name 1.51 -param.update(initiative, "discussion_url") 1.52 initiative:save() 1.53 1.54 local draft = Draft:new()