integral 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (430) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/logo.png +0 -0
  3. data/app/assets/javascripts/ckeditor/my_config.js.erb +26 -18
  4. data/app/assets/javascripts/ckeditor/plugins/autoembed/lang/lv.js +8 -0
  5. data/app/assets/javascripts/ckeditor/plugins/autoembed/plugin.js +1 -1
  6. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +14 -14
  7. data/app/assets/javascripts/ckeditor/plugins/autogrow/samples/autogrow.html +8 -8
  8. data/app/assets/javascripts/ckeditor/plugins/codemirror/css/codemirror.min.css +1 -1
  9. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/autoformat.png +0 -0
  10. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/searchcode.png +0 -0
  11. data/app/assets/javascripts/ckeditor/plugins/codemirror/icons/uncommentselectedrange.png +0 -0
  12. data/app/assets/javascripts/ckeditor/plugins/codemirror/images/autocomplete.png +0 -0
  13. data/app/assets/javascripts/ckeditor/plugins/codemirror/images/autoformat.png +0 -0
  14. data/app/assets/javascripts/ckeditor/plugins/codemirror/images/commentselectedrange.png +0 -0
  15. data/app/assets/javascripts/ckeditor/plugins/codemirror/images/searchcode.png +0 -0
  16. data/app/assets/javascripts/ckeditor/plugins/codemirror/images/uncommentselectedrange.png +0 -0
  17. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/beautify.min.js +2 -2
  18. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.min.js +2 -2
  19. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.addons.search.min.js +1 -1
  20. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.min.js +1 -6
  21. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.bbcodemixed.min.js +1 -1
  22. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.handlebars.min.js +1 -0
  23. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js +2 -2
  24. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.javascript.min.js +1 -1
  25. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js +3 -3
  26. data/app/assets/javascripts/ckeditor/plugins/codemirror/js/codemirror.mode.twig.min.js +1 -1
  27. data/app/assets/javascripts/ckeditor/plugins/codemirror/lang/bg.js +7 -7
  28. data/app/assets/javascripts/ckeditor/plugins/codemirror/plugin.js +231 -217
  29. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/darcula.css +46 -0
  30. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/gruvbox-dark.css +34 -0
  31. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/idea.css +42 -0
  32. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/lesser-dark.css +1 -1
  33. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/lucario.css +37 -0
  34. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/monokai.css +5 -0
  35. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/oceanic-next.css +44 -0
  36. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/shadowfox.css +52 -0
  37. data/app/assets/javascripts/ckeditor/plugins/codemirror/theme/ssms.css +16 -0
  38. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/ar.js +15 -0
  39. data/app/assets/javascripts/ckeditor/plugins/embedbase/lang/lv.js +15 -0
  40. data/app/assets/javascripts/ckeditor/plugins/embedbase/plugin.js +1 -1
  41. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/copywidget.png +0 -0
  42. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/editwidget.png +0 -0
  43. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/hidpi/copywidget.png +0 -0
  44. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/hidpi/editwidget.png +0 -0
  45. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/hidpi/removewidget.png +0 -0
  46. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/hidpi/widget.png +0 -0
  47. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/removewidget.png +0 -0
  48. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/icons/widget.png +0 -0
  49. data/app/assets/javascripts/ckeditor/plugins/foundation-callout/plugin.js +86 -0
  50. data/app/assets/javascripts/ckeditor/plugins/image2/dev/assets/image1.jpg +0 -0
  51. data/app/assets/javascripts/ckeditor/plugins/image2/dev/assets/image2.jpg +0 -0
  52. data/app/assets/javascripts/ckeditor/plugins/image2/dev/contents.css +35 -0
  53. data/app/assets/javascripts/ckeditor/plugins/image2/dev/image2.html +339 -0
  54. data/app/assets/javascripts/ckeditor/plugins/image2/dialogs/image2.js +553 -0
  55. data/app/assets/javascripts/ckeditor/plugins/image2/icons/hidpi/image.png +0 -0
  56. data/app/assets/javascripts/ckeditor/plugins/image2/icons/image.png +0 -0
  57. data/app/assets/javascripts/ckeditor/plugins/image2/lang/af.js +21 -0
  58. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ar.js +21 -0
  59. data/app/assets/javascripts/ckeditor/plugins/image2/lang/az.js +21 -0
  60. data/app/assets/javascripts/ckeditor/plugins/image2/lang/bg.js +21 -0
  61. data/app/assets/javascripts/ckeditor/plugins/image2/lang/bn.js +21 -0
  62. data/app/assets/javascripts/ckeditor/plugins/image2/lang/bs.js +21 -0
  63. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ca.js +21 -0
  64. data/app/assets/javascripts/ckeditor/plugins/image2/lang/cs.js +21 -0
  65. data/app/assets/javascripts/ckeditor/plugins/image2/lang/cy.js +21 -0
  66. data/app/assets/javascripts/ckeditor/plugins/image2/lang/da.js +21 -0
  67. data/app/assets/javascripts/ckeditor/plugins/image2/lang/de-ch.js +21 -0
  68. data/app/assets/javascripts/ckeditor/plugins/image2/lang/de.js +21 -0
  69. data/app/assets/javascripts/ckeditor/plugins/image2/lang/el.js +21 -0
  70. data/app/assets/javascripts/ckeditor/plugins/image2/lang/en-au.js +21 -0
  71. data/app/assets/javascripts/ckeditor/plugins/image2/lang/en-ca.js +21 -0
  72. data/app/assets/javascripts/ckeditor/plugins/image2/lang/en-gb.js +21 -0
  73. data/app/assets/javascripts/ckeditor/plugins/image2/lang/en.js +21 -0
  74. data/app/assets/javascripts/ckeditor/plugins/image2/lang/eo.js +21 -0
  75. data/app/assets/javascripts/ckeditor/plugins/image2/lang/es-mx.js +21 -0
  76. data/app/assets/javascripts/ckeditor/plugins/image2/lang/es.js +21 -0
  77. data/app/assets/javascripts/ckeditor/plugins/image2/lang/et.js +21 -0
  78. data/app/assets/javascripts/ckeditor/plugins/image2/lang/eu.js +21 -0
  79. data/app/assets/javascripts/ckeditor/plugins/image2/lang/fa.js +21 -0
  80. data/app/assets/javascripts/ckeditor/plugins/image2/lang/fi.js +21 -0
  81. data/app/assets/javascripts/ckeditor/plugins/image2/lang/fo.js +21 -0
  82. data/app/assets/javascripts/ckeditor/plugins/image2/lang/fr-ca.js +21 -0
  83. data/app/assets/javascripts/ckeditor/plugins/image2/lang/fr.js +21 -0
  84. data/app/assets/javascripts/ckeditor/plugins/image2/lang/gl.js +21 -0
  85. data/app/assets/javascripts/ckeditor/plugins/image2/lang/gu.js +21 -0
  86. data/app/assets/javascripts/ckeditor/plugins/image2/lang/he.js +21 -0
  87. data/app/assets/javascripts/ckeditor/plugins/image2/lang/hi.js +21 -0
  88. data/app/assets/javascripts/ckeditor/plugins/image2/lang/hr.js +21 -0
  89. data/app/assets/javascripts/ckeditor/plugins/image2/lang/hu.js +21 -0
  90. data/app/assets/javascripts/ckeditor/plugins/image2/lang/id.js +21 -0
  91. data/app/assets/javascripts/ckeditor/plugins/image2/lang/is.js +21 -0
  92. data/app/assets/javascripts/ckeditor/plugins/image2/lang/it.js +21 -0
  93. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ja.js +21 -0
  94. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ka.js +21 -0
  95. data/app/assets/javascripts/ckeditor/plugins/image2/lang/km.js +21 -0
  96. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ko.js +21 -0
  97. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ku.js +21 -0
  98. data/app/assets/javascripts/ckeditor/plugins/image2/lang/lt.js +21 -0
  99. data/app/assets/javascripts/ckeditor/plugins/image2/lang/lv.js +21 -0
  100. data/app/assets/javascripts/ckeditor/plugins/image2/lang/mk.js +21 -0
  101. data/app/assets/javascripts/ckeditor/plugins/image2/lang/mn.js +21 -0
  102. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ms.js +21 -0
  103. data/app/assets/javascripts/ckeditor/plugins/image2/lang/nb.js +21 -0
  104. data/app/assets/javascripts/ckeditor/plugins/image2/lang/nl.js +21 -0
  105. data/app/assets/javascripts/ckeditor/plugins/image2/lang/no.js +21 -0
  106. data/app/assets/javascripts/ckeditor/plugins/image2/lang/oc.js +21 -0
  107. data/app/assets/javascripts/ckeditor/plugins/image2/lang/pl.js +21 -0
  108. data/app/assets/javascripts/ckeditor/plugins/image2/lang/pt-br.js +21 -0
  109. data/app/assets/javascripts/ckeditor/plugins/image2/lang/pt.js +21 -0
  110. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ro.js +21 -0
  111. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ru.js +21 -0
  112. data/app/assets/javascripts/ckeditor/plugins/image2/lang/si.js +21 -0
  113. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sk.js +21 -0
  114. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sl.js +21 -0
  115. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sq.js +21 -0
  116. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sr-latn.js +21 -0
  117. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sr.js +21 -0
  118. data/app/assets/javascripts/ckeditor/plugins/image2/lang/sv.js +21 -0
  119. data/app/assets/javascripts/ckeditor/plugins/image2/lang/th.js +21 -0
  120. data/app/assets/javascripts/ckeditor/plugins/image2/lang/tr.js +21 -0
  121. data/app/assets/javascripts/ckeditor/plugins/image2/lang/tt.js +21 -0
  122. data/app/assets/javascripts/ckeditor/plugins/image2/lang/ug.js +21 -0
  123. data/app/assets/javascripts/ckeditor/plugins/image2/lang/uk.js +21 -0
  124. data/app/assets/javascripts/ckeditor/plugins/image2/lang/vi.js +21 -0
  125. data/app/assets/javascripts/ckeditor/plugins/image2/lang/zh-cn.js +21 -0
  126. data/app/assets/javascripts/ckeditor/plugins/image2/lang/zh.js +21 -0
  127. data/app/assets/javascripts/ckeditor/plugins/image2/plugin.js +1720 -0
  128. data/app/assets/javascripts/ckeditor/plugins/image2/samples/assets/image1.jpg +0 -0
  129. data/app/assets/javascripts/ckeditor/plugins/image2/samples/assets/image2.jpg +0 -0
  130. data/app/assets/javascripts/ckeditor/plugins/image2/samples/image2.html +68 -0
  131. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/copywidget.png +0 -0
  132. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/editwidget.png +0 -0
  133. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/copywidget.png +0 -0
  134. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/editwidget.png +0 -0
  135. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/removewidget.png +0 -0
  136. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/hidpi/widget.png +0 -0
  137. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/removewidget.png +0 -0
  138. data/app/assets/javascripts/ckeditor/plugins/integral-card/icons/widget.png +0 -0
  139. data/app/assets/javascripts/ckeditor/plugins/integral-card/plugin.js +86 -0
  140. data/app/assets/javascripts/ckeditor/plugins/integralrecentposts/dialogs/integralrecentposts.js +40 -0
  141. data/app/assets/javascripts/ckeditor/plugins/integralrecentposts/plugin.js +32 -0
  142. data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/dnd.html +4 -4
  143. data/app/assets/javascripts/ckeditor/plugins/lineutils/dev/magicfinger.html +4 -4
  144. data/app/assets/javascripts/ckeditor/plugins/lineutils/plugin.js +7 -7
  145. data/app/assets/javascripts/ckeditor/plugins/linkballoon/README.md +5 -0
  146. data/app/assets/javascripts/ckeditor/plugins/linkballoon/assets/demo.png +0 -0
  147. data/app/assets/javascripts/ckeditor/plugins/linkballoon/plugin.js +25 -0
  148. data/app/assets/javascripts/ckeditor/plugins/notification/lang/az.js +7 -0
  149. data/app/assets/javascripts/ckeditor/plugins/notification/lang/bg.js +7 -0
  150. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ca.js +7 -0
  151. data/app/assets/javascripts/ckeditor/plugins/notification/lang/cs.js +2 -2
  152. data/app/assets/javascripts/ckeditor/plugins/notification/lang/da.js +2 -2
  153. data/app/assets/javascripts/ckeditor/plugins/notification/lang/de-ch.js +2 -2
  154. data/app/assets/javascripts/ckeditor/plugins/notification/lang/de.js +2 -2
  155. data/app/assets/javascripts/ckeditor/plugins/notification/lang/en-au.js +7 -0
  156. data/app/assets/javascripts/ckeditor/plugins/notification/lang/en.js +2 -2
  157. data/app/assets/javascripts/ckeditor/plugins/notification/lang/eo.js +2 -2
  158. data/app/assets/javascripts/ckeditor/plugins/notification/lang/es-mx.js +7 -0
  159. data/app/assets/javascripts/ckeditor/plugins/notification/lang/es.js +7 -0
  160. data/app/assets/javascripts/ckeditor/plugins/notification/lang/et.js +7 -0
  161. data/app/assets/javascripts/ckeditor/plugins/notification/lang/eu.js +2 -2
  162. data/app/assets/javascripts/ckeditor/plugins/notification/lang/fa.js +7 -0
  163. data/app/assets/javascripts/ckeditor/plugins/notification/lang/fr.js +3 -3
  164. data/app/assets/javascripts/ckeditor/plugins/notification/lang/gl.js +2 -2
  165. data/app/assets/javascripts/ckeditor/plugins/notification/lang/hr.js +7 -0
  166. data/app/assets/javascripts/ckeditor/plugins/notification/lang/hu.js +7 -0
  167. data/app/assets/javascripts/ckeditor/plugins/notification/lang/id.js +2 -2
  168. data/app/assets/javascripts/ckeditor/plugins/notification/lang/it.js +2 -2
  169. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ja.js +7 -0
  170. data/app/assets/javascripts/ckeditor/plugins/notification/lang/km.js +2 -2
  171. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ko.js +2 -2
  172. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ku.js +2 -2
  173. data/app/assets/javascripts/ckeditor/plugins/notification/lang/lv.js +7 -0
  174. data/app/assets/javascripts/ckeditor/plugins/notification/lang/nb.js +2 -2
  175. data/app/assets/javascripts/ckeditor/plugins/notification/lang/nl.js +2 -2
  176. data/app/assets/javascripts/ckeditor/plugins/notification/lang/oc.js +7 -0
  177. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pl.js +2 -2
  178. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt-br.js +2 -2
  179. data/app/assets/javascripts/ckeditor/plugins/notification/lang/pt.js +2 -2
  180. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ro.js +7 -0
  181. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ru.js +2 -2
  182. data/app/assets/javascripts/ckeditor/plugins/notification/lang/sk.js +7 -0
  183. data/app/assets/javascripts/ckeditor/plugins/notification/lang/sq.js +7 -0
  184. data/app/assets/javascripts/ckeditor/plugins/notification/lang/sv.js +2 -2
  185. data/app/assets/javascripts/ckeditor/plugins/notification/lang/tr.js +2 -2
  186. data/app/assets/javascripts/ckeditor/plugins/notification/lang/ug.js +2 -2
  187. data/app/assets/javascripts/ckeditor/plugins/notification/lang/uk.js +2 -2
  188. data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh-cn.js +3 -3
  189. data/app/assets/javascripts/ckeditor/plugins/notification/lang/zh.js +2 -2
  190. data/app/assets/javascripts/ckeditor/plugins/notification/plugin.js +794 -784
  191. data/app/assets/javascripts/ckeditor/plugins/numericinput/LICENSE.md +363 -0
  192. data/app/assets/javascripts/ckeditor/plugins/numericinput/README.md +16 -0
  193. data/app/assets/javascripts/ckeditor/plugins/numericinput/plugin.js +354 -0
  194. data/app/assets/javascripts/ckeditor/plugins/openlink/README.md +50 -0
  195. data/app/assets/javascripts/ckeditor/plugins/openlink/icons/hidpi/openLink.png +0 -0
  196. data/app/assets/javascripts/ckeditor/plugins/openlink/icons/openLink.png +0 -0
  197. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/bg.js +7 -0
  198. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/de.js +7 -0
  199. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/en.js +7 -0
  200. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/pl.js +7 -0
  201. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/ru.js +7 -0
  202. data/app/assets/javascripts/ckeditor/plugins/openlink/lang/uk.js +7 -0
  203. data/app/assets/javascripts/ckeditor/plugins/openlink/plugin.js +178 -0
  204. data/app/assets/javascripts/ckeditor/plugins/placeholder/dev/placeholder.html +5 -5
  205. data/app/assets/javascripts/ckeditor/plugins/placeholder/dialogs/placeholder.js +2 -2
  206. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/af.js +2 -2
  207. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ar.js +2 -2
  208. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/az.js +2 -2
  209. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/bg.js +5 -5
  210. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ca.js +2 -2
  211. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cs.js +2 -2
  212. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/cy.js +2 -2
  213. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/da.js +2 -2
  214. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de-ch.js +2 -2
  215. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/de.js +2 -2
  216. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/el.js +2 -2
  217. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en-au.js +12 -0
  218. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en-gb.js +2 -2
  219. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en.js +2 -2
  220. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eo.js +2 -2
  221. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es-mx.js +2 -2
  222. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/es.js +2 -2
  223. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/et.js +2 -2
  224. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/eu.js +2 -2
  225. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fa.js +2 -2
  226. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fi.js +2 -2
  227. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr-ca.js +2 -2
  228. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/fr.js +2 -2
  229. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/gl.js +2 -2
  230. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/he.js +2 -2
  231. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hr.js +2 -2
  232. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/hu.js +2 -2
  233. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/id.js +2 -2
  234. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/it.js +2 -2
  235. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ja.js +2 -2
  236. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/km.js +2 -2
  237. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ko.js +2 -2
  238. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ku.js +2 -2
  239. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/lv.js +5 -5
  240. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nb.js +2 -2
  241. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/nl.js +2 -2
  242. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/no.js +2 -2
  243. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/oc.js +2 -2
  244. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pl.js +2 -2
  245. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt-br.js +2 -2
  246. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/pt.js +2 -2
  247. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ro.js +12 -0
  248. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ru.js +2 -2
  249. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/si.js +2 -2
  250. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sk.js +2 -2
  251. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sl.js +2 -2
  252. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sq.js +2 -2
  253. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/sv.js +2 -2
  254. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/th.js +2 -2
  255. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tr.js +2 -2
  256. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/tt.js +2 -2
  257. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/ug.js +2 -2
  258. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/uk.js +2 -2
  259. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/vi.js +2 -2
  260. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh-cn.js +2 -2
  261. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/zh.js +2 -2
  262. data/app/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +3 -3
  263. data/app/assets/javascripts/ckeditor/plugins/placeholder/samples/placeholder.html +6 -6
  264. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/dialogs/simplebox.js +4 -4
  265. data/app/assets/javascripts/ckeditor/plugins/widget/dev/assets/simplebox/plugin.js +3 -3
  266. data/app/assets/javascripts/ckeditor/plugins/widget/dev/console.js +2 -2
  267. data/app/assets/javascripts/ckeditor/plugins/widget/dev/nestedwidgets.html +2 -2
  268. data/app/assets/javascripts/ckeditor/plugins/widget/dev/widgetstyles.html +2 -2
  269. data/app/assets/javascripts/ckeditor/plugins/widget/lang/af.js +2 -2
  270. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ar.js +2 -2
  271. data/app/assets/javascripts/ckeditor/plugins/widget/lang/az.js +2 -2
  272. data/app/assets/javascripts/ckeditor/plugins/widget/lang/bg.js +3 -3
  273. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ca.js +2 -2
  274. data/app/assets/javascripts/ckeditor/plugins/widget/lang/cs.js +2 -2
  275. data/app/assets/javascripts/ckeditor/plugins/widget/lang/cy.js +2 -2
  276. data/app/assets/javascripts/ckeditor/plugins/widget/lang/da.js +2 -2
  277. data/app/assets/javascripts/ckeditor/plugins/widget/lang/de-ch.js +2 -2
  278. data/app/assets/javascripts/ckeditor/plugins/widget/lang/de.js +2 -2
  279. data/app/assets/javascripts/ckeditor/plugins/widget/lang/el.js +2 -2
  280. data/app/assets/javascripts/ckeditor/plugins/widget/lang/en-au.js +8 -0
  281. data/app/assets/javascripts/ckeditor/plugins/widget/lang/en-gb.js +2 -2
  282. data/app/assets/javascripts/ckeditor/plugins/widget/lang/en.js +2 -2
  283. data/app/assets/javascripts/ckeditor/plugins/widget/lang/eo.js +2 -2
  284. data/app/assets/javascripts/ckeditor/plugins/widget/lang/es-mx.js +2 -2
  285. data/app/assets/javascripts/ckeditor/plugins/widget/lang/es.js +2 -2
  286. data/app/assets/javascripts/ckeditor/plugins/widget/lang/et.js +8 -0
  287. data/app/assets/javascripts/ckeditor/plugins/widget/lang/eu.js +2 -2
  288. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fa.js +3 -3
  289. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fi.js +2 -2
  290. data/app/assets/javascripts/ckeditor/plugins/widget/lang/fr.js +2 -2
  291. data/app/assets/javascripts/ckeditor/plugins/widget/lang/gl.js +2 -2
  292. data/app/assets/javascripts/ckeditor/plugins/widget/lang/he.js +2 -2
  293. data/app/assets/javascripts/ckeditor/plugins/widget/lang/hr.js +2 -2
  294. data/app/assets/javascripts/ckeditor/plugins/widget/lang/hu.js +2 -2
  295. data/app/assets/javascripts/ckeditor/plugins/widget/lang/id.js +2 -2
  296. data/app/assets/javascripts/ckeditor/plugins/widget/lang/it.js +2 -2
  297. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ja.js +2 -2
  298. data/app/assets/javascripts/ckeditor/plugins/widget/lang/km.js +2 -2
  299. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ko.js +2 -2
  300. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ku.js +2 -2
  301. data/app/assets/javascripts/ckeditor/plugins/widget/lang/lv.js +3 -3
  302. data/app/assets/javascripts/ckeditor/plugins/widget/lang/nb.js +2 -2
  303. data/app/assets/javascripts/ckeditor/plugins/widget/lang/nl.js +2 -2
  304. data/app/assets/javascripts/ckeditor/plugins/widget/lang/no.js +2 -2
  305. data/app/assets/javascripts/ckeditor/plugins/widget/lang/oc.js +2 -2
  306. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pl.js +2 -2
  307. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt-br.js +2 -2
  308. data/app/assets/javascripts/ckeditor/plugins/widget/lang/pt.js +2 -2
  309. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ro.js +8 -0
  310. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ru.js +2 -2
  311. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sk.js +2 -2
  312. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sl.js +2 -2
  313. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sq.js +3 -3
  314. data/app/assets/javascripts/ckeditor/plugins/widget/lang/sv.js +2 -2
  315. data/app/assets/javascripts/ckeditor/plugins/widget/lang/tr.js +2 -2
  316. data/app/assets/javascripts/ckeditor/plugins/widget/lang/tt.js +2 -2
  317. data/app/assets/javascripts/ckeditor/plugins/widget/lang/ug.js +2 -2
  318. data/app/assets/javascripts/ckeditor/plugins/widget/lang/uk.js +2 -2
  319. data/app/assets/javascripts/ckeditor/plugins/widget/lang/vi.js +2 -2
  320. data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh-cn.js +2 -2
  321. data/app/assets/javascripts/ckeditor/plugins/widget/lang/zh.js +2 -2
  322. data/app/assets/javascripts/ckeditor/plugins/widget/plugin.js +235 -64
  323. data/app/assets/javascripts/ckeditor/plugins/widgetselection/plugin.js +6 -11
  324. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ar.js +1 -0
  325. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/bg.js +17 -0
  326. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ca.js +1 -0
  327. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/cs.js +15 -0
  328. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/da.js +1 -0
  329. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/de.js +1 -0
  330. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/el.js +1 -0
  331. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/en.js +5 -1
  332. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/es.js +1 -0
  333. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/eu.js +17 -0
  334. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fa.js +13 -0
  335. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fi.js +1 -0
  336. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/fr.js +1 -0
  337. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/he.js +1 -0
  338. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/hr.js +1 -0
  339. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/hu.js +14 -0
  340. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/it.js +4 -3
  341. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ja.js +5 -5
  342. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ko.js +16 -0
  343. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/nl.js +3 -2
  344. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/no.js +1 -0
  345. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pl.js +4 -3
  346. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt-br.js +1 -0
  347. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/pt.js +1 -0
  348. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ro.js +15 -0
  349. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/ru.js +2 -1
  350. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/sk.js +15 -0
  351. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/sv.js +5 -3
  352. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/tr.js +1 -0
  353. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/uk.js +17 -0
  354. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/zh-cn.js +1 -0
  355. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/zh.js +14 -0
  356. data/app/assets/javascripts/ckeditor/plugins/wordcount/plugin.js +485 -302
  357. data/app/assets/javascripts/ckeditor/plugins/wordcount/samples/maxParagraphs.html +26 -0
  358. data/app/assets/javascripts/integral/backend.js +10 -14
  359. data/app/assets/javascripts/integral/frontend.js +0 -2
  360. data/app/assets/javascripts/integral/support/date_picker.coffee +54 -59
  361. data/app/assets/javascripts/integral/support/grid.coffee +11 -4
  362. data/app/assets/javascripts/integral/support/remote_form.coffee +13 -9
  363. data/app/assets/stylesheets/integral/frontend.sass +0 -1
  364. data/app/controllers/integral/application_controller.rb +3 -2
  365. data/app/controllers/integral/backend/activities_controller.rb +1 -1
  366. data/app/controllers/integral/backend/base_controller.rb +160 -24
  367. data/app/controllers/integral/backend/images_controller.rb +16 -49
  368. data/app/controllers/integral/backend/lists_controller.rb +15 -85
  369. data/app/controllers/integral/backend/pages_controller.rb +13 -116
  370. data/app/controllers/integral/backend/posts_controller.rb +21 -108
  371. data/app/controllers/integral/backend/settings_controller.rb +5 -10
  372. data/app/controllers/integral/backend/static_pages_controller.rb +4 -0
  373. data/app/controllers/integral/backend/users_controller.rb +23 -66
  374. data/app/controllers/integral/pages_controller.rb +2 -2
  375. data/app/controllers/integral/posts_controller.rb +2 -6
  376. data/app/decorators/integral/image_decorator.rb +1 -1
  377. data/app/decorators/integral/list_decorator.rb +1 -1
  378. data/app/decorators/integral/page_decorator.rb +1 -1
  379. data/app/decorators/integral/paginating_decorator.rb +6 -0
  380. data/app/decorators/integral/post_decorator.rb +34 -1
  381. data/app/decorators/integral/user_decorator.rb +1 -1
  382. data/app/decorators/integral/version_decorator.rb +1 -1
  383. data/app/helpers/integral/application_helper.rb +7 -0
  384. data/app/helpers/integral/blog_helper.rb +29 -0
  385. data/app/helpers/integral/social_helper.rb +0 -23
  386. data/app/models/integral/list.rb +1 -2
  387. data/app/models/integral/page.rb +1 -1
  388. data/app/models/integral/post.rb +1 -1
  389. data/app/models/integral/user.rb +6 -0
  390. data/app/policies/integral/base_policy.rb +1 -1
  391. data/app/views/devise/sessions/new.haml +2 -2
  392. data/app/views/integral/backend/images/_form.haml +8 -8
  393. data/app/views/integral/backend/images/edit.haml +10 -2
  394. data/app/views/integral/backend/lists/_child_fields.haml +1 -1
  395. data/app/views/integral/backend/lists/_form.haml +1 -1
  396. data/app/views/integral/backend/lists/_item_container.haml +2 -2
  397. data/app/views/integral/backend/lists/_item_modal.haml +1 -1
  398. data/app/views/integral/backend/lists/_list_item_fields.haml +4 -3
  399. data/app/views/integral/backend/lists/edit.haml +15 -1
  400. data/app/views/integral/backend/pages/_form.haml +3 -3
  401. data/app/views/integral/backend/pages/activities.haml +2 -2
  402. data/app/views/integral/backend/pages/activity.haml +1 -1
  403. data/app/views/integral/backend/pages/edit.haml +20 -0
  404. data/app/views/integral/backend/posts/_form.haml +9 -5
  405. data/app/views/integral/backend/posts/activities.haml +2 -2
  406. data/app/views/integral/backend/posts/activity.haml +1 -1
  407. data/app/views/integral/backend/posts/edit.haml +8 -3
  408. data/app/views/integral/backend/settings/sections/_social.haml +1 -3
  409. data/app/views/integral/backend/users/_form.haml +4 -4
  410. data/app/views/integral/backend/users/edit.haml +1 -1
  411. data/app/views/integral/backend/users/show.haml +7 -7
  412. data/app/views/integral/posts/index.haml +2 -1
  413. data/app/views/integral/posts/templates/default.haml +1 -2
  414. data/app/views/integral/shared/_share_modal.haml +0 -3
  415. data/app/views/integral/shared/_social_list_items.haml +6 -12
  416. data/config/locales/en.yml +23 -12
  417. data/lib/generators/templates/app.yml +0 -1
  418. data/lib/integral/engine.rb +1 -0
  419. data/lib/integral/router.rb +3 -1
  420. data/lib/integral/version.rb +1 -1
  421. data/public/integral/ckeditor_demo_content.html +0 -13
  422. metadata +186 -12
  423. data/app/assets/javascripts/ckeditor/plugins/wordcount/lang/jp.js +0 -13
  424. data/app/assets/javascripts/integral/support/date_picker/picker.date.js +0 -1435
  425. data/app/assets/javascripts/integral/support/date_picker/picker.js +0 -1132
  426. data/app/assets/stylesheets/integral/support/date-picker.scss +0 -16
  427. data/app/assets/stylesheets/integral/support/date_picker/_default.date.scss +0 -452
  428. data/app/assets/stylesheets/integral/support/date_picker/_default.scss +0 -201
  429. data/app/assets/stylesheets/integral/support/date_picker/materialize_clockpicker.sass +0 -220
  430. data/app/views/integral/backend/pages/edit.html.haml +0 -15
@@ -1,13 +0,0 @@
1
- /*
2
- Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
3
- For licensing, see LICENSE.html or http://ckeditor.com/license
4
- */
5
- CKEDITOR.plugins.setLang('wordcount', 'jp', {
6
- WordCount: '単語数:',
7
- CharCount: '文字数:',
8
- CharCountWithHTML: '文字数 (with HTML):',
9
- Paragraphs: 'Paragraphs:',
10
- pasteWarning: 'Content can not be pasted because it is above the allowed limit',
11
- Selected: 'Selected: ',
12
- title: 'ワードカウント'
13
- });
@@ -1,1435 +0,0 @@
1
- /*!
2
- * Date picker for pickadate.js v3.5.0
3
- * http://amsul.github.io/pickadate.js/date.htm
4
- */
5
-
6
- (function ( factory ) {
7
-
8
- // AMD.
9
- if ( typeof define == 'function' && define.amd )
10
- define( ['picker', 'jquery'], factory )
11
-
12
- // Node.js/browserify.
13
- else if ( typeof exports == 'object' )
14
- module.exports = factory( require('./picker.js'), require('jquery') )
15
-
16
- // Browser globals.
17
- else factory( Picker, jQuery )
18
-
19
- }(function( Picker, $ ) {
20
-
21
-
22
- /**
23
- * Globals and constants
24
- */
25
- var DAYS_IN_WEEK = 7,
26
- WEEKS_IN_CALENDAR = 6,
27
- _ = Picker._
28
-
29
-
30
-
31
- /**
32
- * The date picker constructor
33
- */
34
- function DatePicker( picker, settings ) {
35
-
36
- var calendar = this,
37
- element = picker.$node[ 0 ],
38
- elementValue = element.value,
39
- elementDataValue = picker.$node.data( 'value' ),
40
- valueString = elementDataValue || elementValue,
41
- formatString = elementDataValue ? settings.formatSubmit : settings.format,
42
- isRTL = function() {
43
-
44
- return element.currentStyle ?
45
-
46
- // For IE.
47
- element.currentStyle.direction == 'rtl' :
48
-
49
- // For normal browsers.
50
- getComputedStyle( picker.$root[0] ).direction == 'rtl'
51
- }
52
-
53
- calendar.settings = settings
54
- calendar.$node = picker.$node
55
-
56
- // The queue of methods that will be used to build item objects.
57
- calendar.queue = {
58
- min: 'measure create',
59
- max: 'measure create',
60
- now: 'now create',
61
- select: 'parse create validate',
62
- highlight: 'parse navigate create validate',
63
- view: 'parse create validate viewset',
64
- disable: 'deactivate',
65
- enable: 'activate'
66
- }
67
-
68
- // The component's item object.
69
- calendar.item = {}
70
-
71
- calendar.item.clear = null
72
- calendar.item.disable = ( settings.disable || [] ).slice( 0 )
73
- calendar.item.enable = -(function( collectionDisabled ) {
74
- return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
75
- })( calendar.item.disable )
76
-
77
- calendar.
78
- set( 'min', settings.min ).
79
- set( 'max', settings.max ).
80
- set( 'now' )
81
-
82
- // When there’s a value, set the `select`, which in turn
83
- // also sets the `highlight` and `view`.
84
- if ( valueString ) {
85
- calendar.set( 'select', valueString, { format: formatString })
86
- }
87
-
88
- // If there’s no value, default to highlighting “today”.
89
- else {
90
- calendar.
91
- set( 'select', null ).
92
- set( 'highlight', calendar.item.now )
93
- }
94
-
95
-
96
- // The keycode to movement mapping.
97
- calendar.key = {
98
- 40: 7, // Down
99
- 38: -7, // Up
100
- 39: function() { return isRTL() ? -1 : 1 }, // Right
101
- 37: function() { return isRTL() ? 1 : -1 }, // Left
102
- go: function( timeChange ) {
103
- var highlightedObject = calendar.item.highlight,
104
- targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )
105
- calendar.set(
106
- 'highlight',
107
- targetDate,
108
- { interval: timeChange }
109
- )
110
- this.render()
111
- }
112
- }
113
-
114
-
115
- // Bind some picker events.
116
- picker.
117
- on( 'render', function() {
118
- picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {
119
- var value = this.value
120
- if ( value ) {
121
- picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )
122
- picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )
123
- }
124
- })
125
- picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {
126
- var value = this.value
127
- if ( value ) {
128
- picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )
129
- picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )
130
- }
131
- })
132
- }, 1 ).
133
- on( 'open', function() {
134
- var includeToday = ''
135
- if ( calendar.disabled( calendar.get('now') ) ) {
136
- includeToday = ':not(.' + settings.klass.buttonToday + ')'
137
- }
138
- picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )
139
- }, 1 ).
140
- on( 'close', function() {
141
- picker.$root.find( 'button, select' ).attr( 'disabled', true )
142
- }, 1 )
143
-
144
- } //DatePicker
145
-
146
-
147
- /**
148
- * Set a datepicker item object.
149
- */
150
- DatePicker.prototype.set = function( type, value, options ) {
151
-
152
- var calendar = this,
153
- calendarItem = calendar.item
154
-
155
- // If the value is `null` just set it immediately.
156
- if ( value === null ) {
157
- if ( type == 'clear' ) type = 'select'
158
- calendarItem[ type ] = value
159
- return calendar
160
- }
161
-
162
- // Otherwise go through the queue of methods, and invoke the functions.
163
- // Update this as the time unit, and set the final value as this item.
164
- // * In the case of `enable`, keep the queue but set `disable` instead.
165
- // And in the case of `flip`, keep the queue but set `enable` instead.
166
- calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) {
167
- value = calendar[ method ]( type, value, options )
168
- return value
169
- }).pop()
170
-
171
- // Check if we need to cascade through more updates.
172
- if ( type == 'select' ) {
173
- calendar.set( 'highlight', calendarItem.select, options )
174
- }
175
- else if ( type == 'highlight' ) {
176
- calendar.set( 'view', calendarItem.highlight, options )
177
- }
178
- else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
179
- if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) {
180
- calendar.set( 'select', calendarItem.select, options )
181
- }
182
- if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) {
183
- calendar.set( 'highlight', calendarItem.highlight, options )
184
- }
185
- }
186
-
187
- return calendar
188
- } //DatePicker.prototype.set
189
-
190
-
191
- /**
192
- * Get a datepicker item object.
193
- */
194
- DatePicker.prototype.get = function( type ) {
195
- return this.item[ type ]
196
- } //DatePicker.prototype.get
197
-
198
-
199
- /**
200
- * Create a picker date object.
201
- */
202
- DatePicker.prototype.create = function( type, value, options ) {
203
-
204
- var isInfiniteValue,
205
- calendar = this
206
-
207
- // If there’s no value, use the type as the value.
208
- value = value === undefined ? type : value
209
-
210
-
211
- // If it’s infinity, update the value.
212
- if ( value == -Infinity || value == Infinity ) {
213
- isInfiniteValue = value
214
- }
215
-
216
- // If it’s an object, use the native date object.
217
- else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
218
- value = value.obj
219
- }
220
-
221
- // If it’s an array, convert it into a date and make sure
222
- // that it’s a valid date – otherwise default to today.
223
- else if ( $.isArray( value ) ) {
224
- value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
225
- value = _.isDate( value ) ? value : calendar.create().obj
226
- }
227
-
228
- // If it’s a number or date object, make a normalized date.
229
- else if ( _.isInteger( value ) || _.isDate( value ) ) {
230
- value = calendar.normalize( new Date( value ), options )
231
- }
232
-
233
- // If it’s a literal true or any other case, set it to now.
234
- else /*if ( value === true )*/ {
235
- value = calendar.now( type, value, options )
236
- }
237
-
238
- // Return the compiled object.
239
- return {
240
- year: isInfiniteValue || value.getFullYear(),
241
- month: isInfiniteValue || value.getMonth(),
242
- date: isInfiniteValue || value.getDate(),
243
- day: isInfiniteValue || value.getDay(),
244
- obj: isInfiniteValue || value,
245
- pick: isInfiniteValue || value.getTime()
246
- }
247
- } //DatePicker.prototype.create
248
-
249
-
250
- /**
251
- * Create a range limit object using an array, date object,
252
- * literal “true”, or integer relative to another time.
253
- */
254
- DatePicker.prototype.createRange = function( from, to ) {
255
-
256
- var calendar = this,
257
- createDate = function( date ) {
258
- if ( date === true || $.isArray( date ) || _.isDate( date ) ) {
259
- return calendar.create( date )
260
- }
261
- return date
262
- }
263
-
264
- // Create objects if possible.
265
- if ( !_.isInteger( from ) ) {
266
- from = createDate( from )
267
- }
268
- if ( !_.isInteger( to ) ) {
269
- to = createDate( to )
270
- }
271
-
272
- // Create relative dates.
273
- if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
274
- from = [ to.year, to.month, to.date + from ];
275
- }
276
- else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
277
- to = [ from.year, from.month, from.date + to ];
278
- }
279
-
280
- return {
281
- from: createDate( from ),
282
- to: createDate( to )
283
- }
284
- } //DatePicker.prototype.createRange
285
-
286
-
287
- /**
288
- * Check if a date unit falls within a date range object.
289
- */
290
- DatePicker.prototype.withinRange = function( range, dateUnit ) {
291
- range = this.createRange(range.from, range.to)
292
- return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
293
- }
294
-
295
-
296
- /**
297
- * Check if two date range objects overlap.
298
- */
299
- DatePicker.prototype.overlapRanges = function( one, two ) {
300
-
301
- var calendar = this
302
-
303
- // Convert the ranges into comparable dates.
304
- one = calendar.createRange( one.from, one.to )
305
- two = calendar.createRange( two.from, two.to )
306
-
307
- return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
308
- calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
309
- }
310
-
311
-
312
- /**
313
- * Get the date today.
314
- */
315
- DatePicker.prototype.now = function( type, value, options ) {
316
- value = new Date()
317
- if ( options && options.rel ) {
318
- value.setDate( value.getDate() + options.rel )
319
- }
320
- return this.normalize( value, options )
321
- }
322
-
323
-
324
- /**
325
- * Navigate to next/prev month.
326
- */
327
- DatePicker.prototype.navigate = function( type, value, options ) {
328
-
329
- var targetDateObject,
330
- targetYear,
331
- targetMonth,
332
- targetDate,
333
- isTargetArray = $.isArray( value ),
334
- isTargetObject = $.isPlainObject( value ),
335
- viewsetObject = this.item.view/*,
336
- safety = 100*/
337
-
338
-
339
- if ( isTargetArray || isTargetObject ) {
340
-
341
- if ( isTargetObject ) {
342
- targetYear = value.year
343
- targetMonth = value.month
344
- targetDate = value.date
345
- }
346
- else {
347
- targetYear = +value[0]
348
- targetMonth = +value[1]
349
- targetDate = +value[2]
350
- }
351
-
352
- // If we’re navigating months but the view is in a different
353
- // month, navigate to the view’s year and month.
354
- if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) {
355
- targetYear = viewsetObject.year
356
- targetMonth = viewsetObject.month
357
- }
358
-
359
- // Figure out the expected target year and month.
360
- targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 )
361
- targetYear = targetDateObject.getFullYear()
362
- targetMonth = targetDateObject.getMonth()
363
-
364
- // If the month we’re going to doesn’t have enough days,
365
- // keep decreasing the date until we reach the month’s last date.
366
- while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
367
- targetDate -= 1
368
- /*safety -= 1
369
- if ( !safety ) {
370
- throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
371
- }*/
372
- }
373
-
374
- value = [ targetYear, targetMonth, targetDate ]
375
- }
376
-
377
- return value
378
- } //DatePicker.prototype.navigate
379
-
380
-
381
- /**
382
- * Normalize a date by setting the hours to midnight.
383
- */
384
- DatePicker.prototype.normalize = function( value/*, options*/ ) {
385
- value.setHours( 0, 0, 0, 0 )
386
- return value
387
- }
388
-
389
-
390
- /**
391
- * Measure the range of dates.
392
- */
393
- DatePicker.prototype.measure = function( type, value/*, options*/ ) {
394
-
395
- var calendar = this
396
-
397
- // If it’s anything false-y, remove the limits.
398
- if ( !value ) {
399
- value = type == 'min' ? -Infinity : Infinity
400
- }
401
-
402
- // If it’s a string, parse it.
403
- else if ( typeof value == 'string' ) {
404
- value = calendar.parse( type, value )
405
- }
406
-
407
- // If it's an integer, get a date relative to today.
408
- else if ( _.isInteger( value ) ) {
409
- value = calendar.now( type, value, { rel: value } )
410
- }
411
-
412
- return value
413
- } ///DatePicker.prototype.measure
414
-
415
-
416
- /**
417
- * Create a viewset object based on navigation.
418
- */
419
- DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) {
420
- return this.create([ dateObject.year, dateObject.month, 1 ])
421
- }
422
-
423
-
424
- /**
425
- * Validate a date as enabled and shift if needed.
426
- */
427
- DatePicker.prototype.validate = function( type, dateObject, options ) {
428
-
429
- var calendar = this,
430
-
431
- // Keep a reference to the original date.
432
- originalDateObject = dateObject,
433
-
434
- // Make sure we have an interval.
435
- interval = options && options.interval ? options.interval : 1,
436
-
437
- // Check if the calendar enabled dates are inverted.
438
- isFlippedBase = calendar.item.enable === -1,
439
-
440
- // Check if we have any enabled dates after/before now.
441
- hasEnabledBeforeTarget, hasEnabledAfterTarget,
442
-
443
- // The min & max limits.
444
- minLimitObject = calendar.item.min,
445
- maxLimitObject = calendar.item.max,
446
-
447
- // Check if we’ve reached the limit during shifting.
448
- reachedMin, reachedMax,
449
-
450
- // Check if the calendar is inverted and at least one weekday is enabled.
451
- hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) {
452
-
453
- // If there’s a date, check where it is relative to the target.
454
- if ( $.isArray( value ) ) {
455
- var dateTime = calendar.create( value ).pick
456
- if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true
457
- else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true
458
- }
459
-
460
- // Return only integers for enabled weekdays.
461
- return _.isInteger( value )
462
- }).length/*,
463
-
464
- safety = 100*/
465
-
466
-
467
-
468
- // Cases to validate for:
469
- // [1] Not inverted and date disabled.
470
- // [2] Inverted and some dates enabled.
471
- // [3] Not inverted and out of range.
472
- //
473
- // Cases to **not** validate for:
474
- // • Navigating months.
475
- // • Not inverted and date enabled.
476
- // • Inverted and all dates disabled.
477
- // • ..and anything else.
478
- if ( !options || !options.nav ) if (
479
- /* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
480
- /* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
481
- /* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
482
- ) {
483
-
484
-
485
- // When inverted, flip the direction if there aren’t any enabled weekdays
486
- // and there are no enabled dates in the direction of the interval.
487
- if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
488
- interval *= -1
489
- }
490
-
491
-
492
- // Keep looping until we reach an enabled date.
493
- while ( /*safety &&*/ calendar.disabled( dateObject ) ) {
494
-
495
- /*safety -= 1
496
- if ( !safety ) {
497
- throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
498
- }*/
499
-
500
-
501
- // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
502
- if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) {
503
- dateObject = originalDateObject
504
- interval = interval > 0 ? 1 : -1
505
- }
506
-
507
-
508
- // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
509
- if ( dateObject.pick <= minLimitObject.pick ) {
510
- reachedMin = true
511
- interval = 1
512
- dateObject = calendar.create([
513
- minLimitObject.year,
514
- minLimitObject.month,
515
- minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
516
- ])
517
- }
518
- else if ( dateObject.pick >= maxLimitObject.pick ) {
519
- reachedMax = true
520
- interval = -1
521
- dateObject = calendar.create([
522
- maxLimitObject.year,
523
- maxLimitObject.month,
524
- maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
525
- ])
526
- }
527
-
528
-
529
- // If we’ve reached both limits, just break out of the loop.
530
- if ( reachedMin && reachedMax ) {
531
- break
532
- }
533
-
534
-
535
- // Finally, create the shifted date using the interval and keep looping.
536
- dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ])
537
- }
538
-
539
- } //endif
540
-
541
-
542
- // Return the date object settled on.
543
- return dateObject
544
- } //DatePicker.prototype.validate
545
-
546
-
547
- /**
548
- * Check if a date is disabled.
549
- */
550
- DatePicker.prototype.disabled = function( dateToVerify ) {
551
-
552
- var
553
- calendar = this,
554
-
555
- // Filter through the disabled dates to check if this is one.
556
- isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) {
557
-
558
- // If the date is a number, match the weekday with 0index and `firstDay` check.
559
- if ( _.isInteger( dateToDisable ) ) {
560
- return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
561
- }
562
-
563
- // If it’s an array or a native JS date, create and match the exact date.
564
- if ( $.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) {
565
- return dateToVerify.pick === calendar.create( dateToDisable ).pick
566
- }
567
-
568
- // If it’s an object, match a date within the “from” and “to” range.
569
- if ( $.isPlainObject( dateToDisable ) ) {
570
- return calendar.withinRange( dateToDisable, dateToVerify )
571
- }
572
- })
573
-
574
- // If this date matches a disabled date, confirm it’s not inverted.
575
- isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) {
576
- return $.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' ||
577
- $.isPlainObject( dateToDisable ) && dateToDisable.inverted
578
- }).length
579
-
580
- // Check the calendar “enabled” flag and respectively flip the
581
- // disabled state. Then also check if it’s beyond the min/max limits.
582
- return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
583
- dateToVerify.pick < calendar.item.min.pick ||
584
- dateToVerify.pick > calendar.item.max.pick
585
-
586
- } //DatePicker.prototype.disabled
587
-
588
-
589
- /**
590
- * Parse a string into a usable type.
591
- */
592
- DatePicker.prototype.parse = function( type, value, options ) {
593
-
594
- var calendar = this,
595
- parsingObject = {}
596
-
597
- // If it’s already parsed, we’re good.
598
- if ( !value || typeof value != 'string' ) {
599
- return value
600
- }
601
-
602
- // We need a `.format` to parse the value with.
603
- if ( !( options && options.format ) ) {
604
- options = options || {}
605
- options.format = calendar.settings.format
606
- }
607
-
608
- // Convert the format into an array and then map through it.
609
- calendar.formats.toArray( options.format ).map( function( label ) {
610
-
611
- var
612
- // Grab the formatting label.
613
- formattingLabel = calendar.formats[ label ],
614
-
615
- // The format length is from the formatting label function or the
616
- // label length without the escaping exclamation (!) mark.
617
- formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length
618
-
619
- // If there's a format label, split the value up to the format length.
620
- // Then add it to the parsing object with appropriate label.
621
- if ( formattingLabel ) {
622
- parsingObject[ label ] = value.substr( 0, formatLength )
623
- }
624
-
625
- // Update the value as the substring from format length to end.
626
- value = value.substr( formatLength )
627
- })
628
-
629
- // Compensate for month 0index.
630
- return [
631
- parsingObject.yyyy || parsingObject.yy,
632
- +( parsingObject.mm || parsingObject.m ) - 1,
633
- parsingObject.dd || parsingObject.d
634
- ]
635
- } //DatePicker.prototype.parse
636
-
637
-
638
- /**
639
- * Various formats to display the object in.
640
- */
641
- DatePicker.prototype.formats = (function() {
642
-
643
- // Return the length of the first word in a collection.
644
- function getWordLengthFromCollection( string, collection, dateObject ) {
645
-
646
- // Grab the first word from the string.
647
- var word = string.match( /\w+/ )[ 0 ]
648
-
649
- // If there's no month index, add it to the date object
650
- if ( !dateObject.mm && !dateObject.m ) {
651
- dateObject.m = collection.indexOf( word ) + 1
652
- }
653
-
654
- // Return the length of the word.
655
- return word.length
656
- }
657
-
658
- // Get the length of the first word in a string.
659
- function getFirstWordLength( string ) {
660
- return string.match( /\w+/ )[ 0 ].length
661
- }
662
-
663
- return {
664
-
665
- d: function( string, dateObject ) {
666
-
667
- // If there's string, then get the digits length.
668
- // Otherwise return the selected date.
669
- return string ? _.digits( string ) : dateObject.date
670
- },
671
- dd: function( string, dateObject ) {
672
-
673
- // If there's a string, then the length is always 2.
674
- // Otherwise return the selected date with a leading zero.
675
- return string ? 2 : _.lead( dateObject.date )
676
- },
677
- ddd: function( string, dateObject ) {
678
-
679
- // If there's a string, then get the length of the first word.
680
- // Otherwise return the short selected weekday.
681
- return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ]
682
- },
683
- dddd: function( string, dateObject ) {
684
-
685
- // If there's a string, then get the length of the first word.
686
- // Otherwise return the full selected weekday.
687
- return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ]
688
- },
689
- m: function( string, dateObject ) {
690
-
691
- // If there's a string, then get the length of the digits
692
- // Otherwise return the selected month with 0index compensation.
693
- return string ? _.digits( string ) : dateObject.month + 1
694
- },
695
- mm: function( string, dateObject ) {
696
-
697
- // If there's a string, then the length is always 2.
698
- // Otherwise return the selected month with 0index and leading zero.
699
- return string ? 2 : _.lead( dateObject.month + 1 )
700
- },
701
- mmm: function( string, dateObject ) {
702
-
703
- var collection = this.settings.monthsShort
704
-
705
- // If there's a string, get length of the relevant month from the short
706
- // months collection. Otherwise return the selected month from that collection.
707
- return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
708
- },
709
- mmmm: function( string, dateObject ) {
710
-
711
- var collection = this.settings.monthsFull
712
-
713
- // If there's a string, get length of the relevant month from the full
714
- // months collection. Otherwise return the selected month from that collection.
715
- return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
716
- },
717
- yy: function( string, dateObject ) {
718
-
719
- // If there's a string, then the length is always 2.
720
- // Otherwise return the selected year by slicing out the first 2 digits.
721
- return string ? 2 : ( '' + dateObject.year ).slice( 2 )
722
- },
723
- yyyy: function( string, dateObject ) {
724
-
725
- // If there's a string, then the length is always 4.
726
- // Otherwise return the selected year.
727
- return string ? 4 : dateObject.year
728
- },
729
-
730
- // Create an array by splitting the formatting string passed.
731
- toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) },
732
-
733
- // Format an object into a string using the formatting options.
734
- toString: function ( formatString, itemObject ) {
735
- var calendar = this
736
- return calendar.formats.toArray( formatString ).map( function( label ) {
737
- return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' )
738
- }).join( '' )
739
- }
740
- }
741
- })() //DatePicker.prototype.formats
742
-
743
-
744
-
745
-
746
- /**
747
- * Check if two date units are the exact.
748
- */
749
- DatePicker.prototype.isDateExact = function( one, two ) {
750
-
751
- var calendar = this
752
-
753
- // When we’re working with weekdays, do a direct comparison.
754
- if (
755
- ( _.isInteger( one ) && _.isInteger( two ) ) ||
756
- ( typeof one == 'boolean' && typeof two == 'boolean' )
757
- ) {
758
- return one === two
759
- }
760
-
761
- // When we’re working with date representations, compare the “pick” value.
762
- if (
763
- ( _.isDate( one ) || $.isArray( one ) ) &&
764
- ( _.isDate( two ) || $.isArray( two ) )
765
- ) {
766
- return calendar.create( one ).pick === calendar.create( two ).pick
767
- }
768
-
769
- // When we’re working with range objects, compare the “from” and “to”.
770
- if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
771
- return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to )
772
- }
773
-
774
- return false
775
- }
776
-
777
-
778
- /**
779
- * Check if two date units overlap.
780
- */
781
- DatePicker.prototype.isDateOverlap = function( one, two ) {
782
-
783
- var calendar = this,
784
- firstDay = calendar.settings.firstDay ? 1 : 0
785
-
786
- // When we’re working with a weekday index, compare the days.
787
- if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
788
- one = one % 7 + firstDay
789
- return one === calendar.create( two ).day + 1
790
- }
791
- if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
792
- two = two % 7 + firstDay
793
- return two === calendar.create( one ).day + 1
794
- }
795
-
796
- // When we’re working with range objects, check if the ranges overlap.
797
- if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
798
- return calendar.overlapRanges( one, two )
799
- }
800
-
801
- return false
802
- }
803
-
804
-
805
- /**
806
- * Flip the “enabled” state.
807
- */
808
- DatePicker.prototype.flipEnable = function(val) {
809
- var itemObject = this.item
810
- itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
811
- }
812
-
813
-
814
- /**
815
- * Mark a collection of dates as “disabled”.
816
- */
817
- DatePicker.prototype.deactivate = function( type, datesToDisable ) {
818
-
819
- var calendar = this,
820
- disabledItems = calendar.item.disable.slice(0)
821
-
822
-
823
- // If we’re flipping, that’s all we need to do.
824
- if ( datesToDisable == 'flip' ) {
825
- calendar.flipEnable()
826
- }
827
-
828
- else if ( datesToDisable === false ) {
829
- calendar.flipEnable(1)
830
- disabledItems = []
831
- }
832
-
833
- else if ( datesToDisable === true ) {
834
- calendar.flipEnable(-1)
835
- disabledItems = []
836
- }
837
-
838
- // Otherwise go through the dates to disable.
839
- else {
840
-
841
- datesToDisable.map(function( unitToDisable ) {
842
-
843
- var matchFound
844
-
845
- // When we have disabled items, check for matches.
846
- // If something is matched, immediately break out.
847
- for ( var index = 0; index < disabledItems.length; index += 1 ) {
848
- if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) {
849
- matchFound = true
850
- break
851
- }
852
- }
853
-
854
- // If nothing was found, add the validated unit to the collection.
855
- if ( !matchFound ) {
856
- if (
857
- _.isInteger( unitToDisable ) ||
858
- _.isDate( unitToDisable ) ||
859
- $.isArray( unitToDisable ) ||
860
- ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
861
- ) {
862
- disabledItems.push( unitToDisable )
863
- }
864
- }
865
- })
866
- }
867
-
868
- // Return the updated collection.
869
- return disabledItems
870
- } //DatePicker.prototype.deactivate
871
-
872
-
873
- /**
874
- * Mark a collection of dates as “enabled”.
875
- */
876
- DatePicker.prototype.activate = function( type, datesToEnable ) {
877
-
878
- var calendar = this,
879
- disabledItems = calendar.item.disable,
880
- disabledItemsCount = disabledItems.length
881
-
882
- // If we’re flipping, that’s all we need to do.
883
- if ( datesToEnable == 'flip' ) {
884
- calendar.flipEnable()
885
- }
886
-
887
- else if ( datesToEnable === true ) {
888
- calendar.flipEnable(1)
889
- disabledItems = []
890
- }
891
-
892
- else if ( datesToEnable === false ) {
893
- calendar.flipEnable(-1)
894
- disabledItems = []
895
- }
896
-
897
- // Otherwise go through the disabled dates.
898
- else {
899
-
900
- datesToEnable.map(function( unitToEnable ) {
901
-
902
- var matchFound,
903
- disabledUnit,
904
- index,
905
- isExactRange
906
-
907
- // Go through the disabled items and try to find a match.
908
- for ( index = 0; index < disabledItemsCount; index += 1 ) {
909
-
910
- disabledUnit = disabledItems[index]
911
-
912
- // When an exact match is found, remove it from the collection.
913
- if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) {
914
- matchFound = disabledItems[index] = null
915
- isExactRange = true
916
- break
917
- }
918
-
919
- // When an overlapped match is found, add the “inverted” state to it.
920
- else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) {
921
- if ( $.isPlainObject( unitToEnable ) ) {
922
- unitToEnable.inverted = true
923
- matchFound = unitToEnable
924
- }
925
- else if ( $.isArray( unitToEnable ) ) {
926
- matchFound = unitToEnable
927
- if ( !matchFound[3] ) matchFound.push( 'inverted' )
928
- }
929
- else if ( _.isDate( unitToEnable ) ) {
930
- matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
931
- }
932
- break
933
- }
934
- }
935
-
936
- // If a match was found, remove a previous duplicate entry.
937
- if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
938
- if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) {
939
- disabledItems[index] = null
940
- break
941
- }
942
- }
943
-
944
- // In the event that we’re dealing with an exact range of dates,
945
- // make sure there are no “inverted” dates because of it.
946
- if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
947
- if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) {
948
- disabledItems[index] = null
949
- break
950
- }
951
- }
952
-
953
- // If something is still matched, add it into the collection.
954
- if ( matchFound ) {
955
- disabledItems.push( matchFound )
956
- }
957
- })
958
- }
959
-
960
- // Return the updated collection.
961
- return disabledItems.filter(function( val ) { return val != null })
962
- } //DatePicker.prototype.activate
963
-
964
-
965
- /**
966
- * Create a string for the nodes in the picker.
967
- */
968
- DatePicker.prototype.nodes = function( isOpen ) {
969
-
970
- var
971
- calendar = this,
972
- settings = calendar.settings,
973
- calendarItem = calendar.item,
974
- nowObject = calendarItem.now,
975
- selectedObject = calendarItem.select,
976
- highlightedObject = calendarItem.highlight,
977
- viewsetObject = calendarItem.view,
978
- disabledCollection = calendarItem.disable,
979
- minLimitObject = calendarItem.min,
980
- maxLimitObject = calendarItem.max,
981
-
982
-
983
- // Create the calendar table head using a copy of weekday labels collection.
984
- // * We do a copy so we don't mutate the original array.
985
- tableHead = (function( collection, fullCollection ) {
986
-
987
- // If the first day should be Monday, move Sunday to the end.
988
- if ( settings.firstDay ) {
989
- collection.push( collection.shift() )
990
- fullCollection.push( fullCollection.shift() )
991
- }
992
-
993
- // Create and return the table head group.
994
- return _.node(
995
- 'thead',
996
- _.node(
997
- 'tr',
998
- _.group({
999
- min: 0,
1000
- max: DAYS_IN_WEEK - 1,
1001
- i: 1,
1002
- node: 'th',
1003
- item: function( counter ) {
1004
- return [
1005
- collection[ counter ],
1006
- settings.klass.weekdays,
1007
- 'scope=col title="' + fullCollection[ counter ] + '"'
1008
- ]
1009
- }
1010
- })
1011
- )
1012
- ) //endreturn
1013
-
1014
- // Materialize modified
1015
- })( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysLetter ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
1016
-
1017
-
1018
- // Create the nav for next/prev month.
1019
- createMonthNav = function( next ) {
1020
-
1021
- // Otherwise, return the created month tag.
1022
- return _.node(
1023
- 'div',
1024
- ' ',
1025
- settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + (
1026
-
1027
- // If the focused month is outside the range, disabled the button.
1028
- ( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) ||
1029
- ( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
1030
- ' ' + settings.klass.navDisabled : ''
1031
- ),
1032
- 'data-nav=' + ( next || -1 ) + ' ' +
1033
- _.ariaAttr({
1034
- role: 'button',
1035
- controls: calendar.$node[0].id + '_table'
1036
- }) + ' ' +
1037
- 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
1038
- ) //endreturn
1039
- }, //createMonthNav
1040
-
1041
-
1042
- // Create the month label.
1043
- //Materialize modified
1044
- createMonthLabel = function(override) {
1045
-
1046
- var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
1047
-
1048
- // Materialize modified
1049
- if (override == "short_months") {
1050
- monthsCollection = settings.monthsShort;
1051
- }
1052
-
1053
- // If there are months to select, add a dropdown menu.
1054
- if ( settings.selectMonths && override == undefined) {
1055
-
1056
- return _.node( 'select',
1057
- _.group({
1058
- min: 0,
1059
- max: 11,
1060
- i: 1,
1061
- node: 'option',
1062
- item: function( loopedMonth ) {
1063
-
1064
- return [
1065
-
1066
- // The looped month and no classes.
1067
- monthsCollection[ loopedMonth ], 0,
1068
-
1069
- // Set the value and selected index.
1070
- 'value=' + loopedMonth +
1071
- ( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
1072
- (
1073
- (
1074
- ( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
1075
- ( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
1076
- ) ?
1077
- ' disabled' : ''
1078
- )
1079
- ]
1080
- }
1081
- }),
1082
- settings.klass.selectMonth + ' browser-default',
1083
- ( isOpen ? '' : 'disabled' ) + ' ' +
1084
- _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
1085
- 'title="' + settings.labelMonthSelect + '"'
1086
- )
1087
- }
1088
-
1089
- // Materialize modified
1090
- if (override == "short_months")
1091
- if (selectedObject != null)
1092
- return _.node( 'div', monthsCollection[ selectedObject.month ] );
1093
- else return _.node( 'div', monthsCollection[ viewsetObject.month ] );
1094
-
1095
- // If there's a need for a month selector
1096
- return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month )
1097
- }, //createMonthLabel
1098
-
1099
-
1100
- // Create the year label.
1101
- // Materialize modified
1102
- createYearLabel = function(override) {
1103
-
1104
- var focusedYear = viewsetObject.year,
1105
-
1106
- // If years selector is set to a literal "true", set it to 5. Otherwise
1107
- // divide in half to get half before and half after focused year.
1108
- numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 )
1109
-
1110
- // If there are years to select, add a dropdown menu.
1111
- if ( numberYears ) {
1112
-
1113
- var
1114
- minYear = minLimitObject.year,
1115
- maxYear = maxLimitObject.year,
1116
- lowestYear = focusedYear - numberYears,
1117
- highestYear = focusedYear + numberYears
1118
-
1119
- // If the min year is greater than the lowest year, increase the highest year
1120
- // by the difference and set the lowest year to the min year.
1121
- if ( minYear > lowestYear ) {
1122
- highestYear += minYear - lowestYear
1123
- lowestYear = minYear
1124
- }
1125
-
1126
- // If the max year is less than the highest year, decrease the lowest year
1127
- // by the lower of the two: available and needed years. Then set the
1128
- // highest year to the max year.
1129
- if ( maxYear < highestYear ) {
1130
-
1131
- var availableYears = lowestYear - minYear,
1132
- neededYears = highestYear - maxYear
1133
-
1134
- lowestYear -= availableYears > neededYears ? neededYears : availableYears
1135
- highestYear = maxYear
1136
- }
1137
-
1138
- if ( settings.selectYears && override == undefined ) {
1139
- return _.node( 'select',
1140
- _.group({
1141
- min: lowestYear,
1142
- max: highestYear,
1143
- i: 1,
1144
- node: 'option',
1145
- item: function( loopedYear ) {
1146
- return [
1147
-
1148
- // The looped year and no classes.
1149
- loopedYear, 0,
1150
-
1151
- // Set the value and selected index.
1152
- 'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
1153
- ]
1154
- }
1155
- }),
1156
- settings.klass.selectYear + ' browser-default',
1157
- ( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
1158
- 'title="' + settings.labelYearSelect + '"'
1159
- )
1160
- }
1161
- }
1162
-
1163
- // Materialize modified
1164
- if (override == "raw")
1165
- return _.node( 'div', focusedYear )
1166
-
1167
- // Otherwise just return the year focused
1168
- return _.node( 'div', focusedYear, settings.klass.year )
1169
- } //createYearLabel
1170
-
1171
-
1172
- // Materialize modified
1173
- createDayLabel = function() {
1174
- if (selectedObject != null)
1175
- return _.node( 'div', selectedObject.date)
1176
- else return _.node( 'div', nowObject.date)
1177
- }
1178
- createWeekdayLabel = function() {
1179
- var display_day;
1180
-
1181
- if (selectedObject != null)
1182
- display_day = selectedObject.day;
1183
- else
1184
- display_day = nowObject.day;
1185
- var weekday = settings.weekdaysFull[ display_day ]
1186
- return weekday
1187
- }
1188
-
1189
-
1190
- // Create and return the entire calendar.
1191
- return _.node(
1192
- // Date presentation View
1193
- 'div',
1194
- _.node(
1195
- 'div',
1196
- createWeekdayLabel(),
1197
- "picker__weekday-display"
1198
- )+
1199
- _.node(
1200
- // Div for short Month
1201
- 'div',
1202
- createMonthLabel("short_months"),
1203
- settings.klass.month_display
1204
- )+
1205
- _.node(
1206
- // Div for Day
1207
- 'div',
1208
- createDayLabel() ,
1209
- settings.klass.day_display
1210
- )+
1211
- _.node(
1212
- // Div for Year
1213
- 'div',
1214
- createYearLabel("raw") ,
1215
- settings.klass.year_display
1216
- ),
1217
- settings.klass.date_display
1218
- )+
1219
- // Calendar container
1220
- _.node('div',
1221
- _.node('div',
1222
- ( settings.selectYears ? createMonthLabel() + createYearLabel() : createMonthLabel() + createYearLabel() ) +
1223
- createMonthNav() + createMonthNav( 1 ),
1224
- settings.klass.header
1225
- ) + _.node(
1226
- 'table',
1227
- tableHead +
1228
- _.node(
1229
- 'tbody',
1230
- _.group({
1231
- min: 0,
1232
- max: WEEKS_IN_CALENDAR - 1,
1233
- i: 1,
1234
- node: 'tr',
1235
- item: function( rowCounter ) {
1236
-
1237
- // If Monday is the first day and the month starts on Sunday, shift the date back a week.
1238
- var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
1239
-
1240
- return [
1241
- _.group({
1242
- min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
1243
- max: function() {
1244
- return this.min + DAYS_IN_WEEK - 1
1245
- },
1246
- i: 1,
1247
- node: 'td',
1248
- item: function( targetDate ) {
1249
-
1250
- // Convert the time date from a relative date to a target date.
1251
- targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ])
1252
-
1253
- var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
1254
- isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
1255
- isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
1256
- formattedDate = _.trigger( calendar.formats.toString, calendar, [ settings.format, targetDate ] )
1257
-
1258
- return [
1259
- _.node(
1260
- 'div',
1261
- targetDate.date,
1262
- (function( klasses ) {
1263
-
1264
- // Add the `infocus` or `outfocus` classes based on month in view.
1265
- klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus )
1266
-
1267
- // Add the `today` class if needed.
1268
- if ( nowObject.pick == targetDate.pick ) {
1269
- klasses.push( settings.klass.now )
1270
- }
1271
-
1272
- // Add the `selected` class if something's selected and the time matches.
1273
- if ( isSelected ) {
1274
- klasses.push( settings.klass.selected )
1275
- }
1276
-
1277
- // Add the `highlighted` class if something's highlighted and the time matches.
1278
- if ( isHighlighted ) {
1279
- klasses.push( settings.klass.highlighted )
1280
- }
1281
-
1282
- // Add the `disabled` class if something's disabled and the object matches.
1283
- if ( isDisabled ) {
1284
- klasses.push( settings.klass.disabled )
1285
- }
1286
-
1287
- return klasses.join( ' ' )
1288
- })([ settings.klass.day ]),
1289
- 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
1290
- role: 'gridcell',
1291
- label: formattedDate,
1292
- selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
1293
- activedescendant: isHighlighted ? true : null,
1294
- disabled: isDisabled ? true : null
1295
- })
1296
- ),
1297
- '',
1298
- _.ariaAttr({ role: 'presentation' })
1299
- ] //endreturn
1300
- }
1301
- })
1302
- ] //endreturn
1303
- }
1304
- })
1305
- ),
1306
- settings.klass.table,
1307
- 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
1308
- role: 'grid',
1309
- controls: calendar.$node[0].id,
1310
- readonly: true
1311
- })
1312
- )
1313
- , settings.klass.calendar_container) // end calendar
1314
-
1315
- +
1316
-
1317
- // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
1318
- _.node(
1319
- 'div',
1320
- _.node( 'button', settings.today, "btn-flat picker__today",
1321
- 'type=button data-pick=' + nowObject.pick +
1322
- ( isOpen && !calendar.disabled(nowObject) ? '' : ' disabled' ) + ' ' +
1323
- _.ariaAttr({ controls: calendar.$node[0].id }) ) +
1324
- _.node( 'button', settings.clear, "btn-flat picker__clear",
1325
- 'type=button data-clear=1' +
1326
- ( isOpen ? '' : ' disabled' ) + ' ' +
1327
- _.ariaAttr({ controls: calendar.$node[0].id }) ) +
1328
- _.node('button', settings.close, "btn-flat picker__close",
1329
- 'type=button data-close=true ' +
1330
- ( isOpen ? '' : ' disabled' ) + ' ' +
1331
- _.ariaAttr({ controls: calendar.$node[0].id }) ),
1332
- settings.klass.footer
1333
- ) //endreturn
1334
- } //DatePicker.prototype.nodes
1335
-
1336
-
1337
-
1338
-
1339
- /**
1340
- * The date picker defaults.
1341
- */
1342
- DatePicker.defaults = (function( prefix ) {
1343
-
1344
- return {
1345
-
1346
- // The title label to use for the month nav buttons
1347
- labelMonthNext: 'Next month',
1348
- labelMonthPrev: 'Previous month',
1349
-
1350
- // The title label to use for the dropdown selectors
1351
- labelMonthSelect: 'Select a month',
1352
- labelYearSelect: 'Select a year',
1353
-
1354
- // Months and weekdays
1355
- monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
1356
- monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
1357
- weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
1358
- weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
1359
-
1360
- // Materialize modified
1361
- weekdaysLetter: [ 'S', 'M', 'T', 'W', 'T', 'F', 'S' ],
1362
-
1363
- // Today and clear
1364
- today: 'Today',
1365
- clear: 'Clear',
1366
- close: 'Close',
1367
-
1368
- // The format to show on the `input` element
1369
- format: 'd mmmm, yyyy',
1370
-
1371
- // Added Options
1372
- closeOnSelect: true,
1373
- closeOnClear: true,
1374
-
1375
-
1376
- // Classes
1377
- klass: {
1378
-
1379
- table: prefix + 'table',
1380
-
1381
- header: prefix + 'header',
1382
-
1383
-
1384
- // Materialize Added klasses
1385
- date_display: prefix + 'date-display',
1386
- day_display: prefix + 'day-display',
1387
- month_display: prefix + 'month-display',
1388
- year_display: prefix + 'year-display',
1389
- calendar_container: prefix + 'calendar-container',
1390
- // end
1391
-
1392
-
1393
-
1394
- navPrev: prefix + 'nav--prev',
1395
- navNext: prefix + 'nav--next',
1396
- navDisabled: prefix + 'nav--disabled',
1397
-
1398
- month: prefix + 'month',
1399
- year: prefix + 'year',
1400
-
1401
- selectMonth: prefix + 'select--month',
1402
- selectYear: prefix + 'select--year',
1403
-
1404
- weekdays: prefix + 'weekday',
1405
-
1406
- day: prefix + 'day',
1407
- disabled: prefix + 'day--disabled',
1408
- selected: prefix + 'day--selected',
1409
- highlighted: prefix + 'day--highlighted',
1410
- now: prefix + 'day--today',
1411
- infocus: prefix + 'day--infocus',
1412
- outfocus: prefix + 'day--outfocus',
1413
-
1414
- footer: prefix + 'footer',
1415
-
1416
- buttonClear: prefix + 'button--clear',
1417
- buttonToday: prefix + 'button--today',
1418
- buttonClose: prefix + 'button--close'
1419
- }
1420
- }
1421
- })( Picker.klasses().picker + '__' )
1422
-
1423
-
1424
-
1425
-
1426
-
1427
- /**
1428
- * Extend the picker to add the date picker.
1429
- */
1430
- Picker.extend( 'pickadate', DatePicker )
1431
-
1432
-
1433
- }));
1434
-
1435
-