Footer MenuPresenter link order

22 views
Skip to first unread message

ma...@markproaudio.com

unread,
Jan 6, 2016, 7:35:27 PM1/6/16
to Refinery CMS
I followed the Refinery CMS Guide to add footer menu page links. The guide is quite thorough and I have it working so that I can choose which page links show only in the footer. The one thing it doesn't do is order the pages according to their order on the editor page. If I re-order them the links are still displayed in the order they are stored in the database.

I'm new to Refinery CMS, and Rails too. I understand that I can probably modify some code so that it orders according to the editor order, but I don't where or how to make this change. Anybody know if I can override some code?

I'm running:
RefineryCMS Github master branch
Rails 4.2.5

Thanks,

Mark O.

Philip Arndt

unread,
Jan 6, 2016, 7:37:04 PM1/6/16
to refine...@googlegroups.com
You need to add:

.order("lft ASC")

To where it loads the pages.

Let us know if this doesn't fix it or you aren't sure where that goes.

ma...@markproaudio.com

unread,
Jan 6, 2016, 11:57:49 PM1/6/16
to Refinery CMS
Thanks for the quick response. I found I could add your little bit of code in the app/helpers/application_helper.rb file:

module ApplicationHelper
  def footer_menu
    menu_items = Refinery::Menu.new(Refinery::Page.footer_menu_pages.order("lft ASC") )

   
Refinery::Pages::MenuPresenter.new(menu_items, self).tap do |presenter|
     
presenter.dom_id = "footerNav"
      presenter.css = "footerNav"
      presenter.menu_tag = :div
    end
  end
end

My footer links are now obeying the editor ordering.

Every so often I get a double set of links in the editor. I believe it is because of the footer links.
I saw someone else post about this issue. It went away for a while, but came back after I made this change above.


Reply all
Reply to author
Forward
0 new messages