Class: Ez::Resources::FormCell
Constant Summary
ApplicationCell::CSS_SCOPE
Instance Method Summary
collapse
#css_for, #custom_css_map, #div_for, form, #t
Instance Method Details
8
9
10
11
12
13
14
|
# File 'app/cells/ez/resources/form_cell.rb', line 8
def
if model.data.new_record?
"#{t('actions.new')} #{model.resource_name.downcase}"
else
"#{t('actions.edit')} #{model.data.public_send(model.resource_label)} #{model.resource_name.downcase}"
end
end
|
#readonly? ⇒ Boolean
16
17
18
19
20
21
22
|
# File 'app/cells/ez/resources/form_cell.rb', line 16
def readonly?
@readonly ||= if model.data.new_record?
!Ez::Resources::Manager::Hooks.can?(:can_create?, model, model.data)
else
!Ez::Resources::Manager::Hooks.can?(:can_update?, model, model.data)
end
end
|
#submit_button_text ⇒ Object
24
25
26
27
28
29
30
|
# File 'app/cells/ez/resources/form_cell.rb', line 24
def submit_button_text
if model.data.new_record?
t('actions.create')
else
t('actions.update')
end
end
|