wallaby 5.0.1 → 5.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -3
  3. data/app/assets/images/wallaby/404.png +0 -0
  4. data/app/assets/images/wallaby/422.png +0 -0
  5. data/app/assets/images/wallaby/500.png +0 -0
  6. data/app/assets/javascripts/wallaby/application.js +1 -15
  7. data/app/assets/javascripts/wallaby/auto_select.js +77 -0
  8. data/app/assets/javascripts/wallaby/base.js +17 -0
  9. data/app/assets/javascripts/wallaby/setup.js.erb +60 -0
  10. data/app/assets/stylesheets/wallaby/application.scss +1 -51
  11. data/app/assets/stylesheets/wallaby/base/_layout.scss +257 -9
  12. data/app/assets/stylesheets/wallaby/base/_layout_desktop.scss +53 -0
  13. data/app/assets/stylesheets/wallaby/base/_mixins.scss +119 -0
  14. data/app/assets/stylesheets/wallaby/base/_override.scss +10 -0
  15. data/app/assets/stylesheets/wallaby/base/_vars.scss +72 -2
  16. data/app/assets/stylesheets/wallaby/base.scss +27 -0
  17. data/app/assets/stylesheets/wallaby/components/_auto_select.scss +119 -0
  18. data/app/assets/stylesheets/wallaby/components/_auto_select_desktop.scss +7 -0
  19. data/app/assets/stylesheets/wallaby/components/_color_square.scss +8 -0
  20. data/app/assets/stylesheets/wallaby/components/_filters.scss +14 -0
  21. data/app/assets/stylesheets/wallaby/components/_links.scss +25 -0
  22. data/app/assets/stylesheets/wallaby/components/_pagination.scss +35 -91
  23. data/app/assets/stylesheets/wallaby/components/_query.scss +101 -0
  24. data/app/assets/stylesheets/wallaby/components/_text.scss +6 -6
  25. data/app/assets/stylesheets/wallaby/pages/_error.scss +108 -0
  26. data/app/assets/stylesheets/wallaby/pages/_form.scss +40 -0
  27. data/app/assets/stylesheets/wallaby/pages/_index.scss +193 -0
  28. data/app/assets/stylesheets/wallaby/pages/_index_desktop.scss +22 -0
  29. data/app/assets/stylesheets/wallaby/pages/_show.scss +21 -0
  30. data/app/controllers/wallaby/abstract_resources_controller.rb +334 -0
  31. data/app/controllers/wallaby/application_controller.rb +45 -15
  32. data/app/controllers/wallaby/base_controller.rb +30 -0
  33. data/app/controllers/wallaby/resources_controller.rb +2 -131
  34. data/app/controllers/wallaby/secure_controller.rb +38 -24
  35. data/app/routes/wallaby/resources_router.rb +40 -43
  36. data/app/security/ability.rb +4 -28
  37. data/app/views/layouts/wallaby/application.html.erb +11 -6
  38. data/app/views/layouts/wallaby/error.html.erb +26 -4
  39. data/app/views/wallaby/error.html.erb +11 -0
  40. data/app/views/wallaby/error.json.jbuilder +8 -0
  41. data/app/views/wallaby/{shared → resources}/_flash_messages.html.erb +0 -0
  42. data/app/views/wallaby/resources/_footer.html.erb +1 -0
  43. data/app/views/wallaby/resources/_form.html.erb +2 -2
  44. data/app/views/wallaby/resources/_header.html.erb +38 -0
  45. data/app/views/wallaby/resources/_imodal.html.erb +13 -0
  46. data/app/views/wallaby/resources/_index_actions.html.erb +4 -1
  47. data/app/views/wallaby/resources/_index_filters.html.erb +23 -0
  48. data/app/views/wallaby/resources/_index_pagination.html.erb +63 -0
  49. data/app/views/wallaby/resources/_index_query.html.erb +23 -0
  50. data/app/views/wallaby/resources/_logo.html.erb +1 -0
  51. data/app/views/wallaby/resources/_navs.html.erb +9 -0
  52. data/app/views/wallaby/resources/_resource_actions.html.erb +3 -3
  53. data/app/views/wallaby/resources/{shared/_resource_nav.html.erb → _resource_navs.html.erb} +6 -6
  54. data/app/views/wallaby/resources/_title.html.erb +1 -0
  55. data/app/views/wallaby/resources/_user_menu.html.erb +5 -0
  56. data/app/views/wallaby/resources/bad_request.json.jbuilder +7 -0
  57. data/app/views/wallaby/resources/edit.html.erb +16 -12
  58. data/app/views/wallaby/resources/form/_belongs_to.html.erb +63 -12
  59. data/app/views/wallaby/resources/form/_bigint.html.erb +10 -1
  60. data/app/views/wallaby/resources/form/_bigserial.html.erb +18 -0
  61. data/app/views/wallaby/resources/form/_binary.html.erb +11 -2
  62. data/app/views/wallaby/resources/form/_bit.html.erb +10 -1
  63. data/app/views/wallaby/resources/form/_bit_varying.html.erb +10 -1
  64. data/app/views/wallaby/resources/form/_blob.html.erb +21 -0
  65. data/app/views/wallaby/resources/form/_boolean.html.erb +9 -0
  66. data/app/views/wallaby/resources/form/_box.html.erb +21 -0
  67. data/app/views/wallaby/resources/form/_cidr.html.erb +13 -1
  68. data/app/views/wallaby/resources/form/_circle.html.erb +21 -0
  69. data/app/views/wallaby/resources/form/_citext.html.erb +11 -2
  70. data/app/views/wallaby/resources/form/_color.html.erb +11 -2
  71. data/app/views/wallaby/resources/form/_date.html.erb +12 -3
  72. data/app/views/wallaby/resources/form/_daterange.html.erb +14 -5
  73. data/app/views/wallaby/resources/form/_datetime.html.erb +12 -3
  74. data/app/views/wallaby/resources/form/_decimal.html.erb +10 -1
  75. data/app/views/wallaby/resources/form/_dropdown.html.erb +18 -0
  76. data/app/views/wallaby/resources/form/_email.html.erb +9 -0
  77. data/app/views/wallaby/resources/form/_file.html.erb +21 -0
  78. data/app/views/wallaby/resources/form/_float.html.erb +10 -1
  79. data/app/views/wallaby/resources/form/_has_and_belongs_to_many.html.erb +53 -7
  80. data/app/views/wallaby/resources/form/_has_many.html.erb +52 -7
  81. data/app/views/wallaby/resources/form/_has_one.html.erb +10 -2
  82. data/app/views/wallaby/resources/form/_hstore.html.erb +12 -5
  83. data/app/views/wallaby/resources/form/_inet.html.erb +13 -1
  84. data/app/views/wallaby/resources/form/_int4range.html.erb +11 -2
  85. data/app/views/wallaby/resources/form/_int8range.html.erb +11 -2
  86. data/app/views/wallaby/resources/form/_integer.html.erb +10 -1
  87. data/app/views/wallaby/resources/form/_json.html.erb +13 -6
  88. data/app/views/wallaby/resources/form/_jsonb.html.erb +13 -6
  89. data/app/views/wallaby/resources/form/_line.html.erb +21 -0
  90. data/app/views/wallaby/resources/form/_longblob.html.erb +21 -0
  91. data/app/views/wallaby/resources/form/_longtext.html.erb +30 -0
  92. data/app/views/wallaby/resources/form/_lseg.html.erb +21 -0
  93. data/app/views/wallaby/resources/form/_ltree.html.erb +17 -1
  94. data/app/views/wallaby/resources/form/_macaddr.html.erb +13 -1
  95. data/app/views/wallaby/resources/form/_markdown.html.erb +29 -0
  96. data/app/views/wallaby/resources/form/_mediumblob.html.erb +21 -0
  97. data/app/views/wallaby/resources/form/_mediumtext.html.erb +30 -0
  98. data/app/views/wallaby/resources/form/_money.html.erb +10 -1
  99. data/app/views/wallaby/resources/form/_numrange.html.erb +11 -2
  100. data/app/views/wallaby/resources/form/_password.html.erb +14 -1
  101. data/app/views/wallaby/resources/form/_path.html.erb +17 -0
  102. data/app/views/wallaby/resources/form/_point.html.erb +11 -2
  103. data/app/views/wallaby/resources/form/_polygon.html.erb +17 -0
  104. data/app/views/wallaby/resources/form/_serial.html.erb +18 -0
  105. data/app/views/wallaby/resources/form/_sti.html.erb +18 -0
  106. data/app/views/wallaby/resources/form/_string.html.erb +14 -1
  107. data/app/views/wallaby/resources/form/_text.html.erb +11 -2
  108. data/app/views/wallaby/resources/form/_time.html.erb +12 -3
  109. data/app/views/wallaby/resources/form/_tinyblob.html.erb +21 -0
  110. data/app/views/wallaby/resources/form/_tinytext.html.erb +30 -0
  111. data/app/views/wallaby/resources/form/_tsrange.html.erb +14 -5
  112. data/app/views/wallaby/resources/form/_tstzrange.html.erb +14 -5
  113. data/app/views/wallaby/resources/form/_tsvector.html.erb +9 -0
  114. data/app/views/wallaby/resources/form/_unsigned_bigint.html.erb +18 -0
  115. data/app/views/wallaby/resources/form/_unsigned_decimal.html.erb +18 -0
  116. data/app/views/wallaby/resources/form/_unsigned_float.html.erb +18 -0
  117. data/app/views/wallaby/resources/form/_unsigned_integer.html.erb +18 -0
  118. data/app/views/wallaby/resources/form/_uuid.html.erb +10 -1
  119. data/app/views/wallaby/resources/form/_xml.html.erb +11 -5
  120. data/app/views/wallaby/resources/form.json.jbuilder +5 -0
  121. data/app/views/wallaby/{core → resources}/home.html.erb +1 -1
  122. data/app/views/wallaby/resources/index/_belongs_to.html.erb +5 -1
  123. data/app/views/wallaby/resources/index/_bigint.html.erb +4 -0
  124. data/app/views/wallaby/resources/index/_bigserial.html.erb +5 -0
  125. data/app/views/wallaby/resources/index/_binary.html.erb +5 -1
  126. data/app/views/wallaby/resources/index/_bit.html.erb +4 -0
  127. data/app/views/wallaby/resources/index/_bit_varying.html.erb +4 -0
  128. data/app/views/wallaby/resources/index/_blob.html.erb +5 -0
  129. data/app/views/wallaby/resources/index/_boolean.html.erb +5 -1
  130. data/app/views/wallaby/resources/index/_box.html.erb +16 -0
  131. data/app/views/wallaby/resources/index/_cidr.html.erb +5 -1
  132. data/app/views/wallaby/resources/index/_circle.html.erb +16 -0
  133. data/app/views/wallaby/resources/index/_citext.html.erb +5 -1
  134. data/app/views/wallaby/resources/index/_color.html.erb +6 -1
  135. data/app/views/wallaby/resources/index/_date.html.erb +4 -0
  136. data/app/views/wallaby/resources/index/_daterange.html.erb +5 -1
  137. data/app/views/wallaby/resources/index/_datetime.html.erb +5 -1
  138. data/app/views/wallaby/resources/index/_decimal.html.erb +4 -0
  139. data/app/views/wallaby/resources/index/_email.html.erb +4 -0
  140. data/app/views/wallaby/resources/index/_float.html.erb +4 -0
  141. data/app/views/wallaby/resources/index/_has_and_belongs_to_many.html.erb +6 -2
  142. data/app/views/wallaby/resources/index/_has_many.html.erb +6 -2
  143. data/app/views/wallaby/resources/index/_has_one.html.erb +5 -1
  144. data/app/views/wallaby/resources/index/_hstore.html.erb +6 -2
  145. data/app/views/wallaby/resources/index/_inet.html.erb +5 -1
  146. data/app/views/wallaby/resources/index/_int4range.html.erb +4 -0
  147. data/app/views/wallaby/resources/index/_int8range.html.erb +4 -0
  148. data/app/views/wallaby/resources/index/_integer.html.erb +4 -0
  149. data/app/views/wallaby/resources/index/_json.html.erb +5 -2
  150. data/app/views/wallaby/resources/index/_jsonb.html.erb +5 -2
  151. data/app/views/wallaby/resources/index/_line.html.erb +16 -0
  152. data/app/views/wallaby/resources/index/_longblob.html.erb +5 -0
  153. data/app/views/wallaby/resources/index/_longtext.html.erb +16 -0
  154. data/app/views/wallaby/resources/index/_lseg.html.erb +16 -0
  155. data/app/views/wallaby/resources/index/_ltree.html.erb +5 -1
  156. data/app/views/wallaby/resources/index/_macaddr.html.erb +4 -0
  157. data/app/views/wallaby/resources/index/_mediumblob.html.erb +5 -0
  158. data/app/views/wallaby/resources/index/_mediumtext.html.erb +16 -0
  159. data/app/views/wallaby/resources/index/_money.html.erb +4 -0
  160. data/app/views/wallaby/resources/index/_numrange.html.erb +4 -0
  161. data/app/views/wallaby/resources/index/_password.html.erb +9 -0
  162. data/app/views/wallaby/resources/index/_path.html.erb +16 -0
  163. data/app/views/wallaby/resources/index/_point.html.erb +4 -0
  164. data/app/views/wallaby/resources/index/_polygon.html.erb +16 -0
  165. data/app/views/wallaby/resources/index/_raw.html.erb +9 -0
  166. data/app/views/wallaby/resources/index/_serial.html.erb +5 -0
  167. data/app/views/wallaby/resources/index/_sti.html.erb +16 -0
  168. data/app/views/wallaby/resources/index/_string.html.erb +5 -1
  169. data/app/views/wallaby/resources/index/_text.html.erb +5 -1
  170. data/app/views/wallaby/resources/index/_time.html.erb +4 -0
  171. data/app/views/wallaby/resources/index/_tinyblob.html.erb +5 -0
  172. data/app/views/wallaby/resources/index/_tinytext.html.erb +16 -0
  173. data/app/views/wallaby/resources/index/_tsrange.html.erb +5 -1
  174. data/app/views/wallaby/resources/index/_tstzrange.html.erb +5 -1
  175. data/app/views/wallaby/resources/index/_tsvector.html.erb +5 -1
  176. data/app/views/wallaby/resources/index/_unsigned_bigint.html.erb +5 -0
  177. data/app/views/wallaby/resources/index/_unsigned_decimal.html.erb +5 -0
  178. data/app/views/wallaby/resources/index/_unsigned_float.html.erb +5 -0
  179. data/app/views/wallaby/resources/index/_unsigned_integer.html.erb +5 -0
  180. data/app/views/wallaby/resources/index/_uuid.html.erb +5 -1
  181. data/app/views/wallaby/resources/index/_xml.html.erb +5 -1
  182. data/app/views/wallaby/resources/index.csv.erb +26 -0
  183. data/app/views/wallaby/resources/index.html.erb +47 -59
  184. data/app/views/wallaby/resources/index.json.jbuilder +5 -0
  185. data/app/views/wallaby/resources/new.html.erb +12 -11
  186. data/app/views/wallaby/resources/show/_belongs_to.html.erb +5 -1
  187. data/app/views/wallaby/resources/show/_bigint.html.erb +4 -0
  188. data/app/views/wallaby/resources/show/_bigserial.html.erb +5 -0
  189. data/app/views/wallaby/resources/show/_binary.html.erb +5 -1
  190. data/app/views/wallaby/resources/show/_bit.html.erb +4 -0
  191. data/app/views/wallaby/resources/show/_bit_varying.html.erb +4 -0
  192. data/app/views/wallaby/resources/show/_blob.html.erb +5 -0
  193. data/app/views/wallaby/resources/show/_boolean.html.erb +5 -1
  194. data/app/views/wallaby/resources/show/_box.html.erb +9 -0
  195. data/app/views/wallaby/resources/show/_cidr.html.erb +5 -1
  196. data/app/views/wallaby/resources/show/_circle.html.erb +9 -0
  197. data/app/views/wallaby/resources/show/_citext.html.erb +4 -0
  198. data/app/views/wallaby/resources/show/_color.html.erb +6 -1
  199. data/app/views/wallaby/resources/show/_date.html.erb +4 -0
  200. data/app/views/wallaby/resources/show/_daterange.html.erb +4 -0
  201. data/app/views/wallaby/resources/show/_datetime.html.erb +4 -0
  202. data/app/views/wallaby/resources/show/_decimal.html.erb +4 -0
  203. data/app/views/wallaby/resources/show/_email.html.erb +4 -0
  204. data/app/views/wallaby/resources/show/_float.html.erb +4 -0
  205. data/app/views/wallaby/resources/show/_has_and_belongs_to_many.html.erb +6 -2
  206. data/app/views/wallaby/resources/show/_has_many.html.erb +6 -2
  207. data/app/views/wallaby/resources/show/_has_one.html.erb +5 -1
  208. data/app/views/wallaby/resources/show/_hstore.html.erb +4 -0
  209. data/app/views/wallaby/resources/show/_image.html.erb +9 -0
  210. data/app/views/wallaby/resources/show/_inet.html.erb +5 -1
  211. data/app/views/wallaby/resources/show/_int4range.html.erb +4 -0
  212. data/app/views/wallaby/resources/show/_int8range.html.erb +4 -0
  213. data/app/views/wallaby/resources/show/_integer.html.erb +4 -0
  214. data/app/views/wallaby/resources/show/_json.html.erb +4 -0
  215. data/app/views/wallaby/resources/show/_jsonb.html.erb +4 -0
  216. data/app/views/wallaby/resources/show/_line.html.erb +9 -0
  217. data/app/views/wallaby/resources/show/_longblob.html.erb +5 -0
  218. data/app/views/wallaby/resources/show/_longtext.html.erb +5 -0
  219. data/app/views/wallaby/resources/show/_lseg.html.erb +9 -0
  220. data/app/views/wallaby/resources/show/_ltree.html.erb +4 -0
  221. data/app/views/wallaby/resources/show/_macaddr.html.erb +4 -0
  222. data/app/views/wallaby/resources/show/_mediumblob.html.erb +5 -0
  223. data/app/views/wallaby/resources/show/_mediumtext.html.erb +5 -0
  224. data/app/views/wallaby/resources/show/_money.html.erb +4 -0
  225. data/app/views/wallaby/resources/show/_numrange.html.erb +4 -0
  226. data/app/views/wallaby/resources/show/_password.html.erb +9 -0
  227. data/app/views/wallaby/resources/show/_path.html.erb +9 -0
  228. data/app/views/wallaby/resources/show/_point.html.erb +4 -0
  229. data/app/views/wallaby/resources/show/_polygon.html.erb +9 -0
  230. data/app/views/wallaby/resources/show/_raw.html.erb +9 -0
  231. data/app/views/wallaby/resources/show/_serial.html.erb +5 -0
  232. data/app/views/wallaby/resources/show/_sti.html.erb +5 -0
  233. data/app/views/wallaby/resources/show/_string.html.erb +4 -0
  234. data/app/views/wallaby/resources/show/_text.html.erb +4 -0
  235. data/app/views/wallaby/resources/show/_time.html.erb +4 -0
  236. data/app/views/wallaby/resources/show/_tinyblob.html.erb +5 -0
  237. data/app/views/wallaby/resources/show/_tinytext.html.erb +5 -0
  238. data/app/views/wallaby/resources/show/_tsrange.html.erb +4 -0
  239. data/app/views/wallaby/resources/show/_tstzrange.html.erb +4 -0
  240. data/app/views/wallaby/resources/show/_tsvector.html.erb +4 -0
  241. data/app/views/wallaby/resources/show/_unsigned_bigint.html.erb +5 -0
  242. data/app/views/wallaby/resources/show/_unsigned_decimal.html.erb +5 -0
  243. data/app/views/wallaby/resources/show/_unsigned_float.html.erb +5 -0
  244. data/app/views/wallaby/resources/show/_unsigned_integer.html.erb +5 -0
  245. data/app/views/wallaby/resources/show/_uuid.html.erb +4 -0
  246. data/app/views/wallaby/resources/show/_xml.html.erb +4 -0
  247. data/app/views/wallaby/resources/show.html.erb +14 -24
  248. data/app/views/wallaby/resources/show.json.jbuilder +5 -0
  249. data/config/brakeman.ignore +26 -0
  250. data/config/locales/wallaby.en.yml +91 -0
  251. data/config/massa.yml +45 -0
  252. data/config/rails_best_practices.yml +42 -0
  253. data/config/routes.rb +29 -23
  254. data/lib/adaptors/wallaby/active_record/model_decorator/fields_builder/association_builder.rb +39 -0
  255. data/lib/adaptors/wallaby/active_record/model_decorator/fields_builder/polymorphic_builder.rb +44 -0
  256. data/lib/adaptors/wallaby/active_record/model_decorator/fields_builder/sti_builder.rb +42 -0
  257. data/lib/adaptors/wallaby/active_record/model_decorator/fields_builder.rb +41 -94
  258. data/lib/adaptors/wallaby/active_record/model_decorator/title_field_finder.rb +24 -14
  259. data/lib/adaptors/wallaby/active_record/model_decorator.rb +118 -64
  260. data/lib/adaptors/wallaby/active_record/model_finder.rb +44 -15
  261. data/lib/adaptors/wallaby/active_record/model_pagination_provider.rb +30 -0
  262. data/lib/adaptors/wallaby/active_record/model_service_provider/normalizer.rb +42 -0
  263. data/lib/adaptors/wallaby/active_record/model_service_provider/permitter.rb +64 -0
  264. data/lib/adaptors/wallaby/active_record/model_service_provider/querier/transformer.rb +70 -0
  265. data/lib/adaptors/wallaby/active_record/model_service_provider/querier.rb +102 -0
  266. data/lib/adaptors/wallaby/active_record/model_service_provider/validator.rb +29 -0
  267. data/lib/adaptors/wallaby/active_record/model_service_provider.rb +137 -0
  268. data/lib/adaptors/wallaby/active_record.rb +4 -1
  269. data/lib/decorators/wallaby/abstract_resource_decorator.rb +74 -0
  270. data/lib/decorators/wallaby/resource_decorator.rb +5 -76
  271. data/lib/errors/wallaby/model_not_found.rb +5 -1
  272. data/lib/errors/wallaby/not_found.rb +4 -0
  273. data/lib/errors/wallaby/resource_not_found.rb +5 -1
  274. data/lib/forms/wallaby/form_builder.rb +42 -19
  275. data/lib/helpers/wallaby/application_helper.rb +34 -24
  276. data/lib/helpers/wallaby/base_helper.rb +52 -0
  277. data/lib/helpers/wallaby/form_helper.rb +40 -16
  278. data/lib/helpers/wallaby/index_helper.rb +59 -0
  279. data/lib/helpers/wallaby/links_helper.rb +150 -81
  280. data/lib/helpers/wallaby/resources_helper.rb +41 -46
  281. data/lib/helpers/wallaby/secure_helper.rb +36 -19
  282. data/lib/helpers/wallaby/styling_helper.rb +53 -44
  283. data/lib/interfaces/wallaby/mode.rb +19 -12
  284. data/lib/interfaces/wallaby/model_decorator.rb +176 -50
  285. data/lib/interfaces/wallaby/model_finder.rb +7 -3
  286. data/lib/interfaces/wallaby/model_pagination_provider.rb +104 -0
  287. data/lib/interfaces/wallaby/model_service_provider.rb +71 -0
  288. data/lib/paginators/wallaby/abstract_resource_paginator.rb +23 -0
  289. data/lib/paginators/wallaby/resource_paginator.rb +6 -0
  290. data/lib/parsers/wallaby/parser.rb +32 -0
  291. data/lib/responders/wallaby/abstract_responder.rb +68 -0
  292. data/lib/responders/wallaby/resources_responder.rb +6 -0
  293. data/lib/servicers/wallaby/abstract_model_servicer.rb +48 -0
  294. data/lib/servicers/wallaby/model_servicer.rb +5 -0
  295. data/lib/services/wallaby/link_options_normalizer.rb +16 -0
  296. data/lib/services/wallaby/lookup_context_wrapper.rb +23 -30
  297. data/lib/services/wallaby/map/mode_mapper.rb +19 -0
  298. data/lib/services/wallaby/map/model_class_collector.rb +41 -0
  299. data/lib/services/wallaby/map/model_class_mapper.rb +24 -0
  300. data/lib/services/wallaby/map.rb +76 -39
  301. data/lib/services/wallaby/partial_renderer.rb +60 -0
  302. data/lib/services/wallaby/prefixes_builder.rb +54 -0
  303. data/lib/services/wallaby/sorting/hash_builder.rb +16 -0
  304. data/lib/services/wallaby/sorting/link_builder.rb +45 -0
  305. data/lib/services/wallaby/sorting/next_builder.rb +54 -0
  306. data/lib/services/wallaby/url_for.rb +36 -0
  307. data/lib/tree/wallaby/node.rb +17 -0
  308. data/lib/utils/wallaby/utils.rb +67 -22
  309. data/lib/wallaby/configuration/features.rb +12 -0
  310. data/lib/wallaby/configuration/metadata.rb +12 -0
  311. data/lib/wallaby/configuration/models.rb +27 -12
  312. data/lib/wallaby/configuration/pagination.rb +12 -0
  313. data/lib/wallaby/configuration/security.rb +55 -24
  314. data/lib/wallaby/configuration.rb +38 -19
  315. data/lib/wallaby/engine.rb +84 -39
  316. data/lib/wallaby/version.rb +1 -1
  317. data/lib/wallaby.rb +22 -3
  318. metadata +200 -55
  319. data/app/assets/javascripts/wallaby/form.js +0 -8
  320. data/app/assets/stylesheets/wallaby/base/_functions.scss +0 -0
  321. data/app/assets/stylesheets/wallaby/base/_normalize.scss +0 -0
  322. data/app/assets/stylesheets/wallaby/base/_reset.scss +0 -0
  323. data/app/assets/stylesheets/wallaby/components/_forms.scss +0 -53
  324. data/app/assets/stylesheets/wallaby/components/_nav.scss +0 -19
  325. data/app/assets/stylesheets/wallaby/components/_tables.scss +0 -78
  326. data/app/assets/stylesheets/wallaby/form.scss +0 -11
  327. data/app/controllers/wallaby/core_controller.rb +0 -28
  328. data/app/views/layouts/wallaby/_footer.html.erb +0 -2
  329. data/app/views/layouts/wallaby/_header.html.erb +0 -57
  330. data/app/views/layouts/wallaby/_navs.html.erb +0 -1
  331. data/app/views/wallaby/errors/access_denied.html.erb +0 -1
  332. data/app/views/wallaby/errors/not_authenticated.html.erb +0 -1
  333. data/app/views/wallaby/errors/not_found.html.erb +0 -6
  334. data/app/views/wallaby/errors/unprocessable_entity.erb +0 -1
  335. data/config/locales/en.yml +0 -29
  336. data/lib/adaptors/wallaby/active_record/model_operator/normalizer.rb +0 -44
  337. data/lib/adaptors/wallaby/active_record/model_operator/permitter.rb +0 -50
  338. data/lib/adaptors/wallaby/active_record/model_operator/querier.rb +0 -47
  339. data/lib/adaptors/wallaby/active_record/model_operator/validator.rb +0 -16
  340. data/lib/adaptors/wallaby/active_record/model_operator.rb +0 -82
  341. data/lib/errors/wallaby/deprecated.rb +0 -4
  342. data/lib/errors/wallaby/operation_not_found.rb +0 -4
  343. data/lib/handlers/wallaby/cached_compiled_erb.rb +0 -14
  344. data/lib/helpers/wallaby/core_helper.rb +0 -50
  345. data/lib/helpers/wallaby/paginatable_helper.rb +0 -9
  346. data/lib/helpers/wallaby/sorting_helper.rb +0 -43
  347. data/lib/interfaces/wallaby/model_operator.rb +0 -31
  348. data/lib/services/wallaby/decorator_finder.rb +0 -16
  349. data/lib/services/wallaby/model_servicer.rb +0 -38
  350. data/lib/services/wallaby/servicer_finder.rb +0 -5
@@ -1,8 +1,12 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
8
  <span class="from"><%= I18n.l value.first, format: :short %></span>
5
9
  ...
6
10
  <span class="to"><%= I18n.l value.last, format: :short %></span>
7
- <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'time' %>
11
+ <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'clock-o' %>
8
12
  <% end %>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
8
  <% value = Time.zone.parse value if value.is_a? String %>
5
9
  <span><%= I18n.l value, format: :short %></span>
6
- <%= itooltip I18n.l(value), 'time' %>
10
+ <%= itooltip I18n.l(value), 'clock-o' %>
7
11
  <% end %>
@@ -1 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <%= value || null %>
@@ -1 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <%= value.nil? ? null : mail_to(value) %>
@@ -1 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <%= value.try(:to_f) || null %>
@@ -1,9 +1,13 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% unique_collection = value.uniq %>
2
- <%= raw unique_collection.first(2).map{ |item| show_link item }.join(', ') %>
6
+ <%= raw unique_collection.first(2).map{ |item| show_link item, options: { readonly: true } }.join(', ') %>
3
7
 
4
8
  <% if unique_collection.length > 2 %>
5
9
  <% title = metadata[:label] %>
6
- <% body = unique_collection.map{ |item| show_link item }.to_sentence.html_safe %>
10
+ <% body = unique_collection.map{ |item| show_link item, options: { readonly: true } }.to_sentence.html_safe %>
7
11
  <% label = "#{ unique_collection.length - 2 } more" %>
8
12
  and <%= imodal title, body, label: label %>
9
13
  <% elsif unique_collection.blank? %>
@@ -1,9 +1,13 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% unique_collection = value.uniq %>
2
- <%= raw unique_collection.first(2).map{ |item| show_link item }.join(', ') %>
6
+ <%= raw unique_collection.first(2).map{ |item| show_link item, options: { readonly: true } }.join(', ') %>
3
7
 
4
8
  <% if unique_collection.length > 2 %>
5
9
  <% title = metadata[:label] %>
6
- <% body = unique_collection.map{ |item| show_link item }.to_sentence.html_safe %>
10
+ <% body = unique_collection.map{ |item| show_link item, options: { readonly: true } }.to_sentence.html_safe %>
7
11
  <% label = "#{ unique_collection.length - 2 } more" %>
8
12
  and <%= imodal title, body, label: label %>
9
13
  <% elsif unique_collection.blank? %>
@@ -1 +1,5 @@
1
- <%= value.present? ? show_link(value) : null %>
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value.present? ? show_link(value, options: { readonly: true }) : null %>
@@ -1,8 +1,12 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
5
- <% value = value.to_json %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <code><%= value.truncate max %></code>
8
12
  <%= imodal metadata[:label], "<pre>#{ h value }</pre>".html_safe %>
@@ -1,6 +1,10 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
8
  <code><%= value %></code>
5
- <%= link_to icon('new-window'), "http://ip-api.com/##{ value }", target: :_blank, class: 'text-info' %>
9
+ <%= link_to fa_icon('external-link-square'), "http://ip-api.com/##{ value }", target: :_blank, class: 'text-info' %>
6
10
  <% end %>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -1 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <%= value.try(:to_i) || null %>
@@ -1,8 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
5
- <% value = value.to_json %>
8
+ <% max = metadata[:max] || default_metadata.max %>
6
9
  <% if value.length > max %>
7
10
  <code><%= value.truncate max %></code>
8
11
  <%= imodal metadata[:label], "<pre>#{ h value }</pre>".html_safe %>
@@ -1,8 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
5
- <% value = value.to_json %>
8
+ <% max = metadata[:max] || default_metadata.max %>
6
9
  <% if value.length > max %>
7
10
  <code><%= value.truncate max %></code>
8
11
  <%= imodal metadata[:label], "<pre>#{ h value }</pre>".html_safe %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <code><%= value.truncate max %></code>
12
+ <%= itooltip value %>
13
+ <% else %>
14
+ <code><%= value %></code>
15
+ <% end %>
16
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value ? muted('longblob') : null %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <span><%= value.truncate max %></span>
12
+ <%= imodal metadata[:label], value %>
13
+ <% else %>
14
+ <%= value %>
15
+ <% end %>
16
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <code><%= value.truncate max %></code>
12
+ <%= itooltip value %>
13
+ <% else %>
14
+ <code><%= value %></code>
15
+ <% end %>
16
+ <% end %>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <span><%= value.truncate max %></span>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value ? muted('mediumblob') : null %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <span><%= value.truncate max %></span>
12
+ <%= imodal metadata[:label], value %>
13
+ <% else %>
14
+ <%= value %>
15
+ <% end %>
16
+ <% end %>
@@ -1 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <%= value || null %>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -0,0 +1,9 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <code>********</code>
9
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <code><%= value.truncate max %></code>
12
+ <%= imodal metadata[:label], value %>
13
+ <% else %>
14
+ <code><%= value %></code>
15
+ <% end %>
16
+ <% end %>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <code><%= value.truncate max %></code>
12
+ <%= imodal metadata[:label], value %>
13
+ <% else %>
14
+ <code><%= value %></code>
15
+ <% end %>
16
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <%= value.html_safe %>
9
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value || null %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <span><%= value.truncate max %></span>
12
+ <%= itooltip value %>
13
+ <% else %>
14
+ <%= value %>
15
+ <% end %>
16
+ <% end %>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <span><%= value.truncate max %></span>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <span><%= value.truncate max %></span>
@@ -1,3 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value ? muted('tinyblob') : null %>
@@ -0,0 +1,16 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.nil? %>
6
+ <%= null %>
7
+ <% else %>
8
+ <% max = metadata[:max] || default_metadata.max %>
9
+ <% value = value.to_s %>
10
+ <% if value.length > max %>
11
+ <span><%= value.truncate max %></span>
12
+ <%= imodal metadata[:label], value %>
13
+ <% else %>
14
+ <%= value %>
15
+ <% end %>
16
+ <% end %>
@@ -1,8 +1,12 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
8
  <span class="from"><%= I18n.l value.first, format: :short %></span>
5
9
  ...
6
10
  <span class="to"><%= I18n.l value.last, format: :short %></span>
7
- <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'time' %>
11
+ <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'clock-o' %>
8
12
  <% end %>
@@ -1,8 +1,12 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
8
  <span class="from"><%= I18n.l value.first, format: :short %></span>
5
9
  ...
6
10
  <span class="to"><%= I18n.l value.last, format: :short %></span>
7
- <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'time' %>
11
+ <%= itooltip "#{ I18n.l value.first } ... #{ I18n.l value.last }", 'clock-o' %>
8
12
  <% end %>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <span><%= value.truncate max %></span>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value || null %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value || null %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value.try(:to_f) || null %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= value.try(:to_i) || null %>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 17 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <span><%= value.truncate max %></span>
@@ -1,7 +1,11 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
1
5
  <% if value.nil? %>
2
6
  <%= null %>
3
7
  <% else %>
4
- <% max = metadata[:max] || 20 %>
8
+ <% max = metadata[:max] || default_metadata.max %>
5
9
  <% value = value.to_s %>
6
10
  <% if value.length > max %>
7
11
  <code><%= value.truncate max %></code>
@@ -0,0 +1,26 @@
1
+ <%
2
+ headers = current_model_decorator.index_field_names.map do |field_name|
3
+ current_model_decorator.index_metadata_of(field_name)[:label]
4
+ end
5
+ decorated_collection = decorate collection
6
+ %>
7
+ <%= ::CSV.generate_line(headers).strip.html_safe %>
8
+ <%
9
+ decorated_collection.each do |decorated|
10
+ data = current_model_decorator.index_field_names.map do |field_name|
11
+ value = decorated.public_send(field_name)
12
+ if value.respond_to?(:map) && !value.is_a?(Range)
13
+ value.map do |v|
14
+ if model_decorator(v.class).present?
15
+ decorate(v).to_label
16
+ else
17
+ v
18
+ end
19
+ end.to_sentence
20
+ else
21
+ value
22
+ end
23
+ end
24
+ %>
25
+ <%= ::CSV.generate_line(data).strip.html_safe %>
26
+ <% end %>