Skip to content

Commit cd74182

Browse files
authored
Merge pull request #11 from blocknotes/github-actions
Add Github Actions specs
2 parents 5ca5213 + 9801122 commit cd74182

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

.circleci/config.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/specs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Specs
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
ruby: ['2.5', '2.6', '2.7']
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Ruby
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: ${{ matrix.ruby }}
25+
bundler-cache: true
26+
27+
- name: Run tests
28+
run: bundle exec rake
29+
30+
- name: Archive screenshots for failed tests
31+
uses: actions/upload-artifact@v2
32+
if: failure()
33+
with:
34+
name: test-failed-screenshots
35+
path: spec/dummy/tmp/screenshots

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# ActiveAdmin Dynamic Fields [![Gem Version](https://badge.fury.io/rb/activeadmin_dynamic_fields.svg)](https://badge.fury.io/rb/activeadmin_dynamic_fields) [![CircleCI](https://circleci.com/gh/blocknotes/activeadmin_dynamic_fields.svg?style=svg)](https://circleci.com/gh/blocknotes/activeadmin_dynamic_fields)
1+
# ActiveAdmin Dynamic Fields [![Gem Version](https://badge.fury.io/rb/activeadmin_dynamic_fields.svg)](https://badge.fury.io/rb/activeadmin_dynamic_fields) [![Specs](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml/badge.svg)](https://github.com/blocknotes/activeadmin_dynamic_fields/actions/workflows/specs.yml)
22

33
An Active Admin plugin to add dynamic behaviors to some fields.
44

55
Features:
6+
67
- set conditional checks on fields
78
- trigger actions on target elements
89
- inline field editing
@@ -11,6 +12,7 @@ Features:
1112
The easiest way to show how this plugin works is looking the examples [below](#examples).
1213

1314
## Install
15+
1416
- Add to your Gemfile: `gem 'activeadmin_dynamic_fields'`
1517
- Execute bundle
1618
- Add at the end of your ActiveAdmin javascripts (_app/assets/javascripts/active_admin.js_):
@@ -20,9 +22,11 @@ The easiest way to show how this plugin works is looking the examples [below](#e
2022
```
2123

2224
## Options
25+
2326
Options are passed to fields using *input_html* parameter as *data* attributes.
2427

2528
Conditions:
29+
2630
- **data-if**: check a condition, values:
2731
+ **checked**: check if a checkbox is checked (ex. `"data-if": "checked"`)
2832
+ **not_checked**: check if a checkbox is not checked
@@ -36,6 +40,7 @@ Conditions:
3640
- **data-function**: check the return value of a custom function (ex. `"data-function": "my_check"`)
3741

3842
Actions:
43+
3944
- **data-then**: action to trigger (alias **data-action**), values:
4045
+ **hide**: hides elements (ex. `"data-then": "hide", "data-target": ".errors"`)
4146
+ **slide**: hides elements (using sliding)
@@ -49,6 +54,7 @@ Actions:
4954
- **data-args**: arguments passed to the callback function
5055

5156
Targets:
57+
5258
- **data-target**: target css selector (from parent fieldset, look for the closest match)
5359
- **data-gtarget**: target css selector globally
5460

@@ -57,6 +63,7 @@ A check condition or a custom check function are required. A trigger action is r
5763
## Examples
5864

5965
### Dynamic fields examples
66+
6067
- A checkbox that hides other fields if is checked (ex. model *Article*):
6168

6269
```rb
@@ -128,6 +135,7 @@ function on_change_category(el) {
128135
```
129136
130137
### Inline editing examples
138+
131139
- Prepare a custom member action to save data, an *update* helper function is available (third parameter is optional, allow to filter using strong parameters):
132140
133141
```rb
@@ -165,6 +173,7 @@ end
165173
```
166174
167175
### Dialog example
176+
168177
Example with 2 models: *Author* and *Article*
169178
170179
Prepare the content dialog - in Active Admin Author config:
@@ -208,13 +217,16 @@ end
208217
The link url is loaded via AJAX before opening the dialog.
209218
210219
## Do you like it? Star it!
220+
211221
If you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other [Active Admin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source).
212222
213223
Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).
214224
215225
## Contributors
226+
216227
- [Mattia Roccoberton](http://blocknot.es): author
217228
- The good guys that opened issues and pull requests from time to time
218229
219230
## License
231+
220232
The gem is available as open-source under the terms of the [MIT](LICENSE.txt).

0 commit comments

Comments
 (0)