pinkman 0.9.3.5 → 0.9.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72206997f33ae98d5080b07700996ea86b54386b
4
- data.tar.gz: 18ceb0f7c79260cdc53ac2089982afdd5a68daa6
3
+ metadata.gz: 63025f24163cd79085a8e308096e7dbb59cb22b2
4
+ data.tar.gz: a641d4f33cdd87b939dee9d81fbc0452c1ebf6c4
5
5
  SHA512:
6
- metadata.gz: 0dbd64d06d200c74e60b7e962db772878ce8a8e160f44cbc61cac35b64ef6fb6ea9efc3e808fc95e8504c3db9f3bb2e4cd3e654aec006f7d49dfe2f242ee572a
7
- data.tar.gz: b5fe39a9f1b26bc0522cba1f5c962d1ec2c65e29e6a3ac350581aabbe2356b58721687484f5a679bd9cb23d6ac2d7e802f2fe81e8dd050ff0ef98cece7e6e83f
6
+ metadata.gz: 04f51be10fa4480329805094048e9d62d58114c6318477af2aa294631d9801fde17538ecfc67c9c592f46a844fd3e4323f319436eeb1bef3151a076c59069b59
7
+ data.tar.gz: f0b9404662c7e6fe004c157ea4b5c7121d6a946b86a1b47a823cbaaf563e7b4085dbbf8fad71a9de006f228d40f75f34d787d37603adc0ea3201384e3e7553bc
@@ -14,13 +14,11 @@ class window.PinkmanCommon
14
14
  @isInstance: (object) ->
15
15
  object.constructor is this
16
16
 
17
-
18
17
  initialize: (attributesObject) ->
19
18
  if typeof attributesObject == 'object'
20
19
  for key, value of attributesObject
21
20
  @set(key,value) if PinkmanObject.privateAttributes.indexOf(key) is -1
22
21
 
23
-
24
22
  # Desc: return api url path
25
23
  api: () ->
26
24
  if @config? and @config.api?
@@ -103,3 +101,21 @@ class window.PinkmanCommon
103
101
  options.id = options.template
104
102
  @renderQueue = new PinkmanCollection unless @renderQueue?
105
103
  @renderQueue.directPush(options)
104
+
105
+ hasErrorOn: (attr) ->
106
+ if attr? and (Pinkman.isArray(attr) or Pinkman.isString(attr))
107
+ array = if Pinkman.isArray(attr) then attr else [attr]
108
+ valid = true
109
+ if @errors?
110
+ for a in array
111
+ valid = false if @errors[a]?
112
+ !valid
113
+
114
+ hasErrorsOn: (args...) ->
115
+ @hasErrorOn(args...)
116
+
117
+ anyErrorOn: (args...) ->
118
+ @hasErrorOn(args...)
119
+
120
+ anyErrorsOn: (args...) ->
121
+ @hasErrorOn(args...)
@@ -45,7 +45,11 @@ class window.PinkmanObject extends window.PinkmanCommon
45
45
  a = new Object
46
46
  for k,v of this
47
47
  if PinkmanObject.privateAttributes.indexOf(k) == -1 and typeof v != 'function'
48
- a[k] = if (v? and typeof v == 'object' and v.isPink) then v.json() else v
48
+ if (v? and typeof v == 'object' and v.isPink)
49
+ # do not include collections in json format since they are supposed to have their own model/api
50
+ a[k] = v.json() unless v.isCollection
51
+ else
52
+ a[k] = v
49
53
  return a
50
54
 
51
55
  # Desc: returns a array of attributes keys
@@ -175,11 +179,9 @@ class window.PinkmanObject extends window.PinkmanCommon
175
179
  else
176
180
  return false
177
181
 
178
-
179
182
  save: (callback='') ->
180
183
  if @id? and @id!='' then @update(callback) else @create(callback)
181
184
 
182
-
183
185
  destroy: (callback='') ->
184
186
  if @id?
185
187
  @removeFromAllCollections()
@@ -25,6 +25,28 @@ class window.Pinkman
25
25
 
26
26
  # --- tools and facilities
27
27
 
28
+ @ctrl_c: (text) ->
29
+ textArea = document.createElement('textarea')
30
+ textArea.style.position = 'fixed'
31
+ textArea.style.top = 0
32
+ textArea.style.left = 0
33
+ textArea.style.width = '2em'
34
+ textArea.style.height = '2em'
35
+ textArea.style.padding = 0
36
+ textArea.style.border = 'none'
37
+ textArea.style.outline = 'none'
38
+ textArea.style.boxShadow = 'none'
39
+ textArea.style.background = 'transparent'
40
+ textArea.value = text
41
+ document.body.appendChild(textArea)
42
+ textArea.select();
43
+ try
44
+ successful = document.execCommand('copy')
45
+ @ctrl_v = text
46
+ document.body.removeChild(textArea)
47
+ successful
48
+
49
+
28
50
  @doAfter: (ds, callback, timer = '_pinkman_doAfter') ->
29
51
  window[timer] = window.setTimeout(callback, ds*100)
30
52
 
@@ -1,3 +1,3 @@
1
1
  module Pinkman
2
- VERSION = "0.9.3.5"
2
+ VERSION = "0.9.3.6"
3
3
  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: 0.9.3.5
4
+ version: 0.9.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agilso Oliveira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-03 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler