Part page with custom template

31 views
Skip to first unread message

Kotjon Rasolomanana

unread,
Apr 1, 2024, 1:18:33 AMApr 1
to Refinery CMS
Hello!
I'm building a website with RefineryCms,
I wanted to apply custom template for some side body i've created (I want to let the site administrator to select the template they want when creating page part).
I'm asking how to do it ?
I've tried the view /layout template but i didn't succeed.

Could you please point me out some way on how it can be achieved?

Cheers

Anita Graham

unread,
Apr 3, 2024, 9:48:12 PMApr 3
to Refinery CMS
There are some ways you could do this. I've just spent some time looking at one, but I misread your post, so its not quite what you want.
My approach centred on defining different page types, each with a different set of predefined page_parts.

However to make choice at the time of creating the page part
1.  You would need to have a list of predefined page_part types
2.  Add a page_part_type selection to the _form_new_page_part.rb partial, 
3. and now it requires a bit of thinking...  you need to ensure that the part is rendered with the correct partial.

I have used a variation of tabs to get an engine to display partials as editor tabs.

config.after_initialize do
  tabs = [
   { title: 'Admin Tools', partial: 'admin_tools' }, 
   { title: 'Tips', partial: 'visual_editor_text', field s: :tips },
   { title: 'SEO', partial: 'seo' }
  ]

  tabs.each do |t|
    Refinery::Pages::Tab.register do |tab|
      tab.name = t[:title]
      tab.partial = "/refinery/products/admin/products/tabs/#{t[:partial]}"
      tab.fields = t[:fields]
    end
  end
end

This will display these tabs for all pages. 

Will keep on thinking about it. 


Kotjon Rasolomanana

unread,
Apr 6, 2024, 6:37:51 PMApr 6
to Refinery CMS
Thank you Anita for your response I appreciate it,

Yes I expected something kind of layout or view template per part page.
alright, these tabs are displayed for all pages. 

Again thank you very much.
Reply all
Reply to author
Forward
0 new messages