I've been subscribed to this mailing list for many months now but  
this is my first time posting. Please forgive me if I do something  
wrong :)

I am trying to use tags to show content based on user session &  
permissions. For example, a custom sidebar for when someone is not  
logged in, for when they are logged in as an administrator, etc.

In the radiant admin this is performed by erb in /vendor/radiant/app/ 
views/layouts/application.rhtml. I could create a layout like this,  
but then I don't have pages that are editable through radiant.

I believe the problem is that the tag I have written does not see the  
radiant application helper. Is there any way to get around this? My  
code is below with the error.


from vendor/extensions/session_tags/app/models/session_tags.rb:

module SessionTags
include Radiant::Taggable

desc %{ Check for admin session. }
tag 'session' do |tag|
if admin?
tag.expand
end
end

end


from vendor/radiant/app/helpers/application_helper.rb:

def admin?
user = session['user']
user and user.admin?
end


in the page part:

<r:session>
Put your radius tags here
</r:session>


outputs:

undefined method `admin?' for #
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to