Forum: Radiant CMS SiteController sessions and flash access

Posted by Wes Gamble (weyus)
on 2010-10-21 23:22
(Received via mailing list)
All,

1) I read in this post from back in '08
(http://www.ruby-forum.com/topic/142224) that the SiteController had
sessions disabled by default.

Sessions are enabled in my SiteController (which is good, since I am
doing lots of user-centric stuff).  When did that change in the base
Radiant install (or did I turn them on and not remember doing it).

2) I would like to take advantage of the flash for standard
informational messages in my UI.  But there is no built-in access to the
flash.  Has anyone built a tag to access the flash and would you be
willing to share it?

Thanks,
Wes
Posted by Wes Gamble (weyus)
on 2010-10-21 23:55
(Received via mailing list)
My new <r:flash/>  tag - perhaps it is of some use:

    desc %{
       Returns the requested element of the flash for use in layout/page
display.

       *Usage:*

<pre><code><r:flash key="notice"/></code></pre>
     }

     tag "flash" do |tag|
       if key = tag.attr['key']
         flash =
tag.locals.page.response.template.controller.session['flash']
         flash ? (flash[key] || flash[key.to_sym] || '') : ''
       else
         raise TagError.new("`flash' tag must contain `key' attribute")
       end
     end
Posted by swartz (Guest)
on 2010-10-22 01:32
(Received via mailing list)
flash[] with :notice, :error, :success keys are already in use by the
radiant admin.
So if you have a user logged into admin and into you custom auth, you
will get msg's meant for admin interface appear on user side and vice
versa.
This, of course, may be something you that you do want or you dont.
Posted by Wes Gamble (weyus)
on 2010-10-22 01:39
(Received via mailing list)
For now, I am counting on admin. types (which are us) to be mindful
enough to not be logged into user side.

If I have to, I can add admin. logout logic as a before_filter on the
SiteController, and user logout logic as a before filter on the admin
side of things.

W
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.