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

#nuntius_campaigns_menuObject



34
35
36
37
38
39
# File 'app/helpers/nuntius/application_helper.rb', line 34

def nuntius_campaigns_menu
  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

#nuntius_dashboard_menuObject



5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/nuntius/application_helper.rb', line 5

def nuntius_dashboard_menu
  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

#nuntius_layouts_menuObject



22
23
24
25
26
# File 'app/helpers/nuntius/application_helper.rb', line 22

def nuntius_layouts_menu
  Satis::Menus::Builder.build([:nuntius, :layouts]) do |m|
    m.item :new, link: nuntius.new_admin_layout_path
  end
end

#nuntius_list_menuObject



47
48
49
50
51
# File 'app/helpers/nuntius/application_helper.rb', line 47

def nuntius_list_menu
  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

#nuntius_lists_menuObject



41
42
43
44
45
# File 'app/helpers/nuntius/application_helper.rb', line 41

def nuntius_lists_menu
  Satis::Menus::Builder.build([:nuntius, :lists]) do |m|
    m.item :new, link: nuntius.new_admin_list_path
  end
end

#nuntius_locales_menuObject



28
29
30
31
32
# File 'app/helpers/nuntius/application_helper.rb', line 28

def nuntius_locales_menu
  Satis::Menus::Builder.build([:nuntius, :locales]) do |m|
    m.item :new, link: nuntius.new_admin_locale_path
  end
end

#nuntius_templates_menuObject



16
17
18
19
20
# File 'app/helpers/nuntius/application_helper.rb', line 16

def nuntius_templates_menu
  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

Yields:

  • (presenter)


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