BeetleReporter

Short description and motivation.

Usage

How to use my plugin.

Installation

Add this line to your application's Gemfile:

gem 'beetle_reporter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install beetle_reporter

路由

mount BeetleReporter::Engine => "/beetle_reporter", as: "beetle_reporter"

初始化配置

BeetleReporter.configure do |config|
  config.user_class = 'Admin'
  config.user_name_method = 'username'

  config.main_app_root_path_method = 'admins_user_root_path'
  config.main_app_user_path_method = 'admins_user_path'
end

实现hook方法

class Diary
  def beetle_record_path
    Rails.application.routes.url_helpers.admins_diary_path(id)
  end

  def beetle_hide
    update_columns(is_approved: false)
  end

  def beetle_undo_hide
    update_columns(is_approved: true)
  end

  def beetle_remove
    discard
  end

  def beetle_undo_remove
    undiscard
  end

  def beetle_mute
    true
  end

  def beetle_undo_mute
    true
  end

  def beetle_forbid
    true
  end

  def beetle_undo_forbid
    true
  end

  def beetle_record_partial_path
    "admins/diaries/beetle"
  end
end

约定

  • 支持 is_approved 字段
  • 支持 discard 软删 gem

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.