Simplify with Behaviors

Hi all,

I’m almost finished with a site built on radiant (my first). But I
still don’t understand behaviors fully.

I have a sub-navigation which changes based on the URL, But I can’t
help but feel that:
A) there is a easier, cleaner way to do this even without behaviors and
B) It seems like this would be something to write a behavior for (I
think)

Here is the code, any suggestions?

(also, the if_url to set the class to “activelink” doesn’t seem to work.
It works if it is hard coded but the slug doesn’t seem to return the
right value while in the if_url context.)

(and yes I know about the navigation tag, but I’d still need to check
the url and
iterate through the children to build the array.)

(and…just in case you were wondering why, I don’t want to see the
children of each page, I want to see the children of each section
throughout each page in the entire section
Area
Section
Page
Page <-- If here, still show section and section children
Page
Page
Page )

START sub-nav snippet

<dd class="activelink"> <dd class="activelink"> <dd class="activelink"> <dd class="activelink"> <dd class="activelink"> <dd class="activelink">

end sub-nav snippet

Mac Baker

/me ports a snippet to markaby for giggles.

dl.sub-nav! do
r.if_url_matches “^/$” do
r.find_url("/membership").each do |p|
dd.send(p.current_page?) { link_to p }
end
end
end

Please… for the love of KIS, let’s start to move away from the
gobbly gook that is radius (at least within the domain of
radiant.layouts).

:slight_smile:


Caylan

Caylan Van L. wrote:

Please… for the love of KIS, let’s start to move away from the gobbly
gook that is radius (at least within the domain of radiant.layouts).

Not everyone can afford to let users put ruby code in the database.

Your plugin for markaby makes it simple enough, eh? :wink:


John L.
http://wiseheartdesign.com

Okey,

here’s a simple one that I’ve been unable to find in the list
archives: when using Radiant as a weblog and I display a single post,
how can I refer to the previous and next pages so I can do the the
previous/next link thingy? OK, I imagine I can use r:children with an
offset, but where do I place it so it only renders when viewing a
single page?

andrew

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs