Sha256: 4b6bcd7cd4726517336f05811eb2c772ea80082cbc0c9bd7283cb203cd4f2d6c

Contents?: true

Size: 615 Bytes

Versions: 15

Compression:

Stored size: 615 Bytes

Contents

module Admin
  class Select2AjaxController < ApplicationController
    before_action(:authenticate_user!) if defined?(Devise)
    before_action { EffectiveResources.authorize!(self, :admin, :effective_resources) }

    include Effective::Select2AjaxController

    def users
      collection = current_user.class.all

      respond_with_select2_ajax(collection) do |user|
        { id: user.to_param, text: user.try(:to_select2) || to_select2(user) }
      end
    end

    private

    def to_select2(user)
      "<span>#{user.first_name} #{user.last_name}</span> <small>#{user.email}</small>"
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
effective_resources-2.0.2 app/controllers/admin/select2_ajax_controller.rb
effective_resources-2.0.1 app/controllers/admin/select2_ajax_controller.rb
effective_resources-2.0.0 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.19.1 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.19.0 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.10 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.9 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.8 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.7 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.6 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.5 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.4 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.3 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.2 app/controllers/admin/select2_ajax_controller.rb
effective_resources-1.18.1 app/controllers/admin/select2_ajax_controller.rb