liquid_feedback_frontend
diff model/draft.lua @ 1495:17e7082c377a
Added image attachments for initiatives
| author | bsw |
|---|---|
| date | Mon Feb 10 21:10:49 2020 +0100 (2020-02-10) |
| parents | 32cc544d5a5b |
| children |
line diff
1.1 --- a/model/draft.lua Mon Dec 09 15:54:57 2019 +0100 1.2 +++ b/model/draft.lua Mon Feb 10 21:10:49 2020 +0100 1.3 @@ -97,5 +97,19 @@ 1.4 1.5 draft:render_content() 1.6 1.7 + local draft_attachments = DraftAttachment:new_selector() 1.8 + :add_where{ "draft_id = ?", old_draft.id } 1.9 + :exec() 1.10 + 1.11 + for i, draft_attachment in ipairs(draft_attachments) do 1.12 + local new_draft_attachment = DraftAttachment:new() 1.13 + new_draft_attachment.draft_id = draft.id 1.14 + new_draft_attachment.file_id = draft_attachment.file_id 1.15 + new_draft_attachment.title = draft_attachment.title 1.16 + new_draft_attachment.description = draft_attachment.description 1.17 + new_draft_attachment:save() 1.18 + end 1.19 + 1.20 slot.put_into("notice", _"The initiative text has been updated") 1.21 + return draft.id 1.22 end