Sha256: b0ab518970ef0955ee1cabb0b2087cee253091310d9ddc65da454a17ca13356e

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

module Admin::ResourcesHelper

  def admin_search(resource = @resource, local_params = params)
    if (typus_search = resource.typus_defaults_for(:search)) && typus_search.any?

      hidden_filters = local_params.dup
      rejections = %w(controller action locale utf8 sort_order order_by search page)
      hidden_filters.delete_if { |k, v| rejections.include?(k) }

      render "helpers/admin/resources/search", :hidden_filters => hidden_filters
    end
  end

  def build_sidebar
    app_name = @resource.typus_application
    resources = admin_user.application(app_name).map(&:constantize).delete_if { |k| k.typus_options_for(:hide_from_sidebar) }

    if resources.any?
      render "helpers/admin/resources/sidebar", :resources => resources
    else
      render "admin/dashboard/sidebar"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brainsome_typus-4.0.0.beta13 app/helpers/admin/resources_helper.rb
brainsome_typus-4.0.0.beta12 app/helpers/admin/resources_helper.rb
brainsome_typus-4.0.0.beta11 app/helpers/admin/resources_helper.rb