I want to conditionally display content in a view based on a session variable. I'm not clear at this stage if there is a built in template language that would allow me to use conditional statements. Below is my first stab at the controller and view code. Can you point me in the right direction for documentation or examples? Any insight is much appreciated.
controller/presentationtest.rb:
class PresentationsController < Ramaze::Controller
map '/presentations'
def authenticate(password)
if password = 'ammpresentations'
session[:logged_in] = true
end
end
end
view/presentations.xhtml:
<p>
Please login below to view the Presentations.
</p>
<form action="#{PresentationsController.r(:authenticate)}" method="POST">
<label for="password">Password</label>
<input type="password" name="password" />
<br /><br />
<input type="submit" value="Login" />
</form>
<!-- conditional check goes here; logged_in = true -->
// here is the content that will be displayed, once you enter password //
<a href="#" >Presentation 1</a><br>
<a href="#" >Presentation 2</a><br>
<a href="#" >Presentation 3</a>
<!-- end of conditional section -->
--
You received this message because you are subscribed to the Google Groups "Ramaze" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/ramaze/-/sOj3wqRefiIJ.
To post to this group, send email to ramaze-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to ramaze+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ramaze?hl=en.