avo 0.4.10 → 0.5.0.beta5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (579) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +37 -9
  3. data/Gemfile.lock +108 -85
  4. data/README.md +8 -0
  5. data/app/components/avo/common/badge_viewer_component.html.erb +24 -0
  6. data/app/components/avo/common/badge_viewer_component.rb +8 -0
  7. data/app/components/avo/common/boolean_check_component.html.erb +12 -0
  8. data/app/components/avo/common/boolean_check_component.rb +7 -0
  9. data/app/components/avo/common/boolean_group_component.html.erb +16 -0
  10. data/app/components/avo/common/boolean_group_component.rb +8 -0
  11. data/app/components/avo/common/files_list_viewer_component.html.erb +5 -0
  12. data/app/components/avo/common/files_list_viewer_component.rb +8 -0
  13. data/app/components/avo/common/gravatar_viewer_component.html.erb +12 -0
  14. data/app/components/avo/common/gravatar_viewer_component.rb +12 -0
  15. data/app/components/avo/common/heading_component.html.erb +13 -0
  16. data/app/components/avo/common/heading_component.rb +8 -0
  17. data/app/components/avo/common/multiple_file_viewer_component.html.erb +26 -0
  18. data/app/components/avo/common/multiple_file_viewer_component.rb +13 -0
  19. data/app/components/avo/common/single_file_viewer_component.html.erb +28 -0
  20. data/app/components/avo/common/single_file_viewer_component.rb +13 -0
  21. data/app/components/avo/common/status_viewer_component.html.erb +10 -0
  22. data/app/components/avo/common/status_viewer_component.rb +8 -0
  23. data/app/components/avo/edit/field_wrapper_component.html.erb +20 -0
  24. data/app/components/avo/edit/field_wrapper_component.rb +19 -0
  25. data/app/components/avo/edit/fields/belongs_to_field_component.html.erb +19 -0
  26. data/app/components/avo/edit/fields/belongs_to_field_component.rb +4 -0
  27. data/app/components/avo/edit/fields/boolean_field_component.html.erb +9 -0
  28. data/app/components/avo/edit/fields/boolean_field_component.rb +4 -0
  29. data/app/components/avo/edit/fields/boolean_group_field_component.html.erb +25 -0
  30. data/app/components/avo/edit/fields/boolean_group_field_component.rb +4 -0
  31. data/app/components/avo/edit/fields/code_field_component.html.erb +19 -0
  32. data/app/components/avo/edit/fields/code_field_component.rb +4 -0
  33. data/app/components/avo/edit/fields/country_field_component.html.erb +7 -0
  34. data/app/components/avo/edit/fields/country_field_component.rb +4 -0
  35. data/app/components/avo/edit/fields/date_field_component.html.erb +18 -0
  36. data/app/components/avo/edit/fields/date_field_component.rb +4 -0
  37. data/app/components/avo/edit/fields/date_time_field_component.html.erb +20 -0
  38. data/app/components/avo/edit/fields/date_time_field_component.rb +4 -0
  39. data/app/components/avo/edit/fields/external_image_field_component.html.erb +6 -0
  40. data/app/components/avo/edit/fields/external_image_field_component.rb +4 -0
  41. data/app/components/avo/edit/fields/field_component.rb +13 -0
  42. data/app/components/avo/edit/fields/file_field_component.html.erb +9 -0
  43. data/app/components/avo/edit/fields/file_field_component.rb +4 -0
  44. data/app/components/avo/edit/fields/files_field_component.html.erb +5 -0
  45. data/app/components/avo/edit/fields/files_field_component.rb +4 -0
  46. data/app/components/avo/edit/fields/heading_field_component.html.erb +3 -0
  47. data/app/components/avo/edit/fields/heading_field_component.rb +4 -0
  48. data/app/components/avo/edit/fields/hidden_field_component.html.erb +1 -0
  49. data/app/components/avo/edit/fields/hidden_field_component.rb +4 -0
  50. data/app/components/avo/edit/fields/id_field_component.html.erb +3 -0
  51. data/app/components/avo/edit/fields/id_field_component.rb +4 -0
  52. data/app/components/avo/edit/fields/markdown_field_component.html.erb +11 -0
  53. data/app/components/avo/edit/fields/markdown_field_component.rb +4 -0
  54. data/app/components/avo/edit/fields/number_field_component.html.erb +9 -0
  55. data/app/components/avo/edit/fields/number_field_component.rb +4 -0
  56. data/app/components/avo/edit/fields/password_field_component.html.erb +7 -0
  57. data/app/components/avo/edit/fields/password_field_component.rb +4 -0
  58. data/app/components/avo/edit/fields/select_field_component.html.erb +6 -0
  59. data/app/components/avo/edit/fields/select_field_component.rb +4 -0
  60. data/app/components/avo/edit/fields/status_field_component.html.erb +7 -0
  61. data/app/components/avo/edit/fields/status_field_component.rb +4 -0
  62. data/app/components/avo/edit/fields/text_field_component.html.erb +6 -0
  63. data/app/components/avo/edit/fields/text_field_component.rb +4 -0
  64. data/app/components/avo/edit/fields/textarea_field_component.html.erb +7 -0
  65. data/app/components/avo/edit/fields/textarea_field_component.rb +4 -0
  66. data/app/components/avo/edit/fields/trix_field_component.html.erb +11 -0
  67. data/app/components/avo/edit/fields/trix_field_component.rb +4 -0
  68. data/app/components/avo/index/field_wrapper_component.html.erb +7 -0
  69. data/app/components/avo/index/field_wrapper_component.rb +10 -0
  70. data/app/components/avo/index/fields/badge_field_component.html.erb +3 -0
  71. data/app/components/avo/index/fields/badge_field_component.rb +4 -0
  72. data/app/components/avo/index/fields/belongs_to_field_component.html.erb +7 -0
  73. data/app/components/avo/index/fields/belongs_to_field_component.rb +4 -0
  74. data/app/components/avo/index/fields/boolean_field_component.html.erb +3 -0
  75. data/app/components/avo/index/fields/boolean_field_component.rb +4 -0
  76. data/app/components/avo/index/fields/boolean_group_field_component.html.erb +3 -0
  77. data/app/components/avo/index/fields/boolean_group_field_component.rb +4 -0
  78. data/app/components/avo/index/fields/country_field_component.html.erb +7 -0
  79. data/app/components/avo/index/fields/country_field_component.rb +4 -0
  80. data/app/components/avo/index/fields/date_field_component.html.erb +3 -0
  81. data/app/components/avo/index/fields/date_field_component.rb +4 -0
  82. data/app/components/avo/index/fields/date_time_field_component.html.erb +3 -0
  83. data/app/components/avo/index/fields/date_time_field_component.rb +4 -0
  84. data/app/components/avo/index/fields/external_image_field_component.html.erb +9 -0
  85. data/app/components/avo/index/fields/external_image_field_component.rb +4 -0
  86. data/app/components/avo/index/fields/field_component.html.erb +1 -0
  87. data/app/components/avo/index/fields/field_component.rb +11 -0
  88. data/app/components/avo/index/fields/file_field_component.html.erb +11 -0
  89. data/app/components/avo/index/fields/file_field_component.rb +4 -0
  90. data/app/components/avo/index/fields/files_field_component.html.erb +3 -0
  91. data/app/components/avo/index/fields/files_field_component.rb +4 -0
  92. data/app/components/avo/index/fields/gravatar_field_component.html.erb +11 -0
  93. data/app/components/avo/index/fields/gravatar_field_component.rb +4 -0
  94. data/app/components/avo/index/fields/has_one_field_component.html.erb +7 -0
  95. data/app/components/avo/index/fields/has_one_field_component.rb +4 -0
  96. data/app/components/avo/index/fields/id_field_component.html.erb +10 -0
  97. data/app/components/avo/index/fields/id_field_component.rb +4 -0
  98. data/app/components/avo/index/fields/number_field_component.html.erb +3 -0
  99. data/app/components/avo/index/fields/number_field_component.rb +4 -0
  100. data/app/components/avo/index/fields/select_field_component.html.erb +3 -0
  101. data/app/components/avo/index/fields/select_field_component.rb +4 -0
  102. data/app/components/avo/index/fields/status_field_component.html.erb +3 -0
  103. data/app/components/avo/index/fields/status_field_component.rb +4 -0
  104. data/app/components/avo/index/fields/text_field_component.html.erb +3 -0
  105. data/app/components/avo/index/fields/text_field_component.rb +4 -0
  106. data/app/components/avo/index/grid_item_component.html.erb +41 -0
  107. data/app/components/avo/index/grid_item_component.rb +25 -0
  108. data/app/components/avo/index/resource_controls_component.html.erb +56 -0
  109. data/app/components/avo/index/resource_controls_component.rb +39 -0
  110. data/app/components/avo/index/resource_grid_component.html.erb +13 -0
  111. data/app/components/avo/index/resource_grid_component.rb +10 -0
  112. data/app/components/avo/index/resource_table_component.html.erb +16 -0
  113. data/app/components/avo/index/resource_table_component.rb +10 -0
  114. data/app/components/avo/index/table_row_component.html.erb +18 -0
  115. data/app/components/avo/index/table_row_component.rb +11 -0
  116. data/app/components/avo/loading_component.html.erb +10 -0
  117. data/app/components/avo/loading_component.rb +7 -0
  118. data/app/components/avo/modal_component.html.erb +20 -0
  119. data/app/components/avo/modal_component.rb +5 -0
  120. data/app/components/avo/navigation_heading_component.html.erb +3 -0
  121. data/app/components/avo/navigation_heading_component.rb +7 -0
  122. data/app/components/avo/navigation_link_component.html.erb +3 -0
  123. data/app/components/avo/navigation_link_component.rb +10 -0
  124. data/app/components/avo/panel_component.html.erb +27 -0
  125. data/app/components/avo/panel_component.rb +20 -0
  126. data/app/components/avo/resource_component.rb +14 -0
  127. data/app/components/avo/show/field_wrapper_component.html.erb +16 -0
  128. data/app/components/avo/show/field_wrapper_component.rb +15 -0
  129. data/app/components/avo/show/fields/badge_field_component.html.erb +3 -0
  130. data/app/components/avo/show/fields/badge_field_component.rb +4 -0
  131. data/app/components/avo/show/fields/belongs_to_field_component.html.erb +3 -0
  132. data/app/components/avo/show/fields/belongs_to_field_component.rb +4 -0
  133. data/app/components/avo/show/fields/boolean_field_component.html.erb +3 -0
  134. data/app/components/avo/show/fields/boolean_field_component.rb +4 -0
  135. data/app/components/avo/show/fields/boolean_group_field_component.html.erb +3 -0
  136. data/app/components/avo/show/fields/boolean_group_field_component.rb +4 -0
  137. data/app/components/avo/show/fields/code_field_component.html.erb +19 -0
  138. data/app/components/avo/show/fields/code_field_component.rb +4 -0
  139. data/app/components/avo/show/fields/country_field_component.html.erb +7 -0
  140. data/app/components/avo/show/fields/country_field_component.rb +4 -0
  141. data/app/components/avo/show/fields/date_field_component.html.erb +3 -0
  142. data/app/components/avo/show/fields/date_field_component.rb +4 -0
  143. data/app/components/avo/show/fields/date_time_field_component.html.erb +3 -0
  144. data/app/components/avo/show/fields/date_time_field_component.rb +4 -0
  145. data/app/components/avo/show/fields/external_image_field_component.html.erb +5 -0
  146. data/app/components/avo/show/fields/external_image_field_component.rb +4 -0
  147. data/app/components/avo/show/fields/field_component.rb +11 -0
  148. data/app/components/avo/show/fields/file_field_component.html.erb +3 -0
  149. data/app/components/avo/show/fields/file_field_component.rb +4 -0
  150. data/app/components/avo/show/fields/files_field_component.html.erb +3 -0
  151. data/app/components/avo/show/fields/files_field_component.rb +4 -0
  152. data/app/components/avo/show/fields/gravatar_field_component.html.erb +7 -0
  153. data/app/components/avo/show/fields/gravatar_field_component.rb +4 -0
  154. data/app/components/avo/show/fields/has_many_field_component.html.erb +3 -0
  155. data/app/components/avo/show/fields/has_many_field_component.rb +4 -0
  156. data/app/components/avo/show/fields/has_one_field_component.html.erb +19 -0
  157. data/app/components/avo/show/fields/has_one_field_component.rb +5 -0
  158. data/app/components/avo/show/fields/heading_field_component.html.erb +3 -0
  159. data/app/components/avo/show/fields/heading_field_component.rb +4 -0
  160. data/app/components/avo/show/fields/id_field_component.html.erb +3 -0
  161. data/app/components/avo/show/fields/id_field_component.rb +4 -0
  162. data/app/components/avo/show/fields/markdown_field_component.html.erb +10 -0
  163. data/app/components/avo/show/fields/markdown_field_component.rb +4 -0
  164. data/app/components/avo/show/fields/number_field_component.html.erb +3 -0
  165. data/app/components/avo/show/fields/number_field_component.rb +4 -0
  166. data/app/components/avo/show/fields/select_field_component.html.erb +3 -0
  167. data/app/components/avo/show/fields/select_field_component.rb +4 -0
  168. data/app/components/avo/show/fields/status_field_component.html.erb +3 -0
  169. data/app/components/avo/show/fields/status_field_component.rb +4 -0
  170. data/app/components/avo/show/fields/text_field_component.html.erb +3 -0
  171. data/app/components/avo/show/fields/text_field_component.rb +4 -0
  172. data/app/components/avo/show/fields/textarea_field_component.html.erb +3 -0
  173. data/app/components/avo/show/fields/textarea_field_component.rb +4 -0
  174. data/app/components/avo/show/fields/trix_field_component.html.erb +14 -0
  175. data/app/components/avo/show/fields/trix_field_component.rb +4 -0
  176. data/app/components/avo/views/resource_edit_component.html.erb +29 -0
  177. data/app/components/avo/views/resource_edit_component.rb +23 -0
  178. data/app/components/avo/views/resource_index_component.html.erb +62 -0
  179. data/app/components/avo/views/resource_index_component.rb +93 -0
  180. data/app/components/avo/views/resource_new_component.html.erb +25 -0
  181. data/app/components/avo/views/resource_new_component.rb +27 -0
  182. data/app/components/avo/views/resource_show_component.html.erb +64 -0
  183. data/app/components/avo/views/resource_show_component.rb +66 -0
  184. data/app/controllers/avo/actions_controller.rb +51 -22
  185. data/app/controllers/avo/application_controller.rb +189 -27
  186. data/app/controllers/avo/attachments_controller.rb +25 -0
  187. data/app/controllers/avo/base_controller.rb +226 -0
  188. data/app/controllers/avo/home_controller.rb +3 -0
  189. data/app/controllers/avo/relations_controller.rb +88 -19
  190. data/app/controllers/avo/resources_controller.rb +2 -259
  191. data/app/controllers/avo/search_controller.rb +8 -7
  192. data/app/frontend/css/alerts.css +35 -0
  193. data/app/frontend/css/application.css +73 -0
  194. data/app/frontend/css/components/code.css +27 -0
  195. data/app/frontend/css/components/status.css +30 -0
  196. data/app/frontend/css/fonts.css +26 -0
  197. data/app/frontend/css/loader.css +134 -0
  198. data/app/frontend/css/pagination.css +67 -0
  199. data/app/frontend/css/tailwindcss/base.css +1 -0
  200. data/app/frontend/css/tailwindcss/components.css +1 -0
  201. data/app/frontend/css/tailwindcss/utilities.css +1 -0
  202. data/app/frontend/css/tooltips.css +105 -0
  203. data/app/frontend/css/typography.css +23 -0
  204. data/app/frontend/fonts/nunito-v16-latin-700.eot +0 -0
  205. data/app/frontend/fonts/nunito-v16-latin-700.svg +388 -0
  206. data/app/frontend/fonts/nunito-v16-latin-700.ttf +0 -0
  207. data/app/frontend/fonts/nunito-v16-latin-700.woff +0 -0
  208. data/app/frontend/fonts/nunito-v16-latin-700.woff2 +0 -0
  209. data/app/frontend/fonts/nunito-v16-latin-regular.eot +0 -0
  210. data/app/frontend/fonts/nunito-v16-latin-regular.svg +380 -0
  211. data/app/frontend/fonts/nunito-v16-latin-regular.ttf +0 -0
  212. data/app/frontend/fonts/nunito-v16-latin-regular.woff +0 -0
  213. data/app/frontend/fonts/nunito-v16-latin-regular.woff2 +0 -0
  214. data/app/frontend/images/logo.png +0 -0
  215. data/app/frontend/importmap.json.erb +5 -0
  216. data/app/frontend/js/controllers/action_controller.js +32 -0
  217. data/app/frontend/js/controllers/actions_picker_controller.js +44 -0
  218. data/app/frontend/js/controllers/alerts_controller.js +26 -0
  219. data/app/frontend/js/controllers/attachments_controller.js +9 -0
  220. data/app/frontend/js/controllers/boolean_filter_controller.js +21 -0
  221. data/app/frontend/js/controllers/fields/code_field_controller.js +35 -0
  222. data/app/frontend/js/controllers/fields/date_field_controller.js +53 -0
  223. data/app/frontend/js/controllers/fields/simple_mde_controller.js +26 -0
  224. data/app/frontend/js/controllers/filter_controller.js +52 -0
  225. data/app/frontend/js/controllers/hidden_input_controller.js +10 -0
  226. data/app/frontend/js/controllers/item_selector_controller.js +68 -0
  227. data/app/frontend/js/controllers/modal_controller.js +11 -0
  228. data/app/frontend/js/controllers/per_page_controller.js +9 -0
  229. data/app/frontend/js/controllers/select_filter_controller.js +15 -0
  230. data/app/frontend/js/controllers/tippy_controller.js +14 -0
  231. data/app/frontend/js/controllers/toggle_panel_controller.js +18 -0
  232. data/app/frontend/js/helpers/cast_boolean.js +2 -0
  233. data/app/frontend/js/toastr.js +9 -0
  234. data/app/frontend/packs/application.js +45 -0
  235. data/{public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg → app/frontend/svgs/arrow-circle-right.svg} +0 -0
  236. data/{public/avo-packs/media/svgs/arrow-left-0e8e808ff771a62a348d0232c8ccf539.svg → app/frontend/svgs/arrow-left.svg} +0 -0
  237. data/{public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg → app/frontend/svgs/avocado.svg} +0 -0
  238. data/app/frontend/svgs/badge-check-sm.svg +3 -0
  239. data/{public/avo-packs/media/svgs/check-circle-be9e4dcbd25467ae9a3d3c6c5c7a09fa.svg → app/frontend/svgs/check-circle.svg} +0 -0
  240. data/{public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg → app/frontend/svgs/chevron-down.svg} +0 -0
  241. data/{public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg → app/frontend/svgs/chevron-up.svg} +0 -0
  242. data/{public/avo-packs/media/svgs/code-69010c6ddb6ad50be8677f16468c51f8.svg → app/frontend/svgs/code.svg} +0 -0
  243. data/{public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg → app/frontend/svgs/color-swatch.svg} +0 -0
  244. data/app/frontend/svgs/document-text.svg +3 -0
  245. data/{public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg → app/frontend/svgs/download.svg} +0 -0
  246. data/{public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg → app/frontend/svgs/edit.svg} +0 -0
  247. data/app/frontend/svgs/exclamation-circle-sm.svg +3 -0
  248. data/app/frontend/svgs/exclamation-sm.svg +3 -0
  249. data/{public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg → app/frontend/svgs/exclamation.svg} +0 -0
  250. data/{public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg → app/frontend/svgs/eye.svg} +0 -0
  251. data/{public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg → app/frontend/svgs/filter.svg} +0 -0
  252. data/{public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg → app/frontend/svgs/fire.svg} +0 -0
  253. data/{public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg → app/frontend/svgs/game-board.svg} +0 -0
  254. data/{public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg → app/frontend/svgs/globe.svg} +0 -0
  255. data/app/frontend/svgs/information-circle-sm.svg +3 -0
  256. data/app/frontend/svgs/information-circle.svg +1 -0
  257. data/{public/avo-packs/media/svgs/library-7d391192a15da64fbb527908c9e035c7.svg → app/frontend/svgs/library.svg} +0 -0
  258. data/{public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg → app/frontend/svgs/photograph.svg} +0 -0
  259. data/app/frontend/svgs/play.svg +1 -0
  260. data/{public/avo-packs/media/svgs/plus-circle-b379b2a2aa803511ae5945b6fd323204.svg → app/frontend/svgs/plus-circle.svg} +0 -0
  261. data/{public/avo-packs/media/svgs/plus-530f0af27b9f1a4552454233c2f9a641.svg → app/frontend/svgs/plus.svg} +0 -0
  262. data/{public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg → app/frontend/svgs/question-mark-circle.svg} +0 -0
  263. data/{public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg → app/frontend/svgs/save.svg} +0 -0
  264. data/{public/avo-packs/media/svgs/selector-b43b3957d7cc121d06be14312613c218.svg → app/frontend/svgs/selector.svg} +0 -0
  265. data/{public/avo-packs/media/svgs/sort-ascending-f5bc0761702809cab20b0ea3065cb88a.svg → app/frontend/svgs/sort-ascending.svg} +0 -0
  266. data/{public/avo-packs/media/svgs/sort-descending-1c8ddc56c72be6781e59d808f9d06203.svg → app/frontend/svgs/sort-descending.svg} +0 -0
  267. data/{public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg → app/frontend/svgs/switch-horizontal.svg} +0 -0
  268. data/{public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg → app/frontend/svgs/thumbs-down.svg} +0 -0
  269. data/{public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg → app/frontend/svgs/thumbs-up.svg} +0 -0
  270. data/app/frontend/svgs/times.svg +3 -0
  271. data/app/frontend/svgs/trash-sm.svg +3 -0
  272. data/{public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg → app/frontend/svgs/trash.svg} +0 -0
  273. data/{public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg → app/frontend/svgs/view-grid-add.svg} +0 -0
  274. data/{public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg → app/frontend/svgs/view-grid.svg} +0 -0
  275. data/{public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg → app/frontend/svgs/view-list.svg} +0 -0
  276. data/{public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg → app/frontend/svgs/x-circle.svg} +0 -0
  277. data/app/helpers/avo/actions_helper.rb +4 -0
  278. data/app/helpers/avo/application_helper.rb +156 -3
  279. data/app/helpers/avo/attachments_helper.rb +4 -0
  280. data/app/helpers/avo/resources_helper.rb +101 -0
  281. data/app/views/avo/actions/show.html.erb +71 -0
  282. data/app/views/avo/attachments/show.html.erb +7 -0
  283. data/app/views/avo/base/_actions.html.erb +30 -0
  284. data/app/views/avo/base/_boolean_filter.html.erb +33 -0
  285. data/app/views/avo/base/_filters.html.erb +29 -0
  286. data/app/views/avo/base/_select_filter.html.erb +20 -0
  287. data/app/views/avo/base/edit.html.erb +1 -0
  288. data/app/views/avo/base/index.html.erb +15 -0
  289. data/app/views/avo/base/new.html.erb +1 -0
  290. data/app/views/avo/base/show.html.erb +3 -0
  291. data/app/views/avo/home/_actions.html.erb +16 -0
  292. data/app/views/avo/home/_docs.html.erb +9 -0
  293. data/app/views/avo/home/_filters.html.erb +16 -0
  294. data/app/views/avo/home/_resources.html.erb +28 -0
  295. data/app/views/avo/home/index.html.erb +54 -3
  296. data/app/views/avo/partials/_a_button.html.erb +7 -0
  297. data/app/views/avo/partials/_a_link.html.erb +7 -0
  298. data/app/views/avo/partials/_alert.html.erb +1 -0
  299. data/app/views/avo/partials/_alerts.html.erb +3 -0
  300. data/app/views/avo/partials/_empty_state.html.erb +17 -0
  301. data/app/views/{partials → avo/partials}/_footer.html.erb +0 -0
  302. data/app/views/{partials → avo/partials}/_header.html.erb +0 -0
  303. data/app/views/avo/partials/_javascript.html.erb +3 -0
  304. data/app/views/{partials → avo/partials}/_logo.html.erb +0 -0
  305. data/app/views/avo/partials/_paginator.html.erb +30 -0
  306. data/app/views/avo/partials/_sortable_component.html.erb +14 -0
  307. data/app/views/avo/partials/_table_header.html.erb +50 -0
  308. data/app/views/avo/partials/_view_toggle_button.html.erb +17 -0
  309. data/app/views/avo/relations/new.html.erb +29 -0
  310. data/app/views/avo/sidebar/_license_warning.html.erb +12 -0
  311. data/app/views/avo/sidebar/_license_warnings.html.erb +6 -0
  312. data/app/views/avo/sidebar/_sidebar.html.erb +23 -0
  313. data/app/views/kaminari/_first_page.html.erb +3 -0
  314. data/app/views/kaminari/_last_page.html.erb +3 -0
  315. data/app/views/kaminari/_next_page.html.erb +9 -0
  316. data/app/views/kaminari/_page.html.erb +12 -0
  317. data/app/views/kaminari/_prev_page.html.erb +9 -0
  318. data/app/views/layouts/avo/_filter_wrapper.html.erb +8 -0
  319. data/app/views/layouts/avo/application.html.erb +33 -40
  320. data/app/views/layouts/avo/application_vue.html.erb +61 -0
  321. data/avo.gemspec +5 -3
  322. data/bin/helpers.rb +34 -0
  323. data/bin/init +35 -0
  324. data/bin/rspec +8 -0
  325. data/bin/spring +17 -0
  326. data/bin/test +21 -0
  327. data/bin/webpack +9 -10
  328. data/bin/webpack-dev-server +9 -10
  329. data/config/cable.yml +11 -0
  330. data/config/initializers/inline_svg.rb +33 -0
  331. data/config/initializers/pagy.rb +1 -0
  332. data/config/routes.rb +22 -18
  333. data/config/spring.rb +7 -0
  334. data/config/webpack/environment.js +14 -10
  335. data/config/webpacker.yml +14 -26
  336. data/db/factories.rb +10 -3
  337. data/db/migrate/20210305082639_add_url_to_teams.rb +5 -0
  338. data/lib/avo.rb +5 -13
  339. data/lib/avo/app.rb +190 -0
  340. data/lib/avo/base_action.rb +115 -0
  341. data/lib/avo/base_resource.rb +321 -0
  342. data/lib/avo/configuration.rb +14 -0
  343. data/lib/avo/engine.rb +15 -31
  344. data/lib/avo/fields/badge_field.rb +18 -0
  345. data/lib/avo/fields/base_field.rb +184 -0
  346. data/lib/avo/fields/belongs_to_field.rb +65 -0
  347. data/lib/avo/{app/fields → fields}/boolean_field.rb +9 -11
  348. data/lib/avo/fields/boolean_group_field.rb +40 -0
  349. data/lib/avo/fields/code_field.rb +29 -0
  350. data/lib/avo/fields/country_field.rb +32 -0
  351. data/lib/avo/{app/fields → fields}/currency_field.rb +2 -3
  352. data/lib/avo/{app/fields → fields}/date_field.rb +16 -13
  353. data/lib/avo/fields/date_time_field.rb +36 -0
  354. data/lib/avo/fields/external_image_field.rb +24 -0
  355. data/lib/avo/{app/fields → fields}/field_extensions/has_field_name.rb +0 -0
  356. data/lib/avo/{app/fields → fields}/field_extensions/visible_in_different_views.rb +6 -6
  357. data/lib/avo/fields/file_field.rb +29 -0
  358. data/lib/avo/fields/files_field.rb +33 -0
  359. data/lib/avo/{app/fields → fields}/gravatar_field.rb +19 -14
  360. data/lib/avo/fields/has_and_belongs_to_many_field.rb +37 -0
  361. data/lib/avo/fields/has_many_field.rb +38 -0
  362. data/lib/avo/fields/has_one_field.rb +63 -0
  363. data/lib/avo/{app/fields → fields}/heading_field.rb +3 -9
  364. data/lib/avo/{app/fields → fields}/hidden_field.rb +2 -4
  365. data/lib/avo/{app/fields → fields}/id_field.rb +3 -9
  366. data/lib/avo/{app/fields → fields}/key_value_field.rb +6 -3
  367. data/lib/avo/{app/fields → fields}/markdown_field.rb +2 -4
  368. data/lib/avo/fields/number_field.rb +20 -0
  369. data/lib/avo/{app/fields → fields}/password_field.rb +1 -3
  370. data/lib/avo/fields/select_field.rb +51 -0
  371. data/lib/avo/{app/fields → fields}/status_field.rb +10 -8
  372. data/lib/avo/{app/fields → fields}/text_field.rb +2 -9
  373. data/lib/avo/fields/textarea_field.rb +18 -0
  374. data/lib/avo/{app/fields → fields}/trix_field.rb +4 -10
  375. data/lib/avo/filters/base_filter.rb +20 -0
  376. data/lib/avo/filters/boolean_filter.rb +7 -0
  377. data/lib/avo/filters/select_filter.rb +7 -0
  378. data/lib/avo/{app/grid_fields → grid_fields}/body_field.rb +0 -2
  379. data/lib/avo/{app/grid_fields → grid_fields}/grid_field.rb +0 -0
  380. data/lib/avo/{app/grid_fields → grid_fields}/preview_field.rb +0 -2
  381. data/lib/avo/{app/grid_fields → grid_fields}/title_field.rb +0 -2
  382. data/lib/avo/licensing/community_license.rb +6 -0
  383. data/lib/avo/licensing/h_q.rb +88 -0
  384. data/lib/avo/licensing/license.rb +50 -0
  385. data/lib/avo/licensing/license_manager.rb +22 -0
  386. data/lib/avo/licensing/null_license.rb +14 -0
  387. data/lib/avo/licensing/pro_license.rb +11 -0
  388. data/lib/avo/loaders/actions_loader.rb +6 -0
  389. data/lib/avo/loaders/fields_loader.rb +27 -0
  390. data/lib/avo/loaders/filters_loader.rb +6 -0
  391. data/lib/avo/loaders/loader.rb +15 -0
  392. data/lib/avo/services/authorization_service.rb +93 -0
  393. data/lib/avo/services/panel_service.rb +27 -0
  394. data/lib/avo/{app/tools_manager.rb → tools_manager.rb} +0 -0
  395. data/lib/avo/version.rb +1 -1
  396. data/lib/generators/avo/action_generator.rb +11 -5
  397. data/lib/generators/avo/controller_generator.rb +19 -0
  398. data/lib/generators/avo/filter_generator.rb +14 -8
  399. data/lib/generators/avo/install_generator.rb +14 -10
  400. data/lib/generators/avo/locales_generator.rb +16 -0
  401. data/lib/generators/avo/partials_generator.rb +14 -0
  402. data/lib/generators/avo/resource_generator.rb +37 -5
  403. data/lib/generators/avo/templates/{action.rb → action.tt} +2 -4
  404. data/lib/generators/avo/templates/filters/boolean_filter.tt +11 -0
  405. data/lib/generators/avo/templates/filters/select_filter.tt +11 -0
  406. data/lib/generators/avo/templates/initializer/{avo.rb → avo.tt} +9 -4
  407. data/lib/generators/avo/templates/locales/avo.en.yml +22 -1
  408. data/lib/generators/avo/templates/partials/_footer.html.erb +3 -0
  409. data/lib/generators/avo/templates/partials/_header.html.erb +1 -0
  410. data/lib/generators/avo/templates/{views → partials}/_logo.html.erb +0 -0
  411. data/lib/generators/avo/templates/{views → partials}/_scripts.html.erb +0 -0
  412. data/lib/generators/avo/templates/resource/controller.tt +2 -0
  413. data/lib/generators/avo/templates/resource/resource.tt +17 -0
  414. data/public/avo-packs/css/application-c75ac28c.css +6 -0
  415. data/public/avo-packs/css/application-c75ac28c.css.br +0 -0
  416. data/public/avo-packs/css/application-c75ac28c.css.gz +0 -0
  417. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js +2 -0
  418. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.br +0 -0
  419. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.gz +0 -0
  420. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map +1 -0
  421. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.br +0 -0
  422. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.gz +0 -0
  423. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js +26 -0
  424. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.LICENSE.txt +77 -0
  425. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.br +0 -0
  426. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.gz +0 -0
  427. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map +1 -0
  428. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.br +0 -0
  429. data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.gz +0 -0
  430. data/public/avo-packs/manifest.json +17 -46
  431. data/public/avo-packs/manifest.json.br +0 -0
  432. data/public/avo-packs/manifest.json.gz +0 -0
  433. data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf +0 -0
  434. data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.br +0 -0
  435. data/public/avo-packs/media/fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.gz +0 -0
  436. data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg +388 -0
  437. data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.br +0 -0
  438. data/public/avo-packs/media/fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.gz +0 -0
  439. data/public/avo-packs/media/fonts/nunito-v16-latin-700-412073df419ad5f6f8f2ea76eb4aced9.woff2 +0 -0
  440. data/public/avo-packs/media/fonts/nunito-v16-latin-700-7c472b19cb573f537bad8ef62ca917ac.woff +0 -0
  441. data/public/avo-packs/media/fonts/nunito-v16-latin-700-df7e79af617f98cd3b95d320e8b2a1af.eot +0 -0
  442. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg +380 -0
  443. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.br +0 -0
  444. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.gz +0 -0
  445. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-2fae1e2418251b68fe5d0505ab93dd5c.eot +0 -0
  446. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-bcf84d6cb8a0ac214c8c14ba9af834f3.woff2 +0 -0
  447. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-cb632c9fe211ba2c2bf1564c9a9295cc.woff +0 -0
  448. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf +0 -0
  449. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.br +0 -0
  450. data/public/avo-packs/media/fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.gz +0 -0
  451. metadata +466 -194
  452. data/app/controllers/avo/filters_controller.rb +0 -19
  453. data/app/controllers/avo/resource_overview_controller.rb +0 -24
  454. data/app/views/avo/home/router.html.erb +0 -8
  455. data/app/views/layouts/avo/_javascript.html.erb +0 -8
  456. data/app/views/layouts/avo/_translations.html.erb +0 -5
  457. data/config/webpack/loaders/vue-post-css.js +0 -20
  458. data/config/webpack/loaders/vue-svg.js +0 -21
  459. data/config/webpack/loaders/vue.js +0 -6
  460. data/lib/avo/app/action.rb +0 -156
  461. data/lib/avo/app/app.rb +0 -169
  462. data/lib/avo/app/fields/badge_field.rb +0 -45
  463. data/lib/avo/app/fields/belongs_to.rb +0 -77
  464. data/lib/avo/app/fields/boolean_group_field.rb +0 -38
  465. data/lib/avo/app/fields/code_field.rb +0 -27
  466. data/lib/avo/app/fields/country_field.rb +0 -41
  467. data/lib/avo/app/fields/datetime_field.rb +0 -34
  468. data/lib/avo/app/fields/field.rb +0 -196
  469. data/lib/avo/app/fields/file_field.rb +0 -36
  470. data/lib/avo/app/fields/files_field.rb +0 -42
  471. data/lib/avo/app/fields/has_and_belongs_to_many.rb +0 -48
  472. data/lib/avo/app/fields/has_many.rb +0 -51
  473. data/lib/avo/app/fields/has_one.rb +0 -70
  474. data/lib/avo/app/fields/number_field.rb +0 -29
  475. data/lib/avo/app/fields/select_field.rb +0 -28
  476. data/lib/avo/app/fields/textarea_field.rb +0 -27
  477. data/lib/avo/app/filter.rb +0 -34
  478. data/lib/avo/app/filters/boolean_filter.rb +0 -13
  479. data/lib/avo/app/filters/select_filter.rb +0 -13
  480. data/lib/avo/app/licensing/community_license.rb +0 -4
  481. data/lib/avo/app/licensing/hq.rb +0 -86
  482. data/lib/avo/app/licensing/license.rb +0 -48
  483. data/lib/avo/app/licensing/license_manager.rb +0 -25
  484. data/lib/avo/app/licensing/null_license.rb +0 -12
  485. data/lib/avo/app/licensing/pro_license.rb +0 -9
  486. data/lib/avo/app/resource.rb +0 -233
  487. data/lib/avo/app/resource_actions.rb +0 -18
  488. data/lib/avo/app/resource_fields.rb +0 -26
  489. data/lib/avo/app/resource_filters.rb +0 -18
  490. data/lib/avo/app/resource_grid_fields.rb +0 -30
  491. data/lib/avo/app/services/authorization_service.rb +0 -48
  492. data/lib/avo/app/tool.rb +0 -5
  493. data/lib/generators/avo/templates/filters/boolean_filter.rb +0 -17
  494. data/lib/generators/avo/templates/filters/select_filter.rb +0 -17
  495. data/lib/generators/avo/templates/resource.rb +0 -14
  496. data/lib/generators/avo/templates/views/_footer.html.erb +0 -3
  497. data/lib/generators/avo/templates/views/_header.html.erb +0 -1
  498. data/lib/generators/avo/views_generator.rb +0 -8
  499. data/public/avo-packs/css/application-c9595d99.css +0 -3
  500. data/public/avo-packs/css/application-c9595d99.css.br +0 -0
  501. data/public/avo-packs/css/application-c9595d99.css.gz +0 -0
  502. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js +0 -3
  503. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.LICENSE.txt +0 -767
  504. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.br +0 -0
  505. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.gz +0 -0
  506. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map +0 -1
  507. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map.br +0 -0
  508. data/public/avo-packs/js/application-78fe71b4e59ebc7141f4.js.map.gz +0 -0
  509. data/public/avo-packs/media/font/fontello-068ca2b3.ttf +0 -0
  510. data/public/avo-packs/media/font/fontello-068ca2b3.ttf.br +0 -0
  511. data/public/avo-packs/media/font/fontello-068ca2b3.ttf.gz +0 -0
  512. data/public/avo-packs/media/font/fontello-8d4a4e6f.woff2 +0 -0
  513. data/public/avo-packs/media/font/fontello-9354499c.svg +0 -72
  514. data/public/avo-packs/media/font/fontello-9354499c.svg.br +0 -0
  515. data/public/avo-packs/media/font/fontello-9354499c.svg.gz +0 -0
  516. data/public/avo-packs/media/font/fontello-a782baa8.woff +0 -0
  517. data/public/avo-packs/media/font/fontello-e73a0647.eot +0 -0
  518. data/public/avo-packs/media/font/fontello-e73a0647.eot.br +0 -0
  519. data/public/avo-packs/media/font/fontello-e73a0647.eot.gz +0 -0
  520. data/public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg.br +0 -0
  521. data/public/avo-packs/media/svgs/arrow-circle-right-1ad1e15ec9a7aa54b67d126566a5aa2d.svg.gz +0 -0
  522. data/public/avo-packs/media/svgs/arrow-left-0e8e808ff771a62a348d0232c8ccf539.svg.br +0 -0
  523. data/public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg.br +0 -0
  524. data/public/avo-packs/media/svgs/avocado-bca389be7cf81162df902dfbd09b8adb.svg.gz +0 -0
  525. data/public/avo-packs/media/svgs/check-circle-be9e4dcbd25467ae9a3d3c6c5c7a09fa.svg.br +0 -0
  526. data/public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg.br +0 -0
  527. data/public/avo-packs/media/svgs/chevron-down-01208b17a1f70a1bb8d82bba131da4f4.svg.gz +0 -0
  528. data/public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg.br +0 -0
  529. data/public/avo-packs/media/svgs/chevron-up-25ecf340dd76966d5ed63c85c025befc.svg.gz +0 -0
  530. data/public/avo-packs/media/svgs/code-69010c6ddb6ad50be8677f16468c51f8.svg.br +0 -0
  531. data/public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg.br +0 -0
  532. data/public/avo-packs/media/svgs/color-swatch-60cf90fb6b5386e38f3b003f34e7ecbe.svg.gz +0 -0
  533. data/public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg.br +0 -0
  534. data/public/avo-packs/media/svgs/download-c6ae3f12364a467c28cbf41dc90afbdd.svg.gz +0 -0
  535. data/public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg.br +0 -0
  536. data/public/avo-packs/media/svgs/edit-46c6dbef52ba6ddfc9afbc37186dfa2b.svg.gz +0 -0
  537. data/public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg.br +0 -0
  538. data/public/avo-packs/media/svgs/exclamation-8d1c0baa390a8df9bb52176011eb5892.svg.gz +0 -0
  539. data/public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg.br +0 -1
  540. data/public/avo-packs/media/svgs/eye-cc6f85c70ebed6929712a5c7d51f102d.svg.gz +0 -0
  541. data/public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg.br +0 -0
  542. data/public/avo-packs/media/svgs/filter-0007cddbc85cfe207f9876d4d184444a.svg.gz +0 -0
  543. data/public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg.br +0 -0
  544. data/public/avo-packs/media/svgs/fire-782f08df79993311b6d907e12d9ebe9f.svg.gz +0 -0
  545. data/public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg.br +0 -0
  546. data/public/avo-packs/media/svgs/game-board-6c59fe04181ac9954356c9f1f4d28053.svg.gz +0 -0
  547. data/public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg.br +0 -0
  548. data/public/avo-packs/media/svgs/globe-dfd9977c9d65814d2fc576904406dd08.svg.gz +0 -0
  549. data/public/avo-packs/media/svgs/library-7d391192a15da64fbb527908c9e035c7.svg.br +0 -0
  550. data/public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg.br +0 -2
  551. data/public/avo-packs/media/svgs/photograph-9f37f1f5e6a48e68ce3b7d9cbe7b6fad.svg.gz +0 -0
  552. data/public/avo-packs/media/svgs/plus-530f0af27b9f1a4552454233c2f9a641.svg.br +0 -0
  553. data/public/avo-packs/media/svgs/plus-circle-b379b2a2aa803511ae5945b6fd323204.svg.br +0 -0
  554. data/public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg.br +0 -0
  555. data/public/avo-packs/media/svgs/question-mark-circle-3ece1d61091827910cdd097db711062b.svg.gz +0 -0
  556. data/public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg.br +0 -0
  557. data/public/avo-packs/media/svgs/save-e54acd7ac9646053e36382776f822756.svg.gz +0 -0
  558. data/public/avo-packs/media/svgs/selector-b43b3957d7cc121d06be14312613c218.svg.br +0 -0
  559. data/public/avo-packs/media/svgs/sort-ascending-f5bc0761702809cab20b0ea3065cb88a.svg.br +0 -0
  560. data/public/avo-packs/media/svgs/sort-descending-1c8ddc56c72be6781e59d808f9d06203.svg.br +0 -0
  561. data/public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg.br +0 -2
  562. data/public/avo-packs/media/svgs/switch-horizontal-d23337f0fb533a86d14b746d25ad48ae.svg.gz +0 -0
  563. data/public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg.br +0 -0
  564. data/public/avo-packs/media/svgs/thumbs-down-44f83eacbf5b8fe0f2f085da75866ce0.svg.gz +0 -0
  565. data/public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg.br +0 -4
  566. data/public/avo-packs/media/svgs/thumbs-up-b866900017db179b50d6b19a1424ed25.svg.gz +0 -0
  567. data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg +0 -1
  568. data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg.br +0 -0
  569. data/public/avo-packs/media/svgs/times-539256e95a00360c3bbc6160c6b695cd.svg.gz +0 -0
  570. data/public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg.br +0 -0
  571. data/public/avo-packs/media/svgs/trash-a61412a066e358bcc24494a5080b7255.svg.gz +0 -0
  572. data/public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg.br +0 -1
  573. data/public/avo-packs/media/svgs/view-grid-393669034db69f59497616d5416ae411.svg.gz +0 -0
  574. data/public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg.br +0 -0
  575. data/public/avo-packs/media/svgs/view-grid-add-d0ee477a044e5d46c0c62af66cb6de77.svg.gz +0 -0
  576. data/public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg.br +0 -3
  577. data/public/avo-packs/media/svgs/view-list-8a7a159ca5d892f72cf8c6744a2074e2.svg.gz +0 -0
  578. data/public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg.br +0 -0
  579. data/public/avo-packs/media/svgs/x-circle-c540f9ccfe937ad9b4f662e0b65e47e2.svg.gz +0 -0
@@ -0,0 +1,115 @@
1
+ module Avo
2
+ class BaseAction
3
+ class_attribute :name, default: self.class.to_s.demodulize.underscore.humanize(keep_id_suffix: true)
4
+ class_attribute :message, default: I18n.t('avo.are_you_sure_you_want_to_run_this_option')
5
+ class_attribute :confirm_text, default: I18n.t('avo.run')
6
+ class_attribute :cancel_text, default: I18n.t('avo.cancel')
7
+ class_attribute :no_confirmation, default: false
8
+
9
+ attr_accessor :response
10
+ attr_accessor :model
11
+ attr_accessor :resource
12
+ attr_accessor :user
13
+
14
+ attr_accessor :field_loader
15
+
16
+ alias :field :field_loader
17
+ alias :f :field
18
+
19
+ def initialize
20
+ @fields ||= []
21
+ @response ||= {}
22
+ @response[:message_type] ||= :notice
23
+ @response[:message] ||= I18n.t('avo.action_ran_successfully')
24
+ end
25
+
26
+ def boot_fields(request)
27
+ @field_loader = Avo::Loaders::FieldsLoader.new
28
+ fields request if self.respond_to? :fields
29
+ end
30
+
31
+ def get_fields(view_type: :table)
32
+ get_field_definitions.map do |field|
33
+ field.hydrate(action: self, model: @model)
34
+ end
35
+ .select do |field|
36
+ field.can_see.present? ? field.can_see.call : true
37
+ end
38
+ end
39
+
40
+ def get_field_definitions
41
+ @field_loader.bag.map do |field|
42
+ field.hydrate(action: self)
43
+ end
44
+ end
45
+
46
+ def hydrate(model: nil, resource: nil, user: nil)
47
+ @model = model if model.present?
48
+ @resource = resource if resource.present?
49
+ @user = user if user.present?
50
+
51
+ self
52
+ end
53
+
54
+ def handle_action(request, models, raw_fields)
55
+ avo_fields = get_fields.map { |field| [field.id, field] }.to_h
56
+
57
+ if raw_fields.present?
58
+ fields = raw_fields.to_unsafe_h.map do |name, value|
59
+ [name, avo_fields[name.to_sym].resolve_attribute(value)]
60
+ end
61
+
62
+ fields = fields.to_h
63
+ else
64
+ fields = {}
65
+ end
66
+
67
+ result = self.handle request, models, fields
68
+
69
+ self
70
+ end
71
+
72
+ def param_id
73
+ self.class.to_s.demodulize.underscore.gsub '/', '_'
74
+ end
75
+
76
+ def succeed(text)
77
+ self.response[:message_type] = :notice
78
+ self.response[:message] = text
79
+
80
+ self
81
+ end
82
+
83
+ def fail(text)
84
+ self.response[:message_type] = :alert
85
+ self.response[:message] = text
86
+
87
+ self
88
+ end
89
+
90
+ def redirect_to(path = nil, &block)
91
+ self.response[:type] = :redirect
92
+ if block.present?
93
+ self.response[:path] = block
94
+ else
95
+ self.response[:path] = path
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ def reload
102
+ self.response[:type] = :reload
103
+
104
+ self
105
+ end
106
+
107
+ def download(path, filename)
108
+ self.response[:type] = :download
109
+ self.response[:path] = path
110
+ self.response[:filename] = filename
111
+
112
+ self
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,321 @@
1
+ module Avo
2
+ class BaseResource
3
+ extend ActiveSupport::DescendantsTracker
4
+
5
+ attr_accessor :view
6
+ attr_accessor :model
7
+ attr_accessor :user
8
+ attr_accessor :params
9
+
10
+ class_attribute :id, default: :id
11
+ class_attribute :title, default: :id
12
+ class_attribute :search, default: [:id]
13
+ class_attribute :includes, default: []
14
+ class_attribute :translation_key
15
+ class_attribute :default_view_type, default: :table
16
+ class_attribute :devise_password_optional, default: false
17
+ class_attribute :fields_loader
18
+ class_attribute :actions_loader
19
+ class_attribute :filters_loader
20
+ class_attribute :grid_cover_loader
21
+ class_attribute :grid_title_loader
22
+ class_attribute :grid_body_loader
23
+
24
+ class << self
25
+ def fields(&block)
26
+ self.fields_loader ||= Avo::Loaders::FieldsLoader.new
27
+
28
+ yield(fields_loader)
29
+ end
30
+
31
+ def actions(&block)
32
+ self.actions_loader ||= Avo::Loaders::ActionsLoader.new
33
+
34
+ yield(actions_loader)
35
+ end
36
+
37
+ def filters(&block)
38
+ self.filters_loader ||= Avo::Loaders::FiltersLoader.new
39
+
40
+ yield(filters_loader)
41
+ end
42
+
43
+ def grid(&block)
44
+ self.grid_cover_loader ||= Avo::Loaders::FieldsLoader.new
45
+ self.grid_title_loader ||= Avo::Loaders::FieldsLoader.new
46
+ self.grid_body_loader ||= Avo::Loaders::FieldsLoader.new
47
+
48
+ yield(grid_cover_loader, grid_title_loader, grid_body_loader)
49
+ end
50
+
51
+ def context
52
+ App.context
53
+ end
54
+ end
55
+
56
+ def hydrate(model: nil, view: nil, user: nil, params: nil)
57
+ @view = view if view.present?
58
+ @user = user if user.present?
59
+ @params = params if params.present?
60
+
61
+ if model.present?
62
+ @model = model
63
+
64
+ hydrate_model_with_default_values if @view == :new
65
+ end
66
+
67
+ self
68
+ end
69
+
70
+ def get_fields(panel: nil, reflection: nil)
71
+ fields = get_field_definitions.select do |field|
72
+ field.send("show_on_#{@view.to_s}")
73
+ end
74
+ .select do |field|
75
+ field.can_see.present? ? field.can_see.call : true
76
+ end
77
+ .select do |field|
78
+ unless field.respond_to?(:foreign_key) &&
79
+ reflection.present? &&
80
+ reflection.respond_to?(:foreign_key) &&
81
+ reflection.foreign_key == field.foreign_key
82
+ true
83
+ end
84
+ end
85
+
86
+ if panel.present?
87
+ fields = fields.select do |field|
88
+ field.panel_name == panel
89
+ end
90
+ end
91
+
92
+ fields = fields.map do |field|
93
+ field.hydrate(model: @model, view: @view, resource: self)
94
+ end
95
+
96
+ fields
97
+ end
98
+
99
+ def get_grid_fields
100
+ return if self.class.grid_title_loader.blank?
101
+
102
+ card = {
103
+ cover: [*self.class.grid_cover_loader.bag],
104
+ title: [*self.class.grid_title_loader.bag],
105
+ body: [*self.class.grid_body_loader.bag],
106
+ }
107
+
108
+ card.each do |section, fields|
109
+ fields = fields.map do |field|
110
+ field.hydrate(model: @model, view: @view, resource: self)
111
+ end
112
+ end
113
+ end
114
+
115
+ def get_filters
116
+ return [] if self.class.filters_loader.blank?
117
+
118
+ self.class.filters_loader.bag
119
+ end
120
+
121
+ def get_actions
122
+ return [] if self.class.actions_loader.blank?
123
+
124
+ self.class.actions_loader.bag
125
+ end
126
+
127
+ def get_field_definitions
128
+ self.class.fields_loader.bag.map do |field|
129
+ field.hydrate(resource: self, panel_name: default_panel_name, user: user)
130
+ end
131
+ end
132
+
133
+ def default_panel_name
134
+ return @params[:related_name].capitalize if @params[:related_name].present?
135
+
136
+ case @view
137
+ when :show
138
+ I18n.t('avo.resource_details', item: self.name.downcase, title: model_title).upcase_first
139
+ when :edit
140
+ I18n.t('avo.update_item', item: self.name.downcase, title: model_title).upcase_first
141
+ when :new
142
+ I18n.t('avo.create_new_item', item: self.name.downcase).upcase_first
143
+ end
144
+ end
145
+
146
+ def panels
147
+ panels = [
148
+ {
149
+ name: default_panel_name,
150
+ type: :fields,
151
+ in_panel: true,
152
+ }
153
+ ]
154
+
155
+ panels
156
+ end
157
+
158
+ def model_class
159
+ return @model.class if @model.present?
160
+
161
+ self.class.name.demodulize.chomp('Resource').safe_constantize
162
+ end
163
+
164
+ def model_title
165
+ return @model.send title if @model.present?
166
+
167
+ name
168
+ end
169
+
170
+ def name
171
+ return @name if @name.present?
172
+
173
+ return I18n.t(@translation_key, count: 1).capitalize if @translation_key
174
+
175
+ self.class.name.demodulize.chomp('Resource').titlecase
176
+ end
177
+
178
+ def singular_name
179
+ name
180
+ end
181
+
182
+ def plural_name
183
+ return I18n.t(@translation_key, count: 2).capitalize if @translation_key
184
+
185
+ name.pluralize
186
+ end
187
+
188
+ def underscore_name
189
+ return @name if @name.present?
190
+
191
+ self.class.name.demodulize.underscore
192
+ end
193
+
194
+ def available_view_types
195
+ view_types = [:table]
196
+
197
+ view_types << :grid if get_grid_fields.present?
198
+
199
+ view_types
200
+ end
201
+
202
+ def route_key
203
+ model_class.model_name.route_key
204
+ end
205
+
206
+ def context
207
+ App.context
208
+ end
209
+
210
+ # def fields
211
+ # raise NotImplementedError
212
+ # end
213
+
214
+ def query_search(query: '', via_resource_name: , via_resource_id:, user:)
215
+ # model_class = self.model
216
+
217
+ db_query = AuthorizationService.apply_policy(user, model_class)
218
+
219
+ if via_resource_name.present?
220
+ related_model = App.get_resource_by_name(via_resource_name).model
221
+
222
+ db_query = related_model.find(via_resource_id).public_send(self.plural_name.downcase)
223
+ end
224
+
225
+ new_query = []
226
+
227
+ [self.search].flatten.each_with_index do |search_by, index|
228
+ new_query.push 'or' if index != 0
229
+
230
+ new_query.push "text(#{search_by}) ILIKE '%#{query}%'"
231
+ end
232
+
233
+ db_query.where(new_query.join(' '))
234
+ end
235
+
236
+ def attached_file_fields
237
+ get_field_definitions.select do |field|
238
+ [Avo::Fields::FileField, Avo::Fields::FilesField].include? field.class
239
+ end
240
+ end
241
+
242
+ def fill_model(model, params)
243
+ # Map the received params to their actual fields
244
+ fields_by_database_id = self.get_field_definitions.map { |field| [field.database_id(model).to_s, field] }.to_h
245
+
246
+ params.each do |key, value|
247
+ field = fields_by_database_id[key]
248
+
249
+ next unless field
250
+
251
+ model = field.fill_field model, key, value
252
+ end
253
+
254
+ model
255
+ end
256
+
257
+ def authorization
258
+ Avo::Services::AuthorizationService.new(user, model)
259
+ end
260
+
261
+ def file_hash
262
+ content_to_be_hashed = ''
263
+
264
+ # resource file hash
265
+ resource_path = Rails.root.join('app', 'avo', 'resources', "#{name.underscore}.rb").to_s
266
+ if File.file? resource_path
267
+ content_to_be_hashed += File.read(resource_path)
268
+ end
269
+
270
+ # policy file hash
271
+ policy_path = Rails.root.join('app', 'policies', "#{name.underscore}_policy.rb").to_s
272
+ if File.file? policy_path
273
+ content_to_be_hashed += File.read(policy_path)
274
+ end
275
+
276
+ Digest::MD5.hexdigest(content_to_be_hashed)
277
+ end
278
+
279
+ def cache_hash(parent_model)
280
+ if parent_model.present?
281
+ [self.model, self.file_hash, parent_model]
282
+ else
283
+ [self.model, self.file_hash]
284
+ end
285
+ end
286
+
287
+ # For :new views we're hydrating the model with the values from the resource's default attribute.
288
+ # We will not overwrite any attributes that come pre-filled in the model.
289
+ def hydrate_model_with_default_values
290
+ default_values = get_fields.select do |field|
291
+ !field.computed
292
+ end
293
+ .map do |field|
294
+ id = field.id
295
+ value = field.value
296
+
297
+ if field.respond_to? :foreign_key
298
+ id = field.foreign_key.to_sym
299
+
300
+ reflection = @model._reflections[@params[:via_relation]]
301
+
302
+ if reflection.present? && reflection.foreign_key.present?
303
+ value = @params[:via_resource_id]
304
+ end
305
+ end
306
+
307
+ [id, value]
308
+ end
309
+ .to_h
310
+ .select do |id, value|
311
+ value.present?
312
+ end
313
+
314
+ default_values.each do |id, value|
315
+ if @model.send(id).nil?
316
+ @model.send("#{id}=", value)
317
+ end
318
+ end
319
+ end
320
+ end
321
+ end
@@ -16,6 +16,11 @@ module Avo
16
16
  attr_accessor :authorization_methods
17
17
  attr_accessor :authenticate
18
18
  attr_accessor :current_user
19
+ attr_accessor :id_links_to_resource
20
+ attr_accessor :full_width_container
21
+ attr_accessor :full_width_index_view
22
+ attr_accessor :cache_resources_on_index_view
23
+ attr_accessor :context
19
24
 
20
25
  def initialize
21
26
  @root_path = '/avo'
@@ -42,6 +47,11 @@ module Avo
42
47
  create: 'create?',
43
48
  destroy: 'destroy?',
44
49
  }
50
+ @id_links_to_resource = false
51
+ @full_width_container = false
52
+ @full_width_index_view = false
53
+ @cache_resources_on_index_view = Avo::PACKED
54
+ @context = proc {}
45
55
  end
46
56
 
47
57
  def locale_tag
@@ -63,6 +73,10 @@ module Avo
63
73
  def authenticate_with(&block)
64
74
  @authenticate = block if block.present?
65
75
  end
76
+
77
+ def set_context(&block)
78
+ @context = block if block.present?
79
+ end
66
80
  end
67
81
 
68
82
  def self.configuration