liquid_feedback_frontend
diff app/main/suggestion/show.lua @ 142:44ba79952610
redirect to initiative if suggestion got deleted when changing to neutral
fixes bug #240
fixes bug #240
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Wed Oct 06 16:18:54 2010 +0200 (2010-10-06) |
parents | 7d0f4721d2f3 |
children | cc64a4fc6ab6 |
line diff
1.1 --- a/app/main/suggestion/show.lua Wed Oct 06 14:34:45 2010 +0200 1.2 +++ b/app/main/suggestion/show.lua Wed Oct 06 16:18:54 2010 +0200 1.3 @@ -1,5 +1,23 @@ 1.4 local suggestion = Suggestion:by_id(param.get_id()) 1.5 1.6 +-- redirect to initiative if suggestion does not exist anymore 1.7 +if not suggestion then 1.8 + local initiative_id = param.get('initiative_id', atom.integer) 1.9 + if initiative_id then 1.10 + slot.reset_all{except={"notice", "error"}} 1.11 + request.redirect{ 1.12 + module='initiative', 1.13 + view='show', 1.14 + id=initiative_id, 1.15 + params = { tab = "suggestions" } 1.16 + } 1.17 + else 1.18 + slot.put_into('error', _"Suggestion does not exist anymore") 1.19 + end 1.20 + return 1.21 +end 1.22 + 1.23 + 1.24 app.html_title.title = suggestion.name 1.25 app.html_title.subtitle = _("Suggestion ##{id}", { id = suggestion.id }) 1.26