Class: PolicyManager::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- PolicyManager::ApplicationController
show all
- Includes:
- Doorman::Controller
- Defined in:
- app/controllers/policy_manager/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
#admin_user ⇒ Object
40
41
42
|
# File 'app/controllers/policy_manager/application_controller.rb', line 40
def admin_user
self.send("current_#{Config.admin_user_resource.name.underscore}")
end
|
#allow_admins ⇒ Object
11
12
13
|
# File 'app/controllers/policy_manager/application_controller.rb', line 11
def allow_admins
return redirect_to pending_user_terms_path unless Config.is_admin?(current_user)
end
|
#doc ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'app/controllers/policy_manager/application_controller.rb', line 15
def doc
require "redcarpet"
@markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true, fenced_code_blocks: true)
lines = File.open( PolicyManager::Engine.root.join("README.md")).readlines
@html = @markdown.render(lines.join(""))
render "policy_manager/doc"
end
|
#set_language ⇒ Object
32
33
34
|
# File 'app/controllers/policy_manager/application_controller.rb', line 32
def set_language
I18n.locale = Config.user_language(current_user)
end
|
#user_authenticated? ⇒ Boolean
24
25
26
27
28
29
30
|
# File 'app/controllers/policy_manager/application_controller.rb', line 24
def user_authenticated?
if !current_user
render :file => "policy_manager/401.erb",
:layout => "policy_manager/blank",
:status => :unauthorized
end
end
|