merged/app/views/merged/pages/index.haml

50 lines
2.7 KiB
Plaintext

.mx-20.flex.h-16.items-center.gap-16
.text-xl.font-bold.text-gray-900
= link_to( "All" , merged.pages_path(type: '') , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{params[:type].blank? ? 'bg-blue-200':''}")
- @page_styles.each do |style|
= link_to( "Only #{style.type.capitalize}s" , merged.pages_path(type: style.type) , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{(params[:type] == style.type) ? 'bg-blue-200':''}")
.overflow-hidden.overflow-x-auto.rounded-lg.border.border-gray-200.mx-20.my-10
%table.min-w-full.divide-y.divide-gray-200.text-sm
%thead.bg-gray-100
%tr
-["Index", "Name","Sections" ,"Updated" ,"Edited by" ,
"Sections at", "Sections by","Actions"].each do |header|
%th.whitespace-nowrap.px-4.py-2.text-left.font-medium.text-gray-900
.flex.items-center.gap-2
= header
%tbody.divide-y.divide-gray-200
- @pages.each do |page|
%tr{id: page.name}
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to page.id , merged.page_path(page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= link_to page.name , merged.page_sections_path(page.id)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= page.sections.length
%td.whitespace-nowrap.px-4.py-2.text-gray-700
= distance_of_time_in_words_to_now(page.updated_at)
%td.whitespace-nowrap.px-4.py-2.text-gray-700
=page.updated_by
- s = page.sections_update
%td.whitespace-nowrap.px-4.py-2.text-gray-700
=distance_of_time_in_words_to_now(s&.updated_at) if s
%td.whitespace-nowrap.px-4.py-2.text-gray-700
=s.updated_by if s
%td.whitespace-nowrap.px-4.py-2
%strong.rounded.bg-green-100.px-3.text-xs.font-medium.text-green-700{:class => "py-1.5"}
= link_to 'Sections', merged.page_sections_path(page.id)
%strong.ml-2.rounded.bg-amber-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
= link_to 'Edit', merged.page_path(page.id)
%strong.ml-2.rounded.bg-blue-100.px-3.text-xs.font-medium.text-amber-700{:class => "py-1.5"}
=link_to "View live" , "/#{page.name}" , target: page.name
.flex.mx-20.new_page
= form_tag( merged.pages_path , {method: :post } ) do
%label.block
%h4.text-lg.font-bold Name
= text_field_tag( :name , params[:name], class: "block w-full rounded-lg border-gray-200 p-4 pr-12 text-sm shadow-sm")
.flex.gap-3.mt-3.justify-between
- @page_styles.each do |page|
%button.button.change{name: :type , value: page.type}= "New #{page.type.capitalize}"