ende 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (299) hide show
  1. checksums.yaml +4 -4
  2. data/component.json +2 -1
  3. data/lib/assets/javascripts/aura/extensions/devise.js.coffee +3 -2
  4. data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +1 -2
  5. data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +37 -16
  6. data/lib/assets/javascripts/ende.js.coffee +1 -1
  7. data/lib/assets/javascripts/widgets/dialog/main.js.coffee +100 -0
  8. data/lib/assets/javascripts/widgets/dialog/presenter.js.coffee +18 -0
  9. data/lib/assets/javascripts/widgets/dialog/states/default.html +2 -0
  10. data/lib/assets/javascripts/widgets/dialog/states/index.js.coffee +2 -0
  11. data/lib/assets/javascripts/widgets/list/main.js.coffee +1 -0
  12. data/lib/assets/stylesheets/ende.styl +1 -0
  13. data/lib/ende/version.rb +1 -1
  14. data/lib/ende.rb +6 -2
  15. data/vendor/assets/components/build.css +111 -0
  16. data/vendor/{components/indefinido-indemma/build/release.js → assets/components/build.js} +25468 -17590
  17. data/vendor/assets/components/ende_build.css +111 -0
  18. data/vendor/assets/components/ende_build.js +29571 -0
  19. data/vendor/assets/javascripts/ende/build.js +1962 -0
  20. data/vendor/components/component-classes/component.json +19 -0
  21. data/vendor/components/component-classes/index.js +165 -0
  22. data/vendor/components/component-css/component.json +18 -0
  23. data/vendor/components/component-css/index.js +34 -0
  24. data/vendor/components/component-delegate/component.json +2 -2
  25. data/vendor/components/component-delegate/index.js +4 -4
  26. data/vendor/components/component-dialog/component.json +23 -0
  27. data/vendor/components/component-dialog/dialog.css +92 -0
  28. data/vendor/components/component-dialog/index.js +292 -0
  29. data/vendor/components/component-dialog/template.js +1 -0
  30. data/vendor/components/component-dom/component.json +33 -0
  31. data/vendor/components/component-dom/index.js +725 -0
  32. data/vendor/components/component-domify/component.json +22 -0
  33. data/vendor/components/component-domify/index.js +71 -0
  34. data/vendor/components/component-emitter/component.json +13 -0
  35. data/vendor/components/component-emitter/index.js +156 -0
  36. data/vendor/components/component-event/index.js +8 -11
  37. data/vendor/components/component-indexof/component.json +15 -0
  38. data/vendor/components/component-indexof/index.js +10 -0
  39. data/vendor/components/component-overlay/component.json +22 -0
  40. data/vendor/components/component-overlay/index.js +111 -0
  41. data/vendor/components/component-overlay/overlay.css +19 -0
  42. data/vendor/components/component-overlay/template.js +1 -0
  43. data/vendor/components/component-query/component.json +2 -1
  44. data/vendor/components/component-sort/component.json +20 -0
  45. data/vendor/components/component-sort/index.js +43 -0
  46. data/vendor/components/component-value/component.json +25 -0
  47. data/vendor/components/component-value/index.js +95 -0
  48. data/vendor/components/indefinido-indemma/component.json +2 -3
  49. data/vendor/components/indefinido-indemma/lib/record/resource.js +2 -4
  50. data/vendor/components/mikeric-rivets/component.json +1 -1
  51. data/vendor/components/mikeric-rivets/dist/rivets.js +64 -44
  52. data/vendor/components/paulmillr-es6-shim/component.json +1 -1
  53. data/vendor/components/paulmillr-es6-shim/es6-shim.js +22 -11
  54. data/vendor/components/pluma-assimilate/component.json +1 -1
  55. data/vendor/components/pluma-assimilate/dist/assimilate.js +103 -63
  56. metadata +35 -246
  57. data/lib/tasks/component.thor +0 -63
  58. data/vendor/assets/components/KapIT-observe-utils/component.json +0 -16
  59. data/vendor/assets/components/KapIT-observe-utils/lib/observe-utils.js +0 -780
  60. data/vendor/assets/components/chaijs-assertion-error/component.json +0 -18
  61. data/vendor/assets/components/chaijs-assertion-error/index.js +0 -110
  62. data/vendor/assets/components/chaijs-chai/component.json +0 -47
  63. data/vendor/assets/components/chaijs-chai/index.js +0 -1
  64. data/vendor/assets/components/chaijs-chai/lib/chai/assertion.js +0 -130
  65. data/vendor/assets/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
  66. data/vendor/assets/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
  67. data/vendor/assets/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
  68. data/vendor/assets/components/chaijs-chai/lib/chai/interface/should.js +0 -76
  69. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
  70. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
  71. data/vendor/assets/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
  72. data/vendor/assets/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
  73. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
  74. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
  75. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
  76. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
  77. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
  78. data/vendor/assets/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
  79. data/vendor/assets/components/chaijs-chai/lib/chai/utils/index.js +0 -108
  80. data/vendor/assets/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
  81. data/vendor/assets/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
  82. data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
  83. data/vendor/assets/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
  84. data/vendor/assets/components/chaijs-chai/lib/chai/utils/test.js +0 -26
  85. data/vendor/assets/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
  86. data/vendor/assets/components/chaijs-chai/lib/chai/utils/type.js +0 -45
  87. data/vendor/assets/components/chaijs-chai/lib/chai.js +0 -80
  88. data/vendor/assets/components/chaijs-deep-eql/component.json +0 -18
  89. data/vendor/assets/components/chaijs-deep-eql/lib/eql.js +0 -257
  90. data/vendor/assets/components/chaijs-type-detect/component.json +0 -16
  91. data/vendor/assets/components/chaijs-type-detect/lib/type.js +0 -142
  92. data/vendor/assets/components/component-bind/component.json +0 -14
  93. data/vendor/assets/components/component-bind/index.js +0 -24
  94. data/vendor/assets/components/component-delegate/component.json +0 -19
  95. data/vendor/assets/components/component-delegate/index.js +0 -42
  96. data/vendor/assets/components/component-event/component.json +0 -13
  97. data/vendor/assets/components/component-event/index.js +0 -40
  98. data/vendor/assets/components/component-jquery/component.json +0 -14
  99. data/vendor/assets/components/component-jquery/index.js +0 -9601
  100. data/vendor/assets/components/component-link-delegate/component.json +0 -23
  101. data/vendor/assets/components/component-link-delegate/index.js +0 -60
  102. data/vendor/assets/components/component-matches-selector/component.json +0 -20
  103. data/vendor/assets/components/component-matches-selector/index.js +0 -45
  104. data/vendor/assets/components/component-query/component.json +0 -21
  105. data/vendor/assets/components/component-query/index.js +0 -21
  106. data/vendor/assets/components/component-type/component.json +0 -18
  107. data/vendor/assets/components/component-type/index.js +0 -32
  108. data/vendor/assets/components/component-url/component.json +0 -17
  109. data/vendor/assets/components/component-url/index.js +0 -63
  110. data/vendor/assets/components/discore-closest/component.json +0 -14
  111. data/vendor/assets/components/discore-closest/index.js +0 -18
  112. data/vendor/assets/components/indefinido-advisable/component.json +0 -21
  113. data/vendor/assets/components/indefinido-advisable/index.js +0 -1
  114. data/vendor/assets/components/indefinido-advisable/lib/advisable.js +0 -60
  115. data/vendor/assets/components/indefinido-indemma/component.json +0 -40
  116. data/vendor/assets/components/indefinido-indemma/index.js +0 -1
  117. data/vendor/assets/components/indefinido-indemma/lib/extensions/rivets.js +0 -23
  118. data/vendor/assets/components/indefinido-indemma/lib/record/associable.js +0 -217
  119. data/vendor/assets/components/indefinido-indemma/lib/record/maid.js +0 -24
  120. data/vendor/assets/components/indefinido-indemma/lib/record/resource.js +0 -104
  121. data/vendor/assets/components/indefinido-indemma/lib/record/rest.js +0 -36
  122. data/vendor/assets/components/indefinido-indemma/lib/record/restfulable.js +0 -326
  123. data/vendor/assets/components/indefinido-indemma/lib/record/scopable.js +0 -279
  124. data/vendor/assets/components/indefinido-indemma/lib/record/translationable.js +0 -19
  125. data/vendor/assets/components/indefinido-indemma/lib/record/validatable.js +0 -216
  126. data/vendor/assets/components/indefinido-indemma/lib/record/validations/associated.js +0 -30
  127. data/vendor/assets/components/indefinido-indemma/lib/record/validations/confirmation.js +0 -19
  128. data/vendor/assets/components/indefinido-indemma/lib/record/validations/cpf.js +0 -60
  129. data/vendor/assets/components/indefinido-indemma/lib/record/validations/presence.js +0 -19
  130. data/vendor/assets/components/indefinido-indemma/lib/record/validations/remote.js +0 -71
  131. data/vendor/assets/components/indefinido-indemma/lib/record.js +0 -167
  132. data/vendor/assets/components/indefinido-indemma/vendor/sinon.js +0 -4290
  133. data/vendor/assets/components/indefinido-indemma/vendor/stampit.js +0 -392
  134. data/vendor/assets/components/indefinido-observable/component.json +0 -25
  135. data/vendor/assets/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
  136. data/vendor/assets/components/indefinido-observable/index.js +0 -1
  137. data/vendor/assets/components/indefinido-observable/lib/adapters/rivets.js +0 -26
  138. data/vendor/assets/components/indefinido-observable/lib/observable.js +0 -320
  139. data/vendor/assets/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
  140. data/vendor/assets/components/indefinido-observable/vendor/shims/accessors.js +0 -173
  141. data/vendor/assets/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
  142. data/vendor/assets/components/indefinido-observable/vendor/shims/object.create.js +0 -77
  143. data/vendor/assets/components/mikeric-rivets/component.json +0 -15
  144. data/vendor/assets/components/mikeric-rivets/dist/rivets.js +0 -1020
  145. data/vendor/assets/components/paulmillr-es6-shim/component.json +0 -17
  146. data/vendor/assets/components/paulmillr-es6-shim/es6-shim.js +0 -985
  147. data/vendor/assets/components/pluma-assimilate/component.json +0 -25
  148. data/vendor/assets/components/pluma-assimilate/dist/assimilate.js +0 -87
  149. data/vendor/assets/components/segmentio-extend/component.json +0 -13
  150. data/vendor/assets/components/segmentio-extend/index.js +0 -15
  151. data/vendor/components/chaijs-assertion-error/component.json +0 -18
  152. data/vendor/components/chaijs-assertion-error/index.js +0 -110
  153. data/vendor/components/chaijs-chai/component.json +0 -47
  154. data/vendor/components/chaijs-chai/index.js +0 -1
  155. data/vendor/components/chaijs-chai/lib/chai/assertion.js +0 -130
  156. data/vendor/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
  157. data/vendor/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
  158. data/vendor/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
  159. data/vendor/components/chaijs-chai/lib/chai/interface/should.js +0 -76
  160. data/vendor/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
  161. data/vendor/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
  162. data/vendor/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
  163. data/vendor/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
  164. data/vendor/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
  165. data/vendor/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
  166. data/vendor/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
  167. data/vendor/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
  168. data/vendor/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
  169. data/vendor/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
  170. data/vendor/components/chaijs-chai/lib/chai/utils/index.js +0 -108
  171. data/vendor/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
  172. data/vendor/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
  173. data/vendor/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
  174. data/vendor/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
  175. data/vendor/components/chaijs-chai/lib/chai/utils/test.js +0 -26
  176. data/vendor/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
  177. data/vendor/components/chaijs-chai/lib/chai/utils/type.js +0 -45
  178. data/vendor/components/chaijs-chai/lib/chai.js +0 -80
  179. data/vendor/components/chaijs-deep-eql/component.json +0 -18
  180. data/vendor/components/chaijs-deep-eql/lib/eql.js +0 -257
  181. data/vendor/components/chaijs-type-detect/component.json +0 -16
  182. data/vendor/components/chaijs-type-detect/lib/type.js +0 -142
  183. data/vendor/components/component-link-delegate/component.json +0 -23
  184. data/vendor/components/component-link-delegate/index.js +0 -60
  185. data/vendor/components/component-url/component.json +0 -17
  186. data/vendor/components/component-url/index.js +0 -63
  187. data/vendor/components/discore-closest/component.json +0 -14
  188. data/vendor/components/discore-closest/index.js +0 -18
  189. data/vendor/components/indefinido-indemma/.gitignore +0 -14
  190. data/vendor/components/indefinido-indemma/.ruby-gemset +0 -1
  191. data/vendor/components/indefinido-indemma/.ruby-version +0 -1
  192. data/vendor/components/indefinido-indemma/Gemfile +0 -13
  193. data/vendor/components/indefinido-indemma/Guardfile +0 -39
  194. data/vendor/components/indefinido-indemma/History.md +0 -0
  195. data/vendor/components/indefinido-indemma/Readme.md +0 -443
  196. data/vendor/components/indefinido-indemma/build/development.js +0 -331
  197. data/vendor/components/indefinido-indemma/build/test.js +0 -331
  198. data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +0 -18
  199. data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +0 -110
  200. data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +0 -47
  201. data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +0 -1
  202. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +0 -130
  203. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
  204. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
  205. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
  206. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +0 -76
  207. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
  208. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
  209. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
  210. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +0 -129
  211. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
  212. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
  213. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
  214. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
  215. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
  216. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
  217. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
  218. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +0 -108
  219. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
  220. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
  221. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
  222. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
  223. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +0 -26
  224. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
  225. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +0 -45
  226. data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +0 -80
  227. data/vendor/components/indefinido-indemma/components/component-bind/component.json +0 -14
  228. data/vendor/components/indefinido-indemma/components/component-bind/index.js +0 -24
  229. data/vendor/components/indefinido-indemma/components/component-jquery/component.json +0 -14
  230. data/vendor/components/indefinido-indemma/components/component-jquery/index.js +0 -9601
  231. data/vendor/components/indefinido-indemma/components/component-type/component.json +0 -18
  232. data/vendor/components/indefinido-indemma/components/component-type/index.js +0 -32
  233. data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +0 -21
  234. data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +0 -1
  235. data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +0 -60
  236. data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +0 -25
  237. data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
  238. data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +0 -1
  239. data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +0 -26
  240. data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +0 -323
  241. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +0 -92
  242. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +0 -173
  243. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +0 -8
  244. data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +0 -77
  245. data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +0 -13
  246. data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +0 -25
  247. data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +0 -87
  248. data/vendor/components/indefinido-indemma/karma.conf.js +0 -86
  249. data/vendor/components/indefinido-indemma/lib/record/errors.js +0 -1
  250. data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +0 -76
  251. data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +0 -90
  252. data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +0 -32
  253. data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +0 -232
  254. data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +0 -201
  255. data/vendor/components/indefinido-indemma/spec/record/translationable.js +0 -28
  256. data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +0 -111
  257. data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +0 -43
  258. data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +0 -36
  259. data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +0 -35
  260. data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +0 -28
  261. data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +0 -86
  262. data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +0 -48
  263. data/vendor/components/indefinido-indemma/spec/record_spec.js +0 -37
  264. data/vendor/components/indefinido-indemma/spec/spec_helper.js +0 -11
  265. data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +0 -45
  266. data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +0 -17
  267. data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +0 -173
  268. data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +0 -20
  269. data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +0 -16
  270. data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +0 -103
  271. data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +0 -28
  272. data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +0 -314
  273. data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +0 -266
  274. data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +0 -18
  275. data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +0 -209
  276. data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +0 -32
  277. data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +0 -19
  278. data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +0 -58
  279. data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +0 -19
  280. data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +0 -65
  281. data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +0 -32
  282. data/vendor/components/indefinido-indemma/src/lib/record.coffee +0 -123
  283. data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +0 -63
  284. data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +0 -64
  285. data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +0 -22
  286. data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +0 -164
  287. data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +0 -181
  288. data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +0 -19
  289. data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +0 -100
  290. data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +0 -35
  291. data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +0 -25
  292. data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +0 -28
  293. data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +0 -24
  294. data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +0 -72
  295. data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +0 -33
  296. data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +0 -23
  297. data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +0 -9
  298. data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +0 -30
  299. data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +0 -190
@@ -1,1020 +0,0 @@
1
- // Rivets.js
2
- // version: 0.5.13
3
- // author: Michael Richards
4
- // license: MIT
5
- (function() {
6
- var Rivets, jQuery,
7
- __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
8
- __slice = [].slice,
9
- __hasProp = {}.hasOwnProperty,
10
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
11
- __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
12
-
13
- Rivets = {};
14
-
15
- jQuery = window.jQuery || window.Zepto;
16
-
17
- if (!String.prototype.trim) {
18
- String.prototype.trim = function() {
19
- return this.replace(/^\s+|\s+$/g, '');
20
- };
21
- }
22
-
23
- Rivets.Binding = (function() {
24
- function Binding(view, el, type, key, keypath, options) {
25
- var identifier, regexp, value, _ref;
26
- this.view = view;
27
- this.el = el;
28
- this.type = type;
29
- this.key = key;
30
- this.keypath = keypath;
31
- this.options = options != null ? options : {};
32
- this.update = __bind(this.update, this);
33
- this.unbind = __bind(this.unbind, this);
34
- this.bind = __bind(this.bind, this);
35
- this.publish = __bind(this.publish, this);
36
- this.sync = __bind(this.sync, this);
37
- this.set = __bind(this.set, this);
38
- this.eventHandler = __bind(this.eventHandler, this);
39
- this.formattedValue = __bind(this.formattedValue, this);
40
- if (!(this.binder = this.view.binders[type])) {
41
- _ref = this.view.binders;
42
- for (identifier in _ref) {
43
- value = _ref[identifier];
44
- if (identifier !== '*' && identifier.indexOf('*') !== -1) {
45
- regexp = new RegExp("^" + (identifier.replace('*', '.+')) + "$");
46
- if (regexp.test(type)) {
47
- this.binder = value;
48
- this.args = new RegExp("^" + (identifier.replace('*', '(.+)')) + "$").exec(type);
49
- this.args.shift();
50
- }
51
- }
52
- }
53
- }
54
- this.binder || (this.binder = this.view.binders['*']);
55
- if (this.binder instanceof Function) {
56
- this.binder = {
57
- routine: this.binder
58
- };
59
- }
60
- this.formatters = this.options.formatters || [];
61
- this.model = this.key ? this.view.models[this.key] : this.view.models;
62
- }
63
-
64
- Binding.prototype.formattedValue = function(value) {
65
- var args, formatter, id, _i, _len, _ref;
66
- _ref = this.formatters;
67
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
68
- formatter = _ref[_i];
69
- args = formatter.split(/\s+/);
70
- id = args.shift();
71
- formatter = this.model[id] instanceof Function ? this.model[id] : this.view.formatters[id];
72
- if ((formatter != null ? formatter.read : void 0) instanceof Function) {
73
- value = formatter.read.apply(formatter, [value].concat(__slice.call(args)));
74
- } else if (formatter instanceof Function) {
75
- value = formatter.apply(null, [value].concat(__slice.call(args)));
76
- }
77
- }
78
- return value;
79
- };
80
-
81
- Binding.prototype.eventHandler = function(fn) {
82
- var binding, handler;
83
- handler = (binding = this).view.config.handler;
84
- return function(ev) {
85
- return handler.call(fn, this, ev, binding);
86
- };
87
- };
88
-
89
- Binding.prototype.set = function(value) {
90
- var _ref;
91
- value = value instanceof Function && !this.binder["function"] ? this.formattedValue(value.call(this.model)) : this.formattedValue(value);
92
- return (_ref = this.binder.routine) != null ? _ref.call(this, this.el, value) : void 0;
93
- };
94
-
95
- Binding.prototype.sync = function() {
96
- return this.set(this.options.bypass ? this.model[this.keypath] : this.view.config.adapter.read(this.model, this.keypath));
97
- };
98
-
99
- Binding.prototype.publish = function() {
100
- var args, formatter, id, value, _i, _len, _ref, _ref1, _ref2;
101
- value = Rivets.Util.getInputValue(this.el);
102
- _ref = this.formatters.slice(0).reverse();
103
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
104
- formatter = _ref[_i];
105
- args = formatter.split(/\s+/);
106
- id = args.shift();
107
- if ((_ref1 = this.view.formatters[id]) != null ? _ref1.publish : void 0) {
108
- value = (_ref2 = this.view.formatters[id]).publish.apply(_ref2, [value].concat(__slice.call(args)));
109
- }
110
- }
111
- return this.view.config.adapter.publish(this.model, this.keypath, value);
112
- };
113
-
114
- Binding.prototype.bind = function() {
115
- var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results;
116
- if ((_ref = this.binder.bind) != null) {
117
- _ref.call(this, this.el);
118
- }
119
- if (this.options.bypass) {
120
- this.sync();
121
- } else {
122
- this.view.config.adapter.subscribe(this.model, this.keypath, this.sync);
123
- if (this.view.config.preloadData) {
124
- this.sync();
125
- }
126
- }
127
- if ((_ref1 = this.options.dependencies) != null ? _ref1.length : void 0) {
128
- _ref2 = this.options.dependencies;
129
- _results = [];
130
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
131
- dependency = _ref2[_i];
132
- if (/^\./.test(dependency)) {
133
- model = this.model;
134
- keypath = dependency.substr(1);
135
- } else {
136
- dependency = dependency.split('.');
137
- model = this.view.models[dependency.shift()];
138
- keypath = dependency.join('.');
139
- }
140
- _results.push(this.view.config.adapter.subscribe(model, keypath, this.sync));
141
- }
142
- return _results;
143
- }
144
- };
145
-
146
- Binding.prototype.unbind = function() {
147
- var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results;
148
- if ((_ref = this.binder.unbind) != null) {
149
- _ref.call(this, this.el);
150
- }
151
- if (!this.options.bypass) {
152
- this.view.config.adapter.unsubscribe(this.model, this.keypath, this.sync);
153
- }
154
- if ((_ref1 = this.options.dependencies) != null ? _ref1.length : void 0) {
155
- _ref2 = this.options.dependencies;
156
- _results = [];
157
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
158
- dependency = _ref2[_i];
159
- if (/^\./.test(dependency)) {
160
- model = this.model;
161
- keypath = dependency.substr(1);
162
- } else {
163
- dependency = dependency.split('.');
164
- model = this.view.models[dependency.shift()];
165
- keypath = dependency.join('.');
166
- }
167
- _results.push(this.view.config.adapter.unsubscribe(model, keypath, this.sync));
168
- }
169
- return _results;
170
- }
171
- };
172
-
173
- Binding.prototype.update = function(models) {
174
- var _ref;
175
- if (models == null) {
176
- models = {};
177
- }
178
- if (this.key) {
179
- if (models[this.key]) {
180
- if (!this.options.bypass) {
181
- this.view.config.adapter.unsubscribe(this.model, this.keypath, this.sync);
182
- }
183
- this.model = models[this.key];
184
- if (this.options.bypass) {
185
- this.sync();
186
- } else {
187
- this.view.config.adapter.subscribe(this.model, this.keypath, this.sync);
188
- if (this.view.config.preloadData) {
189
- this.sync();
190
- }
191
- }
192
- }
193
- } else {
194
- this.sync();
195
- }
196
- return (_ref = this.binder.update) != null ? _ref.call(this, models) : void 0;
197
- };
198
-
199
- return Binding;
200
-
201
- })();
202
-
203
- Rivets.ComponentBinding = (function(_super) {
204
- __extends(ComponentBinding, _super);
205
-
206
- function ComponentBinding(view, el, type) {
207
- var attribute, _i, _len, _ref, _ref1;
208
- this.view = view;
209
- this.el = el;
210
- this.type = type;
211
- this.unbind = __bind(this.unbind, this);
212
- this.bind = __bind(this.bind, this);
213
- this.update = __bind(this.update, this);
214
- this.locals = __bind(this.locals, this);
215
- this.component = Rivets.components[this.type];
216
- this.attributes = {};
217
- this.inflections = {};
218
- _ref = this.el.attributes || [];
219
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
220
- attribute = _ref[_i];
221
- if (_ref1 = attribute.name, __indexOf.call(this.component.attributes, _ref1) >= 0) {
222
- this.attributes[attribute.name] = attribute.value;
223
- } else {
224
- this.inflections[attribute.name] = attribute.value;
225
- }
226
- }
227
- }
228
-
229
- ComponentBinding.prototype.sync = function() {};
230
-
231
- ComponentBinding.prototype.locals = function(models) {
232
- var inverse, key, model, path, result, _i, _len, _ref, _ref1;
233
- if (models == null) {
234
- models = this.view.models;
235
- }
236
- result = {};
237
- _ref = this.inflections;
238
- for (key in _ref) {
239
- inverse = _ref[key];
240
- _ref1 = inverse.split('.');
241
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
242
- path = _ref1[_i];
243
- result[key] = (result[key] || models)[path];
244
- }
245
- }
246
- for (key in models) {
247
- model = models[key];
248
- if (result[key] == null) {
249
- result[key] = model;
250
- }
251
- }
252
- return result;
253
- };
254
-
255
- ComponentBinding.prototype.update = function(models) {
256
- var _ref;
257
- return (_ref = this.componentView) != null ? _ref.update(this.locals(models)) : void 0;
258
- };
259
-
260
- ComponentBinding.prototype.bind = function() {
261
- var el, _ref;
262
- if (this.componentView != null) {
263
- return (_ref = this.componentView) != null ? _ref.bind() : void 0;
264
- } else {
265
- el = this.component.build.call(this.attributes);
266
- (this.componentView = new Rivets.View(el, this.locals(), this.view.options)).bind();
267
- return this.el.parentNode.replaceChild(el, this.el);
268
- }
269
- };
270
-
271
- ComponentBinding.prototype.unbind = function() {
272
- var _ref;
273
- return (_ref = this.componentView) != null ? _ref.unbind() : void 0;
274
- };
275
-
276
- return ComponentBinding;
277
-
278
- })(Rivets.Binding);
279
-
280
- Rivets.TextBinding = (function(_super) {
281
- __extends(TextBinding, _super);
282
-
283
- function TextBinding(view, el, type, key, keypath, options) {
284
- this.view = view;
285
- this.el = el;
286
- this.type = type;
287
- this.key = key;
288
- this.keypath = keypath;
289
- this.options = options != null ? options : {};
290
- this.sync = __bind(this.sync, this);
291
- this.formatters = this.options.formatters || [];
292
- this.model = this.key ? this.view.models[this.key] : this.view.models;
293
- }
294
-
295
- TextBinding.prototype.binder = {
296
- routine: function(node, value) {
297
- return node.data = value != null ? value : '';
298
- }
299
- };
300
-
301
- TextBinding.prototype.sync = function() {
302
- return TextBinding.__super__.sync.apply(this, arguments);
303
- };
304
-
305
- return TextBinding;
306
-
307
- })(Rivets.Binding);
308
-
309
- Rivets.View = (function() {
310
- function View(els, models, options) {
311
- var k, option, v, _base, _i, _len, _ref, _ref1, _ref2;
312
- this.els = els;
313
- this.models = models;
314
- this.options = options != null ? options : {};
315
- this.update = __bind(this.update, this);
316
- this.publish = __bind(this.publish, this);
317
- this.sync = __bind(this.sync, this);
318
- this.unbind = __bind(this.unbind, this);
319
- this.bind = __bind(this.bind, this);
320
- this.select = __bind(this.select, this);
321
- this.build = __bind(this.build, this);
322
- this.componentRegExp = __bind(this.componentRegExp, this);
323
- this.bindingRegExp = __bind(this.bindingRegExp, this);
324
- if (typeof this.els.length === 'undefined') {
325
- this.els = [this.els];
326
- }
327
- _ref = ['config', 'binders', 'formatters'];
328
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
329
- option = _ref[_i];
330
- this[option] = {};
331
- if (this.options[option]) {
332
- _ref1 = this.options[option];
333
- for (k in _ref1) {
334
- v = _ref1[k];
335
- this[option][k] = v;
336
- }
337
- }
338
- _ref2 = Rivets[option];
339
- for (k in _ref2) {
340
- v = _ref2[k];
341
- if ((_base = this[option])[k] == null) {
342
- _base[k] = v;
343
- }
344
- }
345
- }
346
- this.build();
347
- }
348
-
349
- View.prototype.bindingRegExp = function() {
350
- var prefix;
351
- prefix = this.config.prefix;
352
- if (prefix) {
353
- return new RegExp("^data-" + prefix + "-");
354
- } else {
355
- return /^data-/;
356
- }
357
- };
358
-
359
- View.prototype.componentRegExp = function() {
360
- var _ref, _ref1;
361
- return new RegExp("^" + ((_ref = (_ref1 = this.config.prefix) != null ? _ref1.toUpperCase() : void 0) != null ? _ref : 'RV') + "-");
362
- };
363
-
364
- View.prototype.build = function() {
365
- var bindingRegExp, buildBinding, componentRegExp, el, parse, skipNodes, _i, _len, _ref,
366
- _this = this;
367
- this.bindings = [];
368
- skipNodes = [];
369
- bindingRegExp = this.bindingRegExp();
370
- componentRegExp = this.componentRegExp();
371
- buildBinding = function(binding, node, type, declaration) {
372
- var context, ctx, dependencies, key, keypath, options, path, pipe, pipes, splitPath;
373
- options = {};
374
- pipes = (function() {
375
- var _i, _len, _ref, _results;
376
- _ref = declaration.split('|');
377
- _results = [];
378
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
379
- pipe = _ref[_i];
380
- _results.push(pipe.trim());
381
- }
382
- return _results;
383
- })();
384
- context = (function() {
385
- var _i, _len, _ref, _results;
386
- _ref = pipes.shift().split('<');
387
- _results = [];
388
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
389
- ctx = _ref[_i];
390
- _results.push(ctx.trim());
391
- }
392
- return _results;
393
- })();
394
- path = context.shift();
395
- splitPath = path.split(/\.|:/);
396
- options.formatters = pipes;
397
- options.bypass = path.indexOf(':') !== -1;
398
- if (splitPath[0]) {
399
- key = splitPath.shift();
400
- } else {
401
- key = null;
402
- splitPath.shift();
403
- }
404
- keypath = splitPath.join('.');
405
- if (dependencies = context.shift()) {
406
- options.dependencies = dependencies.split(/\s+/);
407
- }
408
- return _this.bindings.push(new Rivets[binding](_this, node, type, key, keypath, options));
409
- };
410
- parse = function(node) {
411
- var attribute, attributes, binder, childNode, delimiters, identifier, n, parser, regexp, restTokens, startToken, text, token, tokens, type, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4, _results;
412
- if (__indexOf.call(skipNodes, node) < 0) {
413
- if (node.nodeType === Node.TEXT_NODE) {
414
- parser = Rivets.TextTemplateParser;
415
- if (delimiters = _this.config.templateDelimiters) {
416
- if ((tokens = parser.parse(node.data, delimiters)).length) {
417
- if (!(tokens.length === 1 && tokens[0].type === parser.types.text)) {
418
- startToken = tokens[0], restTokens = 2 <= tokens.length ? __slice.call(tokens, 1) : [];
419
- node.data = startToken.value;
420
- if (startToken.type === 0) {
421
- node.data = startToken.value;
422
- } else {
423
- buildBinding('TextBinding', node, null, startToken.value);
424
- }
425
- for (_i = 0, _len = restTokens.length; _i < _len; _i++) {
426
- token = restTokens[_i];
427
- text = document.createTextNode(token.value);
428
- node.parentNode.appendChild(text);
429
- if (token.type === 1) {
430
- buildBinding('TextBinding', text, null, token.value);
431
- }
432
- }
433
- }
434
- }
435
- }
436
- } else if (componentRegExp.test(node.tagName)) {
437
- type = node.tagName.replace(componentRegExp, '').toLowerCase();
438
- _this.bindings.push(new Rivets.ComponentBinding(_this, node, type));
439
- } else if (node.attributes != null) {
440
- _ref = node.attributes;
441
- for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
442
- attribute = _ref[_j];
443
- if (bindingRegExp.test(attribute.name)) {
444
- type = attribute.name.replace(bindingRegExp, '');
445
- if (!(binder = _this.binders[type])) {
446
- _ref1 = _this.binders;
447
- for (identifier in _ref1) {
448
- value = _ref1[identifier];
449
- if (identifier !== '*' && identifier.indexOf('*') !== -1) {
450
- regexp = new RegExp("^" + (identifier.replace('*', '.+')) + "$");
451
- if (regexp.test(type)) {
452
- binder = value;
453
- }
454
- }
455
- }
456
- }
457
- binder || (binder = _this.binders['*']);
458
- if (binder.block) {
459
- _ref2 = node.childNodes;
460
- for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
461
- n = _ref2[_k];
462
- skipNodes.push(n);
463
- }
464
- attributes = [attribute];
465
- }
466
- }
467
- }
468
- _ref3 = attributes || node.attributes;
469
- for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
470
- attribute = _ref3[_l];
471
- if (bindingRegExp.test(attribute.name)) {
472
- type = attribute.name.replace(bindingRegExp, '');
473
- buildBinding('Binding', node, type, attribute.value);
474
- }
475
- }
476
- }
477
- _ref4 = node.childNodes;
478
- _results = [];
479
- for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
480
- childNode = _ref4[_m];
481
- _results.push(parse(childNode));
482
- }
483
- return _results;
484
- }
485
- };
486
- _ref = this.els;
487
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
488
- el = _ref[_i];
489
- parse(el);
490
- }
491
- };
492
-
493
- View.prototype.select = function(fn) {
494
- var binding, _i, _len, _ref, _results;
495
- _ref = this.bindings;
496
- _results = [];
497
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
498
- binding = _ref[_i];
499
- if (fn(binding)) {
500
- _results.push(binding);
501
- }
502
- }
503
- return _results;
504
- };
505
-
506
- View.prototype.bind = function() {
507
- var binding, _i, _len, _ref, _results;
508
- _ref = this.bindings;
509
- _results = [];
510
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
511
- binding = _ref[_i];
512
- _results.push(binding.bind());
513
- }
514
- return _results;
515
- };
516
-
517
- View.prototype.unbind = function() {
518
- var binding, _i, _len, _ref, _results;
519
- _ref = this.bindings;
520
- _results = [];
521
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
522
- binding = _ref[_i];
523
- _results.push(binding.unbind());
524
- }
525
- return _results;
526
- };
527
-
528
- View.prototype.sync = function() {
529
- var binding, _i, _len, _ref, _results;
530
- _ref = this.bindings;
531
- _results = [];
532
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
533
- binding = _ref[_i];
534
- _results.push(binding.sync());
535
- }
536
- return _results;
537
- };
538
-
539
- View.prototype.publish = function() {
540
- var binding, _i, _len, _ref, _results;
541
- _ref = this.select(function(b) {
542
- return b.binder.publishes;
543
- });
544
- _results = [];
545
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
546
- binding = _ref[_i];
547
- _results.push(binding.publish());
548
- }
549
- return _results;
550
- };
551
-
552
- View.prototype.update = function(models) {
553
- var binding, key, model, _i, _len, _ref, _results;
554
- if (models == null) {
555
- models = {};
556
- }
557
- for (key in models) {
558
- model = models[key];
559
- this.models[key] = model;
560
- }
561
- _ref = this.bindings;
562
- _results = [];
563
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
564
- binding = _ref[_i];
565
- _results.push(binding.update(models));
566
- }
567
- return _results;
568
- };
569
-
570
- return View;
571
-
572
- })();
573
-
574
- Rivets.TextTemplateParser = (function() {
575
- function TextTemplateParser() {}
576
-
577
- TextTemplateParser.types = {
578
- text: 0,
579
- binding: 1
580
- };
581
-
582
- TextTemplateParser.parse = function(template, delimiters) {
583
- var index, lastIndex, lastToken, length, substring, tokens, value;
584
- tokens = [];
585
- length = template.length;
586
- index = 0;
587
- lastIndex = 0;
588
- while (lastIndex < length) {
589
- index = template.indexOf(delimiters[0], lastIndex);
590
- if (index < 0) {
591
- tokens.push({
592
- type: this.types.text,
593
- value: template.slice(lastIndex)
594
- });
595
- break;
596
- } else {
597
- if (index > 0 && lastIndex < index) {
598
- tokens.push({
599
- type: this.types.text,
600
- value: template.slice(lastIndex, index)
601
- });
602
- }
603
- lastIndex = index + 2;
604
- index = template.indexOf(delimiters[1], lastIndex);
605
- if (index < 0) {
606
- substring = template.slice(lastIndex - 2);
607
- lastToken = tokens[tokens.length - 1];
608
- if ((lastToken != null ? lastToken.type : void 0) === this.types.text) {
609
- lastToken.value += substring;
610
- } else {
611
- tokens.push({
612
- type: this.types.text,
613
- value: substring
614
- });
615
- }
616
- break;
617
- }
618
- value = template.slice(lastIndex, index).trim();
619
- tokens.push({
620
- type: this.types.binding,
621
- value: value
622
- });
623
- lastIndex = index + 2;
624
- }
625
- }
626
- return tokens;
627
- };
628
-
629
- return TextTemplateParser;
630
-
631
- })();
632
-
633
- Rivets.Util = {
634
- bindEvent: function(el, event, handler) {
635
- if (window.jQuery != null) {
636
- el = jQuery(el);
637
- if (el.on != null) {
638
- return el.on(event, handler);
639
- } else {
640
- return el.bind(event, handler);
641
- }
642
- } else if (window.addEventListener != null) {
643
- return el.addEventListener(event, handler, false);
644
- } else {
645
- event = 'on' + event;
646
- return el.attachEvent(event, handler);
647
- }
648
- },
649
- unbindEvent: function(el, event, handler) {
650
- if (window.jQuery != null) {
651
- el = jQuery(el);
652
- if (el.off != null) {
653
- return el.off(event, handler);
654
- } else {
655
- return el.unbind(event, handler);
656
- }
657
- } else if (window.removeEventListener != null) {
658
- return el.removeEventListener(event, handler, false);
659
- } else {
660
- event = 'on' + event;
661
- return el.detachEvent(event, handler);
662
- }
663
- },
664
- getInputValue: function(el) {
665
- var o, _i, _len, _results;
666
- if (window.jQuery != null) {
667
- el = jQuery(el);
668
- switch (el[0].type) {
669
- case 'checkbox':
670
- return el.is(':checked');
671
- default:
672
- return el.val();
673
- }
674
- } else {
675
- switch (el.type) {
676
- case 'checkbox':
677
- return el.checked;
678
- case 'select-multiple':
679
- _results = [];
680
- for (_i = 0, _len = el.length; _i < _len; _i++) {
681
- o = el[_i];
682
- if (o.selected) {
683
- _results.push(o.value);
684
- }
685
- }
686
- return _results;
687
- break;
688
- default:
689
- return el.value;
690
- }
691
- }
692
- }
693
- };
694
-
695
- Rivets.binders = {
696
- enabled: function(el, value) {
697
- return el.disabled = !value;
698
- },
699
- disabled: function(el, value) {
700
- return el.disabled = !!value;
701
- },
702
- checked: {
703
- publishes: true,
704
- bind: function(el) {
705
- return Rivets.Util.bindEvent(el, 'change', this.publish);
706
- },
707
- unbind: function(el) {
708
- return Rivets.Util.unbindEvent(el, 'change', this.publish);
709
- },
710
- routine: function(el, value) {
711
- var _ref;
712
- if (el.type === 'radio') {
713
- return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) === (value != null ? value.toString() : void 0);
714
- } else {
715
- return el.checked = !!value;
716
- }
717
- }
718
- },
719
- unchecked: {
720
- publishes: true,
721
- bind: function(el) {
722
- return Rivets.Util.bindEvent(el, 'change', this.publish);
723
- },
724
- unbind: function(el) {
725
- return Rivets.Util.unbindEvent(el, 'change', this.publish);
726
- },
727
- routine: function(el, value) {
728
- var _ref;
729
- if (el.type === 'radio') {
730
- return el.checked = ((_ref = el.value) != null ? _ref.toString() : void 0) !== (value != null ? value.toString() : void 0);
731
- } else {
732
- return el.checked = !value;
733
- }
734
- }
735
- },
736
- show: function(el, value) {
737
- return el.style.display = value ? '' : 'none';
738
- },
739
- hide: function(el, value) {
740
- return el.style.display = value ? 'none' : '';
741
- },
742
- html: function(el, value) {
743
- return el.innerHTML = value != null ? value : '';
744
- },
745
- value: {
746
- publishes: true,
747
- bind: function(el) {
748
- return Rivets.Util.bindEvent(el, 'change', this.publish);
749
- },
750
- unbind: function(el) {
751
- return Rivets.Util.unbindEvent(el, 'change', this.publish);
752
- },
753
- routine: function(el, value) {
754
- var o, _i, _len, _ref, _ref1, _ref2, _results;
755
- if (window.jQuery != null) {
756
- el = jQuery(el);
757
- if ((value != null ? value.toString() : void 0) !== ((_ref = el.val()) != null ? _ref.toString() : void 0)) {
758
- return el.val(value != null ? value : '');
759
- }
760
- } else {
761
- if (el.type === 'select-multiple') {
762
- if (value != null) {
763
- _results = [];
764
- for (_i = 0, _len = el.length; _i < _len; _i++) {
765
- o = el[_i];
766
- _results.push(o.selected = (_ref1 = o.value, __indexOf.call(value, _ref1) >= 0));
767
- }
768
- return _results;
769
- }
770
- } else if ((value != null ? value.toString() : void 0) !== ((_ref2 = el.value) != null ? _ref2.toString() : void 0)) {
771
- return el.value = value != null ? value : '';
772
- }
773
- }
774
- }
775
- },
776
- text: function(el, value) {
777
- if (el.innerText != null) {
778
- return el.innerText = value != null ? value : '';
779
- } else {
780
- return el.textContent = value != null ? value : '';
781
- }
782
- },
783
- "if": {
784
- block: true,
785
- bind: function(el) {
786
- var attr, declaration;
787
- if (this.marker == null) {
788
- attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-');
789
- declaration = el.getAttribute(attr);
790
- this.marker = document.createComment(" rivets: " + this.type + " " + declaration + " ");
791
- el.removeAttribute(attr);
792
- el.parentNode.insertBefore(this.marker, el);
793
- return el.parentNode.removeChild(el);
794
- }
795
- },
796
- unbind: function() {
797
- var _ref;
798
- return (_ref = this.nested) != null ? _ref.unbind() : void 0;
799
- },
800
- routine: function(el, value) {
801
- var key, model, models, options, _ref;
802
- if (!!value === (this.nested == null)) {
803
- if (value) {
804
- models = {};
805
- _ref = this.view.models;
806
- for (key in _ref) {
807
- model = _ref[key];
808
- models[key] = model;
809
- }
810
- options = {
811
- binders: this.view.options.binders,
812
- formatters: this.view.options.formatters,
813
- config: this.view.options.config
814
- };
815
- (this.nested = new Rivets.View(el, models, options)).bind();
816
- return this.marker.parentNode.insertBefore(el, this.marker.nextSibling);
817
- } else {
818
- el.parentNode.removeChild(el);
819
- this.nested.unbind();
820
- return delete this.nested;
821
- }
822
- }
823
- },
824
- update: function(models) {
825
- var _ref;
826
- return (_ref = this.nested) != null ? _ref.update(models) : void 0;
827
- }
828
- },
829
- unless: {
830
- block: true,
831
- bind: function(el) {
832
- return Rivets.binders["if"].bind.call(this, el);
833
- },
834
- unbind: function() {
835
- return Rivets.binders["if"].unbind.call(this);
836
- },
837
- routine: function(el, value) {
838
- return Rivets.binders["if"].routine.call(this, el, !value);
839
- },
840
- update: function(models) {
841
- return Rivets.binders["if"].update.call(this, models);
842
- }
843
- },
844
- "on-*": {
845
- "function": true,
846
- unbind: function(el) {
847
- if (this.handler) {
848
- return Rivets.Util.unbindEvent(el, this.args[0], this.handler);
849
- }
850
- },
851
- routine: function(el, value) {
852
- if (this.handler) {
853
- Rivets.Util.unbindEvent(el, this.args[0], this.handler);
854
- }
855
- return Rivets.Util.bindEvent(el, this.args[0], this.handler = this.eventHandler(value));
856
- }
857
- },
858
- "each-*": {
859
- block: true,
860
- bind: function(el) {
861
- var attr;
862
- if (this.marker == null) {
863
- attr = ['data', this.view.config.prefix, this.type].join('-').replace('--', '-');
864
- this.marker = document.createComment(" rivets: " + this.type + " ");
865
- this.iterated = [];
866
- el.removeAttribute(attr);
867
- el.parentNode.insertBefore(this.marker, el);
868
- return el.parentNode.removeChild(el);
869
- }
870
- },
871
- unbind: function(el) {
872
- var view, _i, _len, _ref, _results;
873
- if (this.iterated != null) {
874
- _ref = this.iterated;
875
- _results = [];
876
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
877
- view = _ref[_i];
878
- _results.push(view.unbind());
879
- }
880
- return _results;
881
- }
882
- },
883
- routine: function(el, collection) {
884
- var data, i, index, k, key, model, modelName, options, previous, template, v, view, _i, _j, _len, _len1, _ref, _ref1, _ref2, _results;
885
- modelName = this.args[0];
886
- collection = collection || [];
887
- if (this.iterated.length > collection.length) {
888
- _ref = Array(this.iterated.length - collection.length);
889
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
890
- i = _ref[_i];
891
- view = this.iterated.pop();
892
- view.unbind();
893
- this.marker.parentNode.removeChild(view.els[0]);
894
- }
895
- }
896
- _results = [];
897
- for (index = _j = 0, _len1 = collection.length; _j < _len1; index = ++_j) {
898
- model = collection[index];
899
- data = {};
900
- data[modelName] = model;
901
- if (this.iterated[index] == null) {
902
- _ref1 = this.view.models;
903
- for (key in _ref1) {
904
- model = _ref1[key];
905
- if (data[key] == null) {
906
- data[key] = model;
907
- }
908
- }
909
- previous = this.iterated.length ? this.iterated[this.iterated.length - 1].els[0] : this.marker;
910
- options = {
911
- binders: this.view.options.binders,
912
- formatters: this.view.options.formatters,
913
- config: {}
914
- };
915
- _ref2 = this.view.options.config;
916
- for (k in _ref2) {
917
- v = _ref2[k];
918
- options.config[k] = v;
919
- }
920
- options.config.preloadData = true;
921
- template = el.cloneNode(true);
922
- view = new Rivets.View(template, data, options);
923
- view.bind();
924
- this.iterated.push(view);
925
- _results.push(this.marker.parentNode.insertBefore(template, previous.nextSibling));
926
- } else if (this.iterated[index].models[modelName] !== model) {
927
- _results.push(this.iterated[index].update(data));
928
- } else {
929
- _results.push(void 0);
930
- }
931
- }
932
- return _results;
933
- },
934
- update: function(models) {
935
- var data, key, model, view, _i, _len, _ref, _results;
936
- data = {};
937
- for (key in models) {
938
- model = models[key];
939
- if (key !== this.args[0]) {
940
- data[key] = model;
941
- }
942
- }
943
- _ref = this.iterated;
944
- _results = [];
945
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
946
- view = _ref[_i];
947
- _results.push(view.update(data));
948
- }
949
- return _results;
950
- }
951
- },
952
- "class-*": function(el, value) {
953
- var elClass;
954
- elClass = " " + el.className + " ";
955
- if (!value === (elClass.indexOf(" " + this.args[0] + " ") !== -1)) {
956
- return el.className = value ? "" + el.className + " " + this.args[0] : elClass.replace(" " + this.args[0] + " ", ' ').trim();
957
- }
958
- },
959
- "*": function(el, value) {
960
- if (value) {
961
- return el.setAttribute(this.type, value);
962
- } else {
963
- return el.removeAttribute(this.type);
964
- }
965
- }
966
- };
967
-
968
- Rivets.components = {};
969
-
970
- Rivets.config = {
971
- preloadData: true,
972
- handler: function(context, ev, binding) {
973
- return this.call(context, ev, binding.view.models);
974
- }
975
- };
976
-
977
- Rivets.formatters = {};
978
-
979
- Rivets.factory = function(exports) {
980
- exports._ = Rivets;
981
- exports.binders = Rivets.binders;
982
- exports.components = Rivets.components;
983
- exports.formatters = Rivets.formatters;
984
- exports.config = Rivets.config;
985
- exports.configure = function(options) {
986
- var property, value;
987
- if (options == null) {
988
- options = {};
989
- }
990
- for (property in options) {
991
- value = options[property];
992
- Rivets.config[property] = value;
993
- }
994
- };
995
- return exports.bind = function(el, models, options) {
996
- var view;
997
- if (models == null) {
998
- models = {};
999
- }
1000
- if (options == null) {
1001
- options = {};
1002
- }
1003
- view = new Rivets.View(el, models, options);
1004
- view.bind();
1005
- return view;
1006
- };
1007
- };
1008
-
1009
- if (typeof exports === 'object') {
1010
- Rivets.factory(exports);
1011
- } else if (typeof define === 'function' && define.amd) {
1012
- define(['exports'], function(exports) {
1013
- Rivets.factory(this.rivets = exports);
1014
- return exports;
1015
- });
1016
- } else {
1017
- Rivets.factory(this.rivets = {});
1018
- }
1019
-
1020
- }).call(this);