Sha256: 1e549f51dd212e01d6ea6a708270179d907ad7bae86add68562684e5bb5e085a

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

module Adminpanel
  module RouterHelper
    def gallery_is_sortable?(resource)
      resource_class(resource).has_sortable_gallery?
    end

    def sortable_galleries(resource)
      resource_class(resource).sortable_galleries
    end

    def resources_parameters(resource)
      resource_class(resource).routes_options
    end

    def has_fb_share?(resource)
      resource_class(resource).fb_share?
    end

    def has_twitter_share?(resource)
      resource_class(resource).twitter_share?
    end

    def has_gallery?(resource)
      resource_class(resource).has_gallery? || resource_class(resource).has_trix_gallery?
    end

    def resource_is_sortable?(resource)
      resource_class(resource).is_sortable?
    end

    def member_routes(resource)
      resource_class(resource).member_routes
    end

    def collection_routes(resource)
      resource_class(resource).collection_routes
    end

    def rest_path_names
      {
        path_names: {
          new: I18n.t('routes.new'),
          edit: I18n.t('routes.edit'),
          show: I18n.t('routes.show')
        }
      }
    end

    private

      def resource_class(resource)
        "adminpanel/#{resource.to_s.singularize}".classify.constantize
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminpanel-3.3.0 app/helpers/adminpanel/router_helper.rb
adminpanel-3.2.1 app/helpers/adminpanel/router_helper.rb
adminpanel-3.2.0 app/helpers/adminpanel/router_helper.rb