Module: Nuntius::ApplicationHelper
- Defined in:
- app/helpers/nuntius/application_helper.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
65
66
67
68
69
70
71
|
# File 'app/helpers/nuntius/application_helper.rb', line 65
def method_missing(method, *args, &block)
if main_app.respond_to?(method)
main_app.send(method, *args)
else
super
end
end
|
Instance Method Details
34
35
36
37
38
39
|
# File 'app/helpers/nuntius/application_helper.rb', line 34
def
Satis::Menus::Builder.build([:nuntius, :campaigns]) do |m|
m.item :new, link: nuntius.new_admin_campaign_path
m.item :lists, link: nuntius.admin_lists_path
end
end
|
5
6
7
8
9
10
11
12
13
14
|
# File 'app/helpers/nuntius/application_helper.rb', line 5
def
Satis::Menus::Builder.build(:dashboard) do |m|
m.item :messages, link: nuntius.admin_messages_path, icon: "fal fa-envelope"
m.item :templates, link: nuntius.admin_templates_path, icon: "fal fa-file"
m.item :layouts, link: nuntius.admin_layouts_path, icon: "fal fa-table-layout"
m.item :locales, link: nuntius.admin_locales_path, icon: "fal fa-language"
m.item :campaigns, link: nuntius.admin_campaigns_path, icon: "fal fa-megaphone"
m.item :lists, link: nuntius.admin_lists_path, icon: "fal fa-address-book"
end
end
|
22
23
24
25
26
|
# File 'app/helpers/nuntius/application_helper.rb', line 22
def
Satis::Menus::Builder.build([:nuntius, :layouts]) do |m|
m.item :new, link: nuntius.new_admin_layout_path
end
end
|
47
48
49
50
51
|
# File 'app/helpers/nuntius/application_helper.rb', line 47
def
Satis::Menus::Builder.build([:nuntius, :lists]) do |m|
m.item :new_subscriber, link: nuntius.new_admin_list_subscriber_path(@list) if @list.persisted?
end
end
|
41
42
43
44
45
|
# File 'app/helpers/nuntius/application_helper.rb', line 41
def
Satis::Menus::Builder.build([:nuntius, :lists]) do |m|
m.item :new, link: nuntius.new_admin_list_path
end
end
|
28
29
30
31
32
|
# File 'app/helpers/nuntius/application_helper.rb', line 28
def
Satis::Menus::Builder.build([:nuntius, :locales]) do |m|
m.item :new, link: nuntius.new_admin_locale_path
end
end
|
16
17
18
19
20
|
# File 'app/helpers/nuntius/application_helper.rb', line 16
def
Satis::Menus::Builder.build([:nuntius, :templates]) do |m|
m.item :new, link: nuntius.new_admin_template_path
end
end
|
#present(model, presenter_class = nil) {|presenter| ... } ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
|
# File 'app/helpers/nuntius/application_helper.rb', line 53
def present(model, presenter_class = nil)
array = nil
if model.is_a? Array
array = model
model = model.first
end
klass = presenter_class || "#{model.class}Presenter".constantize
presenter = array ? array.map { |m| klass.new(m) } : klass.new(model)
yield(presenter) if block_given?
end
|