merged/app/views/merged/sections/index.haml

86 lines
3.9 KiB
Plaintext

.mx-20.flex.h-16.items-center.gap-16.mb-10
.text-xl.font-bold.text-gray-900
= @page.type.capitalize
= link_to @page.name , merged.page_path(@page)
.text-xl.text-gray-900
=link_to "View live" , "/#{@page.name}" , target: @page.name
= link_to( "New Section" , merged.new_page_section_path(@page.id) , class: button_classes + " bg-cyan-200")
-@page.sections.each do |section |
.flex.gap-10.mt-2.pt-4.pb-2.border-2.bg-neutral-50.border-slate-400{ id: "section_#{section.id}"}
.basis-72.ml-20
%h3.text-lg.font-bold Section #{section.index} : #{section.header}
.flex.flex-wrap.gap-3
= link_to merged.section_path(section.id) do
%button.button.action Edit
= link_to merged.new_page_section_path(@page.id, template: section.template) do
%button.button.change Copy
.p-2
=link_to(merged.section_move_path(section.id , dir: :down)) do
%svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M8.25 6.75L12 3m0 0l3.75 3.75M12 3v18", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.p-2
=link_to(merged.section_move_path(section.id , dir: :up)) do
%svg.w-6.h-6{:fill => "none", :stroke => "currentColor", "stroke-width" => "1.5", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
%path{:d => "M15.75 17.25L12 21m0 0l-3.75-3.75M12 21V3", "stroke-linecap" => "round", "stroke-linejoin" => "round"}
.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
- if section.has_cards?
- if card = section.cards_update
.basis-full
Cards updated at:
= distance_of_time_in_words_to_now(card.updated_at)
.basis-full.mb-3
Cards updated by:
= card.updated_by
.basis-full.mb-3
= form_tag( merged.section_path(section.id) , {method: :delete } ) do
%button.button.remove{type: :submit} Delete
.basis-72
.flow.flow-cols
%h3.text-lg.font-bold.border-bottom-2 Style
= link_to(merged.section_select_template_path(section.id)) do
%p= section.template_style.header
= section_preview(section , class: "object-contain")
.basis-52.grow
%h3.my-4.text-lg.font-bold Header
%p= section.header
%h3.mt-4.text-lg.font-bold Text
%p= section.text[0..100] + " ..." if section.text
.basis-72
- if section.has_cards?
%h3.text-lg.font-bold #{section.cards.length} Cards
=link_to merged.section_cards_path(section.id) do
=card_preview(section , class: "object-contain")
- else
= 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-gray-200.px-3.py-1.text-md.font-medium
= section.image.aspect_ratio
= image_for( section , "h-40 mb-1")
-else
%h3.mt-y.text-lg.font-bold No Image
.basis-96
%h3.text-lg.font-bold Options
.grid.grid-cols-2.gap-3.mx-10
- section.options.each do|name , value|
-unless value.blank?
.font-bold.mt-1= name.camelcase
.font-xl= value
.grid.grid-cols-2.gap-2.m-8
.relative.block
= link_to merged.new_page_section_path(@page.id) do
%button.button.change New Section
.relative.block.delete_page
= form_tag( merged.page_path(@page.id) , {method: :delete } ) do
%button.button.remove{type: :submit} Delete Page