improve section and preview rendering
This commit is contained in:
parent
c9afd4f3bc
commit
a8f5229935
@ -97,10 +97,6 @@ module Merged
|
||||
def button_classes
|
||||
"mr-3 inline-block rounded-lg px-3 py-2 text-md font-medium border border-gray-500"
|
||||
end
|
||||
# section should be hash with at least 'template' key
|
||||
def find_template(section)
|
||||
"merged/view/" + section.template
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,11 @@ module Merged
|
||||
include MergedHelper
|
||||
include PagesHelper
|
||||
|
||||
def render_section(section)
|
||||
template = "merged/view/" + section.template
|
||||
render( template , section: section)
|
||||
end
|
||||
|
||||
def rows( text )
|
||||
return 5 if text.blank?
|
||||
text = text.text unless text.is_a?(String)
|
||||
|
@ -5,8 +5,7 @@
|
||||
= link_to @section.header , merged.section_path( @section.id) , class: "underline"
|
||||
= link_to( "New Card" , merged.new_section_card_path(@section.id) , class: "p-2 border border-gray-200 bg-cyan-100 font-bold rounded-lg hover:bg-sky-100")
|
||||
|
||||
- template = find_template(@section)
|
||||
= render( template , section: @section)
|
||||
= render_section( @section )
|
||||
|
||||
- @section.cards.each_with_index do |card , index|
|
||||
.flex.gap-10.px-20.pt-4.pb-2.mb-2.border.border-2.bg-neutral-50.border-slate-400{ id: "card_#{card.id}"}
|
||||
|
@ -2,8 +2,7 @@
|
||||
= render "sections_pagination" , section: @section
|
||||
= link_to( "New Section" , merged.new_page_section_path(@section.page.id) , class: button_classes + " bg-cyan-100")
|
||||
|
||||
- template = find_template(@section)
|
||||
= render( template , section: @section)
|
||||
= render_section( @section )
|
||||
|
||||
.flex.gap-8.my-10.flex-wrap.mx-20
|
||||
.basis-80
|
||||
|
@ -7,8 +7,7 @@
|
||||
= distance_of_time_in_words_to_now last_blog.updated_at
|
||||
ago
|
||||
%hr.mt-2.border.border-4.border-gray-600
|
||||
- template = find_template(last_blog)
|
||||
= render( template , section: last_blog)
|
||||
= render_section( last_blog )
|
||||
.flex.justify-between.items-center.border-b-8.border-gray-600
|
||||
.ml-20.mb-2.text-lg
|
||||
= section.text
|
||||
|
@ -1,3 +1,2 @@
|
||||
- @page.sections.each do |section|
|
||||
- template = find_template(section)
|
||||
= render( template , section: section)
|
||||
= render_section( section )
|
||||
|
Loading…
x
Reference in New Issue
Block a user