user1211674
user1211674

Reputation: 77

Menu in Refiney CMS

Sorry for that, but a new I new in rails. Well I created an application and I'm started editing the front end pages

In Refinery guide tells me to edit the application.html.erb. Then I started editing as follows:

<!DOCTYPE html>
<html>
<head>
  <title>A3 Soccer</title>
  <%= stylesheet_link_tag :all %>
  <%= javascript_include_tag :defaults %>
  <%= csrf_meta_tag %>
</head>
<body>


<div id="page_container">
      <header>
        <h1 id='logo'>
  <a href="http://localhost:3000/"><img src="images/logo.png" /></a>
</h1>
<nav id='menu' class='menu clearfix'>
  <ul>
    <li class='selected first' id='item_0'>
  <a href="/">Home</a></li>
<li class='last' id='item_1'>
  <a href="/about">About</a></li>
  </ul>
</nav>

      </header>
      <section id='page'>
        <section id='body_content' class='no_body_content_right'>


<%= yield %>

 <div id="footer">
     <p>dsfdsfdsf</p>
      </div>



</body>
</html>

But this part of the menu is static:

<nav id='menu' class='menu clearfix'>
  <ul>
    <li class='selected first' id='item_0'>
  <a href="/">Home</a></li>
<li class='last' id='item_1'>
  <a href="/about">About</a></li>
  </ul>
</nav>

How do I leave it dynamic?

I want to: when I create a page in the admin, that link(of page) to appear in menu of pages on my site

Upvotes: 0

Views: 1794

Answers (3)

Neal
Neal

Reputation: 63

Try adding

<%= render(:partial => "/refinery/menu", :locals => {
         :dom_id => 'menu',
         :css => 'menu'
       }) %>

to your file.

https://github.com/resolve/refinerycms/blob/master/core/app/views/refinery/_header.html.erb

Upvotes: 0

GoGoGarrett
GoGoGarrett

Reputation: 623

In refinery you typically do not want to override the application.html.erb as it generally takes care of all the functionally you need.

You can take a look at what the file is doing here: https://github.com/resolve/refinerycms/blob/master/core/app/views/layouts/application.html.erb#L1

This file has a lot of calls to other partials that bring in what is needed in each area. For example the header is with a partial called _header.html.erb seen here:

https://github.com/resolve/refinerycms/blob/master/core/app/views/refinery/_header.html.erb#L1

Again here another partial is called to render the menu - that is dynamic.

I would highly suggest to not override these files as these typically do everything you need by default, but on the chance you do need to override them you can run the command:

bundle exec rake refinery:override view=refinery/_header

(you can run simply rake refinery:override to see examples and other options of how this feature works)

Upvotes: 0

slindsey3000
slindsey3000

Reputation: 4269

Are you sure it is not already dynamic? Create another page and see if it shows up in the navigation. I have not used Refinery in about 6 months but the navigation was always dynamic by default.

Upvotes: 1

Related Questions