story cleanup, form, policy

This commit is contained in:
2023-01-22 13:17:27 +02:00
parent 10bdfa39cd
commit 3513b2ada4
7 changed files with 47 additions and 46 deletions

View File

@ -5,10 +5,11 @@ module ApplicationHelper
# different template according to the amount of text
def render_story(story)
return "" unless story
puts story.text.length
text_length = story.text.length
template = "text"
template = "half" if text_length < 400
template = "pic" if text_length < 200
template = "half" if text_length < 500
template = "pic" if text_length < 300
render partial: "stories/#{template}" , locals: {story: story}
end