Sha256: 4bf750bcdc7f5e8c0b1be2cc4029089a9bb41f76cc84094b9fd3fd05d40438fe

Contents?: true

Size: 1018 Bytes

Versions: 7

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::ApplicationController < ApplicationController
  before_action :require_admin_user

  layout "admin/application"
  helper "admin/field_groups"

  # Autocomplete handler for all admin controllers.
  #----------------------------------------------------------------------------
  def auto_complete
    @query = params[:term]
    @auto_complete = klass.text_search(@query).limit(10)
    render partial: 'auto_complete'
  end

  private

  #----------------------------------------------------------------------------
  def require_admin_user
    authenticate_user!
    unless current_user&.admin?
      flash[:notice] = t(:msg_require_admin)
      redirect_to root_path
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 app/controllers/admin/application_controller.rb
fat_free_crm-0.22.0 app/controllers/admin/application_controller.rb
fat_free_crm-0.21.0 app/controllers/admin/application_controller.rb
fat_free_crm-0.20.1 app/controllers/admin/application_controller.rb
fat_free_crm-0.20.0 app/controllers/admin/application_controller.rb
fat_free_crm-0.19.2 app/controllers/admin/application_controller.rb
fat_free_crm-0.19.0 app/controllers/admin/application_controller.rb