abstracted 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/abstracted/app.resources_list.coffee +38 -7
- data/app/helpers/abstract_resources_helper.rb +1 -1
- data/app/views/abstract_resources/defer.html.haml +2 -2
- data/app/views/abstract_resources/prefer.html.haml +2 -2
- data/lib/abstracted/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff5b25e98fbac0db0277def4b26dac60ade157e
|
4
|
+
data.tar.gz: 900baf74932298877889d24f5398b07cc60f217f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6b21d0f05200e511c0545614298932effbdac83fd6a8c18199d92be0957c8c50acd1156a7f3411648f80def83139c0d3466a9c22e3d988e72fb46e08cf0be1f
|
7
|
+
data.tar.gz: b04bfc2af2be21c664f698dacf1a894711cc42934e03d2850c2f056998649d5352c4a109e92bd9c55edd3a279b452fb8c59293e0d6bae62daa05d8028c2ac560
|
@@ -156,24 +156,55 @@ class App.ResourcesList
|
|
156
156
|
|
157
157
|
#
|
158
158
|
# handlePreferredLinks
|
159
|
-
# allows for
|
159
|
+
# allows for preferring/deferring resources - like: /admin/printers/2/prefer & /admin/printers/2/defer
|
160
160
|
#
|
161
161
|
handlePreferredLinks: (e) =>
|
162
162
|
e.preventDefault()
|
163
163
|
e.stopPropagation()
|
164
164
|
|
165
165
|
$elem = $(e.currentTarget)
|
166
|
+
# are we preferring?
|
167
|
+
prefer = $elem.attr('href').match /prefer/
|
166
168
|
request = $.ajax
|
167
169
|
url: $elem.attr('href'),
|
168
170
|
type: "get",
|
169
171
|
dataType: 'html'
|
170
172
|
.done (data) =>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
173
|
+
if prefer
|
174
|
+
sel='a.preferred'
|
175
|
+
if $elem.attr('ref')!=undefined
|
176
|
+
sel='a.preferred[ref="x"]'.replace /x/, $elem.attr('ref')
|
177
|
+
$(sel).each (k,e) =>
|
178
|
+
$e=$(e)
|
179
|
+
if $e!=$elem
|
180
|
+
url=$e.attr('href').replace 'defer', 'prefer'
|
181
|
+
$e.attr 'href', url
|
182
|
+
$e.html '<i class="deferred material-icons grey-text">bookmark_border</i>'
|
183
|
+
|
184
|
+
$elem.html(data)
|
185
|
+
# if prefer
|
186
|
+
# sel='a.preferred'
|
187
|
+
# if $elem.attr('ref')!=undefined
|
188
|
+
# sel='a.preferred[ref="x"]'.replace /x/, $elem.attr('ref')
|
189
|
+
#
|
190
|
+
# $(sel).each (k,e) =>
|
191
|
+
# $e = $(e)
|
192
|
+
# if $e != $elem
|
193
|
+
# console.log $e
|
194
|
+
# $e.attr('href').replace 'defer', 'prefer'
|
195
|
+
# $e.html '<i class="deferred material-icons grey-text">bookmark_border</i>'
|
196
|
+
#
|
197
|
+
# $elem.html '<i class="preferred material-icons green-text">bookmark</i>'
|
198
|
+
|
199
|
+
|
200
|
+
# # here we have to write all the existing preferred ones
|
201
|
+
# $.when $(sel).each (k,e) =>
|
202
|
+
# $e = $(e)
|
203
|
+
# $e.attr('href').replace 'defer', 'prefer'
|
204
|
+
# $e.html '<i class="deferred material-icons grey-text">bookmark_border</i>'
|
205
|
+
# # $( $elem[0].parentElement).html(data)
|
206
|
+
# .then $elem.html '<i class="preferred material-icons green-text">bookmark</i>'
|
207
|
+
|
177
208
|
|
178
209
|
.error (data) =>
|
179
210
|
swal("Oops", "We couldn't connect to the server!", "error")
|
@@ -161,7 +161,7 @@ module AbstractResourcesHelper
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def defer_url parent, resource
|
164
|
-
'%s/%s/%s/defer' % [url_for( parent), resource.class.to_s.downcase.pluralize,
|
164
|
+
'%s/%s/%s/defer' % [url_for( parent), resource.class.to_s.downcase.pluralize, resource.id]
|
165
165
|
end
|
166
166
|
|
167
167
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
= link_to prefer_url( parent,resource), class: 'deferred
|
2
|
-
%i.material-icons bookmark_border
|
1
|
+
= link_to prefer_url( parent,resource), class: 'deferred grey-text', ref: resource._ref, data: { id: resource.id }, title: t('prefer_%s' % resource_name) do
|
2
|
+
%i.material-icons.deferred.grey-text bookmark_border
|
3
3
|
|
4
4
|
:javascript
|
5
5
|
eval("#{set_toasts}");
|
@@ -1,5 +1,5 @@
|
|
1
|
-
= link_to
|
2
|
-
%i.material-icons
|
1
|
+
= link_to defer_url( parent,resource), class: 'preferred green-text', ref: resource._ref, data: { id: resource.id }, title: t('prefer_%s' % resource_name) do
|
2
|
+
%i.material-icons.preferred.green-text bookmark
|
3
3
|
|
4
4
|
:javascript
|
5
5
|
eval("#{set_toasts}");
|
data/lib/abstracted/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstracted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Walther H Diechmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|