releaf-core 1.1.21 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (495) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/releaf_core_manifest.js +3 -0
  3. data/app/assets/images/ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png +0 -0
  4. data/app/assets/images/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  5. data/app/assets/images/ckeditor/plugins/flash/images/placeholder.png +0 -0
  6. data/app/assets/images/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
  7. data/app/assets/images/ckeditor/plugins/icons.png +0 -0
  8. data/app/assets/images/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  9. data/app/assets/images/ckeditor/plugins/image/images/noimage.png +0 -0
  10. data/app/assets/images/ckeditor/plugins/link/images/anchor.png +0 -0
  11. data/app/assets/images/ckeditor/plugins/link/images/hidpi/anchor.png +0 -0
  12. data/app/assets/images/ckeditor/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
  13. data/app/assets/images/ckeditor/plugins/magicline/images/hidpi/icon.png +0 -0
  14. data/app/assets/images/ckeditor/plugins/magicline/images/icon-rtl.png +0 -0
  15. data/app/assets/images/ckeditor/plugins/magicline/images/icon.png +0 -0
  16. data/app/assets/images/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  17. data/app/assets/images/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  18. data/app/assets/images/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  19. data/app/assets/images/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  20. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  21. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  22. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  23. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  24. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  25. data/app/assets/images/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  26. data/app/assets/images/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  27. data/app/assets/images/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  28. data/app/assets/images/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  29. data/app/assets/images/ckeditor/plugins/smiley/images/angel_smile.png +0 -0
  30. data/app/assets/images/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  31. data/app/assets/images/ckeditor/plugins/smiley/images/angry_smile.png +0 -0
  32. data/app/assets/images/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  33. data/app/assets/images/ckeditor/plugins/smiley/images/broken_heart.png +0 -0
  34. data/app/assets/images/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  35. data/app/assets/images/ckeditor/plugins/smiley/images/confused_smile.png +0 -0
  36. data/app/assets/images/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  37. data/app/assets/images/ckeditor/plugins/smiley/images/cry_smile.png +0 -0
  38. data/app/assets/images/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  39. data/app/assets/images/ckeditor/plugins/smiley/images/devil_smile.png +0 -0
  40. data/app/assets/images/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  41. data/app/assets/images/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
  42. data/app/assets/images/ckeditor/plugins/smiley/images/embarrassed_smile.png +0 -0
  43. data/app/assets/images/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  44. data/app/assets/images/ckeditor/plugins/smiley/images/envelope.png +0 -0
  45. data/app/assets/images/ckeditor/plugins/smiley/images/heart.gif +0 -0
  46. data/app/assets/images/ckeditor/plugins/smiley/images/heart.png +0 -0
  47. data/app/assets/images/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  48. data/app/assets/images/ckeditor/plugins/smiley/images/kiss.png +0 -0
  49. data/app/assets/images/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  50. data/app/assets/images/ckeditor/plugins/smiley/images/lightbulb.png +0 -0
  51. data/app/assets/images/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  52. data/app/assets/images/ckeditor/plugins/smiley/images/omg_smile.png +0 -0
  53. data/app/assets/images/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  54. data/app/assets/images/ckeditor/plugins/smiley/images/regular_smile.png +0 -0
  55. data/app/assets/images/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  56. data/app/assets/images/ckeditor/plugins/smiley/images/sad_smile.png +0 -0
  57. data/app/assets/images/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  58. data/app/assets/images/ckeditor/plugins/smiley/images/shades_smile.png +0 -0
  59. data/app/assets/images/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  60. data/app/assets/images/ckeditor/plugins/smiley/images/teeth_smile.png +0 -0
  61. data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  62. data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_down.png +0 -0
  63. data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  64. data/app/assets/images/ckeditor/plugins/smiley/images/thumbs_up.png +0 -0
  65. data/app/assets/images/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
  66. data/app/assets/images/ckeditor/plugins/smiley/images/tongue_smile.png +0 -0
  67. data/app/assets/images/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  68. data/app/assets/images/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  69. data/app/assets/images/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.png +0 -0
  70. data/app/assets/images/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  71. data/app/assets/images/ckeditor/plugins/smiley/images/wink_smile.png +0 -0
  72. data/app/assets/images/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  73. data/app/assets/images/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  74. data/app/assets/images/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  75. data/app/assets/images/ckeditor/plugins/widget/images/handle.png +0 -0
  76. data/app/assets/images/ckeditor/skins/moono-lisa/icons.png +0 -0
  77. data/app/assets/images/ckeditor/skins/moono-lisa/icons_hidpi.png +0 -0
  78. data/app/assets/images/ckeditor/skins/moono-lisa/images/arrow.png +0 -0
  79. data/app/assets/images/ckeditor/skins/moono-lisa/images/close.png +0 -0
  80. data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/close.png +0 -0
  81. data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
  82. data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/lock.png +0 -0
  83. data/app/assets/images/ckeditor/skins/moono-lisa/images/hidpi/refresh.png +0 -0
  84. data/app/assets/images/ckeditor/skins/moono-lisa/images/lock-open.png +0 -0
  85. data/app/assets/images/ckeditor/skins/moono-lisa/images/lock.png +0 -0
  86. data/app/assets/images/ckeditor/skins/moono-lisa/images/refresh.png +0 -0
  87. data/app/assets/images/ckeditor/skins/moono-lisa/images/spinner.gif +0 -0
  88. data/app/assets/javascripts/ckeditor-jquery.js +3 -0
  89. data/app/assets/javascripts/ckeditor/CHANGES.md +1637 -0
  90. data/app/assets/javascripts/ckeditor/LICENSE.md +1420 -0
  91. data/app/assets/javascripts/ckeditor/README.md +39 -0
  92. data/app/assets/javascripts/ckeditor/basepath.js.erb +6 -0
  93. data/app/assets/javascripts/ckeditor/build-config.js +190 -0
  94. data/app/assets/javascripts/ckeditor/ckeditor.js +1331 -0
  95. data/app/assets/javascripts/ckeditor/config.js +10 -0
  96. data/app/assets/javascripts/ckeditor/jquery.js +10 -0
  97. data/app/assets/javascripts/ckeditor/lang/af.js +5 -0
  98. data/app/assets/javascripts/ckeditor/lang/ar.js +5 -0
  99. data/app/assets/javascripts/ckeditor/lang/az.js +5 -0
  100. data/app/assets/javascripts/ckeditor/lang/bg.js +5 -0
  101. data/app/assets/javascripts/ckeditor/lang/bn.js +5 -0
  102. data/app/assets/javascripts/ckeditor/lang/bs.js +5 -0
  103. data/app/assets/javascripts/ckeditor/lang/ca.js +5 -0
  104. data/app/assets/javascripts/ckeditor/lang/cs.js +5 -0
  105. data/app/assets/javascripts/ckeditor/lang/cy.js +5 -0
  106. data/app/assets/javascripts/ckeditor/lang/da.js +5 -0
  107. data/app/assets/javascripts/ckeditor/lang/de-ch.js +5 -0
  108. data/app/assets/javascripts/ckeditor/lang/de.js +5 -0
  109. data/app/assets/javascripts/ckeditor/lang/el.js +5 -0
  110. data/app/assets/javascripts/ckeditor/lang/en-au.js +5 -0
  111. data/app/assets/javascripts/ckeditor/lang/en-ca.js +5 -0
  112. data/app/assets/javascripts/ckeditor/lang/en-gb.js +5 -0
  113. data/app/assets/javascripts/ckeditor/lang/en.js +5 -0
  114. data/app/assets/javascripts/ckeditor/lang/eo.js +5 -0
  115. data/app/assets/javascripts/ckeditor/lang/es-mx.js +5 -0
  116. data/app/assets/javascripts/ckeditor/lang/es.js +5 -0
  117. data/app/assets/javascripts/ckeditor/lang/et.js +5 -0
  118. data/app/assets/javascripts/ckeditor/lang/eu.js +5 -0
  119. data/app/assets/javascripts/ckeditor/lang/fa.js +5 -0
  120. data/app/assets/javascripts/ckeditor/lang/fi.js +5 -0
  121. data/app/assets/javascripts/ckeditor/lang/fo.js +5 -0
  122. data/app/assets/javascripts/ckeditor/lang/fr-ca.js +5 -0
  123. data/app/assets/javascripts/ckeditor/lang/fr.js +5 -0
  124. data/app/assets/javascripts/ckeditor/lang/gl.js +5 -0
  125. data/app/assets/javascripts/ckeditor/lang/gu.js +5 -0
  126. data/app/assets/javascripts/ckeditor/lang/he.js +5 -0
  127. data/app/assets/javascripts/ckeditor/lang/hi.js +5 -0
  128. data/app/assets/javascripts/ckeditor/lang/hr.js +5 -0
  129. data/app/assets/javascripts/ckeditor/lang/hu.js +5 -0
  130. data/app/assets/javascripts/ckeditor/lang/id.js +5 -0
  131. data/app/assets/javascripts/ckeditor/lang/is.js +5 -0
  132. data/app/assets/javascripts/ckeditor/lang/it.js +5 -0
  133. data/app/assets/javascripts/ckeditor/lang/ja.js +5 -0
  134. data/app/assets/javascripts/ckeditor/lang/ka.js +5 -0
  135. data/app/assets/javascripts/ckeditor/lang/km.js +5 -0
  136. data/app/assets/javascripts/ckeditor/lang/ko.js +5 -0
  137. data/app/assets/javascripts/ckeditor/lang/ku.js +5 -0
  138. data/app/assets/javascripts/ckeditor/lang/lt.js +5 -0
  139. data/app/assets/javascripts/ckeditor/lang/lv.js +5 -0
  140. data/app/assets/javascripts/ckeditor/lang/mk.js +5 -0
  141. data/app/assets/javascripts/ckeditor/lang/mn.js +5 -0
  142. data/app/assets/javascripts/ckeditor/lang/ms.js +5 -0
  143. data/app/assets/javascripts/ckeditor/lang/nb.js +5 -0
  144. data/app/assets/javascripts/ckeditor/lang/nl.js +5 -0
  145. data/app/assets/javascripts/ckeditor/lang/no.js +5 -0
  146. data/app/assets/javascripts/ckeditor/lang/oc.js +5 -0
  147. data/app/assets/javascripts/ckeditor/lang/pl.js +5 -0
  148. data/app/assets/javascripts/ckeditor/lang/pt-br.js +5 -0
  149. data/app/assets/javascripts/ckeditor/lang/pt.js +5 -0
  150. data/app/assets/javascripts/ckeditor/lang/ro.js +5 -0
  151. data/app/assets/javascripts/ckeditor/lang/ru.js +5 -0
  152. data/app/assets/javascripts/ckeditor/lang/si.js +5 -0
  153. data/app/assets/javascripts/ckeditor/lang/sk.js +5 -0
  154. data/app/assets/javascripts/ckeditor/lang/sl.js +5 -0
  155. data/app/assets/javascripts/ckeditor/lang/sq.js +5 -0
  156. data/app/assets/javascripts/ckeditor/lang/sr-latn.js +5 -0
  157. data/app/assets/javascripts/ckeditor/lang/sr.js +5 -0
  158. data/app/assets/javascripts/ckeditor/lang/sv.js +5 -0
  159. data/app/assets/javascripts/ckeditor/lang/th.js +5 -0
  160. data/app/assets/javascripts/ckeditor/lang/tr.js +5 -0
  161. data/app/assets/javascripts/ckeditor/lang/tt.js +5 -0
  162. data/app/assets/javascripts/ckeditor/lang/ug.js +5 -0
  163. data/app/assets/javascripts/ckeditor/lang/uk.js +5 -0
  164. data/app/assets/javascripts/ckeditor/lang/vi.js +5 -0
  165. data/app/assets/javascripts/ckeditor/lang/zh-cn.js +5 -0
  166. data/app/assets/javascripts/ckeditor/lang/zh.js +5 -0
  167. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +10 -0
  168. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/af.js +11 -0
  169. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +11 -0
  170. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/az.js +11 -0
  171. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +11 -0
  172. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +13 -0
  173. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +12 -0
  174. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +11 -0
  175. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +11 -0
  176. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de-ch.js +12 -0
  177. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +13 -0
  178. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +13 -0
  179. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en-au.js +11 -0
  180. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en-gb.js +11 -0
  181. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +11 -0
  182. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +13 -0
  183. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es-mx.js +13 -0
  184. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +13 -0
  185. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +11 -0
  186. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/eu.js +12 -0
  187. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +11 -0
  188. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +11 -0
  189. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fo.js +11 -0
  190. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr-ca.js +11 -0
  191. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +13 -0
  192. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gl.js +12 -0
  193. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +11 -0
  194. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +11 -0
  195. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +11 -0
  196. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +11 -0
  197. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +12 -0
  198. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/id.js +11 -0
  199. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +13 -0
  200. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +9 -0
  201. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/km.js +11 -0
  202. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ko.js +10 -0
  203. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +11 -0
  204. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +11 -0
  205. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +12 -0
  206. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +11 -0
  207. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +11 -0
  208. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +12 -0
  209. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +12 -0
  210. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +11 -0
  211. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/oc.js +12 -0
  212. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +13 -0
  213. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +13 -0
  214. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +12 -0
  215. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +12 -0
  216. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +11 -0
  217. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/si.js +10 -0
  218. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +11 -0
  219. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +11 -0
  220. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sq.js +12 -0
  221. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr-latn.js +11 -0
  222. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sr.js +11 -0
  223. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +11 -0
  224. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/th.js +11 -0
  225. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +12 -0
  226. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/tt.js +11 -0
  227. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +12 -0
  228. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +12 -0
  229. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +11 -0
  230. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +9 -0
  231. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/lang/zh.js +9 -0
  232. data/app/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +8 -0
  233. data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  234. data/app/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +14 -0
  235. data/app/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  236. data/app/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +9 -0
  237. data/app/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +25 -0
  238. data/app/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +24 -0
  239. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +8 -0
  240. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +9 -0
  241. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +8 -0
  242. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +7 -0
  243. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +9 -0
  244. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +21 -0
  245. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +8 -0
  246. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +11 -0
  247. data/app/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +10 -0
  248. data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +44 -0
  249. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +8 -0
  250. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +30 -0
  251. data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
  252. data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +55 -0
  253. data/app/assets/javascripts/ckeditor/plugins/preview/preview.html +13 -0
  254. data/app/assets/javascripts/ckeditor/plugins/scayt/CHANGELOG.md +20 -0
  255. data/app/assets/javascripts/ckeditor/plugins/scayt/LICENSE.md +28 -0
  256. data/app/assets/javascripts/ckeditor/plugins/scayt/README.md +25 -0
  257. data/app/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +32 -0
  258. data/app/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +11 -0
  259. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/af.js +13 -0
  260. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ar.js +13 -0
  261. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/az.js +10 -0
  262. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/bg.js +13 -0
  263. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ca.js +14 -0
  264. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cs.js +13 -0
  265. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/cy.js +14 -0
  266. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/da.js +11 -0
  267. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de-ch.js +13 -0
  268. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/de.js +13 -0
  269. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/el.js +13 -0
  270. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-au.js +13 -0
  271. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-ca.js +13 -0
  272. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en-gb.js +13 -0
  273. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/en.js +13 -0
  274. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eo.js +12 -0
  275. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/es-mx.js +13 -0
  276. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/es.js +13 -0
  277. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/et.js +13 -0
  278. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/eu.js +13 -0
  279. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fa.js +12 -0
  280. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fi.js +13 -0
  281. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr-ca.js +10 -0
  282. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/fr.js +12 -0
  283. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/gl.js +13 -0
  284. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/he.js +12 -0
  285. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hr.js +13 -0
  286. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/hu.js +12 -0
  287. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/id.js +13 -0
  288. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/it.js +14 -0
  289. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ja.js +9 -0
  290. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/km.js +13 -0
  291. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ko.js +10 -0
  292. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ku.js +13 -0
  293. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lt.js +13 -0
  294. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/lv.js +13 -0
  295. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nb.js +11 -0
  296. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/nl.js +13 -0
  297. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/no.js +11 -0
  298. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/oc.js +12 -0
  299. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pl.js +12 -0
  300. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js +11 -0
  301. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/pt.js +13 -0
  302. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ro.js +13 -0
  303. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ru.js +13 -0
  304. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/si.js +13 -0
  305. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sk.js +13 -0
  306. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sl.js +12 -0
  307. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sq.js +13 -0
  308. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/sv.js +11 -0
  309. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/th.js +13 -0
  310. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tr.js +12 -0
  311. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/tt.js +13 -0
  312. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/ug.js +13 -0
  313. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/uk.js +12 -0
  314. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/vi.js +14 -0
  315. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +9 -0
  316. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/lang/zh.js +9 -0
  317. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +14 -0
  318. data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +21 -0
  319. data/app/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +18 -0
  320. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +10 -0
  321. data/app/assets/javascripts/ckeditor/plugins/templates/templates/default.js +7 -0
  322. data/app/assets/javascripts/ckeditor/plugins/wsc/LICENSE.md +28 -0
  323. data/app/assets/javascripts/ckeditor/plugins/wsc/README.md +25 -0
  324. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +66 -0
  325. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
  326. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +91 -0
  327. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc_ie.js +11 -0
  328. data/app/assets/javascripts/ckeditor/styles.js +137 -0
  329. data/app/assets/javascripts/releaf/include/remote_validator.js +1 -1
  330. data/app/assets/javascripts/releaf/include/store_settings.js +2 -2
  331. data/app/assets/javascripts/releaf/include/url_builder.js +130 -130
  332. data/app/assets/stylesheets/ckeditor/contents.css +208 -0
  333. data/app/assets/stylesheets/ckeditor/plugins/colordialog/dialogs/colordialog.css +20 -0
  334. data/app/assets/stylesheets/ckeditor/plugins/copyformatting/styles/copyformatting.css +45 -0
  335. data/app/assets/stylesheets/ckeditor/plugins/scayt/dialogs/dialog.css +23 -0
  336. data/app/assets/stylesheets/ckeditor/plugins/scayt/dialogs/toolbar.css +71 -0
  337. data/app/assets/stylesheets/ckeditor/plugins/scayt/skins/moono-lisa/scayt.css +25 -0
  338. data/app/assets/stylesheets/ckeditor/plugins/tableselection/styles/tableselection.css +36 -0
  339. data/app/assets/stylesheets/ckeditor/plugins/templates/dialogs/templates.css +84 -0
  340. data/app/assets/stylesheets/ckeditor/plugins/wsc/dialogs/wsc.css +82 -0
  341. data/app/assets/stylesheets/ckeditor/plugins/wsc/skins/moono-lisa/wsc.css +43 -0
  342. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog.css +5 -0
  343. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_ie.css +5 -0
  344. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_ie8.css +5 -0
  345. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/dialog_iequirks.css +5 -0
  346. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor.css +5 -0
  347. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_gecko.css +5 -0
  348. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_ie.css +5 -0
  349. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_ie8.css +5 -0
  350. data/app/assets/stylesheets/ckeditor/skins/moono-lisa/editor_iequirks.css +5 -0
  351. data/app/builders/releaf/builders.rb +4 -1
  352. data/app/builders/releaf/builders/base.rb +1 -1
  353. data/app/builders/releaf/builders/form_builder/associations.rb +1 -1
  354. data/app/builders/releaf/builders/page/layout_builder.rb +1 -1
  355. data/app/builders/releaf/builders/pagination_builder.rb +1 -1
  356. data/app/builders/releaf/builders/table_builder.rb +0 -1
  357. data/app/controllers/releaf/action_controller.rb +2 -2
  358. data/app/controllers/releaf/root_controller.rb +9 -7
  359. data/app/helpers/releaf/application_helper.rb +2 -2
  360. data/app/lib/releaf/action_controller/features.rb +1 -6
  361. data/app/lib/releaf/build_errors_hash.rb +12 -12
  362. data/app/lib/releaf/responders.rb +0 -1
  363. data/app/lib/releaf/search.rb +5 -18
  364. data/app/models/releaf/settings.rb +1 -1
  365. data/app/views/releaf/action/create_releaf_richtext_attachment.haml +2 -1
  366. data/app/views/releaf/error_pages/access_denied.html.haml +1 -1
  367. data/lib/generators/dummy/install_generator.rb +2 -1
  368. data/lib/generators/dummy/templates/assets/config/manifest.js +3 -0
  369. data/lib/generators/dummy/templates/controllers/application_controller.rb +1 -1
  370. data/lib/generators/dummy/templates/migrations/create_authors.rb +1 -1
  371. data/lib/generators/dummy/templates/migrations/create_banner_groups.rb +1 -1
  372. data/lib/generators/dummy/templates/migrations/create_banner_pages.rb +2 -2
  373. data/lib/generators/dummy/templates/migrations/create_banners.rb +2 -2
  374. data/lib/generators/dummy/templates/migrations/create_book_sequels.rb +1 -1
  375. data/lib/generators/dummy/templates/migrations/create_books.rb +1 -1
  376. data/lib/generators/dummy/templates/migrations/create_bundles.rb +1 -1
  377. data/lib/generators/dummy/templates/migrations/create_chapters.rb +1 -1
  378. data/lib/generators/dummy/templates/migrations/create_home_pages.rb +1 -1
  379. data/lib/generators/dummy/templates/migrations/create_node_extra_fields.rb +1 -1
  380. data/lib/generators/dummy/templates/migrations/create_other_nodes.rb +1 -1
  381. data/lib/generators/dummy/templates/migrations/create_publishers.rb +1 -1
  382. data/lib/generators/dummy/templates/migrations/create_text_pages.rb +1 -1
  383. data/lib/generators/dummy/templates/models/author.rb +1 -1
  384. data/lib/generators/dummy/templates/models/banner.rb +1 -1
  385. data/lib/generators/dummy/templates/models/banner_group.rb +1 -1
  386. data/lib/generators/dummy/templates/models/book.rb +1 -1
  387. data/lib/generators/releaf/templates/migrations/create_releaf_nodes.rb +1 -1
  388. data/lib/generators/releaf/templates/migrations/create_releaf_permissions.rb +1 -1
  389. data/lib/generators/releaf/templates/migrations/create_releaf_richtext_attachments.rb +1 -1
  390. data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +1 -1
  391. data/lib/generators/releaf/templates/migrations/create_releaf_settings.rb +1 -1
  392. data/lib/generators/releaf/templates/migrations/create_releaf_translations.rb +1 -1
  393. data/lib/generators/releaf/templates/migrations/create_releaf_users.rb +1 -1
  394. data/lib/releaf-core.rb +1 -2
  395. data/lib/releaf/engine.rb +2 -3
  396. data/lib/releaf/rails_ext/globalize-accessors.rb +64 -0
  397. data/lib/releaf/rails_ext/validation_error_codes.rb +0 -36
  398. metadata +420 -222
  399. data/app/lib/releaf/responders/feature_disabled_responder.rb +0 -9
  400. data/app/views/releaf/error_pages/feature_disabled.html.haml +0 -1
  401. data/spec/builders/releaf/builders/association_reflector_spec.rb +0 -138
  402. data/spec/builders/releaf/builders/base_spec.rb +0 -272
  403. data/spec/builders/releaf/builders/collection_spec.rb +0 -18
  404. data/spec/builders/releaf/builders/confirm_destroy_dialog_builder_spec.rb +0 -71
  405. data/spec/builders/releaf/builders/confirm_dialog_builder_spec.rb +0 -107
  406. data/spec/builders/releaf/builders/edit_builder_spec.rb +0 -322
  407. data/spec/builders/releaf/builders/form_builder/associations_spec.rb +0 -129
  408. data/spec/builders/releaf/builders/form_builder/date_fields_spec.rb +0 -86
  409. data/spec/builders/releaf/builders/form_builder/i18n_fields_spec.rb +0 -48
  410. data/spec/builders/releaf/builders/form_builder/label_spec.rb +0 -106
  411. data/spec/builders/releaf/builders/form_builder/number_fields_spec.rb +0 -37
  412. data/spec/builders/releaf/builders/form_builder_spec.rb +0 -228
  413. data/spec/builders/releaf/builders/index_builder_spec.rb +0 -364
  414. data/spec/builders/releaf/builders/page/header_builder_spec.rb +0 -65
  415. data/spec/builders/releaf/builders/page/layout_builder_spec.rb +0 -237
  416. data/spec/builders/releaf/builders/page/menu_builder_spec.rb +0 -345
  417. data/spec/builders/releaf/builders/pagination_builder_spec.rb +0 -330
  418. data/spec/builders/releaf/builders/resource_dialog_spec.rb +0 -21
  419. data/spec/builders/releaf/builders/resource_view_spec.rb +0 -158
  420. data/spec/builders/releaf/builders/show_builder_spec.rb +0 -7
  421. data/spec/builders/releaf/builders/table_builder_spec.rb +0 -637
  422. data/spec/builders/releaf/builders/template_spec.rb +0 -12
  423. data/spec/builders/releaf/builders/toolbox_builder_spec.rb +0 -67
  424. data/spec/builders/releaf/builders/toolbox_spec.rb +0 -48
  425. data/spec/builders/releaf/builders/utilities/date_fields_spec.rb +0 -125
  426. data/spec/builders/releaf/builders/utilities/resolve_attribute_field_method_name_spec.rb +0 -318
  427. data/spec/builders/releaf/builders/view_spec.rb +0 -281
  428. data/spec/builders/releaf/builders_spec.rb +0 -134
  429. data/spec/builders/releaf/settings/form_builder_spec.rb +0 -48
  430. data/spec/builders/releaf/settings/table_builder_spec.rb +0 -23
  431. data/spec/controllers/concerns/releaf/richtext_attachments_spec.rb +0 -51
  432. data/spec/controllers/releaf/action_controller_spec.rb +0 -423
  433. data/spec/controllers/releaf/root_controller_spec.rb +0 -45
  434. data/spec/controllers/releaf/settings_controller_spec.rb +0 -52
  435. data/spec/error_hash_builder_spec.rb +0 -83
  436. data/spec/ext/array_reorder_spec.rb +0 -12
  437. data/spec/features/ajaxbox_spec.rb +0 -111
  438. data/spec/features/authorization_spec.rb +0 -50
  439. data/spec/features/breadcrumbs_spec.rb +0 -16
  440. data/spec/features/dragonfly_integration_spec.rb +0 -24
  441. data/spec/features/edit_actions_spec.rb +0 -186
  442. data/spec/features/errors_spec.rb +0 -47
  443. data/spec/features/index_actions_spec.rb +0 -85
  444. data/spec/features/index_table_spec.rb +0 -35
  445. data/spec/features/menu_spec.rb +0 -71
  446. data/spec/features/richtext_attachments_spec.rb +0 -64
  447. data/spec/features/richtext_custom_config_spec.rb +0 -28
  448. data/spec/features/richtext_embed_spec.rb +0 -29
  449. data/spec/features/richtext_spec.rb +0 -31
  450. data/spec/features/search_spec.rb +0 -825
  451. data/spec/features/settings_spec.rb +0 -70
  452. data/spec/features/title_spec.rb +0 -13
  453. data/spec/fixtures/common_fields.yml +0 -17
  454. data/spec/fixtures/cs.png +0 -0
  455. data/spec/fixtures/time.formats.xlsx +0 -0
  456. data/spec/fixtures/unicorn.jpg +0 -0
  457. data/spec/helpers/application_helper_spec.rb +0 -73
  458. data/spec/helpers/button_helper_spec.rb +0 -146
  459. data/spec/lib/releaf/action_controller/features_spec.rb +0 -171
  460. data/spec/lib/releaf/action_controller/search_spec.rb +0 -84
  461. data/spec/lib/releaf/application_spec.rb +0 -43
  462. data/spec/lib/releaf/assets_resolver_spec.rb +0 -130
  463. data/spec/lib/releaf/build_errors_hash_spec.rb +0 -141
  464. data/spec/lib/releaf/configuration_spec.rb +0 -205
  465. data/spec/lib/releaf/controller_definition_spec.rb +0 -78
  466. data/spec/lib/releaf/controller_group_definition_spec.rb +0 -33
  467. data/spec/lib/releaf/default_searchable_fields_spec.rb +0 -161
  468. data/spec/lib/releaf/instance_cache_spec.rb +0 -98
  469. data/spec/lib/releaf/resource_base_spec.rb +0 -212
  470. data/spec/lib/releaf/resource_fields_spec.rb +0 -12
  471. data/spec/lib/releaf/resource_params_spec.rb +0 -115
  472. data/spec/lib/releaf/resource_table_fields_spec.rb +0 -20
  473. data/spec/lib/releaf/resource_utilities_spec.rb +0 -87
  474. data/spec/lib/releaf/responders/access_denied_responder_spec.rb +0 -12
  475. data/spec/lib/releaf/responders/after_save_responder_spec.rb +0 -88
  476. data/spec/lib/releaf/responders/confirm_destroy_responder_spec.rb +0 -26
  477. data/spec/lib/releaf/responders/destroy_responder_spec.rb +0 -30
  478. data/spec/lib/releaf/responders/error_responder_spec.rb +0 -26
  479. data/spec/lib/releaf/responders/feature_disabled_responder_spec.rb +0 -12
  480. data/spec/lib/releaf/responders/page_not_found_responder_spec.rb +0 -12
  481. data/spec/lib/releaf/responders_spec.rb +0 -60
  482. data/spec/lib/releaf/root/configuration_spec.rb +0 -9
  483. data/spec/lib/releaf/root/default_controller_resolver_spec.rb +0 -44
  484. data/spec/lib/releaf/root_spec.rb +0 -13
  485. data/spec/lib/releaf/service_spec.rb +0 -20
  486. data/spec/lib/releaf/settings/normalize_value_spec.rb +0 -103
  487. data/spec/lib/releaf/settings/register_spec.rb +0 -135
  488. data/spec/lib/releaf/settings_manager_spec.rb +0 -22
  489. data/spec/lib/validation_error_codes_spec.rb +0 -56
  490. data/spec/misc/factories_spec.rb +0 -31
  491. data/spec/models/settings_spec.rb +0 -100
  492. data/spec/routing/route_mapper_spec.rb +0 -185
  493. data/spec/rspec_helpers/test_helpers_spec.rb +0 -20
  494. data/spec/rspec_helpers/test_spec.rb +0 -14
  495. data/spec/services/array/reorder_spec.rb +0 -121
@@ -1,21 +0,0 @@
1
- require "rails_helper"
2
-
3
- describe Releaf::Builders::ResourceDialog, type: :class do
4
- class DialogTestHelper < ActionView::Base
5
- end
6
-
7
- class UnitTestDialogBuilder
8
- include Releaf::Builders::Base
9
- include Releaf::Builders::Template
10
- include Releaf::Builders::ResourceDialog
11
- end
12
-
13
- subject { UnitTestDialogBuilder.new(template) }
14
- let(:template){ DialogTestHelper.new }
15
-
16
- describe "#dialog?" do
17
- it "always returns true" do
18
- expect(subject.dialog?).to be true
19
- end
20
- end
21
- end
@@ -1,158 +0,0 @@
1
- require "rails_helper"
2
-
3
- describe Releaf::Builders::ResourceView, type: :class do
4
- class ResourceViewIncluder
5
- include Releaf::Builders::ResourceView
6
- end
7
-
8
- class ResourceViewTestHelper < ActionView::Base
9
- include Releaf::ApplicationHelper
10
- end
11
-
12
- let(:described_class){ ResourceViewIncluder }
13
- let(:template){ ResourceViewTestHelper.new }
14
- let(:subject){ described_class.new(template) }
15
- let(:controller){ Releaf::ActionController.new }
16
- let(:resource){ Book.new }
17
-
18
- before do
19
- allow(template).to receive(:controller).and_return(controller)
20
- allow(subject).to receive(:resource).and_return(resource)
21
- allow(subject).to receive(:index_path).and_return("_index_path_")
22
- end
23
-
24
- it "includes Releaf::Builders::View" do
25
- expect(described_class.ancestors).to include(Releaf::Builders::View)
26
- end
27
-
28
- it "includes Releaf::Builders::Resource" do
29
- expect(described_class.ancestors).to include(Releaf::Builders::Resource)
30
- end
31
-
32
- it "includes Releaf::Builders::Toolbox" do
33
- expect(described_class.ancestors).to include(Releaf::Builders::Toolbox)
34
- end
35
-
36
- describe "#section" do
37
- before do
38
- allow(subject).to receive(:section_attributes).and_return(a: "b")
39
- allow(subject).to receive(:section_blocks).and_return(["_section_","_blocks_"])
40
- end
41
-
42
- it "returns section with index url preserver and section blocks" do
43
- expect(subject.section).to eq('<section a="b">_section__blocks_</section>')
44
- end
45
- end
46
-
47
- describe "#section_header_text" do
48
- before do
49
- allow(subject).to receive(:t).with("Create new resource").and_return("newww")
50
- allow(subject).to receive(:resource_title).with(resource).and_return("existng")
51
- end
52
-
53
- context "when resource is new object" do
54
- it "returns resource to text cast result" do
55
- expect(subject.section_header_text).to eq("newww")
56
- end
57
- end
58
-
59
- context "when resource is persisted object" do
60
- it "returns resource to text cast result" do
61
- allow(resource).to receive(:new_record?).and_return(false)
62
- expect(subject.section_header_text).to eq("existng")
63
- end
64
- end
65
- end
66
-
67
- describe "#section_header_extras" do
68
- before do
69
- allow(subject).to receive(:toolbox).with(resource, index_path: "_index_path_").and_return("_tlbx_")
70
- allow(subject).to receive(:feature_available?).with(:toolbox).and_return(true)
71
- end
72
-
73
- it "returns header extras with toolbox button" do
74
- expect(subject.section_header_extras).to eq('<div class="extras toolbox-wrap">_tlbx_</div>')
75
- end
76
-
77
- context "when toolbox feature is not available" do
78
- it "returns nil" do
79
- allow(subject).to receive(:feature_available?).with(:toolbox).and_return(false)
80
- expect(subject.section_header_extras).to be nil
81
- end
82
- end
83
- end
84
-
85
- describe "#section_body" do
86
- it "returns section body block with applied section body attributes" do
87
- allow(subject).to receive(:section_body_blocks).and_return(["a", "b"])
88
- allow(subject).to receive(:section_body_attributes).and_return(class: "x")
89
- expect(subject.section_body).to eq('<div class="x">ab</div>')
90
- end
91
- end
92
-
93
- describe "#section_body_attributes" do
94
- it "returns section hash with body class" do
95
- expect(subject.section_body_attributes).to eq(class: ["body"])
96
- end
97
- end
98
-
99
- describe "#section_body_blocks" do
100
- it "returns empty array" do
101
- expect(subject.section_body_blocks).to eq([])
102
- end
103
- end
104
-
105
- describe "#footer_secondary_tools" do
106
- before do
107
- allow(subject).to receive(:back_to_list_button).and_return("_btn_")
108
- allow(subject).to receive(:back_to_list?).and_return(true)
109
- end
110
-
111
- it "returns array with back to list button" do
112
- expect(subject.footer_secondary_tools).to eq(["_btn_"])
113
- end
114
-
115
- context "when toolbox feature is not available" do
116
- it "returns empty array" do
117
- allow(subject).to receive(:back_to_list?).and_return(false)
118
- expect(subject.footer_secondary_tools).to eq([])
119
- end
120
- end
121
- end
122
-
123
- describe "#back_to_list?" do
124
- before do
125
- allow(subject).to receive(:params).and_return(index_path: "xxx")
126
- allow(subject).to receive(:feature_available?).with(:index).and_return(true)
127
- end
128
-
129
- context "when index feature is available and index_path is present within params" do
130
- it "returns true" do
131
- expect(subject.back_to_list?).to be true
132
- end
133
- end
134
-
135
- context "when index_path is not present within params" do
136
- it "returns false" do
137
- allow(subject).to receive(:params).and_return(search: "xxx")
138
- expect(subject.back_to_list?).to be false
139
- end
140
- end
141
-
142
- context "when index feature is not available" do
143
- it "returns false" do
144
- allow(subject).to receive(:feature_available?).with(:index).and_return(false)
145
- expect(subject.back_to_list?).to be false
146
- end
147
- end
148
- end
149
-
150
- describe "#back_to_list_button" do
151
- it "returns `back to list` button" do
152
- allow(subject).to receive(:button)
153
- .with("to_list", "caret-left", {class: "secondary", href: "_index_path_"}).and_return("_btn_")
154
- allow(subject).to receive(:t).with("Back to list").and_return("to_list")
155
- expect(subject.back_to_list_button).to eq("_btn_")
156
- end
157
- end
158
- end
@@ -1,7 +0,0 @@
1
- require "rails_helper"
2
-
3
- describe Releaf::Builders::ShowBuilder, type: :class do
4
- it "includes `Releaf::Builders::ResourceView`" do
5
- expect(described_class.ancestors).to include(Releaf::Builders::ResourceView)
6
- end
7
- end
@@ -1,637 +0,0 @@
1
- require "rails_helper"
2
-
3
- describe Releaf::Builders::TableBuilder, type: :class do
4
- class TableBuilderTestHelper < ActionView::Base
5
- include Releaf::ApplicationHelper
6
- end
7
-
8
- class DummyTableBuilderInheriter < Releaf::Builders::TableBuilder
9
- def some_cell_method(resource, column); end
10
- def custom_format(resource, column); end
11
- def format_big_boolean_content(resource, column); end
12
- def title_cell; end
13
- def custom_title(resource); end
14
- end
15
-
16
- let(:template){ TableBuilderTestHelper.new }
17
- let(:resource_class){ Book }
18
- let(:resource){ resource_class.new(id: 77, title: "Life of Brian") }
19
- let(:collection){ Book.all }
20
- let(:options){ {toolbox: false} }
21
- let(:subject){ described_class.new(collection, resource_class, template, options) }
22
- let(:inheriter_subject){ DummyTableBuilderInheriter.new(collection, resource_class, template, options) }
23
-
24
- it "includes Releaf::Builders::Base" do
25
- expect(described_class.ancestors).to include(Releaf::Builders::Base)
26
- end
27
-
28
- it "includes Releaf::Builders::Toolbox" do
29
- expect(described_class.ancestors).to include(Releaf::Builders::Toolbox)
30
- end
31
-
32
- describe "#initialize" do
33
- it "assigns collection" do
34
- expect(subject.collection.to_sql).to eq(collection.to_sql)
35
- end
36
-
37
- it "assigns resource_class" do
38
- expect(subject.resource_class).to eq(resource_class)
39
- end
40
-
41
- it "assigns template" do
42
- expect(subject.template).to eq(template)
43
- end
44
-
45
- it "assigns options" do
46
- expect(subject.options).to eq(options)
47
- end
48
- end
49
-
50
- describe "#columns" do
51
- it "returns columns schema" do
52
- allow(subject).to receive(:columns_schema).and_return("schema")
53
- expect(subject.columns).to eq("schema")
54
- end
55
-
56
- it "caches columns schema data" do
57
- expect(subject).to receive(:columns_schema).and_return("schema").once
58
- subject.columns
59
- subject.columns
60
- end
61
- end
62
-
63
- describe "#column_names" do
64
- it "returns column names for resource_class" do
65
- allow(Releaf::ResourceTableFields).to receive(:new).with(subject.resource_class).and_call_original
66
- allow_any_instance_of(Releaf::ResourceTableFields).to receive(:values)
67
- .with(include_associations: false).and_return(["a", "b"])
68
- expect(subject.column_names).to eq(["a", "b"])
69
- end
70
- end
71
-
72
- describe "#columns_schema" do
73
- before do
74
- allow(subject).to receive(:column_names).and_return([:price, :title, :author_id])
75
- allow(subject).to receive(:cell_content_method).with(:price).and_return(:title_content)
76
- allow(subject).to receive(:cell_content_method).with(:title).and_return(:title_content)
77
- allow(subject).to receive(:cell_content_method).with(:author_id).and_return(nil)
78
- allow(subject).to receive(:cell_format_method).with(:author_id).and_return(:some_text_format)
79
- end
80
-
81
- it "returns hash with columns and corresponding method" do
82
- allow(subject).to receive(:cell_method).with(:price).and_return("price_cell")
83
- allow(subject).to receive(:cell_method).with(:title).and_return(nil)
84
- allow(subject).to receive(:cell_method).with(:author_id).and_return(nil)
85
- columns = {
86
- price: {cell_method: "price_cell"},
87
- title: {content_method: :title_content},
88
- author_id: {format_method: :some_text_format}
89
- }
90
- expect(subject.columns_schema).to eq(columns)
91
- end
92
-
93
- it "preserves order as in #column_names" do
94
- expect(subject.columns_schema.keys).to eq([:price, :title, :author_id])
95
- end
96
-
97
- context "when options[:toolbox] value is 'true'" do
98
- let(:options){ {toolbox: true} }
99
- it "adds toolbox as last column" do
100
- expect(subject.columns_schema.keys.last).to eq(:toolbox)
101
- end
102
-
103
- it "uses #toolbox_cell for toolbox cell rendering" do
104
- expect(subject.columns_schema[:toolbox]).to eq(cell_method: "toolbox_cell")
105
- end
106
- end
107
- end
108
-
109
- describe "#column_klass" do
110
- context "when association column given" do
111
- it "returns corresponding association class" do
112
- resource.author = Author.new(name: "Brian")
113
- expect(subject.column_klass(resource_class, "author.name")).to eq(Author)
114
- end
115
- end
116
-
117
- context "when base resource column given" do
118
- it "returns give resource class" do
119
- expect(subject.column_klass(resource_class, "year")).to eq(resource_class)
120
- end
121
- end
122
- end
123
-
124
- describe "#column_value" do
125
- it "returns value for column of given resource" do
126
- expect(subject.column_value(resource, "title")).to eq("Life of Brian")
127
- end
128
-
129
- it "supports association columns" do
130
- resource.author = Author.new(name: "Brian")
131
- expect(subject.column_value(resource, "author.name")).to eq("Brian")
132
- end
133
-
134
- it "supports empty association columns" do
135
- resource.author = nil
136
- expect(subject.column_value(resource, "author.name")).to be nil
137
- end
138
- end
139
-
140
- describe "#output" do
141
- before do
142
- allow(subject).to receive(:empty_body).and_return("empty")
143
- end
144
-
145
- it "returns table with #empty_body content" do
146
- allow(subject).to receive(:table_attributes).and_return(class: "a", data: {some: "b"})
147
- content = '<table class="a" data-some="b">empty</table>'
148
- expect(subject.output).to eq(content)
149
- end
150
-
151
- context "when collection is not empty" do
152
- it "returns table with #header and #body" do
153
- create(:book)
154
- content = '<table class="table books">header_contentbody_content</table>'
155
- allow(subject).to receive(:head).and_return("header_content")
156
- allow(subject).to receive(:body).and_return("body_content")
157
-
158
- expect(subject.output).to eq(content)
159
- end
160
- end
161
-
162
- context "when collection is empty" do
163
- it "returns table with #empty_body content" do
164
- content = '<table class="table books">empty</table>'
165
- expect(subject.output).to eq(content)
166
- end
167
- end
168
- end
169
-
170
- describe "#table_attributes" do
171
- it "returns hash with table and pluralized, dasherized resource classes" do
172
- expect(subject.table_attributes).to eq(class: ["table", "books"])
173
- end
174
- end
175
-
176
- describe "#head" do
177
- it "returns header row with #head_cell generated cells for each columns" do
178
- allow(subject).to receive(:column_names).and_return([:price, :title, :author_id])
179
- allow(subject).to receive(:head_cell).with(:price).and_return("_price_cell_")
180
- allow(subject).to receive(:head_cell).with(:title).and_return("_title_cell_")
181
- allow(subject).to receive(:head_cell).with(:author_id).and_return("_author_id_cell_")
182
-
183
- content = '<thead><tr>_price_cell__title_cell__author_id_cell_</tr></thead>'
184
- expect(subject.head).to eq(content)
185
- end
186
- end
187
-
188
- describe "#head_cell" do
189
- it "returns 'th' element with content from #head_cell_column" do
190
- allow(subject).to receive(:head_cell_content).with(:title).and_return("_title_content_")
191
- content = '<th>_title_content_</th>'
192
- expect(subject.head_cell(:title)).to eq(content)
193
- end
194
- end
195
-
196
-
197
- describe "#head_cell_content" do
198
- it "returns translated column scoped to resource class attributes" do
199
- allow(resource_class).to receive(:human_attribute_name).with("some_long_name").and_return("Taittls")
200
- expect(subject.head_cell_content("some_long_name")).to eq('Taittls')
201
- end
202
-
203
- it "casts given column to string" do
204
- allow(resource_class).to receive(:human_attribute_name).with("title",).and_return("Taittls")
205
- expect(subject.head_cell_content(:title)).to eq('Taittls')
206
- end
207
-
208
- context "when column value is 'toolbox'" do
209
- it "returns nil" do
210
- expect(subject.head_cell_content(:toolbox)).to eq(nil)
211
- end
212
- end
213
- end
214
-
215
- describe "#empty_body" do
216
- it "returns empty table body content" do
217
- allow(subject).to receive(:t).with("Nothing found").and_return("ntnn")
218
- content = '<tr><th><div class="nothing-found">ntnn</div></th></tr>'
219
- expect(subject.empty_body).to eq(content)
220
- end
221
- end
222
-
223
- describe "#body" do
224
- it "returns table body with rows for each collection items generated with #row method" do
225
- subject.collection = ["a", "b"]
226
- allow(subject).to receive(:row).with("a").and_return("_a_row_")
227
- allow(subject).to receive(:row).with("b").and_return("_b_row_")
228
-
229
- content = '<tbody class="tbody">_a_row__b_row_</tbody>'
230
- expect(subject.body).to eq(content)
231
- end
232
- end
233
-
234
- describe "#row_url" do
235
- let(:controller){ Releaf::ActionController.new }
236
-
237
- before do
238
- allow(subject).to receive(:controller).and_return(controller)
239
- allow(controller).to receive(:index_path).and_return("_index_path_")
240
- end
241
-
242
- it "returns edit url for given resource" do
243
- allow(subject).to receive(:row_url_action).with(resource).and_return(:show)
244
- allow(template).to receive(:url_for).with(action: :show, id: 77, index_path: "_index_path_").and_return('_url_')
245
- expect(subject.row_url(resource)).to eq('_url_')
246
- end
247
-
248
- context "when resource do not have row url action" do
249
- it "returns nil" do
250
- allow(subject).to receive(:row_url_action).with(resource).and_return(nil)
251
- expect(subject.row_url(resource)).to be nil
252
- end
253
- end
254
- end
255
-
256
- describe "#row_url_action" do
257
- let(:controller){ Releaf::ActionController.new }
258
-
259
- before do
260
- allow(subject).to receive(:controller).and_return(controller)
261
- allow(controller).to receive(:feature_available?).with(:show).and_return(true)
262
- allow(controller).to receive(:feature_available?).with(:edit).and_return(true)
263
- end
264
-
265
- context "when show and edit features is available" do
266
- it "returns :show" do
267
- expect(subject.row_url_action(resource)).to eq(:show)
268
- end
269
- end
270
-
271
- context "when show feature is not available and edit feature is available" do
272
- it "returns :edit" do
273
- allow(controller).to receive(:feature_available?).with(:show).and_return(false)
274
- expect(subject.row_url_action(resource)).to eq(:edit)
275
- end
276
- end
277
-
278
- context "when show and edit features is not available" do
279
- it "returns nil" do
280
- allow(controller).to receive(:feature_available?).with(:show).and_return(false)
281
- allow(controller).to receive(:feature_available?).with(:edit).and_return(false)
282
- expect(subject.row_url_action(resource)).to be nil
283
- end
284
- end
285
- end
286
-
287
- describe "#row_attributes" do
288
- it "returns row attributes with html class and resource id as data value" do
289
- resource = resource_class.new(id: 77)
290
- expect(subject.row_attributes(resource)).to eq(class: "row", data: {id: 77})
291
- end
292
- end
293
-
294
- describe "#row" do
295
- it "adds attributes returned from #row_attributes to row" do
296
- resource = resource_class.new
297
- allow(subject).to receive(:column_names).and_return([])
298
- allow(subject).to receive(:row_attributes).with(resource).and_return(class: "color", data: {color: "red"})
299
- allow(subject).to receive(:row_url)
300
-
301
- content = '<tr class="color" data-color="red"></tr>'
302
- expect(subject.row(resource)).to eq(content)
303
- end
304
-
305
- it "calls #row_url only once" do
306
- resource = resource_class.new
307
- allow(subject).to receive(:column_names).and_return([:title, :author_id])
308
- expect(subject).to receive(:row_url).with(resource).once
309
- subject.row(resource)
310
- end
311
-
312
- it "output each cell contents by using either custom or default cell method" do
313
- columns = {
314
- title: {cell_method: "some_cell_method"},
315
- color: {},
316
- }
317
- resource = resource_class.new(id: 89)
318
-
319
- allow(inheriter_subject).to receive(:columns).and_return(columns)
320
- allow(inheriter_subject).to receive(:row_url).with(resource).and_return("url_value")
321
-
322
- allow(inheriter_subject).to receive(:some_cell_method)
323
- .with(resource, cell_method: "some_cell_method", url: "url_value").and_return("_title_cell_value")
324
- allow(inheriter_subject).to receive(:cell)
325
- .with(resource, :color, url: "url_value").and_return("_color_cell_value")
326
-
327
- content = '<tr class="row" data-id="89">_title_cell_value_color_cell_value</tr>'
328
- expect(inheriter_subject.row(resource)).to eq(content)
329
- end
330
- end
331
-
332
- describe "#cell_content" do
333
- it "returns format method output with resource and column as arguments" do
334
- options = {format_method: "custom_format"}
335
- allow(inheriter_subject).to receive(:custom_format).with("a", :title).and_return('_custom " format_')
336
-
337
- content = '_custom " format_'
338
- expect(inheriter_subject.cell_content("a", :title, options)).to eq(content)
339
- end
340
-
341
- context "when given options has :content_method" do
342
- it "returns content method output with resource as argument" do
343
- options = {content_method: "custom_title", format_method: "custom_format"}
344
- allow(inheriter_subject).to receive(:custom_title).with("a").and_return('_custom " _value_')
345
-
346
- content = '_custom " _value_'
347
- expect(inheriter_subject.cell_content("a", :title, options)).to eq(content)
348
- end
349
- end
350
- end
351
-
352
- describe "#format_text_content" do
353
- it "returns truncated and escape column value" do
354
- allow(subject).to receive(:column_value).with(resource, :title)
355
- .and_return('"Pra<tag>nt commodo cursus magn')
356
- expect(subject.format_text_content(resource, :title))
357
- .to eq('&quot;Pra&lt;tag&gt;nt commodo cursus magn')
358
- end
359
-
360
- it "casts value to string before truncation" do
361
- allow(subject).to receive(:column_value).with(resource, :title)
362
- .and_return(nil)
363
- expect(subject.format_text_content(resource, :title)).to eq("")
364
- end
365
- end
366
-
367
- describe "#format_richtext_content" do
368
- it "returns truncated and sanitized column value" do
369
- allow(subject).to receive(:column_value).with(resource, :title)
370
- .and_return('"Pra<tag>nt commodo\ncursus magn')
371
- expect(subject.format_richtext_content(resource, :title))
372
- .to eq('&quot;Prant commodo\ncursus magn')
373
- end
374
-
375
- it "casts value to string before truncation" do
376
- allow(subject).to receive(:column_value).with(resource, :title)
377
- .and_return(nil)
378
- expect(subject.format_richtext_content(resource, :title)).to eq("")
379
- end
380
- end
381
-
382
- describe "#format_textarea_content" do
383
- it "returns truncated and escape column value" do
384
- allow(subject).to receive(:column_value).with(resource, :title)
385
- .and_return('"Pra<tag>nt commodo\ncursus magn')
386
- expect(subject.format_textarea_content(resource, :title))
387
- .to eq('&quot;Pra&lt;tag&gt;nt commodo\ncursus magn')
388
- end
389
-
390
- it "casts value to string before truncation" do
391
- allow(subject).to receive(:column_value).with(resource, :title)
392
- .and_return(nil)
393
- expect(subject.format_textarea_content(resource, :title)).to eq("")
394
- end
395
- end
396
-
397
- describe "#format_string_content" do
398
- context "when resource column value respond to #resource_title method" do
399
- it "returns resource to title result" do
400
- another_obj = Book.new
401
- allow(subject).to receive(:column_value).with(resource, :id).and_return(another_obj)
402
- allow(subject).to receive(:resource_title).with(another_obj).and_return("nineninine")
403
-
404
- expect(subject.format_string_content(resource, :id)).to eq("nineninine")
405
- end
406
- end
407
- end
408
-
409
- describe "#format_boolean_content" do
410
- context "when resource column value is 'true'" do
411
- it "returns localized 'yes' value" do
412
- allow(subject).to receive(:t).with("Yes").and_return("Jā")
413
- allow(subject).to receive(:column_value).with(resource, :active)
414
- .and_return(true)
415
-
416
- expect(subject.format_boolean_content(resource, :active)).to eq("Jā")
417
- end
418
- end
419
-
420
- context "when resource column value is other than 'true'" do
421
- it "returns localized 'no' value" do
422
- allow(subject).to receive(:t).with("No").and_return("Nē")
423
- allow(subject).to receive(:column_value).with(resource, :active)
424
- .and_return(false)
425
- expect(subject.format_boolean_content(resource, :active)).to eq("Nē")
426
-
427
- allow(subject).to receive(:column_value).with(resource, :active)
428
- .and_return(nil)
429
- expect(subject.format_boolean_content(resource, :active)).to eq("Nē")
430
- end
431
- end
432
- end
433
-
434
- describe "#format_date_content" do
435
- it "returns localized date value" do
436
- value = Date.parse("2012.12.29")
437
- allow(subject).to receive(:column_value).with(resource, :birth_date)
438
- .and_return(value)
439
-
440
- expect(I18n).to receive(:l).with(value, format: :default)
441
- .and_call_original
442
-
443
- expect(subject.format_date_content(resource, :birth_date)).to eq("2012-12-29")
444
- end
445
- end
446
-
447
- describe "#format_datetime_content" do
448
- it "returns localized datetime value" do
449
- value = DateTime.parse("2012.12.29 17:12:07")
450
- allow(subject).to receive(:column_value).with(resource, :created_at)
451
- .and_return(value)
452
-
453
- allow(I18n).to receive(:l).with(value, format: "%Y-%m-%d %H:%M")
454
- .and_return("2012-12-29 17:12:07")
455
-
456
- expect(subject.format_datetime_content(resource, :created_at)).to eq("2012-12-29 17:12:07")
457
- end
458
- end
459
-
460
- describe "#format_time_content" do
461
- it "returns localized time value" do
462
- value = Time.parse("2012.12.29 17:12:07")
463
- allow(subject).to receive(:column_value).with(resource, :created_at)
464
- .and_return(value)
465
-
466
- allow(I18n).to receive(:l).with(value, format: "%H:%M")
467
- .and_return("17:12")
468
-
469
- expect(subject.format_time_content(resource, :created_at)).to eq("17:12")
470
- end
471
- end
472
-
473
- describe "#association_name" do
474
- it "normalizes given column name by removing '_id' postfix and returning new value as symbol" do
475
- expect(subject.association_name(:author_id)).to eq(:author)
476
- end
477
- end
478
-
479
- describe "#format_association_content" do
480
- it "pass resource and association name to #format_string_content" do
481
- resource = resource_class.new
482
- allow(subject).to receive(:association_name).with(:author_id).and_return(:another_author)
483
- allow(subject).to receive(:format_string_content).with(resource, :another_author).and_return("x")
484
-
485
- expect(subject.format_association_content(resource, :author_id)).to eq("x")
486
- end
487
- end
488
-
489
- describe "#cell_content_method" do
490
- context "when custom cell content method exists" do
491
- it "returns custom cell content method name" do
492
- expect(subject.cell_content_method(:format_string)).to eq("format_string_content")
493
- end
494
- end
495
-
496
- context "when custom cell content does not method exist" do
497
- it "returns nil" do
498
- expect(subject.cell_content_method(:title)).to be nil
499
- end
500
- end
501
- end
502
-
503
- describe "#cell_method" do
504
- context "when custom cell method exists" do
505
- it "returns custom cell method name" do
506
- expect(inheriter_subject.cell_method(:title)).to eq("title_cell")
507
- end
508
- end
509
-
510
- context "when custom cell does not method exist" do
511
- it "returns nil" do
512
- expect(subject.cell_method(:title)).to be nil
513
- end
514
- end
515
- end
516
-
517
- describe "#toolbox_cell" do
518
- let(:controller){ double(ActionController::Base) }
519
- before do
520
- allow(subject).to receive(:controller).and_return(controller)
521
- allow(controller).to receive(:index_path).and_return("_index_path_")
522
- end
523
-
524
- it "returns cell with toolbox" do
525
- allow(subject).to receive(:toolbox)
526
- .with(resource, index_path: "_index_path_").and_return("_toolbox_")
527
-
528
- content = '<td class="only-icon toolbox-cell">_toolbox_</td>'
529
- expect(subject.toolbox_cell(resource, {})).to eq(content)
530
- end
531
-
532
- it "merges given toolbox options and passes it to toolbox heplper" do
533
- allow(subject.controller).to receive(:index_path).and_return("_index_path_")
534
- expect(subject).to receive(:toolbox)
535
- .with(resource, index_path: "_index_path_", some_url: "xx").and_return("_toolbox_")
536
- subject.toolbox_cell(resource, {toolbox: {some_url: "xx"}})
537
-
538
- expect(subject).to receive(:toolbox)
539
- .with(resource, index_path: "xx").and_return("_toolbox_")
540
- subject.toolbox_cell(resource, {toolbox: {index_path: "xx"}})
541
- end
542
- end
543
-
544
- describe "#column_type" do
545
- it "returns database column type for given column" do
546
- expect(subject.column_type(resource_class, :active)).to eq(:boolean)
547
- expect(subject.column_type(resource_class, :created_at)).to eq(:datetime)
548
- end
549
-
550
- context "when given column does not exists within database column definitions" do
551
- it "returns :string as default value" do
552
- expect(subject.column_type(resource_class, :random_title)).to eq(:string)
553
- end
554
- end
555
- end
556
-
557
- describe "#column_type_format_method" do
558
- it "uses column klass and column name for type calculation" do
559
- allow(subject).to receive(:column_klass).with(resource_class, "some.column").and_return(Chapter)
560
- allow(subject).to receive(:column_type).with(Chapter, "some.column").and_return(:extra_type)
561
- allow(subject).to receive(:type_format_method).with(:extra_type).and_return("extra_type_method")
562
- expect(subject.column_type_format_method("some.column")).to eq("extra_type_method")
563
- end
564
- end
565
-
566
- describe "#type_format_method" do
567
- context "when format method for returned column type exists" do
568
- it "returns column type format method" do
569
- expect(subject.type_format_method(:date)).to eq(:format_date_content)
570
- end
571
- end
572
-
573
- context "when format method for returned column type does not exist" do
574
- it "returns :format_string_content" do
575
- expect(subject.type_format_method(:big_boolean)).to eq(:format_string_content)
576
- end
577
- end
578
- end
579
-
580
- describe "#cell_format_method" do
581
- before do
582
- allow(subject).to receive(:association_column?).with(:title).and_return(false)
583
- allow(subject).to receive(:column_type_format_method).with(:title).and_return(:format_crazy_shit)
584
- end
585
-
586
- it "returns #column_type_format_method for given column" do
587
- expect(subject.cell_format_method(:title)).to eq(:format_crazy_shit)
588
- end
589
-
590
- context "when #association_column? returns true for given column" do
591
- it "returns :format_association_content" do
592
- allow(subject).to receive(:association_column?).with(:title).and_return(true)
593
- expect(subject.cell_format_method(:title)).to eq(:format_association_content)
594
- end
595
- end
596
- end
597
-
598
- describe "#association_column?" do
599
- context "when given column is association" do
600
- it "returns true" do
601
- expect(subject.association_column?(:author_id)).to be true
602
- end
603
- end
604
-
605
- context "when given column is not association" do
606
- it "returns false" do
607
- expect(subject.association_column?(:title)).to be false
608
- end
609
- end
610
- end
611
-
612
- describe "#cell" do
613
- context "when cell options :url value is blank" do
614
- it "returns cell with #cell_contentoutput wrapped in a span" do
615
- options = {a: "x"}
616
- allow(subject).to receive(:cell_content)
617
- .with(resource, :title, options).and_return("_cell_content_")
618
- content = '<td><span>_cell_content_</span></td>'
619
-
620
- expect(subject.cell(resource, :title, options)).to eq(content)
621
-
622
- options[:url] = nil
623
- expect(subject.cell(resource, :title, options)).to eq(content)
624
- end
625
- end
626
-
627
- context "when cell options :url value is not blank" do
628
- it "returns cell with #cell_content output wrapped in a link" do
629
- allow(subject).to receive(:cell_content)
630
- .with(resource, :title, {a: "x", url: "y"}).and_return("_cell_content_")
631
-
632
- content = '<td><a href="y">_cell_content_</a></td>'
633
- expect(subject.cell(resource, :title, {a: "x", url: "y"})).to eq(content)
634
- end
635
- end
636
- end
637
- end