merged/app/views/merged/sections/show.haml

82 lines
3.2 KiB
Plaintext

.mx-20.flex.h-16.items-center.gap-16.w-full
= render "sections_pagination" , section: @section
= link_to( merged.new_page_section_path(@section.page.id) ) do
.button.change New Section
= render_section( @section )
.flex.gap-8.my-10.flex-wrap.mx-20
.basis-80
%h3.text-lg.font-bold= @section.template_style.header
= section_preview(@section , class: "w-full object-contain my-4")
= link_to merged.section_select_template_path(@section.id) do
.button.action Change Style
= link_to merged.new_page_section_path(@section.page.id , template: @section.template) do
.button.change New Section
.basis-full.mt-3
Updated at:
= distance_of_time_in_words_to_now(@section.updated_at)
.basis-full.mb-3
Updated by:
= @section.updated_by
= simple_form_for( @section , method: :patch ) do |f|
= f.input :page_id , label: "move to page" , include_blank: false ,
collection: Merged::Page.all.collect{|p| [p.name , p.id]}
%button.button.change{type: :submit} Move
.basis-80.image
= link_to(merged.images_path(section_id: @section.id)) do
-if @section.image
%h3.text-lg.font-bold Image #{@section.image.name}
.flex.align-center.justify-between.mb-4
.text-lg.font-bold.mt-2.mx-2
= @section.image.size.to_s + "k"
%strong.inline-block.rounded.bg-slate-200.px-3.py-1.text-md.font-medium
= @section.image.aspect_ratio
= image_for( @section )
-else
%h3.text-lg.font-bold No Image
.flex
=link_to merged.images_path(section_id: @section.id) do
.button.action.mt-4 Change Image
- if( @section.image )
=link_to merged.image_path(@section.image.id) do
.button.change.mt-4 Edit Image
=link_to merged.section_set_image_path( @section.id , image: "") do
.button.remove.mt-4 Remove image
.basis-80.grow.content_update
%label.block
%h4.text-lg.font-bold Texts
= simple_form_for( @section , method: :patch) do |f|
= f.input :header
= f.input :text , as: :text , input_html: {rows: rows(@section)}
%button.button.change.mt-4{type: :submit} Update Texts
- if( @section.has_cards? )
.basis-full.h-0
.basis-96
.mx-3.text-lg.font-bold Card Style #{@section.card_template}
=card_preview(@section , class: "my-3")
%p.py-3
=green_button("Change Card Style", merged.section_select_card_template_path(@section.id))
.basis-96.grow
%h3.text-lg.font-bold #{@section.cards.length} Cards
-@section.cards.each do |card|
.mt-4.text-md.font-bold= card.header
.text-sm #{card.text[0..70]} .....
%p.p-3
= green_button( "View and Edit Cards" , merged.section_cards_path(@section.id))
= blue_button( "New Card" , merged.new_section_card_path(@section.id) )
.basis-80.grow
= simple_form_for( @section , method: :patch , class: "mx-auto mb-0 max-w space-y-4") do
- @section.option_definitions.each do |option|
.grid.grid-cols-3
=render "option_form_#{option.type}" , section: @section , option: option
-if @section.option_definitions.empty?
%p No options
-else
%button.button.change.mt-4{type: :submit} Update Options