abstracted 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18399c8acfa9c24fec9a1715b2cc7c745f18e6c9
|
4
|
+
data.tar.gz: 9de54f97a953ae108bd356d98e52ed3d5242fd00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb588b20e86b96fc179543581fccc5df1d3cf977b7b9787ba1f1b87746dad2c6cbd54e9dbb4d2fc74899d77928162b57809f6aa3eb9fd3f953c2fa213a28ebb
|
7
|
+
data.tar.gz: ccd6d39614493067145a22780100a0376db7f0c6bedf59abac9c7dd99a3bf929b52c81762e5ced3552fe5c7e7cc4e1105dd70a9e990db9c4e4d2631984d478f3
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# App is the (only) global object
|
3
|
+
#
|
4
|
+
# reacts to 'app.something' events
|
5
|
+
#
|
6
|
+
window.App ||= { name: 'App'}
|
7
|
+
|
8
|
+
App.trigger = (event) ->
|
9
|
+
$(App).trigger(event)
|
10
|
+
|
11
|
+
#
|
12
|
+
#
|
13
|
+
App.init = ->
|
14
|
+
#
|
15
|
+
# $( document ).trigger( "page:change" )
|
16
|
+
#
|
17
|
+
# $(document).on 'page:change', ->
|
18
|
+
# console.log 'page changed on event'
|
19
|
+
App.trigger('app:init')
|
20
|
+
console.log 'app initialized'
|
21
|
+
|
22
|
+
#
|
23
|
+
# standard triggers - and actions
|
24
|
+
#
|
25
|
+
$(App).on 'app:modal:open', ->
|
26
|
+
window.ReactRailsUJS.mountComponents()
|
@@ -254,7 +254,9 @@ class AbstractResourcesController < ApplicationController
|
|
254
254
|
def new_resource
|
255
255
|
return nil if resource_class.nil?
|
256
256
|
return resource_class.new if resource_class.ancestors.include?( ActiveRecord::Base ) and !(params.include? resource_class.to_s.underscore) #[ 'create', 'update' ].include? params[:action]
|
257
|
-
|
257
|
+
p = resource_params
|
258
|
+
p=p.compact.first if p.class==Array
|
259
|
+
return resource_class.new(p.merge(current_user: current_user)) if resource_class.ancestors.include? ActiveRecord::Base
|
258
260
|
nil
|
259
261
|
rescue Exception => e
|
260
262
|
scoop_from_error e
|
@@ -521,7 +523,8 @@ class AbstractResourcesController < ApplicationController
|
|
521
523
|
elems.delete :action
|
522
524
|
arr = elems.keys.first.to_s.split("_")
|
523
525
|
return nil unless arr.include? "id"
|
524
|
-
arr
|
526
|
+
arr.pop
|
527
|
+
arr.join("_").singularize.classify.constantize.find(elems.values.first)
|
525
528
|
rescue
|
526
529
|
nil
|
527
530
|
end
|
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.1.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2016-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- app/assets/javascripts/abstract_resources.js
|
272
272
|
- app/assets/javascripts/abstracted/.keep
|
273
273
|
- app/assets/javascripts/crud.js.coffee
|
274
|
+
- app/assets/javascripts/init.js.coffee
|
274
275
|
- app/assets/javascripts/initializers.js.coffee
|
275
276
|
- app/assets/javascripts/pagescrolling.js.coffee
|
276
277
|
- app/assets/stylesheets/abstract_resources.css
|