Sha256: 3967325411f7448ba53885e7cbb8fbe98efa397ead433afaaa5f7677cde4e182

Contents?: true

Size: 1.83 KB

Versions: 15

Compression:

Stored size: 1.83 KB

Contents

module Dhatu
  class SectionTypesController < ResourceController

    before_action :require_super_admin
    
    private

    def get_resource
      @r_object = @resource_options[:class].find_by_id(params[:id])
    end

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

      parse_filters
      apply_filters
      
      @section_types = @r_objects = @relation.page(@current_page).per(@per_page)

      return true
    end

    def apply_filters
      @relation = @relation.search(@query) if @query
      
      @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 }
        ],
        boolean_filters: [],
        reference_filters: [],
        variable_filters: [],
      }
    end

    def configure_filter_ui_settings
      @filter_ui_settings = {}
    end

    def resource_controller_configuration
      {
        page_title: "Section Types",
        js_view_path: "/kuppayam/workflows/parrot",
        view_path: "/dhatu/section_types",
        show_modal_after_create: false,
        show_modal_after_update: false,
        collection_name: :section_types,
        item_name: :section_type,
        class: Dhatu::SectionType
      }
    end

    def breadcrumbs_configuration
      {
        heading: "Manage Section Types",
        icon: "fa-reorder",
        description: "Listing all Section Types",
        links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'}, 
                  {name: "Manage Section Types", link: section_types_path, icon: 'fa-reorder', active: true}]
      }
    end

    def permitted_params
      params.require("dhatu/section_type").permit(:name, :code)
    end

    def set_navs
      set_nav("dhatu/section_types")
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dhatu-0.1.25 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.24 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.23 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.22 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.21 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.20 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.19 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.18 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.16 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.15 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.14 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.13 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.12 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.11 app/controllers/dhatu/section_types_controller.rb
dhatu-0.1.10 app/controllers/dhatu/section_types_controller.rb