Permalink
Browse files

Save last viewed template to session.

  • Loading branch information...
1 parent 81d6458 commit fb6c23476ac6a05cd011f35c5f247d7011953a99 Jerry Nummi committed with Adam McCrea Nov 15, 2009
Showing with 12 additions and 1 deletion.
  1. +2 −0 app/controllers/mockups_controller.rb
  2. +9 −0 app/helpers/mockups_helper.rb
  3. +1 −1 app/views/mockups/frameset.html.erb
@@ -23,6 +23,8 @@ def index
end
def show
+ session[:template_name] = params[:template_name]
+ session[:parent_dir] = params[:parent_dir]
template_path = File.join(['mockups', params[:parent_dir], params[:template_name]].compact)
render :template => template_path, :layout => extract_layout(template_path)
end
@@ -0,0 +1,9 @@
+module MockupsHelper
+ def mockup_path_from_session
+ if session[:parent_dir]
+ mockup_path(session[:template_name], :parent_dir => session[:parent_dir])
+ elsif session[:template_name]
+ mockup_path(session[:template_name])
+ end
+ end
+end
@@ -7,7 +7,7 @@
<frameset cols="170,*" frameborder="1" border="1" bordercolor="#666666" framespacing="1">
<frame src="/mockups_index" title="List" name="list" />
- <frame name="content" />
+ <frame name="content" src="<%= mockup_path_from_session %>" />
</frameset>
</html>

0 comments on commit fb6c234

Please sign in to comment.