Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

children tag unsupported in hammer #28

Closed
osteffich opened this issue Mar 31, 2015 · 1 comment
Closed

children tag unsupported in hammer #28

osteffich opened this issue Mar 31, 2015 · 1 comment

Comments

@osteffich
Copy link

I'm trying to do a labeled menu, and in hammer I get the error:
Hammer: children tag is not yet implemented

More about labeled menus here: http://cleanslatecms.wvu.edu/how-to/theme-development/page-label-menu

@zeroedin
Copy link
Contributor

Example of how you would use this in your mock_data.yml:

page:
  id: 1
  name: "Home"
  slug: "home"
  url: "#home"
  meta_description: "<%= Faker::Lorem.paragraph(5) %>"
  title: "Home"
  alternate_name: "Index"
  depth: 1

pages:
  - id: 2
    name: "Study of Birds"
    slug: "study-of-birds"
    url: "#study-of-birds"
    meta_description: "<%= Faker::Lorem.paragraph(5) %>"
    title: "Study of Birds"
    alternate_name: "Ornithology"
    depth: 1
  - id: 3
    name: "Study of Fish"
    slug: "study-of-fish"
    url: "#study-of-fish"
    meta_description: "<%= Faker::Lorem.paragraph(5) %>"
    title: "Study of Fish"
    alternate_name: "Ichthyology"
    depth: 1

Note the new syntax for the pages:, there is a YAML array being used:

Example:

Key:
 - id: 1
 - id: 2
 - id: 3

This allow Hammer to get objects with multiple keys and values and is the first implementation of this structure in Hammer mock_data.yml.

Now if you have the following radius tags:

  <ul>
    <r:children:each labels="name-of-your-label">
      <li>
        <a href="<r:page:url />"><r:page:name /></a>
      </li>
    </r:children:each>
  </ul>

Hammer should generate the following HTML:

<ul>
  <li><a href="#home">Home</a></li>
  <li><a href="#study-of-birds">Study of Birds</a></li>
  <li><a href="#study-of-fish">Study of Fish</a></li>
</ul>

This will not do any "finding" based on labels or any of that, it is a fairly dumb loop. And will reproduce the same loop if you were to use :descendants, :ancestors, :children, or :siblings tags.

@zeroedin zeroedin reopened this Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants