On Feb 1, 2010, at 8:37 AM, tomPorter wrote:

I have an app where I am adding users manually as opposed to allowing
the signup action.  Then they make use of the forgot password link to
reset their password.

I found out how to only allow admins to edit, add, or delete users,
but any user or guest can still see the users tab on the home page.

How can I conditionally display/hide the users tab based on whether a
user is signed in with admin authority?

This is a real vanilla app, no custom pages at all.


I'm not 100% sure that there's a way to make the default nav do this; it's primarily intended as scaffolding until you build some real navigation. But you can just define your own:

<def tag="main-nav">
  <navigation class="main-nav" merge-attrs>
    <nav-item href="/">Home</nav-item>
<nav-item to="&User" if="&current_user.administrator?">Users</nav- item>
  </navigation>
</def>

The navigation/nav-item pairing is even more useful when you start adding name= attributes to nav-items and using snippets like this:

<page title="Some Page">
  <main-nav: current="some_nav_item" />
</page>

to indicate which tab should show as "current".

Hope this helps - when things quiet down a bit here at work, my goal is to put together some navigation recipes, as there's a lot of different approaches.

--Matt Jones

--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to