pinkman 1.4.0 → 1.4.5
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/pinkman_base/collection.coffee +12 -0
- data/app/assets/javascripts/pinkman_base/controller.coffee +11 -2
- data/lib/pinkman/serializer/base.rb +14 -10
- data/lib/pinkman/version.rb +1 -1
- data/lib/pinkman/views_helpers/dispatcher.rb +7 -0
- data/pinkman.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d54a63a8ebb95cb3d0acce83d79aa979668b50c5ea60005e4baa39d8cdc351ac
|
4
|
+
data.tar.gz: b0c3a8143f4b20d710302ea5ac6826697184cce4b5a92489db1af224dc063578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d1b8afbbaecade562f1cd9776c069b7b991343ea74beab91b6af5fe21eeb7b9c5a0c3929db2acb0c1f66d38536bd2371bd66ce94b47fe67ec11c3a282f771ed
|
7
|
+
data.tar.gz: 158438e42ba3f6de9b75f52335b7f552da35a9665e318a1ab9c6a5690b85823ea8593175cbd59fcae775d88703b43d5468e4f932ac9e2e64a622cd390c80519b
|
@@ -94,6 +94,18 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
94
94
|
transformation(o)
|
95
95
|
callback(this) if (i == @count()) and typeof callback == 'function'
|
96
96
|
return this
|
97
|
+
|
98
|
+
# rails/ruby equivalent: map
|
99
|
+
# Desc: receive a function and apply it to all members and returns an array of values
|
100
|
+
map: (transformation='',callback) ->
|
101
|
+
array = []
|
102
|
+
if transformation? and typeof transformation=='function'
|
103
|
+
i = 0
|
104
|
+
for o in @collection
|
105
|
+
i = i+1
|
106
|
+
array.push(transformation(o))
|
107
|
+
callback(array) if (i == @count()) and typeof callback == 'function'
|
108
|
+
return array
|
97
109
|
|
98
110
|
# rails/ruby equivalent: where/select
|
99
111
|
# Desc: returns a new collection of all members that satisfies a criteria (criteria(obj) returns true)
|
@@ -79,7 +79,7 @@ class window.PinkmanController extends window.PinkmanObject
|
|
79
79
|
eventName: eventName
|
80
80
|
callback: callback
|
81
81
|
controller: this
|
82
|
-
preventDefault: preventDefault
|
82
|
+
preventDefault: if preventDefault? then preventDefault else true
|
83
83
|
selector: "##{this.id} [data-action='#{name}']"
|
84
84
|
|
85
85
|
|
@@ -409,6 +409,7 @@ class window.PinkmanAction extends window.PinkmanObject
|
|
409
409
|
a.set 'eventName', options.eventName
|
410
410
|
|
411
411
|
# default value for preventDefault: yes
|
412
|
+
# console.log options.preventDefault
|
412
413
|
a.set 'preventDefault', options.preventDefault
|
413
414
|
|
414
415
|
# a.log 'eventName'
|
@@ -460,7 +461,15 @@ class window.PinkmanAction extends window.PinkmanObject
|
|
460
461
|
$('body').on eventName, action.selector, (ev) ->
|
461
462
|
# debugger
|
462
463
|
# console.log "#{action.id}: called - #{action.name}"
|
463
|
-
|
464
|
+
|
465
|
+
ev.preventDefault() if (eventName != 'keypress' and eventName != 'mousedown') and action.preventDefault
|
466
|
+
# debug mode
|
467
|
+
# if (eventName != 'keypress' and eventName != 'mousedown') and action.preventDefault
|
468
|
+
# console.log 'chamou prevent default'
|
469
|
+
# ev.preventDefault()
|
470
|
+
# else
|
471
|
+
# console.log 'não chamou prevent default'
|
472
|
+
|
464
473
|
obj = window.Pinkman.closest($(this))
|
465
474
|
action.call(obj,$(this),ev)
|
466
475
|
|
@@ -16,7 +16,7 @@ module Pinkman
|
|
16
16
|
self
|
17
17
|
end
|
18
18
|
|
19
|
-
self.root = false
|
19
|
+
# self.root = false
|
20
20
|
def self.table_name
|
21
21
|
model.table_name
|
22
22
|
end
|
@@ -109,15 +109,19 @@ module Pinkman
|
|
109
109
|
def attributes *args
|
110
110
|
hash = super(*args)
|
111
111
|
if scope
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
begin
|
113
|
+
pinkmanscope = self.class.scope(scope)
|
114
|
+
include_all = pinkmanscope.read.include?(:all)
|
115
|
+
model = self.class.model
|
116
|
+
model.column_names.each {|attribute| hash[attribute] = object.send(attribute) } if include_all && model && model.methods.include?(:column_names)
|
117
|
+
pinkmanscope.read.each {|attribute| hash[attribute] = send(attribute) if self.methods.include?(attribute)}
|
118
|
+
pinkmanscope.read.each {|attribute| hash[attribute] ||= object.send(attribute) if object.methods.include?(attribute)}
|
119
|
+
pinkmanscope.read_ghost.each {|attribute| begin hash[attribute] ||= object.send(attribute) rescue nil end }
|
120
|
+
hash[:destroyed] = true if object.destroyed?
|
121
|
+
hash[:errors] = self.class.format_errors(errors) if errors.present? and errors.any?
|
122
|
+
rescue
|
123
|
+
nil
|
124
|
+
end
|
121
125
|
hash
|
122
126
|
end
|
123
127
|
end
|
data/lib/pinkman/version.rb
CHANGED
@@ -7,6 +7,13 @@ module Pinkman
|
|
7
7
|
@rails_helper = value
|
8
8
|
end
|
9
9
|
|
10
|
+
def form_helpers
|
11
|
+
Pinkman::FormHelper.dispatcher(@rails_helper)
|
12
|
+
end
|
13
|
+
def f
|
14
|
+
form_helpers
|
15
|
+
end
|
16
|
+
|
10
17
|
def method_missing m, *args, &block
|
11
18
|
if Pinkman::ViewsHelpers.respond_to?(m)
|
12
19
|
if block_given?
|
data/pinkman.gemspec
CHANGED
@@ -43,6 +43,6 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_dependency 'rails'
|
44
44
|
spec.add_dependency 'activerecord'
|
45
45
|
spec.add_dependency 'jquery-rails'
|
46
|
-
spec.add_dependency 'active_model_serializers', '~> 0.
|
46
|
+
spec.add_dependency 'active_model_serializers', '~> 0.10.0'
|
47
47
|
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinkman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agilso Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.10.0
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
180
|
+
version: 0.10.0
|
181
181
|
description: 'Pinkman: a new way to orchestrate javascript in Rails.'
|
182
182
|
email:
|
183
183
|
- agilso.b@gmail.com
|
@@ -322,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
322
|
- !ruby/object:Gem::Version
|
323
323
|
version: '0'
|
324
324
|
requirements: []
|
325
|
-
rubygems_version: 3.0.
|
325
|
+
rubygems_version: 3.0.6
|
326
326
|
signing_key:
|
327
327
|
specification_version: 4
|
328
328
|
summary: Small Rails-js framework.
|