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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aeef6b73efc71a58a15c9a9c890da2dcab9b4c5129a52da2e9b6bbf33fdf16c
4
- data.tar.gz: 1b58f80c6618a2f9c772a17205fe7f6f3a290ee448f5973e3e8055809fd84923
3
+ metadata.gz: d54a63a8ebb95cb3d0acce83d79aa979668b50c5ea60005e4baa39d8cdc351ac
4
+ data.tar.gz: b0c3a8143f4b20d710302ea5ac6826697184cce4b5a92489db1af224dc063578
5
5
  SHA512:
6
- metadata.gz: f8e74580d7f02430a9be0e1c2a653f050f1d4d714b00c9c94733be3a94cc680585bb7749c2092ae3bb420a1793fb2b25ca65c4599d8af56137558279a47ab587
7
- data.tar.gz: b7490f262eb37b3512614e11baab2e03fedc24958046cfd37763f1d208584e05fa7f7b476cfaae46baf2f2b4a14eb2abd8222afdb7d2f4b2487754bba5e2b3dc
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 || true
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
- ev.preventDefault() if (eventName != 'keypress' and eventName != 'mousedown') and @preventDefault
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
- pinkmanscope = self.class.scope(scope)
113
- include_all = pinkmanscope.read.include?(:all)
114
- model = self.class.model
115
- model.column_names.each {|attribute| hash[attribute] = object.send(attribute) } if include_all && model && model.methods.include?(:column_names)
116
- pinkmanscope.read.each {|attribute| hash[attribute] = send(attribute) if self.methods.include?(attribute)}
117
- pinkmanscope.read.each {|attribute| hash[attribute] ||= object.send(attribute) if object.methods.include?(attribute)}
118
- pinkmanscope.read_ghost.each {|attribute| begin hash[attribute] ||= object.send(attribute) rescue nil end }
119
- hash[:destroyed] = true if object.destroyed?
120
- hash[:errors] = self.class.format_errors(errors) if errors.present? and errors.any?
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
@@ -1,3 +1,3 @@
1
1
  module Pinkman
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.5"
3
3
  end
@@ -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?
@@ -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.9.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.0
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-08-09 00:00:00.000000000 Z
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.9.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.9.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.3
325
+ rubygems_version: 3.0.6
326
326
  signing_key:
327
327
  specification_version: 4
328
328
  summary: Small Rails-js framework.