Sha256: 823d3dcc52fe3d03a205173c163b89810e0ddd0cd859c89a87594df3b0fe320d

Contents?: true

Size: 1.99 KB

Versions: 20

Compression:

Stored size: 1.99 KB

Contents

module Usman
  class FeaturesController < ResourceController

    before_action :require_site_admin
    
    private

    def get_collections
      @relation = Feature.where("")

      parse_filters
      apply_filters
      
      @features = @r_objects = @relation.includes(:feature_image).page(@current_page).per(@per_page)

      return true
    end

    def apply_filters
      @relation = @relation.search(@query) if @query
      @relation = @relation.status(@status) if @status
      
      @order_by = "created_at desc" unless @order_by
      @relation = @relation.order(@order_by)
    end

    def configure_filter_settings
      @filter_settings = {
        string_filters: [
          { filter_name: :query },
          { filter_name: :status }
        ],
        boolean_filters: [],
        reference_filters: [],
        variable_filters: [],
      }
    end

    def configure_filter_ui_settings
      @filter_ui_settings = {
        status: {
          object_filter: false,
          select_label: "Select Status",
          display_hash: Feature::STATUS,
          current_value: @status,
          values: Feature::STATUS_REVERSE,
          current_filters: @filters,
          filters_to_remove: [],
          filters_to_add: {},
          url_method_name: 'users_url',
          show_all_filter_on_top: true
        }
      }
    end

    def resource_controller_configuration
      {
        page_title: "Features",
        js_view_path: "/kuppayam/workflows/parrot",
        view_path: "/usman/features"
      }
    end

    def breadcrumbs_configuration
      {
        heading: "Manage Features",
        icon: "lincons-diamond",
        description: "Listing all Features",
        links: [{name: "Home", link: dashboard_path, icon: 'fa-home'}, 
                  {name: "Manage Features", link: features_path, icon: 'fa-calendar', active: true}]
      }
    end

    def permitted_params
      params.require(:feature).permit(:name)
    end

    def set_navs
      set_nav("usman/features")
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
usman-0.3.8 app/controllers/usman/features_controller.rb
usman-0.3.7 app/controllers/usman/features_controller.rb
usman-0.3.6 app/controllers/usman/features_controller.rb
usman-0.3.5 app/controllers/usman/features_controller.rb
usman-0.3.4 app/controllers/usman/features_controller.rb
usman-0.3.3 app/controllers/usman/features_controller.rb
usman-0.3.2 app/controllers/usman/features_controller.rb
usman-0.3.1 app/controllers/usman/features_controller.rb
usman-0.3.0 app/controllers/usman/features_controller.rb
usman-0.2.11 app/controllers/usman/features_controller.rb
usman-0.2.10 app/controllers/usman/features_controller.rb
usman-0.2.9 app/controllers/usman/features_controller.rb
usman-0.2.8 app/controllers/usman/features_controller.rb
usman-0.2.7 app/controllers/usman/features_controller.rb
usman-0.2.6 app/controllers/usman/features_controller.rb
usman-0.2.5 app/controllers/usman/features_controller.rb
usman-0.2.3 app/controllers/usman/features_controller.rb
usman-0.2.2 app/controllers/usman/features_controller.rb
usman-0.2.1 app/controllers/usman/features_controller.rb
usman-0.2.0 app/controllers/usman/features_controller.rb