Module: Wallaby::CoreHelper
Overview
NOTE: Global helper methods should go in here
Instance Method Summary
collapse
#cancel_link, #delete_link, #edit_link, #edit_path, #index_link, #index_path, #new_link, #new_path, #prepend_if, #show_link, #show_path
#icon, #ilink_to, #imodal, #itooltip, #muted, #na, #null
Instance Method Details
#body_class ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/helpers/wallaby/core_helper.rb', line 24
def body_class
[
params[:action],
current_resources_name.try(:gsub, '::', '__'),
content_for(:custom_body_class)
].compact.join ' '
end
|
#ct(key, options = {}) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/helpers/wallaby/core_helper.rb', line 36
def ct(key, options = {})
t key, { raise: true }.merge(options)
rescue I18n::MissingTranslationData => e
keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])
keys.last.to_s.titleize
end
|
#current_model_label ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/helpers/wallaby/core_helper.rb', line 16
def current_model_label
if current_resources_name.present?
label = to_model_label current_resources_name
return "Resource: #{ label }" if label.present?
end
'Resources'
end
|
#model_classes ⇒ Object
47
48
49
|
# File 'lib/helpers/wallaby/core_helper.rb', line 47
def model_classes
Wallaby::Map.model_classes.sort_by &:name
end
|
#page_title ⇒ Object
32
33
34
|
# File 'lib/helpers/wallaby/core_helper.rb', line 32
def page_title
'Wallaby::Admin'
end
|
#random_uuid ⇒ Object
43
44
45
|
# File 'lib/helpers/wallaby/core_helper.rb', line 43
def random_uuid
SecureRandom.uuid
end
|
#to_model_label(model_class) ⇒ Object
8
9
10
|
# File 'lib/helpers/wallaby/core_helper.rb', line 8
def to_model_label(model_class)
Wallaby::Utils.to_model_label model_class
end
|
#to_resources_name(model_class) ⇒ Object
12
13
14
|
# File 'lib/helpers/wallaby/core_helper.rb', line 12
def to_resources_name(model_class)
Wallaby::Utils.to_resources_name model_class
end
|