Sha256: 3baadca1fc05cd4ce9959c080be6430dd868824edf8391d2f21bb5a5c3f30640

Contents?: true

Size: 1012 Bytes

Versions: 5

Compression:

Stored size: 1012 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
    require_user
    unless current_user&.admin?
      flash[:notice] = t(:msg_require_admin)
      redirect_to root_path
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fat_free_crm-0.18.2 app/controllers/admin/application_controller.rb
fat_free_crm-0.17.3 app/controllers/admin/application_controller.rb
fat_free_crm-0.18.1 app/controllers/admin/application_controller.rb
fat_free_crm-0.18.0 app/controllers/admin/application_controller.rb
fat_free_crm-0.17.2 app/controllers/admin/application_controller.rb