Class: Avo::Services::PanelService
- Inherits:
-
Object
- Object
- Avo::Services::PanelService
- Defined in:
- lib/avo/services/panel_service.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#request ⇒ Object
Returns the value of attribute request.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #default_panel_name ⇒ Object
-
#initialize(request: nil, resource: nil) ⇒ PanelService
constructor
A new instance of PanelService.
Constructor Details
#initialize(request: nil, resource: nil) ⇒ PanelService
Returns a new instance of PanelService.
8 9 10 11 |
# File 'lib/avo/services/panel_service.rb', line 8 def initialize(request: nil, resource: nil) @request = request @params = request.params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/avo/services/panel_service.rb', line 5 def params @params end |
#request ⇒ Object
Returns the value of attribute request.
4 5 6 |
# File 'lib/avo/services/panel_service.rb', line 4 def request @request end |
#resource ⇒ Object
Returns the value of attribute resource.
6 7 8 |
# File 'lib/avo/services/panel_service.rb', line 6 def resource @resource end |
Instance Method Details
#default_panel_name ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/avo/services/panel_service.rb', line 13 def default_panel_name return @request[:via_relation_param].capitalize if @request[:via_relation_param] == "has_one" case @view when :show I18n.t("avo.resource_details", item: @resource.name.downcase, title: @resource.model_title).upcase_first when :edit I18n.t("avo.update_item", item: @resource.name.downcase, title: @resource.model_title).upcase_first when :new I18n.t("avo.create_new_item", item: @resource.name.downcase).upcase_first end end |