Sha256: c8a37512016ce0788d81c87bd4672f64566e224a9a4144125dc34c6490bd4b1e

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

# BeetleReporter
Short description and motivation.

## Usage
How to use my plugin.

## Installation
Add this line to your application's Gemfile:

```ruby
gem 'beetle_reporter'
```

And then execute:
```bash
$ bundle
```

Or install it yourself as:
```bash
$ gem install beetle_reporter
```

路由
```ruby
mount BeetleReporter::Engine => "/beetle_reporter", as: "beetle_reporter"
```

初始化配置
```ruby
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方法
```ruby
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_images
    pictures.map{|pic| {src: pic.full_url} }
  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](https://opensource.org/licenses/MIT).

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
beetle_reporter-0.1.2 README.md
beetle_reporter-0.1.1 README.md