easy_admin_ui 0.8.1 → 0.8.2

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: a5907e41b800e50590f9dd2ef0c80a1eab155a60
4
- data.tar.gz: 9c4e5715f309dac8f227b1a20a72c10a1fa52165
3
+ metadata.gz: 17569379ab675c1225e6f2042aa11be7e757f97e
4
+ data.tar.gz: a4553de0eff931b34ad73946f66409421c58a364
5
5
  SHA512:
6
- metadata.gz: 51202d68c53ccb89cd101f1940a84526c87e58fb757fa3f74de22b47594f35934ea135d828742fbfa270cf8a30daff7bd8dd0c30fa4855dd550f690bbf5e4bd7
7
- data.tar.gz: f5edf2359414196799c0f10c0346c8638293dd0885a2f685084dc939394436b465f78ce1c435bcb7f3fa78ff67005c176fc5654398e46fb61a19cac8c2fd6aae
6
+ metadata.gz: bf3cc80a1d4511ac93f9f1762a0e9bf5d433a3a2a4fc3c66443c604faa52027e0cfb5f58de43eaa1abca9c35008cca0b1e9946dc44463c76980ab9e0ce8d79f7
7
+ data.tar.gz: f476c4e66933615d851f5c2a0dc7f8a1ad3693f2c3c97bb506d4868a9921f508283fdfc1672e3084c7ff4de09339e9ee96f656f33930fcfcbd2f79952b046b57
data/Gemfile.lock CHANGED
@@ -1,34 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easy_admin_ui (0.8.1)
4
+ easy_admin_ui (0.8.2)
5
5
  kaminari (>= 0.12.4)
6
6
  rails (>= 4.0.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (4.1.8)
12
- actionpack (= 4.1.8)
13
- actionview (= 4.1.8)
11
+ actionmailer (4.1.10)
12
+ actionpack (= 4.1.10)
13
+ actionview (= 4.1.10)
14
14
  mail (~> 2.5, >= 2.5.4)
15
- actionpack (4.1.8)
16
- actionview (= 4.1.8)
17
- activesupport (= 4.1.8)
15
+ actionpack (4.1.10)
16
+ actionview (= 4.1.10)
17
+ activesupport (= 4.1.10)
18
18
  rack (~> 1.5.2)
19
19
  rack-test (~> 0.6.2)
20
- actionview (4.1.8)
21
- activesupport (= 4.1.8)
20
+ actionview (4.1.10)
21
+ activesupport (= 4.1.10)
22
22
  builder (~> 3.1)
23
23
  erubis (~> 2.7.0)
24
- activemodel (4.1.8)
25
- activesupport (= 4.1.8)
24
+ activemodel (4.1.10)
25
+ activesupport (= 4.1.10)
26
26
  builder (~> 3.1)
27
- activerecord (4.1.8)
28
- activemodel (= 4.1.8)
29
- activesupport (= 4.1.8)
27
+ activerecord (4.1.10)
28
+ activemodel (= 4.1.10)
29
+ activesupport (= 4.1.10)
30
30
  arel (~> 5.0.0)
31
- activesupport (4.1.8)
31
+ activesupport (4.1.10)
32
32
  i18n (~> 0.6, >= 0.6.9)
33
33
  json (~> 1.7, >= 1.7.7)
34
34
  minitest (~> 5.1)
@@ -43,37 +43,35 @@ GEM
43
43
  httpclient (>= 2.2.7)
44
44
  nesty
45
45
  sinatra (>= 1.2.7)
46
- hike (1.2.3)
47
46
  httpclient (2.3.4.1)
48
47
  i18n (0.7.0)
49
48
  json (1.8.2)
50
- kaminari (0.16.1)
49
+ kaminari (0.16.3)
51
50
  actionpack (>= 3.0.0)
52
51
  activesupport (>= 3.0.0)
53
52
  mail (2.6.3)
54
53
  mime-types (>= 1.16, < 3)
55
- mime-types (2.4.3)
56
- minitest (5.5.1)
57
- multi_json (1.10.1)
54
+ mime-types (2.5)
55
+ minitest (5.6.0)
58
56
  nesty (1.0.2)
59
57
  rack (1.5.2)
60
58
  rack-protection (1.5.2)
61
59
  rack
62
60
  rack-test (0.6.3)
63
61
  rack (>= 1.0)
64
- rails (4.1.8)
65
- actionmailer (= 4.1.8)
66
- actionpack (= 4.1.8)
67
- actionview (= 4.1.8)
68
- activemodel (= 4.1.8)
69
- activerecord (= 4.1.8)
70
- activesupport (= 4.1.8)
62
+ rails (4.1.10)
63
+ actionmailer (= 4.1.10)
64
+ actionpack (= 4.1.10)
65
+ actionview (= 4.1.10)
66
+ activemodel (= 4.1.10)
67
+ activerecord (= 4.1.10)
68
+ activesupport (= 4.1.10)
71
69
  bundler (>= 1.3.0, < 2.0)
72
- railties (= 4.1.8)
70
+ railties (= 4.1.10)
73
71
  sprockets-rails (~> 2.0)
74
- railties (4.1.8)
75
- actionpack (= 4.1.8)
76
- activesupport (= 4.1.8)
72
+ railties (4.1.10)
73
+ actionpack (= 4.1.10)
74
+ activesupport (= 4.1.10)
77
75
  rake (>= 0.8.7)
78
76
  thor (>= 0.18.1, < 2.0)
79
77
  rake (10.1.1)
@@ -89,17 +87,14 @@ GEM
89
87
  rack (~> 1.4)
90
88
  rack-protection (~> 1.4)
91
89
  tilt (~> 1.3, >= 1.3.4)
92
- sprockets (2.12.3)
93
- hike (~> 1.2)
94
- multi_json (~> 1.0)
90
+ sprockets (3.0.2)
95
91
  rack (~> 1.0)
96
- tilt (~> 1.1, != 1.3.0)
97
92
  sprockets-rails (2.2.4)
98
93
  actionpack (>= 3.0)
99
94
  activesupport (>= 3.0)
100
95
  sprockets (>= 2.8, < 4.0)
101
96
  thor (0.19.1)
102
- thread_safe (0.3.4)
97
+ thread_safe (0.3.5)
103
98
  tilt (1.4.1)
104
99
  tzinfo (1.2.2)
105
100
  thread_safe (~> 0.1)
data/README.md CHANGED
@@ -58,6 +58,7 @@ Then you need a partial below users/ named '_user.html.erb':
58
58
  For deeper nested resources simply use:
59
59
 
60
60
  admin_show_link([user, article])
61
+ admin_delete_link_with_confirmation([user, comment])
61
62
 
62
63
  This also works for forms but you need to set
63
64
 
@@ -2,7 +2,7 @@ $(document).ready(function() {
2
2
  var confirm_html = '\
3
3
  <span id="confirm_delete_OBJID" class="admin_delete-confirm_delete" style="display: none;">\
4
4
  Are you sure?\
5
- <a href="DELETE_URL" data-id="OBJID" data-method="delete" data-remote="true">Yes</a> | <a href="" class="no">No</a>\
5
+ <a href="DELETE_URL" data-id="OBJID" data-hide-id="HIDE_ID" data-method="delete" data-remote="true" class="yes">Yes</a> | <a href="" class="no">No</a>\
6
6
  </span>';
7
7
 
8
8
  $('body').on('click', '.admin_delete', function(e) {
@@ -10,12 +10,24 @@ $(document).ready(function() {
10
10
 
11
11
  var a_link = $(e.target).parent('a')
12
12
  var obj_id = a_link.attr('data-id')
13
+ var obj_url = a_link.attr('href')
14
+ var hide_id = a_link.attr('data-hide-id') || ""
13
15
 
14
- a_link.after(confirm_html.replace(/OBJID/g, obj_id).replace(/DELETE_URL/, window.location.protocol + '//' + window.location.hostname + window.location.pathname + '/' + obj_id))
16
+ a_link.after(confirm_html.replace(/OBJID/g, obj_id).replace(/HIDE_ID/g, hide_id).replace(/DELETE_URL/, window.location.protocol + '//' + window.location.hostname + obj_url))
15
17
 
16
18
  a_link.siblings('#confirm_delete_' + obj_id).show()
17
19
  });
18
20
 
21
+ $('body').on('click', '.admin_delete-confirm_delete .yes', function(e) {
22
+ if($(e.target).attr('data-hide-id') !== undefined && $(e.target).attr('data-hide-id').length > 0 ) {
23
+ var hide_id = $(e.target).attr('data-hide-id')
24
+ $("#" + hide_id).remove()
25
+ } else {
26
+ // Remove <tr>
27
+ $(e.target).parents('tr').remove()
28
+ }
29
+ });
30
+
19
31
  // User clicks No.
20
32
  $('body').on('click', '.admin_delete-confirm_delete .no', function(e) {
21
33
  $(e.target).parent('.admin_delete-confirm_delete').remove()
@@ -81,8 +81,8 @@ module EasyAdminUi
81
81
  end
82
82
 
83
83
  # Use if below /admin/.
84
- def admin_delete_link_with_confirmation(item, url_options = {})
85
- link_to(delete_icon_image_tag, eval("#{items_to_url(item)}(*item, url_options)"), class: "admin_delete", 'data-id' => item.to_param)
84
+ def admin_delete_link_with_confirmation(item, url_options = {}, options = {})
85
+ link_to(delete_icon_image_tag, eval("#{items_to_url(item)}(*item, url_options)"), class: "admin_delete", 'data-id' => item.to_param.gsub('/', '_'), 'data-hide-id' => options[:hide_id])
86
86
  end
87
87
 
88
88
  def items_to_url(item)
@@ -1,3 +1,3 @@
1
1
  module EasyAdminUi
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
@@ -90,7 +90,7 @@ module Resourceful
90
90
  before :destroy
91
91
  if current_object.destroy
92
92
  after :destroy
93
- response_for :destroy
93
+ render nothing: true
94
94
  else
95
95
  after :destroy_fails
96
96
  response_for :destroy_fails
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_admin_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Moen Wulffeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,7 +101,6 @@ files:
101
101
  - app/assets/javascripts/easy_admin_ui/easy_admin_ui.js
102
102
  - app/assets/stylesheets/easy_admin_ui/easy_admin_ui.sass
103
103
  - app/helpers/easy_admin_ui/easy_admin_ui_helper.rb
104
- - app/views/easy_admin_ui/destroy.js.erb
105
104
  - app/views/easy_admin_ui/edit.html.erb
106
105
  - app/views/easy_admin_ui/index.html.erb
107
106
  - app/views/easy_admin_ui/new.html.erb
@@ -1 +0,0 @@
1
- $('#tr_<%= current_model_name.underscore %>_<%= @item.id %>').remove();