abstracted 0.4.14 → 0.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +25 -13
- data/app/assets/javascripts/abstracted/app.fab_delete.coffee +6 -1
- data/app/assets/javascripts/abstracted/app.shared.coffee +28 -1
- data/app/helpers/fab_button_helper.rb +17 -10
- data/app/models/abstract_resource.rb +4 -0
- data/app/views/abstract_resources/edit.html.haml +1 -1
- data/app/views/abstract_resources/new.html.haml +1 -1
- data/app/views/abstract_resources/show.html.haml +1 -1
- data/lib/abstracted/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcf51a329c0e1df1f2f9c4d1101a92d23694adc
|
4
|
+
data.tar.gz: 8db87d563718a51ec36e1e4c484f46ccfba4dd14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff92410ac4a7fe6b625aeddd522aef47a93e44c784a1530dbce428849e5e692b50f86ffd94608e9562fbffc799b3ac327d6c6b5bc08387696b869281ab4d906
|
7
|
+
data.tar.gz: c95a0451cddbe10785903d66d5a381d8e762246b687a2f684cc6171be89a637b1d34d36ea4e782e43874dfc630ca3a3b68ab78c4fdafaf2dcdb9265fd5367703
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
abstracted (0.
|
4
|
+
abstracted (0.4.15)
|
5
|
+
amoeba
|
5
6
|
kaminari
|
6
7
|
pundit
|
7
8
|
rails (~> 4.1)
|
@@ -45,7 +46,9 @@ GEM
|
|
45
46
|
minitest (~> 5.1)
|
46
47
|
thread_safe (~> 0.3, >= 0.3.4)
|
47
48
|
tzinfo (~> 1.1)
|
48
|
-
|
49
|
+
amoeba (3.0.0)
|
50
|
+
activerecord (>= 3.2.6)
|
51
|
+
arel (6.0.4)
|
49
52
|
builder (3.2.2)
|
50
53
|
capybara (2.4.4)
|
51
54
|
mime-types (>= 1.16)
|
@@ -60,7 +63,7 @@ GEM
|
|
60
63
|
activesupport (>= 3.0.0)
|
61
64
|
railties (>= 3.0.0)
|
62
65
|
thor (>= 0.14.6)
|
63
|
-
concurrent-ruby (1.0.
|
66
|
+
concurrent-ruby (1.0.4)
|
64
67
|
database_cleaner (1.4.1)
|
65
68
|
diff-lcs (1.2.5)
|
66
69
|
erubis (2.7.0)
|
@@ -71,7 +74,7 @@ GEM
|
|
71
74
|
railties (>= 3.0.0)
|
72
75
|
ffi (1.9.6)
|
73
76
|
formatador (0.2.5)
|
74
|
-
globalid (0.3.
|
77
|
+
globalid (0.3.7)
|
75
78
|
activesupport (>= 4.1.0)
|
76
79
|
guard (2.12.4)
|
77
80
|
formatador (>= 0.2.4)
|
@@ -90,9 +93,18 @@ GEM
|
|
90
93
|
hitimes (1.2.2)
|
91
94
|
i18n (0.7.0)
|
92
95
|
json (1.8.2)
|
93
|
-
kaminari (0.
|
94
|
-
|
95
|
-
|
96
|
+
kaminari (1.0.1)
|
97
|
+
activesupport (>= 4.1.0)
|
98
|
+
kaminari-actionview (= 1.0.1)
|
99
|
+
kaminari-activerecord (= 1.0.1)
|
100
|
+
kaminari-core (= 1.0.1)
|
101
|
+
kaminari-actionview (1.0.1)
|
102
|
+
actionview
|
103
|
+
kaminari-core (= 1.0.1)
|
104
|
+
kaminari-activerecord (1.0.1)
|
105
|
+
activerecord
|
106
|
+
kaminari-core (= 1.0.1)
|
107
|
+
kaminari-core (1.0.1)
|
96
108
|
listen (2.8.5)
|
97
109
|
celluloid (>= 0.15.2)
|
98
110
|
rb-fsevent (>= 0.9.3)
|
@@ -100,8 +112,8 @@ GEM
|
|
100
112
|
loofah (2.0.1)
|
101
113
|
nokogiri (>= 1.5.9)
|
102
114
|
lumberjack (1.0.9)
|
103
|
-
mail (2.6.
|
104
|
-
mime-types (>= 1.16, <
|
115
|
+
mail (2.6.4)
|
116
|
+
mime-types (>= 1.16, < 4)
|
105
117
|
method_source (0.8.2)
|
106
118
|
mime-types (2.4.3)
|
107
119
|
mini_portile (0.6.2)
|
@@ -154,7 +166,7 @@ GEM
|
|
154
166
|
rb-fsevent (0.9.4)
|
155
167
|
rb-inotify (0.9.5)
|
156
168
|
ffi (>= 0.5.0)
|
157
|
-
responders (2.
|
169
|
+
responders (2.3.0)
|
158
170
|
railties (>= 4.2.0, < 5.1)
|
159
171
|
rspec (3.2.0)
|
160
172
|
rspec-core (~> 3.2.0)
|
@@ -182,10 +194,10 @@ GEM
|
|
182
194
|
rspec-support (3.2.2)
|
183
195
|
shellany (0.0.1)
|
184
196
|
slop (3.6.0)
|
185
|
-
sprockets (3.
|
197
|
+
sprockets (3.7.1)
|
186
198
|
concurrent-ruby (~> 1.0)
|
187
199
|
rack (> 1, < 3)
|
188
|
-
sprockets-rails (3.
|
200
|
+
sprockets-rails (3.2.0)
|
189
201
|
actionpack (>= 4.0)
|
190
202
|
activesupport (>= 4.0)
|
191
203
|
sprockets (>= 3.0.0)
|
@@ -220,4 +232,4 @@ DEPENDENCIES
|
|
220
232
|
sqlite3
|
221
233
|
|
222
234
|
BUNDLED WITH
|
223
|
-
1.
|
235
|
+
1.13.6
|
@@ -22,6 +22,8 @@ class App.fabDelete
|
|
22
22
|
if $remove
|
23
23
|
$remove.hide()
|
24
24
|
App.shared.closeSweetAlert($elem)
|
25
|
+
if (window.location.href).endsWith($elem.data('url')+"/"+$elem.data('id'))
|
26
|
+
window.location = $elem.data('url')
|
25
27
|
#swal("Deleted!", "Your file was successfully deleted!", "success")
|
26
28
|
.fail (data) =>
|
27
29
|
$('#message_container').html(data.responseText)
|
@@ -61,10 +63,13 @@ class App.fabDelete
|
|
61
63
|
switch elem.data('action')
|
62
64
|
when undefined then alert 'Fejl!\n Kontakt ALCO på 9791 1470\n (fejlen er: handleFABLinks ikke sat)'
|
63
65
|
when 'new' then App.shared.openNewWindow(elem) # data-action="new", data-url="/endpoint", data-selector="#id.modal"
|
66
|
+
when 'reset' then App.shared.resetForm(elem) # data-action="reset", data-selector="form"
|
64
67
|
when 'submit' then App.shared.submitForm(elem) # data-action="submit", data-selector="form"
|
68
|
+
when 'post' then App.shared.submitForm(elem) # data-action="post", data-selector="form"
|
69
|
+
when 'delete' then @handleDeleteLinks(e) # data-action="delete", data-selector="form", data-id="id", data-url="url"
|
65
70
|
when 'ajax' then App.shared.callAjax(elem,loaded_element) # data-action="ajax", data-url="/endpoint", data-selector="#id.modal", data-method="get", data-type="html"
|
66
71
|
when 'get' then window.location.href = elem.data('url') # data-action="get", data-url="/endpoint"
|
67
|
-
else eval(elem.data('action'))
|
72
|
+
else eval(elem.data('action')) # data-action="$(document.body).trigger({ type: 'app:modal:state:changed', state: {print_format: 'record' }})"
|
68
73
|
|
69
74
|
|
70
75
|
#
|
@@ -48,8 +48,35 @@ class App.Shared
|
|
48
48
|
return $($elem.data('selector')).submit()
|
49
49
|
$(document.body).find('form').first().submit()
|
50
50
|
|
51
|
+
#
|
52
|
+
# resetCheckBoxAndRadio
|
53
|
+
# is a supportive funktion
|
54
|
+
# to resetForm
|
55
|
+
#
|
56
|
+
resetCheckBoxAndRadio: (fld) =>
|
57
|
+
if $(fld).data('original-value') && $(fld).data('original-value')==true
|
58
|
+
fld.checked = true
|
59
|
+
else
|
60
|
+
fld.checked = false if fld.checked
|
51
61
|
|
52
|
-
|
62
|
+
#
|
63
|
+
# resetForm
|
64
|
+
# resets everything to <field data-original-value="" />
|
65
|
+
# - except <field data-no-reset="true" />
|
66
|
+
#
|
67
|
+
resetForm: ($elem=null) =>
|
68
|
+
if $elem && $elem.data('selector')
|
69
|
+
frm = $elem.data('selector')
|
70
|
+
else
|
71
|
+
frm = $(document.body).find('form').first()[0]
|
72
|
+
|
73
|
+
for fld in frm.elements
|
74
|
+
do (fld) ->
|
75
|
+
unless $(fld).data('no-reset')
|
76
|
+
switch fld.type.toLowerCase()
|
77
|
+
when 'text', 'password', 'textarea', 'hidden' then fld.value = $(fld).data('original-value') || ''
|
78
|
+
when 'radio', 'checkbox' then App.shared.resetCheckBoxAndRadio(fld)
|
79
|
+
when 'select-one', 'select-multi' then fld.selectedIndex = $(fld).data('original-value') || -1
|
53
80
|
|
54
81
|
getDownload: (xhr,data) =>
|
55
82
|
# Check if a filename is existing on the response headers.
|
@@ -32,35 +32,42 @@ LISTEND
|
|
32
32
|
#
|
33
33
|
def build_fab_options resource, options={}
|
34
34
|
lst = []
|
35
|
-
|
36
35
|
# if items are empty - dream them up
|
37
36
|
options[:items] ||= {}
|
38
37
|
|
39
|
-
options[:items]
|
38
|
+
options[:items].merge!( list: { ajax: 'get', icon: 'list', class: 'blue', url: resources_url(resources, controller: params[:controller]), oxremote: 'false' }){ |key, v1, v2| v1 }
|
39
|
+
|
40
40
|
case options[:action]
|
41
41
|
when 'new','create'
|
42
|
-
options[:items].merge!
|
43
|
-
options[:items].merge! publish: { ajax: 'post', icon: 'publish', class: 'green', url: resources_url(resources, controller: params[:controller]), oxremote: 'false' }
|
42
|
+
options[:items].merge!( reset: { action: 'reset', icon: 'undo', class: 'orange darken-2' }){ |key, v1, v2| v1 }
|
43
|
+
options[:items].merge!( publish: { ajax: 'post', icon: 'publish', class: 'green', url: resources_url(resources, controller: params[:controller]), oxremote: 'false' }){ |key, v1, v2| v1 }
|
44
44
|
|
45
45
|
options[:button] ||= "<a class='btn-floating btn-large green'><i class='large material-icons'>publish</i> </a>"
|
46
|
+
|
46
47
|
when 'show'
|
47
|
-
options[:items].merge! add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url, oxremote: 'false' }
|
48
|
-
options[:items].merge! edit: { ajax: 'get', icon: 'edit', class: 'yellow darken-2', url: edit_resource_url, oxremote: 'false' }
|
48
|
+
options[:items].merge!( add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url, oxremote: 'false' }){ |key, v1, v2| v1 }
|
49
|
+
options[:items].merge!( edit: { ajax: 'get', icon: 'edit', class: 'yellow darken-2', url: edit_resource_url, oxremote: 'false' }){ |key, v1, v2| v1 }
|
50
|
+
options[:items].merge!( delete: { ajax: 'delete', icon: 'delete', class: 'red darken-1', url: resources_url, id: resource.id, oxremote: 'false' }){ |key, v1, v2| v1 }
|
51
|
+
|
52
|
+
options[:button] ||= "<a class='btn-floating btn-large blue'><i class='fab-button large material-icons'>edit</i> </a>"
|
49
53
|
|
50
|
-
options[:button] ||= "<a class='btn-floating btn-large blue'><i class='fab-button large material-icons'>mode_edit</i> </a>"
|
51
54
|
when 'edit', 'update'
|
52
|
-
options[:items].merge! add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url , oxremote: 'false'}
|
53
|
-
options[:items].merge! publish: { ajax: 'post', icon: 'publish', class: 'green', url: resource_url, oxremote: 'false' }
|
55
|
+
options[:items].merge!( add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url , oxremote: 'false'}){ |key, v1, v2| v1 }
|
56
|
+
options[:items].merge!( publish: { ajax: 'post', icon: 'publish', class: 'green', url: resource_url, oxremote: 'false' }){ |key, v1, v2| v1 }
|
57
|
+
options[:items].merge!( delete: { ajax: 'delete', icon: 'delete', class: 'red darken-1', url: resources_url, id: resource.id, oxremote: 'false' }){ |key, v1, v2| v1 }
|
58
|
+
|
54
59
|
options[:button] ||= "<a class='btn-floating btn-large green'><i class='large material-icons'>publish</i> </a>"
|
55
60
|
|
56
61
|
when 'index'
|
57
|
-
options[:items].merge! add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url(controller: params[:controller]), oxremote: 'false' }
|
62
|
+
options[:items].merge!( add: { ajax: 'get', icon: 'add', class: 'green lighten-1', url: new_resource_url(controller: params[:controller]), oxremote: 'false' }){ |key, v1, v2| v1 }
|
58
63
|
|
59
64
|
options[:button] ||= "<a class='btn-floating btn-large blue'><i class='fab-button large material-icons'>mode_edit</i> </a>"
|
65
|
+
|
60
66
|
end
|
61
67
|
|
62
68
|
if !options[:items].nil?
|
63
69
|
options[:items].each do |k,item|
|
70
|
+
next if item.empty?
|
64
71
|
item[:ajax] ||= 'get'
|
65
72
|
item[:action] ||= item[:ajax]
|
66
73
|
item[:oxremote] ||= 'false'
|
@@ -3,6 +3,6 @@
|
|
3
3
|
%h3= render partial: 'title'
|
4
4
|
- @disabled = false
|
5
5
|
= render 'form'
|
6
|
-
= render partial: 'edit'
|
6
|
+
= render partial: 'edit' rescue nil
|
7
7
|
- unless params[:format] == 'js'
|
8
8
|
= build_fab_button build_fab_options( resource, fab_button_options.merge!( action: params[:action] ))
|
@@ -3,6 +3,6 @@
|
|
3
3
|
%h3= render partial: 'title'
|
4
4
|
- @disabled = false
|
5
5
|
= render 'form'
|
6
|
-
= render partial: 'new'
|
6
|
+
= render partial: 'new' rescue nil
|
7
7
|
- unless params[:format] == 'js'
|
8
8
|
= build_fab_button build_fab_options( resource, fab_button_options.merge!( action: params[:action] ))
|
@@ -3,6 +3,6 @@
|
|
3
3
|
%h3= render partial: 'title'
|
4
4
|
- @disabled = true
|
5
5
|
= render 'form'
|
6
|
-
= render partial: 'show'
|
6
|
+
= render partial: 'show' rescue nil
|
7
7
|
- unless params[:format] == 'js'
|
8
8
|
= build_fab_button build_fab_options( resource, fab_button_options.merge!( action: params[:action] ))
|
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.4.
|
4
|
+
version: 0.4.15
|
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: 2017-02-
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: amoeba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: responders
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|