fix indexing and ordering for section and card

This commit is contained in:
2022-12-11 14:03:21 +02:00
parent 829d653b44
commit 912400b852
13 changed files with 53 additions and 71 deletions

View File

@ -9,7 +9,7 @@
.flex.items-center.justify-center.flex-1
%h3.text-xl.font-bold.tracking-tight.text-gray-900
Cards for
= link_to "Section #{@section.index + 1}", section_url( @section.id) , class: "underline"
= link_to "Section #{@section.index}", section_url( @section.id) , class: "underline"
.grid.grid-cols-4.gap-2.m-8

View File

@ -11,7 +11,7 @@
-@page.sections.each do |section |
.grid.grid-cols-5.gap-2.m-8{class: (section.index%2)==1 ? 'bg-cyan-50' : 'bg-red-50' , id: "section_#{section.id}"}
.relative.block.border.border-gray-100.p-4
%h3.mt-4.text-lg.font-bold Section #{section.index + 1} : #{section.header}
%h3.mt-4.text-lg.font-bold Section #{section.index} : #{section.header}
= blue_button( "Up" , section_move_url(section.id , dir: :up) )
= blue_button( "Down" , section_move_url(section.id , dir: :down) )
= yellow_button("Edit" , section_path(section.id) )

View File

@ -6,7 +6,7 @@
.flex.items-center.justify-center.flex-1
.max-w-xl.px-4.py-8.mx-auto.text-center
%h1.text-3xl.font-bold.tracking-tight.text-gray-900
Select Template for Section #{@section.index + 1}
Select Template for Section #{@section.index}
.grid.grid-cols-4.gap-2.m-8
- @sections.each do |style|

View File

@ -8,7 +8,7 @@
Page #{link_to @section.page.name, page_sections_url(@section.page.name), class: "underline"}
.flex.items-center.justify-center.flex-1
%h3.text-xl.font-bold.tracking-tight.text-gray-900
Section #{@section.index + 1} / #{@section.page.sections.length}
Section #{@section.index} / #{@section.page.sections.length}
- if @section.previous_section
=link_to "(prev)" , section_url(@section.previous_section.id)
- if @section.next_section