Class: KonoUtils::Object::Cell::Base
Overview
Direct Known Subclasses
Bases::Layout, Buttons::Base, Containers::Layout, Create::Base, Edits::Base, FieldSelectors::Layout, Fields::Base, Forms::Base, KonoUtils::Object::Cell::Buttons::CollapseSearch, KonoUtils::Object::Cell::Buttons::Create, KonoUtils::Object::Cell::Buttons::Delete, KonoUtils::Object::Cell::Buttons::Download, KonoUtils::Object::Cell::Buttons::Edit, KonoUtils::Object::Cell::Buttons::List, KonoUtils::Object::Cell::Buttons::ResetSearch, KonoUtils::Object::Cell::Buttons::Show, Create::PageTitle, Create::SideTitle, Edits::PageTitle, Edits::SideTitle, Form, Forms::Container, Forms::FieldSelector, Forms::Fields::Association, Forms::Fields::CheckBox, Forms::Fields::Collection, Forms::Fields::DateTimeField, Forms::Fields::FileField, Forms::Fields::NestedWrapper, Forms::Fields::ReadOnly, Forms::Layout, Forms::Submit, Index::Base, Index::Row, Inject, Search, Show, Shows::PageTitle, Shows::SideTitle, Modals::Base, Modals::Body, Modals::Container, Modals::Footer, Modals::Header, NestedWrappers::Form, NestedWrappers::Forms::Layout, NestedWrappers::FormsContainer, NestedWrappers::FormsContainers::Layout, NestedWrappers::Header, NestedWrappers::RemoveButtons::Layout, Shows::Base
Class Method Summary
collapse
Instance Method Summary
collapse
#fa_icon, #icon
Instance Method Details
#_prefixes ⇒ Object
90
91
92
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 90
def _prefixes
base_class.concept_prefix + super + parent_controller.lookup_context.view_paths.collect(&:to_path)
end
|
#base_class ⇒ Object
16
17
18
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 16
def base_class
context[:base_class] || (@_base_class ||= parent_controller.send(:base_class))
end
|
#concept(name, *args, &block) ⇒ Object
def concept(name, model = nil, options = {}, &block)
77
78
79
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 77
def concept(name, *args, &block)
legacy_concept(base_class.concept_ns(name), *args, &block)
end
|
#content_for_layout(name, content = nil, options = {}, &block) ⇒ String
Registra il contenuto con una chiave, e lo renderizza poi dove è più necessario
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 53
def content_for_layout(name, content = nil, options = {}, &block)
context[:_view_layout_flow] ||= ActionView::OutputFlow.new
if content || block_given?
if block_given?
options = content if content
content = capture(&block)
end
if content
content = content.to_s.html_safe
options[:flush] ? context[:_view_layout_flow].set(name, content) : context[:_view_layout_flow].append(name, content)
end
nil
else
context[:_view_layout_flow].get(name).presence
end
end
|
#content_for_layout?(name) ⇒ Boolean
70
71
72
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 70
def content_for_layout?(name)
context[:_view_layout_flow].get(name).present? rescue false
end
|
#destroy_custom_polymorphic_path(*rec) ⇒ Object
32
33
34
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 32
def destroy_custom_polymorphic_path(*rec)
parent_controller.send(:destroy_custom_polymorphic_path, *rec)
end
|
#edit_custom_polymorphic_path(*rec) ⇒ Object
24
25
26
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 24
def edit_custom_polymorphic_path(*rec)
parent_controller.send(:edit_custom_polymorphic_path, *rec)
end
|
#index_custom_polymorphic_path(*rec) ⇒ Object
28
29
30
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 28
def index_custom_polymorphic_path(*rec)
parent_controller.send(:index_custom_polymorphic_path, *rec)
end
|
#kono_user ⇒ Object
Also known as:
current_user
94
95
96
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 94
def kono_user
context[:kono_user]
end
|
#legacy_concept ⇒ Object
74
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 74
alias_method :legacy_concept, :concept
|
#model_gender ⇒ Object
134
135
136
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 134
def model_gender
t("activerecord.modelgender.#{model.class.name.underscore.to_sym}", :default => :m).to_sym
end
|
#new_custom_polymorphic_path(*base_class) ⇒ Object
20
21
22
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 20
def new_custom_polymorphic_path(*base_class)
parent_controller.send(:new_custom_polymorphic_path, *base_class)
end
|
#show(&block) ⇒ Object
40
41
42
43
44
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 40
def show(&block)
ActiveSupport::Notifications.instrument "kono_utils_bootstrap_view4.#{self.class.name.underscore.gsub("/", ".")}", this: :data do
super
end
end
|
#show_custom_polymorphic_path(*rec) ⇒ Object
36
37
38
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 36
def show_custom_polymorphic_path(*rec)
parent_controller.send(:show_custom_polymorphic_path, *rec)
end
|
#title_del ⇒ Object
114
115
116
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 114
def title_del
"#{t(:del)} #{model.mn}"
end
|
#title_del_g ⇒ Object
126
127
128
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 126
def title_del_g
"#{t("del_title_#{model_gender}", default: 'Cancella')} #{model.mn}"
end
|
#title_edit_g ⇒ Object
118
119
120
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 118
def title_edit_g
"#{t("edit_title_#{model_gender}", default: 'Modifica')} #{model.mn}"
end
|
#title_mod ⇒ Object
102
103
104
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 102
def title_mod
"#{t(:edit)} #{model.mn}"
end
|
#title_new ⇒ Object
106
107
108
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 106
def title_new
"#{t(:new)} #{model.mn}"
end
|
#title_new_g ⇒ Object
122
123
124
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 122
def title_new_g
"#{t("new_title_#{model_gender}", default: 'Nuovo')} #{model.mn}"
end
|
#title_newa ⇒ Object
110
111
112
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 110
def title_newa
"#{t(:newa)} #{model.mn}"
end
|
#title_show_g ⇒ Object
130
131
132
|
# File 'app/concepts/kono_utils/object/cell/base.rb', line 130
def title_show_g
"#{t("show_title_#{model_gender}", default: 'Visualizza')} #{model.mn}"
end
|