Module: Motr::Cargo::Delivery::Helpers

Extended by:
ActiveSupport::Concern
Included in:
Motr::CargoContextsController
Defined in:
lib/motr/cargo/delivery/helpers.rb

Instance Method Summary collapse

Instance Method Details

#cargo_context_path(pack, context, options = {}) ⇒ Object



12
13
14
# File 'lib/motr/cargo/delivery/helpers.rb', line 12

def cargo_context_path(pack, context, options = {})
  motr_cargo_context_path(pack.class.name.to_s, pack.id, context.id, options)
end

#cargo_context_url(pack, context, options = {}) ⇒ Object



16
17
18
# File 'lib/motr/cargo/delivery/helpers.rb', line 16

def cargo_context_url(pack, context, options = {})
  motr_cargo_context_url(pack.class.name.to_s, pack.id, context.id, options)
end

#cargo_contexts_path(pack, options = {}) ⇒ Object



20
21
22
# File 'lib/motr/cargo/delivery/helpers.rb', line 20

def cargo_contexts_path(pack, options = {})
  motr_cargo_contexts_path(pack.scope_type, pack.id, options)
end

#cargo_contexts_url(pack, options = {}) ⇒ Object



24
25
26
# File 'lib/motr/cargo/delivery/helpers.rb', line 24

def cargo_contexts_url(pack, options = {})
  motr_cargo_contexts_url(pack.scope_type, pack.id, options)
end

#edit_cargo_context_path(pack, context, options = {}) ⇒ Object



28
29
30
# File 'lib/motr/cargo/delivery/helpers.rb', line 28

def edit_cargo_context_path(pack, context, options = {})
  edit_motr_cargo_context_path(pack.class.name.to_s, pack.id, context.id, options)
end

#edit_cargo_context_url(pack, context, options = {}) ⇒ Object



32
33
34
# File 'lib/motr/cargo/delivery/helpers.rb', line 32

def edit_cargo_context_url(pack, context, options = {})
  edit_motr_cargo_context_url(pack.class.name.to_s, pack.id, context.id, options)
end

#scope_classObject



40
41
42
# File 'lib/motr/cargo/delivery/helpers.rb', line 40

def scope_class
  (params[:scope_name] || self.class.to_s.split("::").first.gsub(/controller/i, '').singularize).constantize
end

#scope_nameObject



36
37
38
# File 'lib/motr/cargo/delivery/helpers.rb', line 36

def scope_name
  (action_name.to_s === 'index' ? scope_class.to_s.pluralize : scope_class.to_s).underscore
end