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

@ -0,0 +1,17 @@
%div
Story layout changes with the amount of text.
For short lext a wide picture is best. Otherwise square, and for
longer text a high picture also works.
= simple_form_for @story do |f|
= f.error_notification
= f.input :picture , as: :file , label: (@story.picture.blank? ? "Add picture" : "Change picture")
= f.input :header
= f.input :text , input_html: {rows: rows(@story.text)}
= f.input :happened , wrapper_class: "flex mt-4 align-center"
.flex.justify-between.mt-6
%button.bg-cyan-200.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
= f.submit 'Save'
= link_to @story do
%button.ml-20.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
Back

View File

@ -1,16 +1,5 @@
.grid.grid-cols-3
%div
%div
%h1 Editing story
= simple_form_for @story do |f|
= f.error_notification
= f.input :picture , as: :file , label: (@story.picture.blank? ? "Add picture" : "Change picture")
= f.input :header
= f.input :text , input_html: {rows: rows(@story.text)}
= f.input :happened , wrapper_class: "flex mt-4 align-center"
%button.mt-6.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
= f.submit 'Save'
%button.ml-20.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
= link_to 'Back', @story
%div
.flex.justify-center
.column{class: "w-10/12 md:w-8/12 lg:w-5/12 xl:w-4/12"}
.text-2xl.font-bold.my-4
Edit Story
= render 'form'

View File

@ -1,20 +1,5 @@
.grid.grid-cols-3
%div
%div
%h1 New story
= form_for @story do |f|
- if @story.errors.any?
#error_explanation
%h2= "#{pluralize(@story.errors.count, "error")} prohibited this story from being saved:"
%ul
- @story.errors.full_messages.each do |message|
%li= message
= f.input :picture , as: :file
= f.input :header
= f.input :text
= f.input :happened , class: "flex"
= f.submit 'Save'
= link_to 'Back', stories_path
%div
.flex.justify-center
.column{class: "w-10/12 md:w-8/12 lg:w-5/12 xl:w-4/12"}
.text-2xl.font-bold.my-4
New Story
= render 'form'