Class: Goldencobra::ApplicationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Goldencobra::ApplicationController
show all
- Defined in:
- app/controllers/goldencobra/application_controller.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
Catcher for undefined Goldencobra Callback Hooks
66
67
68
69
70
|
# File 'app/controllers/goldencobra/application_controller.rb', line 66
def method_missing(meth, *args)
unless [:before_init, :before_render, :after_init, :after_index].include?(meth.to_sym)
super
end
end
|
Instance Method Details
#after_sign_in_path_for(resource_or_scope) ⇒ Object
15
16
17
|
# File 'app/controllers/goldencobra/application_controller.rb', line 15
def after_sign_in_path_for(resource_or_scope)
request.referrer
end
|
#after_sign_out_path_for(resource_or_scope) ⇒ Object
11
12
13
|
# File 'app/controllers/goldencobra/application_controller.rb', line 11
def after_sign_out_path_for(resource_or_scope)
request.referrer
end
|
#initialize_article(current_article) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/goldencobra/application_controller.rb', line 33
def initialize_article(current_article)
Goldencobra::Article::LiquidParser["current_article"] = current_article
meta_tags = {
:site => s('goldencobra.page.default_title_tag'),
:title => current_article.metatag("Title Tag").present? ? current_article.metatag("Title Tag") : current_article.title,
:reverse => true,
:description => current_article.metatag("Meta Description"),
:keywords => current_article.metatag("Keywords"),
:open_graph => {
:title => current_article.metatag("OpenGraph Title"),
:description => current_article.metatag("OpenGraph Description"),
:type => current_article.metatag("OpenGraph Type"),
:url => current_article.metatag("OpenGraph URL"),
:image => current_article.metatag("OpenGraph Image")
}
}
if current_article.robots_no_index
meta_tags[:noindex] = current_article.robots_no_index
end
if !current_article.canonical_url.blank?
meta_tags[:canonical] = current_article.canonical_url
end
set_meta_tags meta_tags
end
|
#s(name) ⇒ Object
27
28
29
30
31
|
# File 'app/controllers/goldencobra/application_controller.rb', line 27
def s(name)
if name.present?
Goldencobra::Setting.for_key(name)
end
end
|
#set_locale ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/goldencobra/application_controller.rb', line 5
def set_locale
unless Rails.env == "test"
I18n.locale = params[:locale] || session[:locale]
end
end
|