Sha256: 7a301938a4c6905c33eba3b495b63f04504912f21ce9d756898636a6c4a6a7e3

Contents?: true

Size: 817 Bytes

Versions: 138

Compression:

Stored size: 817 Bytes

Contents

module Avo
  module Services
    class PanelService
      attr_accessor :request
      attr_accessor :params
      attr_accessor :resource

      def initialize(request: nil, resource: nil)
        @request = request
        @params = request.params
      end

      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
    end
  end
end

Version data entries

138 entries across 138 versions & 1 rubygems

Version Path
avo-1.25.2 lib/avo/services/panel_service.rb
avo-1.25.1 lib/avo/services/panel_service.rb
avo-1.25.0 lib/avo/services/panel_service.rb
avo-1.24.2 lib/avo/services/panel_service.rb
avo-1.24.1 lib/avo/services/panel_service.rb
avo-1.24.0 lib/avo/services/panel_service.rb
avo-1.23.0 lib/avo/services/panel_service.rb
avo-1.22.4 lib/avo/services/panel_service.rb
avo-1.22.3 lib/avo/services/panel_service.rb
avo-1.22.2 lib/avo/services/panel_service.rb
avo-1.22.1 lib/avo/services/panel_service.rb
avo-1.22.1.pre.2 lib/avo/services/panel_service.rb
avo-1.22.1.pre.1 lib/avo/services/panel_service.rb
avo-1.22.0 lib/avo/services/panel_service.rb
avo-1.22.0.pre.1 lib/avo/services/panel_service.rb
avo-1.21.1.pre.1 lib/avo/services/panel_service.rb
avo-1.21.0 lib/avo/services/panel_service.rb
avo-1.20.2.pre.2 lib/avo/services/panel_service.rb
avo-1.20.2.pre.1 lib/avo/services/panel_service.rb
avo-1.21.0.pre.1 lib/avo/services/panel_service.rb