loco-rails 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/javascripts/loco-model.js +1 -1894
  3. data/lib/assets/javascripts/loco.js +1 -2636
  4. data/lib/loco/version.rb +1 -1
  5. data/test/dummy/log/test.log +47530 -0
  6. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-g/-glvbsYKBct3e3ZhqTtQ_tCPw1sYYWQHKzr4Av5gZ4g.cache +1 -0
  7. data/test/dummy/tmp/cache/assets/sprockets/v3.0/-s/-SkXvTH_48Lb2U5Pq1vCn86A1Yg9HD8FXSZ88kQ2YKU.cache +0 -0
  8. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0C/0C0zg15fXp45nx-lXjlajaA-olEaYX8blHMpqwNOAD4.cache +1 -0
  9. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0F/0FiJ1yKBrA4WD0YYOXocnsu1HqFfy34roz7IU_3zEjQ.cache +0 -0
  10. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0u/0u9L52RmTlI1-RbWm_9FwjjPaGuhn9iFI9plVNSkHDY.cache +0 -0
  11. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0z/0zyR27Vc0p_jfrUc6KiTgWjpb1dkEbRflCWRloiQIJ4.cache +1 -0
  12. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1a/1ALOEy4KwvcqFUG_MptQZwLPvU_3S6vlHZ7HLZDzoF0.cache +0 -0
  13. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1a/1aGOTVggr_cy9x8f4Tmp_NJrm521zOWjWzJufI_-7Ho.cache +1 -0
  14. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1e/1ekuQsQRgO_gWFEfReqPIeWEoIo_JyNWfY0kcuaPbfs.cache +1 -0
  15. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1j/1jSGrdOBkrXmOCshsDnVgj5r4uLSlYOVO1fV8rcg9tI.cache +1 -0
  16. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1l/1lI1ykFHZn1PI7_dNzfMuMjSpgyO9VLBgpG0vYHEYqQ.cache +0 -0
  17. data/test/dummy/tmp/cache/assets/sprockets/v3.0/2r/2r_0tQmYAu9VC0QMpezbB5K98ZTZIcNoQrobIHlWMbg.cache +0 -0
  18. data/test/dummy/tmp/cache/assets/sprockets/v3.0/3-/3-KTTQzVUKvTa05yy5AHcfR2fIZtrzDAaw-DpkOBXPo.cache +0 -0
  19. data/test/dummy/tmp/cache/assets/sprockets/v3.0/3D/3dKRgpO1W4wN4j98W0UKGOtUDSXT4q_6FcoGr-ziCuI.cache +1 -0
  20. data/test/dummy/tmp/cache/assets/sprockets/v3.0/40/40fUcoYCsP05HyFctjDzqq_wNnXuE2My1dDPfK1EfmE.cache +0 -0
  21. data/test/dummy/tmp/cache/assets/sprockets/v3.0/49/49s_cvtWGZ1iJs94swZJ7kmJmgwtQ5dUZej0oT1Oi6M.cache +3 -0
  22. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4R/4RDwPIZTaf7peMy1Y7BIzxcGFDXNIJruugY6wMED6eQ.cache +1 -0
  23. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4h/4hsvzPjR0hjCGRCo-waMi4Ylh34HEqLbB2aZxOO8RvY.cache +1 -0
  24. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4m/4mK_zbfEEcHV5qHEU0hkXbjEfI5CChAKgem8R1L4eWg.cache +0 -0
  25. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Q/5q3AkSVJMw-9Aar2t5wGBkKJXlID_fZ9UVs5D0rli0Y.cache +1 -0
  26. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5c/5cIXLZo_uEwBQFKER7JNnbQY0Nc9LjLqfq-CAIzc520.cache +0 -0
  27. data/test/dummy/tmp/cache/assets/sprockets/v3.0/6R/6rDcQAICzbGJgd0zFfkXnJP7aQBd4s8mKaaHVVTJwKA.cache +0 -0
  28. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7C/7CQKj6CnLuzWD7iwy9UFmv5NoIS2mqe3M-x7HUmR5Vs.cache +1 -0
  29. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7D/7D0DB6TWYRSVYwtEy2Z2Vp0f-y-DKuwDenFDxzXb5TM.cache +1 -0
  30. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7Z/7ZUYdolAY3t_2P6Xt84Vs8rb_WmP6QsyWrILc_bqCpw.cache +1 -0
  31. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7l/7lAvr6UJdTDWaJfRqrHUqmGsxWLgsk4ELWnfHImfgb8.cache +1 -0
  32. data/test/dummy/tmp/cache/assets/sprockets/v3.0/8s/8swBu-mDvtHT7VxeZhOuX-LGmsqHs1DV-8xr82rVLM0.cache +0 -0
  33. data/test/dummy/tmp/cache/assets/sprockets/v3.0/9W/9we0tXsROmrSTPTbFLFbdTzX9GnLVieO7ux77RUsync.cache +0 -0
  34. data/test/dummy/tmp/cache/assets/sprockets/v3.0/9f/9f9SK5HHCYqGBXUs5_u2AwTg0wUVLUXf3rhEt_clw8Q.cache +1 -0
  35. data/test/dummy/tmp/cache/assets/sprockets/v3.0/AP/aPwZoNqFNmWcJOAyy91Co33tMb8ncigmNS-iAU6rD34.cache +0 -0
  36. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ak/akNdpjTiLgqlWgSlhlMfKaRhbRiaYRzILFV-DmC5XzM.cache +1 -0
  37. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ak/akkZUoXiZiZ0yl3BAuycsDN24chr3hBlYcbS1EhB7S8.cache +1 -0
  38. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BG/bG9NJPnN4UUaSYySUCbPTps1QeXadW1rIOiHDovQUrU.cache +1 -0
  39. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BN/BN9hqQlx0O2FkfL40OHVBbdwyH83OkwTEK8CM9U0NU0.cache +0 -0
  40. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Bb/BbvLBSpbRRa-jbyBuTPhTLalPe7DYztW_ntIW2Z1ly8.cache +0 -0
  41. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Bs/bsywsdbyTHvdhtZ_ir4qDFcKUJyPkVYKv8PVuwxK-Lw.cache +1 -0
  42. data/test/dummy/tmp/cache/assets/sprockets/v3.0/C0/c0zxESAG7wH_UZEvQifQRkPZpTn48LDlfjwNWKN_zf0.cache +0 -0
  43. data/test/dummy/tmp/cache/assets/sprockets/v3.0/CA/CaguFWP7DXNxWoEkMUgS9kKNfT7RS5GjSqODy3yEeIU.cache +1 -0
  44. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ch/ChlzoF1o97psmDUrTH_wWRiEUi6LY8h3_xIH95O0UAs.cache +1 -0
  45. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ch/Chw_0YliZg5Y5tuJazhDBiNcu0O-luzrU1KKVP5xBVg.cache +0 -0
  46. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DV/dVLbxXIks3crWgp_6R8IgqzMROuyWf_L-9nQhekqWVw.cache +2 -0
  47. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Da/Da7DCdJRAvrV0OKr-Ip8GTBpTPxM_am0X8mYqRz07K0.cache +0 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Da/dAMCFpBuVz2vB3_Bc3BPcmo9T3dL_fr2482oxUB70TM.cache +0 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Df/dfPcjC4AhPqBfNs3rS9kscZYqCCx9qDlqD3mPamAZ5I.cache +0 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Dl/dLoTPiXCKqFj1dRUrTGlUb5oUFaMsuZjLikZ8O5n4Ow.cache +1 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v3.0/EX/EX6aaYl4pJI4t_ZTTq6uK7txCNtiEfpL__Bl9SeDZEI.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v3.0/E_/E_W-p5rFO8lz7e14rHZps07-ezH6iy4x0GmJYiUN9RA.cache +1 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Eb/EBtWKHiT8IaEOvWxXAf31e-kHfppwAe7KDv4yoDJDCY.cache +1 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v3.0/F5/F50TdPj7bNvNZPWw4PlFBE189TS9YVdF32GiP_dvUds.cache +0 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FI/FIEuVgduCmvAHgHuMcGPcsNwWq6rautlpIpXB5iIzSs.cache +1 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FL/flM0DQZ14-qAJth-GUuoj-bwg7Tw_Rz5Wty-0cUEzTk.cache +0 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FU/futgIkTrWYCMggQyqMhKrN7yvah3WadzRSTLc0tWyKg.cache +0 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FZ/FzSNUaKfcxbIz9oMiRIk-9lVEduYaeNK8RvAWPZeS44.cache +1 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FZ/fzAc0RIwYjSI3P-zDHDFuylaOBPSu2jlq0YxhECFeVA.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Fh/FHB6ekI9Srj4liGhBswdFdermFEW6mBpZTAAQnEXMVc.cache +1 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v3.0/GO/GOoEM-J9zvhI_51cLfAtR_rVCkBMTt0i2DYpic5Q424.cache +0 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v3.0/HG/HG91R3wWTHz7ttF2Jl_7b-k91mdqosLo-cDq__vMFjY.cache +0 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Hp/hPlo60yI5DtTAo6fhLUiRT7I6w4hnWQHhlKQaeJqDCc.cache +1 -0
  64. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ij/iJIqcypZWBSwjXrBlA5yStVIqG8m7UYPADfFsXmp7RE.cache +1 -0
  65. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ij/ija4G2i57ckkEJgMYnkByZAgU_pAhOPQugNiX39qqIM.cache +1 -0
  66. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ir/iRJ3nRsWQusA_0yRNjVFRmzr7tYRUPzTFSgz38gVDwo.cache +1 -0
  67. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ir/irxf4b0u-7dglvyEEJDeF3Rnz_qhUg4Ytnkk599LhiQ.cache +1 -0
  68. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Jr/JrQ-CuM4uVaC8j2j-PuhVea4gqyAF4ZXdfsYhpE4xMA.cache +0 -0
  69. data/test/dummy/tmp/cache/assets/sprockets/v3.0/K2/K2J4nesmVjmflLQDlO3SIaZKNsq7Dvc7RcIWw3rm5i0.cache +0 -0
  70. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ki/KIzXitq42PQW_IwktLJwmhFhohLcTOUhdMXCLsrATOc.cache +0 -0
  71. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ku/KuQ8qIA4ImwXU6TLNSWewL2heJKbRh5hUgsQ-_RTABA.cache +1 -0
  72. data/test/dummy/tmp/cache/assets/sprockets/v3.0/L8/L8LmikM2BmoEBTB9QVkQkc92vSOcGprH9KVn9Xla0S4.cache +1 -0
  73. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Li/LixecFrQ06_4Lk8lolNF0Fy__E_wcmi_4uLPgjaixsc.cache +1 -0
  74. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Lj/ljMHONyZVuh3XpDSaWK4e3tDXmrb-Q_O6yKN0-FXhcQ.cache +0 -0
  75. data/test/dummy/tmp/cache/assets/sprockets/v3.0/M2/M2n46tEj0U_2KVGCIeMOAVAQ40aF_YoF4xzUVsfq7x4.cache +1 -0
  76. data/test/dummy/tmp/cache/assets/sprockets/v3.0/MA/mATKTv5XVL_0Sv2ktlc-7wvCnbZnG-UsT9DhbaiFGOY.cache +1 -0
  77. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ME/MeJyK90ynLs3VYXGEFrJMh9vkkztsxsOwDDxW0bUVkw.cache +0 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Mn/mna1x55kwlDmnXJnXSsUov8Y_Vs7rBwBDQuDEkhHqYM.cache +1 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NE/Ne_A5iRzDYzHVzmxzxo4p5-nuPLK1JBqymOfoatzMNU.cache +0 -0
  80. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NS/nSARB4f9nK1w_UXYJnq-2Ga3qlZJjCBbQ_9f0Pm0kis.cache +1 -0
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Nc/NCWqDdUIg-xx40T-11vBPouaEMukl6ggWtQ3xzAV71Q.cache +0 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Nl/nlF91rb12GOAk2MoXLqspAFy8vujK2W8bSacPBVp9-o.cache +0 -0
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O-/o-AeWotLD45uR5g1FZl07Sf5QUzosJe-eculRJzjGos.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/P9/p9sBLX6-mKM_aVGoeUPGKp9rYzIUpoBKEanElM2ou_s.cache +1 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Pj/PjUlupl5ZgiZnzOyztEMq_EXSWGZh-tMJnsWhHT_RMo.cache +0 -0
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QF/qFP6u5SnIgejHhj8R0lhs0jBtEACtmDy67PciG0TYB4.cache +0 -0
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QI/qijVdnTQmmEsheeqib7SJTmLxmgtWmk7wDJxMbFW1Bo.cache +0 -0
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QM/QM_oSvZB2a_jm1BnS7RpCS8IBIHkam-iKw80q6_IDfQ.cache +0 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QN/qnBROkNeNw9RryA6f0EHF4CV72kvL2czb7YjrJGhM3Y.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QQ/qqz_k3gpKkKeuX-fCHyhk7dxegHcN4jr3HzdCAjE-Us.cache +3 -0
  91. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ra/RAYMZ915eUEMWBt4KnWacc8oXECLTQujbWRvCiqkrp4.cache +0 -0
  92. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Rg/rgXN8ew3Jwia72WlnQAf4CgOXrHaZwWqfAcr3b7GLXU.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Rv/rV1lG8maT0aheGhs3JnS_HY4G_eBZ_ekkMK5Bxs_z3k.cache +0 -0
  94. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SY/syy7MC6L4JTmHLxFaN6DGvEBe3xZj4zySixyxkXAiEg.cache +0 -0
  95. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Sn/SnMOLpRpiG1marLH_tvEL21U8lnjbx8CsGPjoPmBiMA.cache +1 -0
  96. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Su/SUU-kW7n0GrxGAnOnvxf9ouvapUSVmRu19q7eCNmXdU.cache +1 -0
  97. data/test/dummy/tmp/cache/assets/sprockets/v3.0/T_/t_GjWcg61xM-KpfdjuIxBpkXWXhmE-qJPnRU2ypp-5w.cache +1 -0
  98. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Tb/TbEi1HHzG_JuA-0bGhDNoMEU8K6XK75jrg2OoABbUwI.cache +1 -0
  99. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Tu/tuw77GnP5-uIPKHOn0oi9wwngRq5dKwSwqWk19o6ny0.cache +1 -0
  100. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UM/uMi-QAHzkB-XojWL0sRiW2dZeVzDXGYuShtgi-_Q-No.cache +0 -0
  101. data/test/dummy/tmp/cache/assets/sprockets/v3.0/V1/v1v_qI3uo7SILonrZvvAyff1bf-RiL3btNVFgNKqCn8.cache +0 -0
  102. data/test/dummy/tmp/cache/assets/sprockets/v3.0/V8/v8Rezsol3flN5aCzAegfHyQUkHl61XxfVrBav0zk1R0.cache +0 -0
  103. data/test/dummy/tmp/cache/assets/sprockets/v3.0/VT/VTaQ2q2OFTLddxRdCO6QRBmXYJvb9g6iuaEUf2PppsY.cache +1 -0
  104. data/test/dummy/tmp/cache/assets/sprockets/v3.0/VU/VUoq_CmGgR74WWVWZR_37eGC4Cq8Th4uwq5P_25PIfw.cache +1 -0
  105. data/test/dummy/tmp/cache/assets/sprockets/v3.0/WS/wsWbKDTo1xoCrblymFzF1G1p2V_L4sHAqYmyCG7LF5A.cache +0 -0
  106. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Wg/WGkMUE3LvnMtyj7OToxIVTEu6vbijM35eSi7pBgLh6M.cache +1 -0
  107. data/test/dummy/tmp/cache/assets/sprockets/v3.0/XL/xLWJVwPf_idKGjxtjaW1k6ang4lFliuIStc06McRKfw.cache +0 -0
  108. data/test/dummy/tmp/cache/assets/sprockets/v3.0/YO/YoBJM0i3z8tMrIVNjmtC0ubBjh0pTxvQ9PPhSYLjpv0.cache +0 -0
  109. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZP/Zpy8oY6ptvKPxj9qSKvx_qfrcpdxJsoWKJVW9bjdlRU.cache +0 -0
  110. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Zn/ZnX4P5fmBY76kvhp_FplaeGN4jQAzWw4EN9qgBbArtc.cache +1 -0
  111. data/test/dummy/tmp/cache/assets/sprockets/v3.0/_T/_T0Xk9E9L_8AjnsASZ08aX_TYymRWOo3GGYcIAemSYU.cache +0 -0
  112. data/test/dummy/tmp/cache/assets/sprockets/v3.0/aH/AHMIpWFFdUOMDTeZxCwk-y5hhJWotUgABQ41wEiPULo.cache +0 -0
  113. data/test/dummy/tmp/cache/assets/sprockets/v3.0/aY/aYc1Af_RzFK5QQEyxlcGCajhZMHYBFjMUVAqRfX42Pc.cache +0 -0
  114. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bR/br3qqtzCUzgCbcONZ1tM8FmedMakmZbEYaFD47cdu7E.cache +0 -0
  115. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bu/BUY-GcHS1x4oBn9PHhR0rgbxOs92dFADK9-rWfLpnks.cache +0 -0
  116. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bw/BWWrH6DiMN9ZdGmEpF1-moCCl2yK49w3jafeBXaTB60.cache +1 -0
  117. data/test/dummy/tmp/cache/assets/sprockets/v3.0/by/bySzYFWzxGb5kLpIrKuSjFRFKD1QeKfaf_X8MzKLu4M.cache +1 -0
  118. data/test/dummy/tmp/cache/assets/sprockets/v3.0/d4/D4XwcPSJer9QjSbCukGiVw0tEY-ZnevlwtWPmxuX8LM.cache +1 -0
  119. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dB/dbsCAW-FCm4K6r4785Al6trx4wGGT4E01mOMPwEzFE8.cache +0 -0
  120. data/test/dummy/tmp/cache/assets/sprockets/v3.0/do/DoUyK2gImaMyEn9h2LkDP4HsUowKbRJs84OdV5gIrMY.cache +0 -0
  121. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dr/dRJc7K6DR_LRxFYPIafVcPXxVEcLc-MGpZyjHFnfiGU.cache +1 -0
  122. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dz/DZjHcW0j2fK_p_0eMDkmZnv06o4Dp44WpXqWNZFSIXw.cache +1 -0
  123. data/test/dummy/tmp/cache/assets/sprockets/v3.0/eD/EDhoEGrDMzNcc46m5rYXACr5oq9hcWPbk23Wn-LqEpA.cache +1 -0
  124. data/test/dummy/tmp/cache/assets/sprockets/v3.0/eH/eHiCCoKGr4ERHDE3nj8BY1WueZ4pUwLiALuRncDg8SE.cache +1 -0
  125. data/test/dummy/tmp/cache/assets/sprockets/v3.0/es/EsvENcro7yayPifg9Ta9ed0Xa-Id71IraycKZxXMp0k.cache +0 -0
  126. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fR/fR9LCGDTcDeaecdq721kTPHURxjx-LGlOcBU95l-ZEQ.cache +0 -0
  127. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fS/fS40oHaNefoTGoEW_KuHofEy06PaB1Zun2MXiNhcHYw.cache +1 -0
  128. data/test/dummy/tmp/cache/assets/sprockets/v3.0/g2/g2pL-dZHKM-XbipS9-UBf5XWGdaNuH1xjEoZUUPYnEM.cache +1 -0
  129. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hq/hqRHy5Czuqz_934GGm4VsCkD_tPvFt-j46FAm8Af6Q0.cache +3 -0
  130. data/test/dummy/tmp/cache/assets/sprockets/v3.0/iW/IWeCDS5qCBekkHiCNqUXivaci4H1ubytRA2ka16sqbo.cache +0 -0
  131. data/test/dummy/tmp/cache/assets/sprockets/v3.0/iv/IvbYUv0C3_0YRRpoVQ9dx2B-EowoOumquf31cAEhNFs.cache +0 -0
  132. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jf/Jft0qe0J3Yc0Vw6oDIpkh-G_08dpbwPDKDv8jRQEZL4.cache +1 -0
  133. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jq/JQhGP-DJ3jsHMJV-88tDhez60cdfgrx17Ga86N0yAQk.cache +1 -0
  134. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jq/jQgX2AmnTZHH0lbhmLY0g3IqkZVeHFV_Uw5sCKLZzps.cache +1 -0
  135. data/test/dummy/tmp/cache/assets/sprockets/v3.0/kL/kLiREZT1aLNmQytZFcUoHXjomGVPjLK0H0AQts1j9ao.cache +1 -0
  136. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mY/MYybjVmFSxNA4i8XYqnJGVtMSFLJu_uOslZxGHdYT_E.cache +0 -0
  137. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mf/mFYXlutn8qY9dozXui5EaB8Hz6SrpdKX8KHAlgVhAyQ.cache +1 -0
  138. data/test/dummy/tmp/cache/assets/sprockets/v3.0/nQ/nqf2iK3_rfdMVp7eY5gEXS7czQ8cdiux1fkC5Rk26kA.cache +1 -0
  139. data/test/dummy/tmp/cache/assets/sprockets/v3.0/od/ODvxcVIsKODIma5T_XUasvMwobQpo-NjXWdVVQ7lmvM.cache +0 -0
  140. data/test/dummy/tmp/cache/assets/sprockets/v3.0/od/odhrEL-QhITZHmH0V8xXwg9kMkOPQuWvkiZfFLgs_Eg.cache +1 -0
  141. data/test/dummy/tmp/cache/assets/sprockets/v3.0/p1/p1rQnE_7JxcP93MVcu3nyVWFxHOl4NZCPm-ZHi-PoCg.cache +0 -0
  142. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pI/Pigt9xARysVKy72QmmMKNS4HB82LY5YX9H5RFOSDP6w.cache +0 -0
  143. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pI/pIn0ybWmwHj5LQiwqxAUrseXouantMZW7I6bnYR6YUk.cache +0 -0
  144. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pO/poLkqGHanSdcxFxWMvbV7CQD2ti4z-Yg_JDHqSUEJis.cache +1 -0
  145. data/test/dummy/tmp/cache/assets/sprockets/v3.0/qC/qcUA4Yt054E9vztPoCMMSx4HqAl26py4Ow9R8Oy5g_A.cache +1 -0
  146. data/test/dummy/tmp/cache/assets/sprockets/v3.0/qE/qE_ruyhYP0ys_VqbrqZEs0qvGTlGfWEeiwrMG6s8Ewo.cache +1 -0
  147. data/test/dummy/tmp/cache/assets/sprockets/v3.0/qU/qUUEmqLAKRobSw1SfJgtP1VlWITnltbAkLoOX0RTNI4.cache +0 -0
  148. data/test/dummy/tmp/cache/assets/sprockets/v3.0/rj/rJRb7bsw8vC8o8WMgLVN23eAYs_oWTrQswhoNhhlP7E.cache +0 -0
  149. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sm/sMO6Xm2yGjAYXTYKlOHjXwDcW0de71yrH4cmZxAv7i4.cache +1 -0
  150. data/test/dummy/tmp/cache/assets/sprockets/v3.0/t4/t4G-sOguV5LF8u-iKRF2aMk_I_0XPkQ1tt1HBKJVbGI.cache +1 -0
  151. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tA/TaDnmYaCFvaJ1JvGTxIgvmiC2wdowzJIf1rNR1M6PDU.cache +1 -0
  152. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uI/uIlxMUxUqIs6zaK9c5SVKel1eVRNobCt7X3mbOeR3UY.cache +1 -0
  153. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uh/Uhx1rYq5bRxJuA0N711WJH26CyoV1GSULNK-hKTVgno.cache +1 -0
  154. data/test/dummy/tmp/cache/assets/sprockets/v3.0/v9/V99__cyNM3MO_6zLLDaMLNwev-Rfii1aBaqUWndZzIA.cache +1 -0
  155. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vZ/VzF_bN2ImRCJ8DrZrEK2pf4iN_HxT5x6irbrxBbSgk8.cache +1 -0
  156. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vh/VHnk45Y-io1lTURCu2y9b2CXfSiFzGmtKvWM7BZmOBU.cache +1 -0
  157. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vm/VM6HFgzrAqW8vFTrx5GArizsMPKBT1G4_HwghLgATgg.cache +3 -0
  158. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vw/VW3mpUDwDQAp8mvDuGEYTQ7jxb93mEVPj5RyaTtmCks.cache +0 -0
  159. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wX/WXNPpyhhJovaM4E9wll3dXdEHPjrqU-eTw3XtFKRHvM.cache +0 -0
  160. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wX/wXnbQD7AtWLKWC-GStlOFOrN28gDcDbhPJPDe7tU2yc.cache +1 -0
  161. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wm/wMas_XusUgGXvv5alTPfvFAg8vvHolpO0STQfTu6cvs.cache +1 -0
  162. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x4/x4QjEJknOXmjvbHn87qC02yMoLf5l2jausjIv0s5h-4.cache +0 -0
  163. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x5/X5yvwulm1al2ufyX6bApHdja-WcrcltVQFoE8wGd88c.cache +3 -0
  164. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x7/x7PYh8DJvPykcEqpVab2vcY9-GFz-3cqtoMlRAu94Uc.cache +0 -0
  165. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xW/xws9dLNTn_Haero8foCEhX0iCJizdBNNcG4j41JisRk.cache +1 -0
  166. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xa/xaYS6oHoDRhbYy60AtqlRqLkROV3X9kQ7DC8Ktq5WiQ.cache +0 -0
  167. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xv/XvgMfXaevoMUPVilsg2m8eMplr9SzfCB7ZZXs-k_Src.cache +0 -0
  168. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xy/XYzUjPc1iFKdl7Pq2RQfZogznxyxcjwIpTEcY_KJ6nQ.cache +0 -0
  169. data/test/dummy/tmp/cache/assets/sprockets/v3.0/y-/Y-ospBsT3N7-qsb9XtkGjyx7ljiOMw28kG2cmSU2HNs.cache +1 -0
  170. data/test/dummy/tmp/cache/assets/sprockets/v3.0/y0/y0RcHxK1mnh7860Y5CX1ReSP7_JFDyAf6kM9B8FPM-g.cache +0 -0
  171. data/test/dummy/tmp/cache/assets/sprockets/v3.0/yZ/yZL1euSReDi-Cr7PYOPdwcN_wzEUkyMTaw3N0VbPYD4.cache +1 -0
  172. data/test/dummy/tmp/cache/assets/sprockets/v3.0/z1/Z1dQeH_1hJAd_P0q5ZdiqmlPytGAFLeB1IPp5qUMBqA.cache +0 -0
  173. data/test/dummy/tmp/cache/assets/sprockets/v3.0/z_/z_gI96ZUO2CEpf0WpXJGIN3SOpzNuf4CUD-2myvL-p4.cache +0 -0
  174. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zk/ZkcfHdphGc7e6b_ydsg8KTYMHX3FUCbLMaJTRskeSPY.cache +1 -0
  175. metadata +332 -2
@@ -1,1894 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["LocoModel"] = factory();
8
- else
9
- root["LocoModel"] = factory();
10
- })(this, function() {
11
- return /******/ (function(modules) { // webpackBootstrap
12
- /******/ // The module cache
13
- /******/ var installedModules = {};
14
- /******/
15
- /******/ // The require function
16
- /******/ function __webpack_require__(moduleId) {
17
- /******/
18
- /******/ // Check if module is in cache
19
- /******/ if(installedModules[moduleId]) {
20
- /******/ return installedModules[moduleId].exports;
21
- /******/ }
22
- /******/ // Create a new module (and put it into the cache)
23
- /******/ var module = installedModules[moduleId] = {
24
- /******/ i: moduleId,
25
- /******/ l: false,
26
- /******/ exports: {}
27
- /******/ };
28
- /******/
29
- /******/ // Execute the module function
30
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
- /******/
32
- /******/ // Flag the module as loaded
33
- /******/ module.l = true;
34
- /******/
35
- /******/ // Return the exports of the module
36
- /******/ return module.exports;
37
- /******/ }
38
- /******/
39
- /******/
40
- /******/ // expose the modules object (__webpack_modules__)
41
- /******/ __webpack_require__.m = modules;
42
- /******/
43
- /******/ // expose the module cache
44
- /******/ __webpack_require__.c = installedModules;
45
- /******/
46
- /******/ // define getter function for harmony exports
47
- /******/ __webpack_require__.d = function(exports, name, getter) {
48
- /******/ if(!__webpack_require__.o(exports, name)) {
49
- /******/ Object.defineProperty(exports, name, {
50
- /******/ configurable: false,
51
- /******/ enumerable: true,
52
- /******/ get: getter
53
- /******/ });
54
- /******/ }
55
- /******/ };
56
- /******/
57
- /******/ // getDefaultExport function for compatibility with non-harmony modules
58
- /******/ __webpack_require__.n = function(module) {
59
- /******/ var getter = module && module.__esModule ?
60
- /******/ function getDefault() { return module['default']; } :
61
- /******/ function getModuleExports() { return module; };
62
- /******/ __webpack_require__.d(getter, 'a', getter);
63
- /******/ return getter;
64
- /******/ };
65
- /******/
66
- /******/ // Object.prototype.hasOwnProperty.call
67
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68
- /******/
69
- /******/ // __webpack_public_path__
70
- /******/ __webpack_require__.p = "";
71
- /******/
72
- /******/ // Load entry module and return exports
73
- /******/ return __webpack_require__(__webpack_require__.s = 6);
74
- /******/ })
75
- /************************************************************************/
76
- /******/ ([
77
- /* 0 */
78
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
79
-
80
- "use strict";
81
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
82
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__validators__ = __webpack_require__(3);
83
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__validators___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__validators__);
84
- var Base;
85
-
86
-
87
-
88
- Base = (function() {
89
- Base.sharedInstances = {};
90
-
91
- Base.instance = function(obj, attr, opts) {
92
- var sharedInstance, validatorName;
93
- validatorName = this.identity;
94
- if (this.sharedInstances[validatorName] == null) {
95
- this.sharedInstances[validatorName] = new __WEBPACK_IMPORTED_MODULE_0__validators___default.a[validatorName];
96
- }
97
- sharedInstance = this.sharedInstances[validatorName];
98
- sharedInstance.assignAttribs(obj, attr, opts);
99
- return sharedInstance;
100
- };
101
-
102
- function Base() {
103
- this.obj = null;
104
- this.attr = null;
105
- this.val = null;
106
- this.opts = null;
107
- }
108
-
109
- Base.prototype.assignAttribs = function(obj, attr, opts) {
110
- this.obj = obj;
111
- this.attr = attr;
112
- this.val = this.obj[this.attr];
113
- return this.opts = opts;
114
- };
115
-
116
- return Base;
117
-
118
- })();
119
-
120
- /* harmony default export */ __webpack_exports__["default"] = (Base);
121
-
122
-
123
- /***/ }),
124
- /* 1 */
125
- /***/ (function(module, exports, __webpack_require__) {
126
-
127
- "use strict";
128
-
129
-
130
- Object.defineProperty(exports, "__esModule", {
131
- value: true
132
- });
133
- var LocalEnv = {
134
- loco: {
135
- getLocale: function getLocale() {
136
- return 'en';
137
- },
138
- protocolWithHost: null
139
- },
140
- scope: null
141
- };
142
-
143
- var Env = function Env() {
144
- if (typeof App === 'undefined') {
145
- return LocalEnv;
146
- }
147
- return App.Env;
148
- };
149
-
150
- exports.default = Env;
151
-
152
- /***/ }),
153
- /* 2 */
154
- /***/ (function(module, exports, __webpack_require__) {
155
-
156
- "use strict";
157
-
158
-
159
- Object.defineProperty(exports, "__esModule", {
160
- value: true
161
- });
162
-
163
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
164
-
165
- var _en = __webpack_require__(9);
166
-
167
- var _en2 = _interopRequireDefault(_en);
168
-
169
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
170
-
171
- var I18n = function I18n() {
172
- if (typeof App !== 'undefined') {
173
- return _extends({ en: _en2.default }, App.I18n);
174
- }
175
- return { en: _en2.default };
176
- };
177
-
178
- exports.default = I18n;
179
-
180
- /***/ }),
181
- /* 3 */
182
- /***/ (function(module, exports, __webpack_require__) {
183
-
184
- "use strict";
185
-
186
-
187
- Object.defineProperty(exports, "__esModule", {
188
- value: true
189
- });
190
-
191
- var _absence = __webpack_require__(8);
192
-
193
- var _absence2 = _interopRequireDefault(_absence);
194
-
195
- var _confirmation = __webpack_require__(10);
196
-
197
- var _confirmation2 = _interopRequireDefault(_confirmation);
198
-
199
- var _exclusion = __webpack_require__(11);
200
-
201
- var _exclusion2 = _interopRequireDefault(_exclusion);
202
-
203
- var _format = __webpack_require__(12);
204
-
205
- var _format2 = _interopRequireDefault(_format);
206
-
207
- var _inclusion = __webpack_require__(13);
208
-
209
- var _inclusion2 = _interopRequireDefault(_inclusion);
210
-
211
- var _length = __webpack_require__(4);
212
-
213
- var _length2 = _interopRequireDefault(_length);
214
-
215
- var _numericality = __webpack_require__(14);
216
-
217
- var _numericality2 = _interopRequireDefault(_numericality);
218
-
219
- var _presence = __webpack_require__(15);
220
-
221
- var _presence2 = _interopRequireDefault(_presence);
222
-
223
- var _size = __webpack_require__(16);
224
-
225
- var _size2 = _interopRequireDefault(_size);
226
-
227
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
228
-
229
- var Validators = {
230
- Absence: _absence2.default,
231
- Confirmation: _confirmation2.default,
232
- Exclusion: _exclusion2.default,
233
- Format: _format2.default,
234
- Inclusion: _inclusion2.default,
235
- Length: _length2.default,
236
- Numericality: _numericality2.default,
237
- Presence: _presence2.default,
238
- Size: _size2.default
239
- };
240
-
241
- exports.default = Validators;
242
-
243
- /***/ }),
244
- /* 4 */
245
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
246
-
247
- "use strict";
248
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
249
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
250
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
251
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
252
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
253
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
254
- var Length,
255
- extend = 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; },
256
- hasProp = {}.hasOwnProperty;
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
- Length = (function(superClass) {
265
- extend(Length, superClass);
266
-
267
- Length.identity = "Length";
268
-
269
- function Length() {
270
- Length.__super__.constructor.call(this);
271
- }
272
-
273
- Length.prototype.validate = function() {
274
- var message;
275
- if (this.val == null) {
276
- return;
277
- }
278
- message = (this._range()[0] != null) && (this._range()[1] != null) && this._range()[0] === this._range()[1] && this.val.length !== this._range()[0] ? this._selectErrorMessage('wrong_length', this._range()[0]) : (this._range()[0] != null) && this.val.length < this._range()[0] ? this._selectErrorMessage('too_short', this._range()[0]) : (this._range()[1] != null) && this.val.length > this._range()[1] ? this._selectErrorMessage('too_long', this._range()[1]) : null;
279
- if (message === null) {
280
- return;
281
- }
282
- return this.obj.addErrorMessage(message, {
283
- "for": this.attr
284
- });
285
- };
286
-
287
- Length.prototype._range = function() {
288
- var from, to;
289
- from = this.opts.minimum || this.opts.is || ((this.opts.within != null) && this.opts.within[0]) || null;
290
- to = this.opts.maximum || this.opts.is || ((this.opts.within != null) && this.opts.within[1]) || null;
291
- return [from, to];
292
- };
293
-
294
- Length.prototype._selectErrorMessage = function(msg, val) {
295
- var i, len, message, ref, variant;
296
- if (val === 1) {
297
- return __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages[msg].one;
298
- }
299
- message = null;
300
- ref = ['few', 'many'];
301
- for (i = 0, len = ref.length; i < len; i++) {
302
- variant = ref[i];
303
- if (this._checkVariant(variant, val)) {
304
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages[msg][variant];
305
- break;
306
- }
307
- }
308
- if (message == null) {
309
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages[msg].other;
310
- }
311
- if (this.opts.message != null) {
312
- message = this.opts.message;
313
- }
314
- if (/%{count}/.exec(message)) {
315
- message = message.replace('%{count}', val);
316
- }
317
- return message;
318
- };
319
-
320
- Length.prototype._checkVariant = function(variant, val) {
321
- if (__WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].variants[variant] == null) {
322
- return;
323
- }
324
- return __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].variants[variant](val);
325
- };
326
-
327
- return Length;
328
-
329
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
330
-
331
- /* harmony default export */ __webpack_exports__["default"] = (Length);
332
-
333
-
334
- /***/ }),
335
- /* 5 */
336
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
337
-
338
- "use strict";
339
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
340
- var IdentityMap;
341
-
342
- IdentityMap = (function() {
343
- function IdentityMap() {}
344
-
345
- IdentityMap.imap = {};
346
-
347
- IdentityMap.clear = function() {
348
- return this.imap = {};
349
- };
350
-
351
- IdentityMap.add = function(obj) {
352
- var identity;
353
- identity = obj.getIdentity();
354
- if (this.imap[identity] == null) {
355
- this.imap[identity] = {};
356
- }
357
- if (this.imap[identity][obj.id] == null) {
358
- this.imap[identity][obj.id] = [];
359
- }
360
- return this.imap[identity][obj.id][0] = obj;
361
- };
362
-
363
- IdentityMap.connect = function(obj, opts) {
364
- var model;
365
- if (opts == null) {
366
- opts = {};
367
- }
368
- model = opts["with"];
369
- this.add(model);
370
- return this.imap[model.getIdentity()][model.id].push(obj);
371
- };
372
-
373
- IdentityMap.addCollection = function(identity, opts) {
374
- if (opts == null) {
375
- opts = {};
376
- }
377
- if (this.imap[identity] == null) {
378
- this.imap[identity] = {};
379
- }
380
- if (this.imap[identity]["collection"] == null) {
381
- this.imap[identity]["collection"] = [];
382
- }
383
- if (this.imap[identity]["collection"].indexOf(opts.to) !== -1) {
384
- return;
385
- }
386
- return this.imap[identity]["collection"].push(opts.to);
387
- };
388
-
389
- IdentityMap.all = function(identity) {
390
- var arr, id, objs, ref;
391
- if (this.imap[identity] == null) {
392
- return null;
393
- }
394
- arr = [];
395
- ref = this.imap[identity];
396
- for (id in ref) {
397
- objs = ref[id];
398
- if (id === "collection") {
399
- continue;
400
- }
401
- arr.push(objs[0]);
402
- }
403
- return arr;
404
- };
405
-
406
- IdentityMap.find = function(klass, id) {
407
- if (this.imap[klass] && this.imap[klass][id]) {
408
- return this.imap[klass][id][0];
409
- } else {
410
- return null;
411
- }
412
- };
413
-
414
- IdentityMap.findConnected = function(klass, id) {
415
- var arr;
416
- if (this.imap[klass] && this.imap[klass][id] && this.imap[klass][id].length > 1) {
417
- arr = this.imap[klass][id];
418
- return arr.slice(1, +(arr.length - 1) + 1 || 9e9);
419
- } else {
420
- return [];
421
- }
422
- };
423
-
424
- return IdentityMap;
425
-
426
- })();
427
-
428
- /* harmony default export */ __webpack_exports__["default"] = (IdentityMap);
429
-
430
-
431
- /***/ }),
432
- /* 6 */
433
- /***/ (function(module, exports, __webpack_require__) {
434
-
435
- "use strict";
436
-
437
-
438
- Object.defineProperty(exports, "__esModule", {
439
- value: true
440
- });
441
- exports.Validators = exports.IdentityMap = exports.Base = undefined;
442
-
443
- var _base = __webpack_require__(7);
444
-
445
- var _base2 = _interopRequireDefault(_base);
446
-
447
- var _identity_map = __webpack_require__(5);
448
-
449
- var _identity_map2 = _interopRequireDefault(_identity_map);
450
-
451
- var _base3 = __webpack_require__(0);
452
-
453
- var _base4 = _interopRequireDefault(_base3);
454
-
455
- var _validators = __webpack_require__(3);
456
-
457
- var _validators2 = _interopRequireDefault(_validators);
458
-
459
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
460
-
461
- _validators2.default.Base = _base4.default;
462
-
463
- exports.Base = _base2.default;
464
- exports.IdentityMap = _identity_map2.default;
465
- exports.Validators = _validators2.default;
466
-
467
- /***/ }),
468
- /* 7 */
469
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
470
-
471
- "use strict";
472
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
473
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__validators__ = __webpack_require__(3);
474
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__validators___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__validators__);
475
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__env__ = __webpack_require__(1);
476
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__env__);
477
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(17);
478
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__utils__);
479
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__identity_map_coffee__ = __webpack_require__(5);
480
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__models__ = __webpack_require__(19);
481
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__models___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__models__);
482
- var Base;
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
- Base = (function() {
495
- function Base(data) {
496
- if (data == null) {
497
- data = {};
498
- }
499
- this.id = null;
500
- this.errors = null;
501
- this.resource = data.resource;
502
- if (this.constructor.attributes != null) {
503
- this.__initAttributes();
504
- }
505
- if (data != null) {
506
- this.__assignAttributes(data);
507
- }
508
- }
509
-
510
- Base.all = function(opts) {
511
- if (opts == null) {
512
- opts = {};
513
- }
514
- return this.get("all", opts);
515
- };
516
-
517
- Base.find = function(idOrObj) {
518
- var id, req, urlParams;
519
- urlParams = {};
520
- if (typeof idOrObj === "object") {
521
- urlParams = idOrObj;
522
- id = idOrObj.id;
523
- delete urlParams.id;
524
- } else {
525
- id = idOrObj;
526
- }
527
- req = new XMLHttpRequest();
528
- req.open('GET', (this.__getResourcesUrl(urlParams)) + "/" + id);
529
- req.setRequestHeader("Accept", "application/json");
530
- req.setRequestHeader("Content-Type", "application/json");
531
- req.send(JSON.stringify(urlParams));
532
- return new Promise((function(_this) {
533
- return function(resolve, reject) {
534
- req.onerror = function(e) {
535
- return reject(e);
536
- };
537
- return req.onload = function(e) {
538
- var obj, record;
539
- record = JSON.parse(e.target.response);
540
- obj = _this.__initSubclass(record);
541
- __WEBPACK_IMPORTED_MODULE_3__identity_map_coffee__["default"].add(obj);
542
- return resolve(obj);
543
- };
544
- };
545
- })(this));
546
- };
547
-
548
- Base.get = function(action, opts) {
549
- if (opts == null) {
550
- opts = {};
551
- }
552
- return this.__send("GET", action, opts);
553
- };
554
-
555
- Base.post = function(action, opts) {
556
- if (opts == null) {
557
- opts = {};
558
- }
559
- return this.__send("POST", action, opts);
560
- };
561
-
562
- Base.put = function(action, opts) {
563
- if (opts == null) {
564
- opts = {};
565
- }
566
- return this.__send("PUT", action, opts);
567
- };
568
-
569
- Base["delete"] = function(action, opts) {
570
- if (opts == null) {
571
- opts = {};
572
- }
573
- return this.__send("DELETE", action, opts);
574
- };
575
-
576
- Base.getIdentity = function() {
577
- if (this.identity != null) {
578
- return this.identity;
579
- } else {
580
- throw "Specify Model's @identity!";
581
- }
582
- };
583
-
584
- Base.getRemoteName = function() {
585
- if (this.remoteName != null) {
586
- return this.remoteName;
587
- } else {
588
- return this.getIdentity();
589
- }
590
- };
591
-
592
- Base.getAttribRemoteName = function(attrib) {
593
- if (this.attributes == null) {
594
- return null;
595
- }
596
- if (this.attributes[attrib] == null) {
597
- return null;
598
- }
599
- if (this.attributes[attrib].remoteName == null) {
600
- return attrib;
601
- }
602
- return this.attributes[attrib].remoteName;
603
- };
604
-
605
- Base.getResourcesUrlParams = function() {
606
- var match, params, regexp, url;
607
- url = this.__getResourcesUrl();
608
- regexp = /:(\w+)\/?/;
609
- params = [];
610
- while (match = regexp.exec(url)) {
611
- params.push(match[1]);
612
- url = url.replace(match[0], match[1]);
613
- }
614
- return params;
615
- };
616
-
617
- Base.__getResourcesUrl = function(opts) {
618
- var match, resourcesUrl;
619
- if (opts == null) {
620
- opts = {};
621
- }
622
- resourcesUrl = this.resources == null ? "/" + (this.getRemoteName().toLowerCase()) + "s" : opts.resource ? this.resources[opts.resource].url : (__WEBPACK_IMPORTED_MODULE_1__env___default()().scope != null) && (this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope] != null) ? this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope].url : this.resources.url;
623
- if (__WEBPACK_IMPORTED_MODULE_1__env___default()().loco.protocolWithHost != null) {
624
- resourcesUrl = "" + (__WEBPACK_IMPORTED_MODULE_1__env___default()().loco.protocolWithHost) + resourcesUrl;
625
- }
626
- match = /:(\w+)\/?/.exec(resourcesUrl);
627
- if (match == null) {
628
- return resourcesUrl;
629
- }
630
- if (opts[match[1]] != null) {
631
- resourcesUrl = resourcesUrl.replace(":" + match[1], opts[match[1]]);
632
- delete opts[match[1]];
633
- } else if ((opts.obj != null) && (opts.obj[match[1]] != null)) {
634
- resourcesUrl = resourcesUrl.replace(":" + match[1], opts.obj[match[1]]);
635
- }
636
- return resourcesUrl;
637
- };
638
-
639
- Base.__initSubclass = function(params) {
640
- var model, parts;
641
- if (params == null) {
642
- params = {};
643
- }
644
- parts = this.getIdentity().split(".");
645
- if (parts.length === 1) {
646
- model = __WEBPACK_IMPORTED_MODULE_4__models___default()()[parts[0]];
647
- if (model == null) {
648
- return new this(params);
649
- }
650
- return new model(params);
651
- }
652
- model = __WEBPACK_IMPORTED_MODULE_4__models___default()()[parts[0]][parts[1]];
653
- return new model(params);
654
- };
655
-
656
- Base.__page = function(i, opts, reqOpts, resp) {
657
- var data, httpMethod, key, ref, ref1, req, url, val;
658
- if (opts == null) {
659
- opts = {};
660
- }
661
- if (reqOpts == null) {
662
- reqOpts = {};
663
- }
664
- if (resp == null) {
665
- resp = {
666
- resources: [],
667
- count: 0
668
- };
669
- }
670
- httpMethod = reqOpts.method || "GET";
671
- url = reqOpts.url || this.__getResourcesUrl(opts);
672
- data = {};
673
- if (reqOpts.data != null) {
674
- ref = reqOpts.data;
675
- for (key in ref) {
676
- val = ref[key];
677
- if (key === "resource") {
678
- continue;
679
- }
680
- data[key] = val;
681
- }
682
- }
683
- data[this.__getPaginationParam()] = i;
684
- if (httpMethod === 'GET') {
685
- url = url + '?' + __WEBPACK_IMPORTED_MODULE_2__utils___default.a.Obj.toURIParams(data);
686
- }
687
- req = new XMLHttpRequest();
688
- req.open(httpMethod, url);
689
- req.setRequestHeader("Accept", "application/json");
690
- req.setRequestHeader("Content-Type", "application/json");
691
- req.setRequestHeader("X-CSRF-Token", (ref1 = document.querySelector("meta[name='csrf-token']")) != null ? ref1.content : void 0);
692
- req.send(JSON.stringify(data));
693
- return new Promise((function(_this) {
694
- return function(resolve, reject) {
695
- req.onerror = function(e) {
696
- return reject(e);
697
- };
698
- return req.onload = function(e) {
699
- var j, len, obj, record, ref2;
700
- data = JSON.parse(e.target.response);
701
- resp.count = data.count;
702
- for (key in data) {
703
- val = data[key];
704
- if (['resources', 'count'].indexOf(key) === -1) {
705
- resp[key] = val;
706
- }
707
- }
708
- ref2 = data.resources;
709
- for (j = 0, len = ref2.length; j < len; j++) {
710
- record = ref2[j];
711
- obj = _this.__initSubclass(record);
712
- if (opts.resource != null) {
713
- obj.resource = opts.resource;
714
- }
715
- __WEBPACK_IMPORTED_MODULE_3__identity_map_coffee__["default"].add(obj);
716
- resp.resources.push(obj);
717
- }
718
- return resolve(resp);
719
- };
720
- };
721
- })(this));
722
- };
723
-
724
- Base.__paginate = function(opts, reqOpts) {
725
- var pageNum, perPage, ref;
726
- perPage = this.__getPaginationPer();
727
- pageNum = (ref = opts.page) != null ? ref : 1;
728
- return this.__page(pageNum, opts, reqOpts).then((function(_this) {
729
- return function(data) {
730
- var func, i, j, max, promise, ref1;
731
- if (opts.page != null) {
732
- return Promise.resolve(data);
733
- }
734
- if (data.count <= perPage) {
735
- return Promise.resolve(data);
736
- }
737
- max = parseInt(data.count / perPage);
738
- if (max !== data.count / perPage) {
739
- max += 1;
740
- }
741
- promise = Promise.resolve(data);
742
- if (max === 1) {
743
- return promise;
744
- }
745
- for (i = j = 2, ref1 = max; 2 <= ref1 ? j <= ref1 : j >= ref1; i = 2 <= ref1 ? ++j : --j) {
746
- func = function(i) {
747
- return promise = promise.then(function(arr) {
748
- return _this.__page(i, opts, reqOpts, data);
749
- });
750
- };
751
- func(i);
752
- }
753
- return promise;
754
- };
755
- })(this));
756
- };
757
-
758
- Base.__getPaginationParam = function() {
759
- var defaultParam, param, ref, ref1, ref2, ref3;
760
- defaultParam = 'page';
761
- if ((__WEBPACK_IMPORTED_MODULE_1__env___default()().scope != null) && (this.resources != null) && (this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope] != null)) {
762
- param = (ref = this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope]) != null ? (ref1 = ref.paginate) != null ? ref1.param : void 0 : void 0;
763
- return param != null ? param : defaultParam;
764
- }
765
- if (((ref2 = this.resources) != null ? (ref3 = ref2.paginate) != null ? ref3.param : void 0 : void 0) != null) {
766
- return this.resources.paginate.param;
767
- }
768
- return defaultParam;
769
- };
770
-
771
- Base.__getPaginationPer = function() {
772
- var ref, ref1, ref2, ref3;
773
- if ((__WEBPACK_IMPORTED_MODULE_1__env___default()().scope != null) && (this.resources != null) && (this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope] != null)) {
774
- return (ref = this.resources[__WEBPACK_IMPORTED_MODULE_1__env___default()().scope]) != null ? (ref1 = ref.paginate) != null ? ref1.per : void 0 : void 0;
775
- }
776
- if (((ref2 = this.resources) != null ? (ref3 = ref2.paginate) != null ? ref3.per : void 0 : void 0) != null) {
777
- return this.resources.paginate.per;
778
- }
779
- return null;
780
- };
781
-
782
- Base.__send = function(method, action, opts) {
783
- var reqOpts, url;
784
- url = this.__getResourcesUrl(opts);
785
- if (action !== "all") {
786
- url = url + "/" + action;
787
- }
788
- reqOpts = {
789
- method: method,
790
- url: url,
791
- data: opts
792
- };
793
- return this.__paginate(opts, reqOpts);
794
- };
795
-
796
- Base.prototype.setResource = function(name) {
797
- return this.resource = name;
798
- };
799
-
800
- Base.prototype.getIdentity = function() {
801
- return this.constructor.getIdentity();
802
- };
803
-
804
- Base.prototype.getAttrRemoteName = function(attr) {
805
- if (this.constructor.attributes == null) {
806
- return null;
807
- }
808
- if (this.constructor.attributes[attr] == null) {
809
- return null;
810
- }
811
- return this.constructor.attributes[attr].remoteName || attr;
812
- };
813
-
814
- Base.prototype.getAttrName = function(remoteName) {
815
- var config, name, ref;
816
- if (this.constructor.attributes == null) {
817
- return remoteName;
818
- }
819
- if (this.constructor.attributes[remoteName] != null) {
820
- return remoteName;
821
- }
822
- ref = this.constructor.attributes;
823
- for (name in ref) {
824
- config = ref[name];
825
- if (config.remoteName === remoteName) {
826
- return name;
827
- }
828
- }
829
- return remoteName;
830
- };
831
-
832
- Base.prototype.getAttrType = function(attrName) {
833
- if (this.constructor.attributes == null) {
834
- return null;
835
- }
836
- if (this.constructor.attributes[attrName] == null) {
837
- return null;
838
- }
839
- return this.constructor.attributes[attrName].type;
840
- };
841
-
842
- Base.prototype.assignAttr = function(attrName, val) {
843
- var attrType;
844
- attrType = this.getAttrType(attrName);
845
- if (val == null) {
846
- this[attrName] = null;
847
- return;
848
- }
849
- switch (attrType) {
850
- case "Date":
851
- val = new Date(Date.parse(val));
852
- break;
853
- case "Integer":
854
- case "Int":
855
- val = parseInt(val);
856
- break;
857
- case "Float":
858
- val = parseFloat(val);
859
- break;
860
- case "Boolean":
861
- case "Bool":
862
- val = typeof val === 'boolean' ? val : Boolean(parseInt(val));
863
- break;
864
- case "Number":
865
- val = Number(val);
866
- break;
867
- case "String":
868
- val = String(val);
869
- }
870
- return this[attrName] = val;
871
- };
872
-
873
- Base.prototype.attributes = function() {
874
- var _, attribs, name, ref;
875
- attribs = {
876
- id: this.id
877
- };
878
- if (this.constructor.attributes == null) {
879
- return attribs;
880
- }
881
- ref = this.constructor.attributes;
882
- for (name in ref) {
883
- _ = ref[name];
884
- attribs[name] = this[name];
885
- }
886
- return attribs;
887
- };
888
-
889
- Base.prototype.isValid = function() {
890
- var config, j, len, meth, name, pvs, ref, ref1, ref2, validationName, validationSettings, validator;
891
- if (this.constructor.attributes == null) {
892
- return true;
893
- }
894
- this.errors = null;
895
- ref = this.constructor.attributes;
896
- for (name in ref) {
897
- config = ref[name];
898
- if (config.validations == null) {
899
- continue;
900
- }
901
- ref1 = config.validations;
902
- for (validationName in ref1) {
903
- validationSettings = ref1[validationName];
904
- if ((this.id != null) && validationSettings.on === "create") {
905
- continue;
906
- }
907
- if ((this.id == null) && validationSettings.on === "update") {
908
- continue;
909
- }
910
- if ((validationSettings["if"] != null) && !validationSettings["if"](this)) {
911
- continue;
912
- }
913
- validator = validationName.charAt(0).toUpperCase() + validationName.slice(1);
914
- if (__WEBPACK_IMPORTED_MODULE_0__validators___default.a[validator] == null) {
915
- console.log("Warning! \"" + validator + "\" validator is not implemented!");
916
- continue;
917
- }
918
- pvs = this.__processedValidationSettings(validationSettings);
919
- __WEBPACK_IMPORTED_MODULE_0__validators___default.a[validator].instance(this, name, pvs).validate();
920
- }
921
- }
922
- if (this.constructor.validate != null) {
923
- ref2 = this.constructor.validate;
924
- for (j = 0, len = ref2.length; j < len; j++) {
925
- meth = ref2[j];
926
- this[meth]();
927
- }
928
- }
929
- if (this.errors != null) {
930
- return false;
931
- } else {
932
- return true;
933
- }
934
- };
935
-
936
- Base.prototype.isInvalid = function() {
937
- return !this.isValid();
938
- };
939
-
940
- Base.prototype.isEmpty = function() {
941
- var name, ref, val;
942
- ref = this.attributes();
943
- for (name in ref) {
944
- val = ref[name];
945
- if (this[name] !== null) {
946
- return false;
947
- }
948
- }
949
- return true;
950
- };
951
-
952
- Base.prototype.addErrorMessage = function(message, opts) {
953
- if (opts == null) {
954
- opts = {};
955
- }
956
- if (this.errors == null) {
957
- this.errors = {};
958
- }
959
- if (this.errors[opts["for"]] == null) {
960
- this.errors[opts["for"]] = [];
961
- }
962
- return this.errors[opts["for"]].push(message);
963
- };
964
-
965
- Base.prototype.save = function() {
966
- var httpMeth, ref, req;
967
- httpMeth = this.id != null ? "PUT" : "POST";
968
- req = new XMLHttpRequest();
969
- req.open(httpMeth, this.__getResourceUrl());
970
- req.setRequestHeader("Accept", "application/json");
971
- req.setRequestHeader("Content-Type", "application/json");
972
- req.setRequestHeader("X-CSRF-Token", (ref = document.querySelector("meta[name='csrf-token']")) != null ? ref.content : void 0);
973
- req.send(JSON.stringify(this.serialize()));
974
- return new Promise((function(_this) {
975
- return function(resolve, reject) {
976
- req.onerror = function(e) {
977
- return reject(e);
978
- };
979
- return req.onload = function(e) {
980
- var data;
981
- data = JSON.parse(e.target.response);
982
- if (data.success) {
983
- resolve(data);
984
- return;
985
- }
986
- if (data.errors != null) {
987
- _this.__assignRemoteErrorMessages(data.errors);
988
- }
989
- return resolve(data);
990
- };
991
- };
992
- })(this));
993
- };
994
-
995
- Base.prototype.updateAttribute = function(attr) {
996
- var ref, req;
997
- req = new XMLHttpRequest();
998
- req.open('PUT', this.__getResourceUrl());
999
- req.setRequestHeader("Accept", "application/json");
1000
- req.setRequestHeader("Content-Type", "application/json");
1001
- req.setRequestHeader("X-CSRF-Token", (ref = document.querySelector("meta[name='csrf-token']")) != null ? ref.content : void 0);
1002
- req.send(JSON.stringify(this.serialize(attr)));
1003
- return new Promise((function(_this) {
1004
- return function(resolve, reject) {
1005
- req.onerror = function(e) {
1006
- return reject(e);
1007
- };
1008
- return req.onload = function(e) {
1009
- var data;
1010
- if (e.target.status >= 200 && e.target.status < 400) {
1011
- data = JSON.parse(e.target.response);
1012
- if (data.success) {
1013
- resolve(data);
1014
- return;
1015
- }
1016
- if (data.errors != null) {
1017
- _this.__assignRemoteErrorMessages(data.errors);
1018
- }
1019
- return resolve(data);
1020
- } else if (e.target.status >= 500) {
1021
- return reject(e);
1022
- }
1023
- };
1024
- };
1025
- })(this));
1026
- };
1027
-
1028
- Base.prototype.serialize = function(attr) {
1029
- var _, attribs, hash, mainKey, remoteName;
1030
- if (attr == null) {
1031
- attr = null;
1032
- }
1033
- if (this.constructor.attributes == null) {
1034
- return {};
1035
- }
1036
- hash = {};
1037
- mainKey = this.constructor.getRemoteName().toLowerCase();
1038
- hash[mainKey] = {};
1039
- attribs = {};
1040
- if (attr != null) {
1041
- attribs[attr] = null;
1042
- } else {
1043
- attribs = this.constructor.attributes;
1044
- }
1045
- for (attr in attribs) {
1046
- _ = attribs[attr];
1047
- remoteName = this.getAttrRemoteName(attr);
1048
- hash[mainKey][remoteName] = this[attr];
1049
- }
1050
- return hash;
1051
- };
1052
-
1053
- Base.prototype.reload = function() {
1054
- var findParams, j, len, param, ref;
1055
- findParams = {
1056
- id: this.id
1057
- };
1058
- ref = this.constructor.getResourcesUrlParams();
1059
- for (j = 0, len = ref.length; j < len; j++) {
1060
- param = ref[j];
1061
- findParams[param] = this[param];
1062
- }
1063
- return this.constructor.find(findParams);
1064
- };
1065
-
1066
- Base.prototype.changes = function() {
1067
- var currentObj, name, ref, result, val;
1068
- result = {};
1069
- currentObj = __WEBPACK_IMPORTED_MODULE_3__identity_map_coffee__["default"].find(this.getIdentity(), this.id);
1070
- ref = this.attributes();
1071
- for (name in ref) {
1072
- val = ref[name];
1073
- if (val !== currentObj[name]) {
1074
- if ((val != null) && val.constructor === Date && currentObj[name] - val === 0) {
1075
- continue;
1076
- }
1077
- if (val !== currentObj[name]) {
1078
- result[name] = {
1079
- is: currentObj[name],
1080
- was: val
1081
- };
1082
- }
1083
- }
1084
- }
1085
- return result;
1086
- };
1087
-
1088
- Base.prototype.applyChanges = function() {
1089
- var name, ref, results, vals;
1090
- ref = this.changes();
1091
- results = [];
1092
- for (name in ref) {
1093
- vals = ref[name];
1094
- results.push(this[name] = vals.is);
1095
- }
1096
- return results;
1097
- };
1098
-
1099
- Base.prototype.toKey = function() {
1100
- return (this.getIdentity().toLowerCase()) + "_" + this.id;
1101
- };
1102
-
1103
- Base.prototype.get = function(action, data) {
1104
- if (data == null) {
1105
- data = {};
1106
- }
1107
- return this.__send("GET", action, data);
1108
- };
1109
-
1110
- Base.prototype.post = function(action, data) {
1111
- if (data == null) {
1112
- data = {};
1113
- }
1114
- return this.__send("POST", action, data);
1115
- };
1116
-
1117
- Base.prototype.put = function(action, data) {
1118
- if (data == null) {
1119
- data = {};
1120
- }
1121
- return this.__send("PUT", action, data);
1122
- };
1123
-
1124
- Base.prototype.patch = function(action, data) {
1125
- if (data == null) {
1126
- data = {};
1127
- }
1128
- return this.__send("PATCH", action, data);
1129
- };
1130
-
1131
- Base.prototype["delete"] = function(action, data) {
1132
- if (data == null) {
1133
- data = {};
1134
- }
1135
- return this.__send("DELETE", action, data);
1136
- };
1137
-
1138
- Base.prototype.__send = function(method, action, data) {
1139
- var ref, req, url;
1140
- url = this.__getResourceUrl();
1141
- if (action != null) {
1142
- url = url + "/" + action;
1143
- }
1144
- req = new XMLHttpRequest();
1145
- req.open(method, url);
1146
- req.setRequestHeader("Accept", "application/json");
1147
- req.setRequestHeader("Content-Type", "application/json");
1148
- req.setRequestHeader("X-CSRF-Token", (ref = document.querySelector("meta[name='csrf-token']")) != null ? ref.content : void 0);
1149
- req.send(JSON.stringify(data));
1150
- return new Promise(function(resolve, reject) {
1151
- req.onerror = function(e) {
1152
- return reject(e);
1153
- };
1154
- return req.onload = function(e) {
1155
- if (e.target.status >= 200 && e.target.status < 400) {
1156
- data = JSON.parse(e.target.response);
1157
- return resolve(data);
1158
- } else if (e.target.status >= 500) {
1159
- return reject(e);
1160
- }
1161
- };
1162
- });
1163
- };
1164
-
1165
- Base.prototype.__assignAttributes = function(data) {
1166
- var attrName, key, results, val;
1167
- results = [];
1168
- for (key in data) {
1169
- val = data[key];
1170
- attrName = this.getAttrName(key);
1171
- results.push(this.assignAttr(attrName, val));
1172
- }
1173
- return results;
1174
- };
1175
-
1176
- Base.prototype.__initAttributes = function() {
1177
- var config, name, ref, results;
1178
- ref = this.constructor.attributes;
1179
- results = [];
1180
- for (name in ref) {
1181
- config = ref[name];
1182
- results.push(this[name] = null);
1183
- }
1184
- return results;
1185
- };
1186
-
1187
- Base.prototype.__assignRemoteErrorMessages = function(remoteErrors) {
1188
- var attr, error, errors, remoteName, results;
1189
- results = [];
1190
- for (remoteName in remoteErrors) {
1191
- errors = remoteErrors[remoteName];
1192
- attr = this.getAttrName(remoteName);
1193
- results.push((function() {
1194
- var j, len, results1;
1195
- results1 = [];
1196
- for (j = 0, len = errors.length; j < len; j++) {
1197
- error = errors[j];
1198
- results1.push(this.addErrorMessage(error, {
1199
- "for": attr
1200
- }));
1201
- }
1202
- return results1;
1203
- }).call(this));
1204
- }
1205
- return results;
1206
- };
1207
-
1208
- Base.prototype.__getResourceUrl = function() {
1209
- var url;
1210
- url = this.constructor.__getResourcesUrl({
1211
- resource: this.resource,
1212
- obj: this
1213
- });
1214
- if (this.id == null) {
1215
- return url;
1216
- }
1217
- return url + "/" + this.id;
1218
- };
1219
-
1220
- Base.prototype.__processedValidationSettings = function(validationSettings) {
1221
- var confName, confVal, res;
1222
- res = {};
1223
- for (confName in validationSettings) {
1224
- confVal = validationSettings[confName];
1225
- if (typeof confVal === 'function') {
1226
- res[confName] = confVal(this);
1227
- } else {
1228
- res[confName] = confVal;
1229
- }
1230
- }
1231
- return res;
1232
- };
1233
-
1234
- return Base;
1235
-
1236
- })();
1237
-
1238
- /* harmony default export */ __webpack_exports__["default"] = (Base);
1239
-
1240
-
1241
- /***/ }),
1242
- /* 8 */
1243
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1244
-
1245
- "use strict";
1246
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1247
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1248
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1249
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1250
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1251
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1252
- var Absence,
1253
- extend = 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; },
1254
- hasProp = {}.hasOwnProperty;
1255
-
1256
-
1257
-
1258
-
1259
-
1260
-
1261
-
1262
- Absence = (function(superClass) {
1263
- extend(Absence, superClass);
1264
-
1265
- Absence.identity = "Absence";
1266
-
1267
- function Absence() {
1268
- Absence.__super__.constructor.call(this);
1269
- }
1270
-
1271
- Absence.prototype.validate = function() {
1272
- switch (typeof this.val) {
1273
- case 'string':
1274
- if ((this.val != null) && this.val.length === 0) {
1275
- return;
1276
- }
1277
- break;
1278
- default:
1279
- if (this.val == null) {
1280
- return;
1281
- }
1282
- }
1283
- return this._addErrorMessage();
1284
- };
1285
-
1286
- Absence.prototype._addErrorMessage = function() {
1287
- var message;
1288
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.present;
1289
- return this.obj.addErrorMessage(message, {
1290
- "for": this.attr
1291
- });
1292
- };
1293
-
1294
- return Absence;
1295
-
1296
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1297
-
1298
- /* harmony default export */ __webpack_exports__["default"] = (Absence);
1299
-
1300
-
1301
- /***/ }),
1302
- /* 9 */
1303
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1304
-
1305
- "use strict";
1306
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1307
- var en;
1308
-
1309
- en = {
1310
- variants: {},
1311
- models: {},
1312
- attributes: {},
1313
- errors: {
1314
- messages: {
1315
- accepted: "must be accepted",
1316
- blank: "can't be blank",
1317
- confirmation: "doesn't match %{attribute}",
1318
- empty: "can't be empty",
1319
- equal_to: "must be equal to %{count}",
1320
- even: "must be even",
1321
- exclusion: "is reserved",
1322
- greater_than: "must be greater than %{count}",
1323
- greater_than_or_equal_to: "must be greater than or equal to %{count}",
1324
- inclusion: "is not included in the list",
1325
- invalid: "is invalid",
1326
- less_than: "must be less than %{count}",
1327
- less_than_or_equal_to: "must be less than or equal to %{count}",
1328
- not_a_number: "is not a number",
1329
- not_an_integer: "must be an integer",
1330
- odd: "must be odd",
1331
- present: "must be blank",
1332
- too_long: {
1333
- one: "is too long (maximum is 1 character)",
1334
- other: "is too long (maximum is %{count} characters)"
1335
- },
1336
- too_short: {
1337
- one: "is too short (minimum is 1 character)",
1338
- other: "is too short (minimum is %{count} characters)"
1339
- },
1340
- wrong_length: {
1341
- one: "is the wrong length (should be 1 character)",
1342
- other: "is the wrong length (should be %{count} characters)"
1343
- },
1344
- other_than: "must be other than %{count}"
1345
- }
1346
- }
1347
- };
1348
-
1349
- /* harmony default export */ __webpack_exports__["default"] = (en);
1350
-
1351
-
1352
- /***/ }),
1353
- /* 10 */
1354
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1355
-
1356
- "use strict";
1357
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1358
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1359
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1360
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1361
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1362
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1363
- var Confirmation,
1364
- extend = 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; },
1365
- hasProp = {}.hasOwnProperty;
1366
-
1367
-
1368
-
1369
-
1370
-
1371
-
1372
-
1373
- Confirmation = (function(superClass) {
1374
- extend(Confirmation, superClass);
1375
-
1376
- Confirmation.identity = "Confirmation";
1377
-
1378
- function Confirmation() {
1379
- Confirmation.__super__.constructor.call(this);
1380
- }
1381
-
1382
- Confirmation.prototype.validate = function() {
1383
- var properVal;
1384
- properVal = this.obj[this._properAttr()];
1385
- if ((this.val != null) && (properVal != null) && this.val === properVal) {
1386
- return;
1387
- }
1388
- return this._addErrorMessage();
1389
- };
1390
-
1391
- Confirmation.prototype._addErrorMessage = function() {
1392
- var attrName, attrNames, defaultAttrName, message;
1393
- defaultAttrName = this.attr.charAt(0).toUpperCase() + this.attr.slice(1);
1394
- attrNames = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].attributes[this.obj.getIdentity()];
1395
- attrName = (attrNames && attrNames[this.attr]) || defaultAttrName;
1396
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.confirmation;
1397
- message = message.replace('%{attribute}', attrName);
1398
- return this.obj.addErrorMessage(message, {
1399
- "for": this._properAttr()
1400
- });
1401
- };
1402
-
1403
- Confirmation.prototype._properAttr = function() {
1404
- return this.attr + "Confirmation";
1405
- };
1406
-
1407
- return Confirmation;
1408
-
1409
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1410
-
1411
- /* harmony default export */ __webpack_exports__["default"] = (Confirmation);
1412
-
1413
-
1414
- /***/ }),
1415
- /* 11 */
1416
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1417
-
1418
- "use strict";
1419
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1420
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1421
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1422
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1423
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1424
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1425
- var Exclusion,
1426
- extend = 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; },
1427
- hasProp = {}.hasOwnProperty;
1428
-
1429
-
1430
-
1431
-
1432
-
1433
-
1434
-
1435
- Exclusion = (function(superClass) {
1436
- extend(Exclusion, superClass);
1437
-
1438
- Exclusion.identity = "Exclusion";
1439
-
1440
- function Exclusion() {
1441
- Exclusion.__super__.constructor.call(this);
1442
- }
1443
-
1444
- Exclusion.prototype.validate = function() {
1445
- var set;
1446
- set = this.opts["in"] || this.opts.within || [];
1447
- if (set.indexOf(this.val) === -1) {
1448
- return;
1449
- }
1450
- return this._addErrorMessage();
1451
- };
1452
-
1453
- Exclusion.prototype._addErrorMessage = function() {
1454
- var message;
1455
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.exclusion;
1456
- return this.obj.addErrorMessage(message, {
1457
- "for": this.attr
1458
- });
1459
- };
1460
-
1461
- return Exclusion;
1462
-
1463
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1464
-
1465
- /* harmony default export */ __webpack_exports__["default"] = (Exclusion);
1466
-
1467
-
1468
- /***/ }),
1469
- /* 12 */
1470
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1471
-
1472
- "use strict";
1473
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1474
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1475
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1476
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1477
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1478
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1479
- var Format,
1480
- extend = 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; },
1481
- hasProp = {}.hasOwnProperty;
1482
-
1483
-
1484
-
1485
-
1486
-
1487
-
1488
-
1489
- Format = (function(superClass) {
1490
- extend(Format, superClass);
1491
-
1492
- Format.identity = "Format";
1493
-
1494
- function Format() {
1495
- Format.__super__.constructor.call(this);
1496
- }
1497
-
1498
- Format.prototype.validate = function() {
1499
- var match;
1500
- match = this.opts["with"].exec(this.val);
1501
- if (match != null) {
1502
- return;
1503
- }
1504
- return this._addErrorMessage();
1505
- };
1506
-
1507
- Format.prototype._addErrorMessage = function() {
1508
- var message;
1509
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.invalid;
1510
- return this.obj.addErrorMessage(message, {
1511
- "for": this.attr
1512
- });
1513
- };
1514
-
1515
- return Format;
1516
-
1517
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1518
-
1519
- /* harmony default export */ __webpack_exports__["default"] = (Format);
1520
-
1521
-
1522
- /***/ }),
1523
- /* 13 */
1524
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1525
-
1526
- "use strict";
1527
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1528
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1529
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1530
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1531
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1532
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1533
- var Inclusion,
1534
- extend = 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; },
1535
- hasProp = {}.hasOwnProperty;
1536
-
1537
-
1538
-
1539
-
1540
-
1541
-
1542
-
1543
- Inclusion = (function(superClass) {
1544
- extend(Inclusion, superClass);
1545
-
1546
- Inclusion.identity = "Inclusion";
1547
-
1548
- function Inclusion() {
1549
- Inclusion.__super__.constructor.call(this);
1550
- }
1551
-
1552
- Inclusion.prototype.validate = function() {
1553
- var set;
1554
- set = this.opts["in"] || this.opts.within || [];
1555
- if (set.indexOf(this.val) !== -1) {
1556
- return;
1557
- }
1558
- return this._addErrorMessage();
1559
- };
1560
-
1561
- Inclusion.prototype._addErrorMessage = function() {
1562
- var message;
1563
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.inclusion;
1564
- return this.obj.addErrorMessage(message, {
1565
- "for": this.attr
1566
- });
1567
- };
1568
-
1569
- return Inclusion;
1570
-
1571
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1572
-
1573
- /* harmony default export */ __webpack_exports__["default"] = (Inclusion);
1574
-
1575
-
1576
- /***/ }),
1577
- /* 14 */
1578
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1579
-
1580
- "use strict";
1581
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1582
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1583
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1584
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1585
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1586
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1587
- var Numericality,
1588
- extend = 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; },
1589
- hasProp = {}.hasOwnProperty;
1590
-
1591
-
1592
-
1593
-
1594
-
1595
-
1596
-
1597
- Numericality = (function(superClass) {
1598
- extend(Numericality, superClass);
1599
-
1600
- Numericality.identity = "Numericality";
1601
-
1602
- function Numericality() {
1603
- Numericality.__super__.constructor.call(this);
1604
- }
1605
-
1606
- Numericality.prototype.validate = function() {
1607
- if (isNaN(this.val)) {
1608
- return this._addNaNErrorMessage();
1609
- } else if ((this.opts.only_integer != null) && Number(this.val) !== parseInt(this.val)) {
1610
- return this._addIntErrorMessage();
1611
- } else if ((this.opts.greater_than != null) && Number(this.val) <= this.opts.greater_than) {
1612
- return this._addGreatherThanErrorMessage();
1613
- } else if ((this.opts.greater_than_or_equal_to != null) && Number(this.val) < this.opts.greater_than_or_equal_to) {
1614
- return this._addGreatherThanOrEqualToErrorMessage();
1615
- } else if ((this.opts.equal_to != null) && Number(this.val) !== this.opts.equal_to) {
1616
- return this._addEqualToErrorMessage();
1617
- } else if ((this.opts.less_than != null) && Number(this.val) >= this.opts.less_than) {
1618
- return this._addLessThanErrorMessage();
1619
- } else if ((this.opts.less_than_or_equal_to != null) && Number(this.val) > this.opts.less_than_or_equal_to) {
1620
- return this._addLessThanOrEqualToErrorMessage();
1621
- } else if ((this.opts.other_than != null) && Number(this.val) === this.opts.other_than) {
1622
- return this._addOtherThanErrorMessage();
1623
- } else if ((this.opts.odd != null) && Number(this.val) % 2 !== 1) {
1624
- return this._addOddErrorMessage();
1625
- } else if ((this.opts.even != null) && Number(this.val) % 2 !== 0) {
1626
- return this._addEvenErrorMessage();
1627
- }
1628
- };
1629
-
1630
- Numericality.prototype._addNaNErrorMessage = function() {
1631
- var message;
1632
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.not_a_number;
1633
- return this.obj.addErrorMessage(message, {
1634
- "for": this.attr
1635
- });
1636
- };
1637
-
1638
- Numericality.prototype._addIntErrorMessage = function() {
1639
- var message;
1640
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.not_an_integer;
1641
- return this.obj.addErrorMessage(message, {
1642
- "for": this.attr
1643
- });
1644
- };
1645
-
1646
- Numericality.prototype._addGreatherThanErrorMessage = function() {
1647
- var message;
1648
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.greater_than;
1649
- message = message.replace('%{count}', this.opts.greater_than);
1650
- return this.obj.addErrorMessage(message, {
1651
- "for": this.attr
1652
- });
1653
- };
1654
-
1655
- Numericality.prototype._addGreatherThanOrEqualToErrorMessage = function() {
1656
- var message;
1657
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.greater_than_or_equal_to;
1658
- message = message.replace('%{count}', this.opts.greater_than_or_equal_to);
1659
- return this.obj.addErrorMessage(message, {
1660
- "for": this.attr
1661
- });
1662
- };
1663
-
1664
- Numericality.prototype._addEqualToErrorMessage = function() {
1665
- var message;
1666
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.equal_to;
1667
- message = message.replace('%{count}', this.opts.equal_to);
1668
- return this.obj.addErrorMessage(message, {
1669
- "for": this.attr
1670
- });
1671
- };
1672
-
1673
- Numericality.prototype._addLessThanErrorMessage = function() {
1674
- var message;
1675
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.less_than;
1676
- message = message.replace('%{count}', this.opts.less_than);
1677
- return this.obj.addErrorMessage(message, {
1678
- "for": this.attr
1679
- });
1680
- };
1681
-
1682
- Numericality.prototype._addLessThanOrEqualToErrorMessage = function() {
1683
- var message;
1684
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.less_than_or_equal_to;
1685
- message = message.replace('%{count}', this.opts.less_than_or_equal_to);
1686
- return this.obj.addErrorMessage(message, {
1687
- "for": this.attr
1688
- });
1689
- };
1690
-
1691
- Numericality.prototype._addOtherThanErrorMessage = function() {
1692
- var message;
1693
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.other_than;
1694
- message = message.replace('%{count}', this.opts.other_than);
1695
- return this.obj.addErrorMessage(message, {
1696
- "for": this.attr
1697
- });
1698
- };
1699
-
1700
- Numericality.prototype._addOddErrorMessage = function() {
1701
- var message;
1702
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.odd;
1703
- return this.obj.addErrorMessage(message, {
1704
- "for": this.attr
1705
- });
1706
- };
1707
-
1708
- Numericality.prototype._addEvenErrorMessage = function() {
1709
- var message;
1710
- message = __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.even;
1711
- return this.obj.addErrorMessage(message, {
1712
- "for": this.attr
1713
- });
1714
- };
1715
-
1716
- return Numericality;
1717
-
1718
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1719
-
1720
- /* harmony default export */ __webpack_exports__["default"] = (Numericality);
1721
-
1722
-
1723
- /***/ }),
1724
- /* 15 */
1725
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1726
-
1727
- "use strict";
1728
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1729
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1730
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n__ = __webpack_require__(2);
1731
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__i18n___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__i18n__);
1732
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env__ = __webpack_require__(1);
1733
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__env___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__env__);
1734
- var Presence,
1735
- extend = 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; },
1736
- hasProp = {}.hasOwnProperty;
1737
-
1738
-
1739
-
1740
-
1741
-
1742
-
1743
-
1744
- Presence = (function(superClass) {
1745
- extend(Presence, superClass);
1746
-
1747
- Presence.identity = "Presence";
1748
-
1749
- function Presence() {
1750
- Presence.__super__.constructor.call(this);
1751
- }
1752
-
1753
- Presence.prototype.validate = function() {
1754
- switch (typeof this.val) {
1755
- case 'string':
1756
- if ((this.val != null) && this.val.length > 0) {
1757
- return;
1758
- }
1759
- break;
1760
- default:
1761
- if (this.val != null) {
1762
- return;
1763
- }
1764
- }
1765
- return this._addErrorMessage();
1766
- };
1767
-
1768
- Presence.prototype._addErrorMessage = function() {
1769
- var message;
1770
- message = this.opts.message != null ? this.opts.message : __WEBPACK_IMPORTED_MODULE_1__i18n___default()()[__WEBPACK_IMPORTED_MODULE_2__env___default()().loco.getLocale()].errors.messages.blank;
1771
- return this.obj.addErrorMessage(message, {
1772
- "for": this.attr
1773
- });
1774
- };
1775
-
1776
- return Presence;
1777
-
1778
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1779
-
1780
- /* harmony default export */ __webpack_exports__["default"] = (Presence);
1781
-
1782
-
1783
- /***/ }),
1784
- /* 16 */
1785
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1786
-
1787
- "use strict";
1788
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1789
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_coffee__ = __webpack_require__(0);
1790
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__length_coffee__ = __webpack_require__(4);
1791
- var Size,
1792
- extend = 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; },
1793
- hasProp = {}.hasOwnProperty;
1794
-
1795
-
1796
-
1797
-
1798
-
1799
- Size = (function(superClass) {
1800
- extend(Size, superClass);
1801
-
1802
- Size.identity = "Size";
1803
-
1804
- function Size() {
1805
- Size.__super__.constructor.call(this);
1806
- }
1807
-
1808
- Size.prototype.validate = function() {
1809
- return __WEBPACK_IMPORTED_MODULE_1__length_coffee__["default"].instance(this.obj, this.attr, this.opts).validate();
1810
- };
1811
-
1812
- return Size;
1813
-
1814
- })(__WEBPACK_IMPORTED_MODULE_0__base_coffee__["default"]);
1815
-
1816
- /* harmony default export */ __webpack_exports__["default"] = (Size);
1817
-
1818
-
1819
- /***/ }),
1820
- /* 17 */
1821
- /***/ (function(module, exports, __webpack_require__) {
1822
-
1823
- "use strict";
1824
-
1825
-
1826
- Object.defineProperty(exports, "__esModule", {
1827
- value: true
1828
- });
1829
-
1830
- var _obj = __webpack_require__(18);
1831
-
1832
- var _obj2 = _interopRequireDefault(_obj);
1833
-
1834
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1835
-
1836
- var Utils = {
1837
- Obj: _obj2.default
1838
- };
1839
-
1840
- exports.default = Utils;
1841
-
1842
- /***/ }),
1843
- /* 18 */
1844
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1845
-
1846
- "use strict";
1847
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
1848
- var Obj;
1849
-
1850
- Obj = (function() {
1851
- function Obj() {}
1852
-
1853
- Obj.toURIParams = function(obj) {
1854
- var key, str, val;
1855
- str = "";
1856
- for (key in obj) {
1857
- val = obj[key];
1858
- if (str !== "") {
1859
- str += "&";
1860
- }
1861
- str += key + "=" + encodeURIComponent(val);
1862
- }
1863
- return str;
1864
- };
1865
-
1866
- return Obj;
1867
-
1868
- })();
1869
-
1870
- /* harmony default export */ __webpack_exports__["default"] = (Obj);
1871
-
1872
-
1873
- /***/ }),
1874
- /* 19 */
1875
- /***/ (function(module, exports, __webpack_require__) {
1876
-
1877
- "use strict";
1878
-
1879
-
1880
- Object.defineProperty(exports, "__esModule", {
1881
- value: true
1882
- });
1883
- var Models = function Models() {
1884
- if (typeof App === 'undefined') {
1885
- return {};
1886
- }
1887
- return App.Models;
1888
- };
1889
-
1890
- exports.default = Models;
1891
-
1892
- /***/ })
1893
- /******/ ]);
1894
- });
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LocoModel=e():t.LocoModel=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=7)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(3),s=r.n(o);n=function(){function t(){this.obj=null,this.attr=null,this.val=null,this.opts=null}return t.sharedInstances={},t.instance=function(t,e,r){var n,o;return o=this.identity,null==this.sharedInstances[o]&&(this.sharedInstances[o]=new s.a[o]),n=this.sharedInstances[o],n.assignAttribs(t,e,r),n},t.prototype.assignAttribs=function(t,e,r){return this.obj=t,this.attr=e,this.val=this.obj[this.attr],this.opts=r},t}(),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4),o=function(t){return t&&t.__esModule?t:{default:t}}(n),s={loco:o.default,scope:null},i=function(){return"undefined"==typeof App?s:App.Env};e.default=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(10),s=function(t){return t&&t.__esModule?t:{default:t}}(o),i=function(){return"undefined"!=typeof App?n({en:s.default},App.I18n):{en:s.default}};e.default=i},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(9),s=n(o),i=r(11),u=n(i),a=r(12),l=n(a),c=r(13),p=n(c),h=r(14),f=n(h),d=r(5),_=n(d),g=r(15),v=n(g),y=r(16),m=n(y),b=r(17),M=n(b),E={Absence:s.default,Confirmation:u.default,Exclusion:l.default,Format:p.default,Inclusion:f.default,Length:_.default,Numericality:v.default,Presence:m.default,Size:M.default};e.default=E},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={getLocale:function(){return"en"},protocolWithHost:null};e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Length",e.prototype.validate=function(){var t;if(null!=this.val&&null!==(t=null!=this._range()[0]&&null!=this._range()[1]&&this._range()[0]===this._range()[1]&&this.val.length!==this._range()[0]?this._selectErrorMessage("wrong_length",this._range()[0]):null!=this._range()[0]&&this.val.length<this._range()[0]?this._selectErrorMessage("too_short",this._range()[0]):null!=this._range()[1]&&this.val.length>this._range()[1]?this._selectErrorMessage("too_long",this._range()[1]):null))return this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._range=function(){var t,e;return t=this.opts.minimum||this.opts.is||null!=this.opts.within&&this.opts.within[0]||null,e=this.opts.maximum||this.opts.is||null!=this.opts.within&&this.opts.within[1]||null,[t,e]},e.prototype._selectErrorMessage=function(t,e){var r,n,o,s,u;if(1===e)return i()()[a()().loco.getLocale()].errors.messages[t].one;for(o=null,s=["few","many"],r=0,n=s.length;r<n;r++)if(u=s[r],this._checkVariant(u,e)){o=i()()[a()().loco.getLocale()].errors.messages[t][u];break}return null==o&&(o=i()()[a()().loco.getLocale()].errors.messages[t].other),null!=this.opts.message&&(o=this.opts.message),/%{count}/.exec(o)&&(o=o.replace("%{count}",e)),o},e.prototype._checkVariant=function(t,e){if(null!=i()()[a()().loco.getLocale()].variants[t])return i()()[a()().loco.getLocale()].variants[t](e)},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;n=function(){function t(){}return t.imap={},t.clear=function(){return this.imap={}},t.add=function(t){var e;return e=t.getIdentity(),null==this.imap[e]&&(this.imap[e]={}),null==this.imap[e][t.id]&&(this.imap[e][t.id]=[]),this.imap[e][t.id][0]=t},t.connect=function(t,e){var r;return null==e&&(e={}),r=e.with,this.add(r),this.imap[r.getIdentity()][r.id].push(t)},t.addCollection=function(t,e){if(null==e&&(e={}),null==this.imap[t]&&(this.imap[t]={}),null==this.imap[t].collection&&(this.imap[t].collection=[]),-1===this.imap[t].collection.indexOf(e.to))return this.imap[t].collection.push(e.to)},t.all=function(t){var e,r,n,o;if(null==this.imap[t])return null;e=[],o=this.imap[t];for(r in o)n=o[r],"collection"!==r&&e.push(n[0]);return e},t.find=function(t,e){return this.imap[t]&&this.imap[t][e]?this.imap[t][e][0]:null},t.findConnected=function(t,e){var r;return this.imap[t]&&this.imap[t][e]&&this.imap[t][e].length>1?(r=this.imap[t][e],r.slice(1,+(r.length-1)+1||9e9)):[]},t}(),e.default=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=e.IdentityMap=e.Config=e.Base=void 0;var o=r(8),s=n(o),i=r(6),u=n(i),a=r(0),l=n(a),c=r(3),p=n(c),h=r(4),f=n(h);p.default.Base=l.default,e.Base=s.default,e.Config=f.default,e.IdentityMap=u.default,e.Validators=p.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(3),s=r.n(o),i=r(1),u=r.n(i),a=r(18),l=r.n(a),c=r(6),p=r(20),h=r.n(p);n=function(){function t(t){null==t&&(t={}),this.id=null,this.errors=null,this.resource=t.resource,null!=this.constructor.attributes&&this.__initAttributes(),null!=t&&this.__assignAttributes(t)}return t.all=function(t){return null==t&&(t={}),this.get("all",t)},t.find=function(t){var e,r,n;return n={},"object"==typeof t?(n=t,e=t.id,delete n.id):e=t,r=new XMLHttpRequest,r.open("GET",this.__getResourcesUrl(n)+"/"+e),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(n)),new Promise(function(t){return function(e,n){return r.onerror=function(t){return n(t)},r.onload=function(r){var n,o;return o=JSON.parse(r.target.response),n=t.__initSubclass(o),c.default.add(n),e(n)}}}(this))},t.get=function(t,e){return null==e&&(e={}),this.__send("GET",t,e)},t.post=function(t,e){return null==e&&(e={}),this.__send("POST",t,e)},t.put=function(t,e){return null==e&&(e={}),this.__send("PUT",t,e)},t.delete=function(t,e){return null==e&&(e={}),this.__send("DELETE",t,e)},t.getIdentity=function(){if(null!=this.identity)return this.identity;throw"Specify Model's @identity!"},t.getRemoteName=function(){return null!=this.remoteName?this.remoteName:this.getIdentity()},t.getAttribRemoteName=function(t){return null==this.attributes?null:null==this.attributes[t]?null:null==this.attributes[t].remoteName?t:this.attributes[t].remoteName},t.getResourcesUrlParams=function(){var t,e,r,n;for(n=this.__getResourcesUrl(),r=/:(\w+)\/?/,e=[];t=r.exec(n);)e.push(t[1]),n=n.replace(t[0],t[1]);return e},t.__getResourcesUrl=function(t){var e,r;return null==t&&(t={}),r=null==this.resources?"/"+this.getRemoteName().toLowerCase()+"s":t.resource?this.resources[t.resource].url:null!=u()().scope&&null!=this.resources[u()().scope]?this.resources[u()().scope].url:this.resources.url,null!=u()().loco.protocolWithHost&&(r=""+u()().loco.protocolWithHost+r),null==(e=/:(\w+)\/?/.exec(r))?r:(null!=t[e[1]]?(r=r.replace(":"+e[1],t[e[1]]),delete t[e[1]]):null!=t.obj&&null!=t.obj[e[1]]&&(r=r.replace(":"+e[1],t.obj[e[1]])),r)},t.__initSubclass=function(t){var e,r;return null==t&&(t={}),r=this.getIdentity().split("."),1===r.length?(e=h()()[r[0]],null==e?new this(t):new e(t)):new(e=h()()[r[0]][r[1]])(t)},t.__page=function(t,e,r,n){var o,s,i,u,a,p,h,f;if(null==e&&(e={}),null==r&&(r={}),null==n&&(n={resources:[],count:0}),s=r.method||"GET",h=r.url||this.__getResourcesUrl(e),o={},null!=r.data){u=r.data;for(i in u)f=u[i],"resource"!==i&&(o[i]=f)}return o[this.__getPaginationParam()]=t,"GET"===s&&(h=h+"?"+l.a.Obj.toURIParams(o)),p=new XMLHttpRequest,p.open(s,h),p.setRequestHeader("Accept","application/json"),p.setRequestHeader("Content-Type","application/json"),p.setRequestHeader("X-CSRF-Token",null!=(a=document.querySelector("meta[name='csrf-token']"))?a.content:void 0),p.send(JSON.stringify(o)),new Promise(function(t){return function(r,s){return p.onerror=function(t){return s(t)},p.onload=function(s){var u,a,l,p,h;o=JSON.parse(s.target.response),n.count=o.count;for(i in o)f=o[i],-1===["resources","count"].indexOf(i)&&(n[i]=f);for(h=o.resources,u=0,a=h.length;u<a;u++)p=h[u],l=t.__initSubclass(p),null!=e.resource&&(l.resource=e.resource),c.default.add(l),n.resources.push(l);return r(n)}}}(this))},t.__paginate=function(t,e){var r,n,o;return n=this.__getPaginationPer(),r=null!=(o=t.page)?o:1,this.__page(r,t,e).then(function(r){return function(o){var s,i,u,a,l;if(null!=t.page)return Promise.resolve(o);if(o.count<=n)return Promise.resolve(o);if(u=parseInt(o.count/n),u!==o.count/n&&(u+=1),a=Promise.resolve(o),1===u)return a;for(s=i=2,l=u;2<=l?i<=l:i>=l;s=2<=l?++i:--i)(function(n){return a=a.then(function(s){return r.__page(n,t,e,o)})})(s);return a}}(this))},t.__getPaginationParam=function(){var t,e,r,n,o,s;return t="page",null!=u()().scope&&null!=this.resources&&null!=this.resources[u()().scope]?(e=null!=(r=this.resources[u()().scope])&&null!=(n=r.paginate)?n.param:void 0,null!=e?e:t):null!=(null!=(o=this.resources)&&null!=(s=o.paginate)?s.param:void 0)?this.resources.paginate.param:t},t.__getPaginationPer=function(){var t,e,r,n;return null!=u()().scope&&null!=this.resources&&null!=this.resources[u()().scope]?null!=(t=this.resources[u()().scope])&&null!=(e=t.paginate)?e.per:void 0:null!=(null!=(r=this.resources)&&null!=(n=r.paginate)?n.per:void 0)?this.resources.paginate.per:null},t.__send=function(t,e,r){var n,o;return o=this.__getResourcesUrl(r),"all"!==e&&(o=o+"/"+e),n={method:t,url:o,data:r},this.__paginate(r,n)},t.prototype.setResource=function(t){return this.resource=t},t.prototype.getIdentity=function(){return this.constructor.getIdentity()},t.prototype.getAttrRemoteName=function(t){return null==this.constructor.attributes?null:null==this.constructor.attributes[t]?null:this.constructor.attributes[t].remoteName||t},t.prototype.getAttrName=function(t){var e,r,n;if(null==this.constructor.attributes)return t;if(null!=this.constructor.attributes[t])return t;n=this.constructor.attributes;for(r in n)if(e=n[r],e.remoteName===t)return r;return t},t.prototype.getAttrType=function(t){return null==this.constructor.attributes?null:null==this.constructor.attributes[t]?null:this.constructor.attributes[t].type},t.prototype.assignAttr=function(t,e){var r;if(r=this.getAttrType(t),null==e)return void(this[t]=null);switch(r){case"Date":e=new Date(Date.parse(e));break;case"Integer":case"Int":e=parseInt(e);break;case"Float":e=parseFloat(e);break;case"Boolean":case"Bool":e="boolean"==typeof e?e:Boolean(parseInt(e));break;case"Number":e=Number(e);break;case"String":e=String(e)}return this[t]=e},t.prototype.attributes=function(){var t,e,r;if(t={id:this.id},null==this.constructor.attributes)return t;r=this.constructor.attributes;for(e in r)r[e],t[e]=this[e];return t},t.prototype.isValid=function(){var t,e,r,n,o,i,u,a,l,c,p,h;if(null==this.constructor.attributes)return!0;this.errors=null,u=this.constructor.attributes;for(o in u)if(t=u[o],null!=t.validations){a=t.validations;for(c in a)p=a[c],null!=this.id&&"create"===p.on||null==this.id&&"update"===p.on||(null==p.if||p.if(this))&&(h=c.charAt(0).toUpperCase()+c.slice(1),null!=s.a[h]?(i=this.__processedValidationSettings(p),s.a[h].instance(this,o,i).validate()):console.log('Warning! "'+h+'" validator is not implemented!'))}if(null!=this.constructor.validate)for(l=this.constructor.validate,e=0,r=l.length;e<r;e++)n=l[e],this[n]();return null==this.errors},t.prototype.isInvalid=function(){return!this.isValid()},t.prototype.isEmpty=function(){var t,e;e=this.attributes();for(t in e)if(e[t],null!==this[t])return!1;return!0},t.prototype.addErrorMessage=function(t,e){return null==e&&(e={}),null==this.errors&&(this.errors={}),null==this.errors[e.for]&&(this.errors[e.for]=[]),this.errors[e.for].push(t)},t.prototype.save=function(){var t,e,r;return t=null!=this.id?"PUT":"POST",r=new XMLHttpRequest,r.open(t,this.__getResourceUrl()),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-Type","application/json"),r.setRequestHeader("X-CSRF-Token",null!=(e=document.querySelector("meta[name='csrf-token']"))?e.content:void 0),r.send(JSON.stringify(this.serialize())),new Promise(function(t){return function(e,n){return r.onerror=function(t){return n(t)},r.onload=function(r){var n;return n=JSON.parse(r.target.response),n.success?void e(n):(null!=n.errors&&t.__assignRemoteErrorMessages(n.errors),e(n))}}}(this))},t.prototype.updateAttribute=function(t){var e,r;return r=new XMLHttpRequest,r.open("PUT",this.__getResourceUrl()),r.setRequestHeader("Accept","application/json"),r.setRequestHeader("Content-Type","application/json"),r.setRequestHeader("X-CSRF-Token",null!=(e=document.querySelector("meta[name='csrf-token']"))?e.content:void 0),r.send(JSON.stringify(this.serialize(t))),new Promise(function(t){return function(e,n){return r.onerror=function(t){return n(t)},r.onload=function(r){var o;return r.target.status>=200&&r.target.status<400?(o=JSON.parse(r.target.response),o.success?void e(o):(null!=o.errors&&t.__assignRemoteErrorMessages(o.errors),e(o))):r.target.status>=500?n(r):void 0}}}(this))},t.prototype.serialize=function(t){var e,r,n,o;if(null==t&&(t=null),null==this.constructor.attributes)return{};r={},n=this.constructor.getRemoteName().toLowerCase(),r[n]={},e={},null!=t?e[t]=null:e=this.constructor.attributes;for(t in e)e[t],o=this.getAttrRemoteName(t),r[n][o]=this[t];return r},t.prototype.reload=function(){var t,e,r,n,o;for(t={id:this.id},o=this.constructor.getResourcesUrlParams(),e=0,r=o.length;e<r;e++)n=o[e],t[n]=this[n];return this.constructor.find(t)},t.prototype.changes=function(){var t,e,r,n,o;n={},t=c.default.find(this.getIdentity(),this.id),r=this.attributes();for(e in r)if((o=r[e])!==t[e]){if(null!=o&&o.constructor===Date&&t[e]-o==0)continue;o!==t[e]&&(n[e]={is:t[e],was:o})}return n},t.prototype.applyChanges=function(){var t,e,r,n;e=this.changes(),r=[];for(t in e)n=e[t],r.push(this[t]=n.is);return r},t.prototype.toKey=function(){return this.getIdentity().toLowerCase()+"_"+this.id},t.prototype.get=function(t,e){return null==e&&(e={}),this.__send("GET",t,e)},t.prototype.post=function(t,e){return null==e&&(e={}),this.__send("POST",t,e)},t.prototype.put=function(t,e){return null==e&&(e={}),this.__send("PUT",t,e)},t.prototype.patch=function(t,e){return null==e&&(e={}),this.__send("PATCH",t,e)},t.prototype.delete=function(t,e){return null==e&&(e={}),this.__send("DELETE",t,e)},t.prototype.__send=function(t,e,r){var n,o,s;return s=this.__getResourceUrl(),null!=e&&(s=s+"/"+e),o=new XMLHttpRequest,o.open(t,s),o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("X-CSRF-Token",null!=(n=document.querySelector("meta[name='csrf-token']"))?n.content:void 0),o.send(JSON.stringify(r)),new Promise(function(t,e){return o.onerror=function(t){return e(t)},o.onload=function(n){return n.target.status>=200&&n.target.status<400?(r=JSON.parse(n.target.response),t(r)):n.target.status>=500?e(n):void 0}})},t.prototype.__assignAttributes=function(t){var e,r,n,o;n=[];for(r in t)o=t[r],e=this.getAttrName(r),n.push(this.assignAttr(e,o));return n},t.prototype.__initAttributes=function(){var t,e,r;e=this.constructor.attributes,r=[];for(t in e)e[t],r.push(this[t]=null);return r},t.prototype.__assignRemoteErrorMessages=function(t){var e,r,n,o,s;s=[];for(o in t)n=t[o],e=this.getAttrName(o),s.push(function(){var t,o,s;for(s=[],t=0,o=n.length;t<o;t++)r=n[t],s.push(this.addErrorMessage(r,{for:e}));return s}.call(this));return s},t.prototype.__getResourceUrl=function(){var t;return t=this.constructor.__getResourcesUrl({resource:this.resource,obj:this}),null==this.id?t:t+"/"+this.id},t.prototype.__processedValidationSettings=function(t){var e,r,n;n={};for(e in t)r=t[e],n[e]="function"==typeof r?r(this):r;return n},t}(),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Absence",e.prototype.validate=function(){switch(typeof this.val){case"string":if(null!=this.val&&0===this.val.length)return;break;default:if(null==this.val)return}return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.present,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;n={variants:{},models:{},attributes:{},errors:{messages:{accepted:"must be accepted",blank:"can't be blank",confirmation:"doesn't match %{attribute}",empty:"can't be empty",equal_to:"must be equal to %{count}",even:"must be even",exclusion:"is reserved",greater_than:"must be greater than %{count}",greater_than_or_equal_to:"must be greater than or equal to %{count}",inclusion:"is not included in the list",invalid:"is invalid",less_than:"must be less than %{count}",less_than_or_equal_to:"must be less than or equal to %{count}",not_a_number:"is not a number",not_an_integer:"must be an integer",odd:"must be odd",present:"must be blank",too_long:{one:"is too long (maximum is 1 character)",other:"is too long (maximum is %{count} characters)"},too_short:{one:"is too short (minimum is 1 character)",other:"is too short (minimum is %{count} characters)"},wrong_length:{one:"is the wrong length (should be 1 character)",other:"is the wrong length (should be %{count} characters)"},other_than:"must be other than %{count}"}}},e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Confirmation",e.prototype.validate=function(){var t;if(t=this.obj[this._properAttr()],null==this.val||null==t||this.val!==t)return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t,e,r,n;return r=this.attr.charAt(0).toUpperCase()+this.attr.slice(1),e=i()()[a()().loco.getLocale()].attributes[this.obj.getIdentity()],t=e&&e[this.attr]||r,n=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.confirmation,n=n.replace("%{attribute}",t),this.obj.addErrorMessage(n,{for:this._properAttr()})},e.prototype._properAttr=function(){return this.attr+"Confirmation"},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Exclusion",e.prototype.validate=function(){var t;if(t=this.opts.in||this.opts.within||[],-1!==t.indexOf(this.val))return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.exclusion,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Format",e.prototype.validate=function(){if(null==this.opts.with.exec(this.val))return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.invalid,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Inclusion",e.prototype.validate=function(){var t;if(t=this.opts.in||this.opts.within||[],-1===t.indexOf(this.val))return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.inclusion,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Numericality",e.prototype.validate=function(){return isNaN(this.val)?this._addNaNErrorMessage():null!=this.opts.only_integer&&Number(this.val)!==parseInt(this.val)?this._addIntErrorMessage():null!=this.opts.greater_than&&Number(this.val)<=this.opts.greater_than?this._addGreatherThanErrorMessage():null!=this.opts.greater_than_or_equal_to&&Number(this.val)<this.opts.greater_than_or_equal_to?this._addGreatherThanOrEqualToErrorMessage():null!=this.opts.equal_to&&Number(this.val)!==this.opts.equal_to?this._addEqualToErrorMessage():null!=this.opts.less_than&&Number(this.val)>=this.opts.less_than?this._addLessThanErrorMessage():null!=this.opts.less_than_or_equal_to&&Number(this.val)>this.opts.less_than_or_equal_to?this._addLessThanOrEqualToErrorMessage():null!=this.opts.other_than&&Number(this.val)===this.opts.other_than?this._addOtherThanErrorMessage():null!=this.opts.odd&&Number(this.val)%2!=1?this._addOddErrorMessage():null!=this.opts.even&&Number(this.val)%2!=0?this._addEvenErrorMessage():void 0},e.prototype._addNaNErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.not_a_number,this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addIntErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.not_an_integer,this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addGreatherThanErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.greater_than,t=t.replace("%{count}",this.opts.greater_than),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addGreatherThanOrEqualToErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.greater_than_or_equal_to,t=t.replace("%{count}",this.opts.greater_than_or_equal_to),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addEqualToErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.equal_to,t=t.replace("%{count}",this.opts.equal_to),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addLessThanErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.less_than,t=t.replace("%{count}",this.opts.less_than),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addLessThanOrEqualToErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.less_than_or_equal_to,t=t.replace("%{count}",this.opts.less_than_or_equal_to),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addOtherThanErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.other_than,t=t.replace("%{count}",this.opts.other_than),this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addOddErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.odd,this.obj.addErrorMessage(t,{for:this.attr})},e.prototype._addEvenErrorMessage=function(){var t;return t=i()()[a()().loco.getLocale()].errors.messages.even,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(2),i=r.n(s),u=r(1),a=r.n(u),l=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return l(e,t),e.identity="Presence",e.prototype.validate=function(){switch(typeof this.val){case"string":if(null!=this.val&&this.val.length>0)return;break;default:if(null!=this.val)return}return this._addErrorMessage()},e.prototype._addErrorMessage=function(){var t;return t=null!=this.opts.message?this.opts.message:i()()[a()().loco.getLocale()].errors.messages.blank,this.obj.addErrorMessage(t,{for:this.attr})},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o=r(0),s=r(5),i=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=function(t){function e(){e.__super__.constructor.call(this)}return i(e,t),e.identity="Size",e.prototype.validate=function(){return s.default.instance(this.obj,this.attr,this.opts).validate()},e}(o.default),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19),o=function(t){return t&&t.__esModule?t:{default:t}}(n),s={Obj:o.default};e.default=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;n=function(){function t(){}return t.toURIParams=function(t){var e,r,n;r="";for(e in t)n=t[e],""!==r&&(r+="&"),r+=e+"="+encodeURIComponent(n);return r},t}(),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){return"undefined"==typeof App?{}:App.Models};e.default=n}])});