Sha256: 2a61e9d672e24b3af8d6742770cce1bfdd68e92ef2f3fa7baeef4dd40c6bf12b

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module AdminData::Chelper

  def per_page
    AdminData::Config.setting[:will_paginate_per_page]
  end

  def admin_data_is_allowed_to_view?
    return true if Rails.env.development?
    AdminData::Config.setting[:is_allowed_to_view].call(self)
  end

  def admin_data_is_allowed_to_view_model?
    return true if Rails.env.development?
    AdminData::Config.setting[:is_allowed_to_view_model].call(self)
  end

  def admin_data_is_allowed_to_update?
    return true if Rails.env.development?
    AdminData::Config.setting[:is_allowed_to_update].call(self)
  end

  def admin_data_is_allowed_to_update_model?
    return true if Rails.env.development?
    AdminData::Config.setting[:is_allowed_to_update_model].call(self)
  end

  def admin_data_invalid_record_link(klassu, id, error)
    record = klassu.camelize.constantize.send(:find, id)
    tmp = admin_data_on_k_path(:klass => klasss.underscore, :id => record)
    a = []
    a << link_to(klasss, tmp, :target => '_blank')
    a << id
    a << error
    a.join(' | ')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
admin_data-1.0.2 lib/admin_data/chelper.rb
admin_data-1.0.1 lib/admin_data/chelper.rb
admin_data-1.0.0 lib/admin_data/chelper.rb