activeadmin-async_panel 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f0db864cf01637b7d3dd7a89184c50ba28fb589
4
- data.tar.gz: 62092f9c0c95596afc3b48d211ae4c925984efd2
3
+ metadata.gz: 2df2613f5adfd31273f339c52b4bc24c11382e97
4
+ data.tar.gz: 76eed55a9bde3c41bd8bca8bb6e9e8e2f2266b7b
5
5
  SHA512:
6
- metadata.gz: b04bc2d9fd2b58cfd9d4839adf6e13dcae1a20470067f9bfbbc18f69098bc94e4c437b61872e809788097e9ff96e35d9286f261d47285839c36990e7afe60002
7
- data.tar.gz: 2e8e5c6a56c10b1a77ad0ded8b57853072b6ebf559da1d3aa051fb44b0a01a1997f90a4b1f7845b12df7c72df56b63e68e215173e6808fb1e653c04b7ee72e38
6
+ metadata.gz: 6572d93f08779d526f604c2973ee6b996b03d2da7de6d30c7f98c67831b28e93ddec089ce4f4510385804557452419111ea45cc491abc90a477898a89af2b7fc
7
+ data.tar.gz: 207753bab4d6fb194b268f0b8392ba954881572be296676eb0a6d0619e2adbbd21430fa789517739bd0aeec4ca615fc778d84af102507a222ca56cd3149ddbcb
data/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  # ActiveAdmin::AsyncPanel
7
7
 
8
+ <img src="https://s23.postimg.org/vq3bbntxn/async_panel.gif" width="360" alt="ActiveAdmin Async Panel control"/>
9
+
8
10
  This gem allows you to create ActiveAdmin panels with content loaded dynamically via AJAX requests.
9
11
 
10
12
  ## Prerequisites
@@ -35,9 +37,15 @@ Include this line in your JavaScript code (active_admin.js.coffee)
35
37
  #= require activeadmin-async_panel
36
38
  ```
37
39
 
40
+ Include this line in your CSS code (active_admin.scss)
41
+
42
+ ```scss
43
+ @import "activeadmin-async_panel";
44
+ ```
45
+
38
46
  To use this stuff do next steps:
39
47
 
40
- Step 1. Define async panel
48
+ ### Step 1. Define async panel
41
49
 
42
50
  ```ruby
43
51
  panel 'Name', class: 'async-panel', 'data-url' => some_action_admin_resources_path, 'data-period' => 1.minute
@@ -45,7 +53,9 @@ panel 'Name', class: 'async-panel', 'data-url' => some_action_admin_resources_pa
45
53
 
46
54
  If you setup `data-period`, panel will be periodically updated. If not, it will be loaded once right after page load
47
55
 
48
- Step 2. Define `member_action` or `collection_action` to handle request specified by path helper
56
+ ### Step 2. Define action
57
+
58
+ Define `member_action` or `collection_action` to handle request specified by path helper
49
59
 
50
60
  ```ruby
51
61
  collection_action :some_action do
@@ -54,7 +64,9 @@ collection_action :some_action do
54
64
  end
55
65
  ```
56
66
 
57
- Step 3. Define you view template to render action above in file `views/admin/resources/some_action.html.arb`can also be (slim, erb), for e.g. arb:
67
+ ### Step 3. Define view
68
+
69
+ Define you view template to render action above in file `views/admin/resources/some_action.html.arb`can also be (slim, erb), for e.g. `arb` template:
58
70
 
59
71
  ```ruby
60
72
  table_for resources do
@@ -63,7 +75,7 @@ table_for resources do
63
75
  end
64
76
  ```
65
77
 
66
- Note that in step 2 you can pass template variables with `@`, but inside template you should use them without `@`.
78
+ Note that in step 2 you can pass template variables with `@`, but inside `arb` template you should use them without `@`, and inside `erb`, `slim` with.
67
79
 
68
80
  ## Development
69
81
 
Binary file
@@ -20,11 +20,18 @@ $ ->
20
20
  $('.async-panel').each (index, item) ->
21
21
  item = $(item)
22
22
  worker = ->
23
+ item.addClass('processing')
24
+ $('h3', item).hide().show(0)
25
+
23
26
  $.ajax
24
27
  url: item.data('url')
25
28
  success: (data) ->
26
29
  $('.panel_contents', item).html(data)
30
+ error: (data, status, error) ->
31
+ $('.panel_contents', item).html(error)
27
32
  complete: ->
33
+ item.removeClass('processing')
34
+
28
35
  # Schedule the next request when the current one's completed
29
36
  period = item.data('period')
30
37
  if period
@@ -0,0 +1,6 @@
1
+ .async-panel.panel.processing {
2
+ h3 {
3
+ background: url('loading-icon.gif') 99% 50% no-repeat;
4
+ background-size: 27px;
5
+ }
6
+ }
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module AsyncPanel
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-async_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Emelyanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -270,7 +270,9 @@ files:
270
270
  - README.md
271
271
  - Rakefile
272
272
  - activeadmin-async_panel.gemspec
273
+ - app/assets/images/loading-icon.gif
273
274
  - app/assets/javascripts/activeadmin-async_panel.js.coffee
275
+ - app/assets/stylesheets/activeadmin-async_panel.scss
274
276
  - bin/console
275
277
  - bin/setup
276
278
  - lib/active_admin/async_panel.rb