Sha256: 10c910cc68ea65ddb0da00eaa5f6301166fe53a4e0674a1ba72c285e41cf0533

Contents?: true

Size: 951 Bytes

Versions: 1

Compression:

Stored size: 951 Bytes

Contents

module AdminHelpers
  def self.jobs_url
    url = ["/"]

    if ActiveAdmin.application.default_namespace.present?
      url << "#{ActiveAdmin.application.default_namespace}/"
    end

    url << "jobs"
    url.join("")
  end
end

ActiveAdmin.setup do |config|
  config.load_paths += [File.join(ActiveadminJobs::Engine.root, "app", "admin")]
end

class ActiveAdmin::Views::Pages::Base
  alias_method :adj_add_classes_to_body, :add_classes_to_body

  def add_classes_to_body
    adj_add_classes_to_body
    current_user_method = ActiveAdmin.application.current_user_method

    if current_user_method
      admins_job_identifier = send(current_user_method).job_identifier
      @body.set_attribute "data-identifier", admins_job_identifier
      @body.set_attribute "data-root-url", "/"
      @body.set_attribute "data-jobs-url", AdminHelpers.jobs_url
      @body.set_attribute "data-translations", I18nDictionary.translations.to_json
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin_jobs-0.4.0 lib/activeadmin_jobs/activeadmin_config.rb