public
Description: HomeMarks is a web based GUI to build HTML start pages.
Homepage: http://www.homemarks.com/
Clone URL: git://github.com/metaskills/homemarks.git
Search Repo:
Click here to lend your support to: homemarks and make a donation at www.pledgie.com !
commit  5e0a0fc476f3b84fe4a4c63724ceff5d29887cb2
tree    a7f338acde2543877a00cfc8972e65c9d76878fa
parent  b95435740a6410e82e42f8e6981fdbc80d31da4f
homemarks / app / controllers / application.rb
100644 54 lines (39 sloc) 1.27 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class ApplicationController < ActionController::Base
  
  include ERB::Util, AuthenticatedSystem, RenderInvalidRecord
  
  protect_from_forgery
  
  layout :site_or_application_layout
  before_filter :login_required
  
  
  
  protected
  
  def site_or_application_layout
    controller_name =~ /^(site|support_requests|sessions|users)$/ ? 'site' : 'application'
  end
  
  # FIXME: Add an error mailer, or use exception notification plugin.
  def rescue_action_in_public(exception)
    unless controller_name == 'bookmarklet'
      flash[:bad] = "Sorry, unknown error."
      respond_to do |format|
        format.html { redirect_to myhome_url }
        format.js { render(:update) { |page| page.redirect_to(myhome_url) } }
      end
    end
  end
  
  def nil_demo_account
    if session[:demo] == true
      session[:user] = nil
      session[:demo] = nil
    end
  end
  
  def control_demo_user
    if session[:demo] == true
      if request.get?
        @disable_forms = true
      elsif request.xhr?
        flash[:bad] = "Demo action is disabled"
        render(:update) {|page| page.redirect_to(myhome_url)}
      elsif request.post?
        flash[:bad] = "Demo action is disabled"
        redirect_to myhome_url
      end
    end
  end
  
  
  
end