Class: Rich::CmsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/rich/cms_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_rich_cms_login(authenticated, key) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/rich/cms_controller.rb', line 38

def (authenticated, key)
  if request.xhr?
    render :update do |page|
      if authenticated
        page.reload
      else
        page["##{key}_#{rich_cms_authentication_inputs.first}"].focus
      end
    end
  else
    redirect_to request.referrer
  end
end

#after_rich_cms_logoutObject



54
55
56
# File 'app/controllers/rich/cms_controller.rb', line 54

def after_rich_cms_logout
  redirect_to request.referrer
end

#displayObject



7
8
9
10
# File 'app/controllers/rich/cms_controller.rb', line 7

def display
  (session[:rich_cms] ||= {})[:display] = params[:display]
  request.xhr? ? render(:nothing => true) : redirect_to(request.referrer)
end

#loginObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/rich/cms_controller.rb', line 17

def 
  case rich_cms_auth.logic
  when :authlogic
    @current_rich_cms_admin_session = rich_cms_authenticated_class.new params[key = rich_cms_authenticated_class.name.underscore.gsub("/", "_")]
    authenticated = @current_rich_cms_admin_session.save

     authenticated, key
  end
end

#logoutObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/rich/cms_controller.rb', line 27

def logout
  case rich_cms_auth.logic
  when :authlogic
    (@current_rich_cms_admin_session ||= rich_cms_authenticated_class.find).destroy
  end
  session[:rich_cms] = nil

  after_rich_cms_logout
end

#positionObject



12
13
14
15
# File 'app/controllers/rich/cms_controller.rb', line 12

def position
  session[:rich_cms][:position] = params[:position]
  render :nothing => true
end

#updateObject



59
60
61
# File 'app/controllers/rich/cms_controller.rb', line 59

def update
  render :json => Cms::Content::Item.new(params[:content_item]).save
end