pinkman 0.9.8 → 0.9.8.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8cc205f11a3f3d39bc61d4f33d7ce30745061d58
|
|
4
|
+
data.tar.gz: df73337be8d758164de6d80bbbdabeb1fb6102b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e633f748f05e4ef7bdbcbe998279f9cfaf44a3a1939137f987ceec8e49f1460fdf33e7c11922e7b1e3e89a7fad2387c005d78c66decdf0dade14b4a1327feefc
|
|
7
|
+
data.tar.gz: 0de7d512ba641b628dd25ed9b571cc66bad2a2cb88f55c48be3227bad9a87a7d65d1b1160ba610cfda2bb3f1243ad805d2cb85d5c076ec1ffc08d29bb4b1f57c
|
|
@@ -50,9 +50,10 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
50
50
|
# rails/ruby equivalent: each
|
|
51
51
|
# Desc: receive a function and apply it to all members
|
|
52
52
|
# tip: you can chain functions. Example: collection.each(transform).first()
|
|
53
|
-
each: (transformation='') ->
|
|
53
|
+
each: (transformation='',callback) ->
|
|
54
54
|
if transformation? and typeof transformation=='function'
|
|
55
55
|
transformation(o) for o in @collection
|
|
56
|
+
callback(this) if typeof callback == 'function'
|
|
56
57
|
return this
|
|
57
58
|
|
|
58
59
|
# rails/ruby equivalent: where/select
|
|
@@ -344,6 +345,7 @@ class window.PinkmanCollection extends window.PinkmanCommon
|
|
|
344
345
|
else
|
|
345
346
|
return -1
|
|
346
347
|
@collection = if order.toLowerCase()=="asc" then array else array.reverse()
|
|
348
|
+
return(this)
|
|
347
349
|
|
|
348
350
|
# Desc: exactly what it suggests
|
|
349
351
|
shuffle: () ->
|
|
@@ -16,6 +16,11 @@ Pinkman.closest = (jquery,level=0) ->
|
|
|
16
16
|
|
|
17
17
|
# --- controller object
|
|
18
18
|
class window.PinkmanController extends window.PinkmanObject
|
|
19
|
+
|
|
20
|
+
clear: ->
|
|
21
|
+
@actions.each (a) ->
|
|
22
|
+
a.clear()
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
constructor: (args...) ->
|
|
21
26
|
@actions = new PinkmanActions
|
|
@@ -158,10 +163,23 @@ class window.PinkmanController extends window.PinkmanObject
|
|
|
158
163
|
|
|
159
164
|
# --- controller collection
|
|
160
165
|
class window.PinkmanControllers extends window.PinkmanCollection
|
|
161
|
-
|
|
166
|
+
|
|
167
|
+
clear: (callback) ->
|
|
168
|
+
@unbindScrolling() if @pinkey == Pinkman.controllers.pinkey
|
|
169
|
+
@each (c) ->
|
|
170
|
+
c.clear()
|
|
171
|
+
, callback
|
|
172
|
+
|
|
173
|
+
unbindScrolling: ->
|
|
174
|
+
$(window).off('scroll')
|
|
175
|
+
|
|
162
176
|
# --- actions object
|
|
163
177
|
class window.PinkmanAction extends window.PinkmanObject
|
|
164
|
-
|
|
178
|
+
|
|
179
|
+
constructor: (args...) ->
|
|
180
|
+
super(args...)
|
|
181
|
+
@events = []
|
|
182
|
+
|
|
165
183
|
# Desc: mirrors/redirects a action to another already defined
|
|
166
184
|
mirror: (controllerID,actionName) ->
|
|
167
185
|
# gets all actions named 'action' in all controllers with 'controller' id
|
|
@@ -180,10 +198,16 @@ class window.PinkmanAction extends window.PinkmanObject
|
|
|
180
198
|
redirectTo: (args...) ->
|
|
181
199
|
@mirror(args...)
|
|
182
200
|
|
|
201
|
+
# Desc: removes event
|
|
202
|
+
clear: ->
|
|
203
|
+
for ev in @events
|
|
204
|
+
$('body').off ev, @selector
|
|
205
|
+
|
|
183
206
|
# Desc: attaches one single event
|
|
184
207
|
attach: (eventName) ->
|
|
185
208
|
if Pinkman.isString(eventName) and $("##{@controller.id}").length
|
|
186
209
|
action = this
|
|
210
|
+
@events.push(eventName)
|
|
187
211
|
$('body').on eventName, action.selector, (ev) ->
|
|
188
212
|
ev.preventDefault() if eventName != 'keypress' and eventName != 'mousedown'
|
|
189
213
|
obj = window.Pinkman.closest($(this))
|
|
@@ -12,20 +12,26 @@ class window.PinkmanPath extends Pinkman.object
|
|
|
12
12
|
a.shift() if a[0] == ''
|
|
13
13
|
a.pop() if a[a.length-1] == ''
|
|
14
14
|
i = 0
|
|
15
|
+
s = 0
|
|
16
|
+
d = 0
|
|
15
17
|
for l in a
|
|
16
18
|
i = i + 1
|
|
17
19
|
obj = new Pinkman.object({entry: l, index: i})
|
|
18
20
|
if /:/.test(l[0])
|
|
21
|
+
d = d + 1
|
|
19
22
|
obj.set('dynamic',yes)
|
|
20
23
|
obj.set('static',no)
|
|
21
24
|
@dynamic.push(obj)
|
|
22
25
|
else
|
|
26
|
+
s = s + 1
|
|
23
27
|
obj.set('dynamic',no)
|
|
24
28
|
obj.set('static',yes)
|
|
25
29
|
@static.push(obj)
|
|
26
30
|
@levels.push(obj)
|
|
27
|
-
|
|
31
|
+
|
|
28
32
|
@set('depth',i)
|
|
33
|
+
@set('staticDepth',s)
|
|
34
|
+
@set('dynamicDepth',d)
|
|
29
35
|
|
|
30
36
|
|
|
31
37
|
@isExternal: (url) ->
|
|
@@ -58,7 +64,10 @@ class window.PinkmanRouteMatcher extends Pinkman.object
|
|
|
58
64
|
|
|
59
65
|
initialize: ->
|
|
60
66
|
if @controllers.any()?
|
|
67
|
+
Pinkman.controllers.unbindScrolling()
|
|
68
|
+
# console.log 'clear dos Pinkman.controllers'
|
|
61
69
|
@controllers.each (c) =>
|
|
70
|
+
# console.log 'dentro dos controllers desse router'
|
|
62
71
|
c.setParams(@params())
|
|
63
72
|
c.build(yes)
|
|
64
73
|
else
|
|
@@ -70,8 +79,7 @@ class window.PinkmanRouteMatcher extends Pinkman.object
|
|
|
70
79
|
candidates = Pinkman.routes.select(depth: path.depth)
|
|
71
80
|
routes = candidates.select (candidate) ->
|
|
72
81
|
candidate.path.match(path)
|
|
73
|
-
route = routes.first()
|
|
74
|
-
|
|
82
|
+
route = routes.sortBy('staticDepth','desc').first()
|
|
75
83
|
if route?
|
|
76
84
|
@set('url',url)
|
|
77
85
|
@set('path',path)
|
|
@@ -139,6 +147,7 @@ class window.PinkmanRouter
|
|
|
139
147
|
yieldIn = r.route.yieldIn() || @_config.yield
|
|
140
148
|
$(yieldIn).html("<div class='pink-yield' id='#{r.controller}'></div>") if r.route.blank
|
|
141
149
|
r.initialize()
|
|
150
|
+
window.scrollTo(0,0) unless Pinkman.router._config.freeze
|
|
142
151
|
callback() if typeof callback == 'function'
|
|
143
152
|
true
|
|
144
153
|
else
|
|
@@ -181,7 +190,7 @@ class window.PinkmanRouter
|
|
|
181
190
|
route = new PinkmanRoute
|
|
182
191
|
route.set('id',path)
|
|
183
192
|
route.set('url',path)
|
|
184
|
-
route.set('path',p).set('depth',p.depth)
|
|
193
|
+
route.set('path',p).set('depth',p.depth).set('staticDepth',p.staticDepth).set('dynamicDepth',p.dynamicDepth)
|
|
185
194
|
route.set('blank',yes)
|
|
186
195
|
route.set('controller', if object? and object.controller? then object.controller else p.level(1).entry)
|
|
187
196
|
if object? and typeof object == 'object'
|
data/lib/pinkman/version.rb
CHANGED