avo 0.5.0.beta3 → 0.5.0.beta8

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 (293) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -6
  3. data/Gemfile.lock +28 -22
  4. data/app/components/avo/common/badge_viewer_component.html.erb +1 -1
  5. data/app/components/avo/common/gravatar_viewer_component.html.erb +2 -2
  6. data/app/components/avo/common/gravatar_viewer_component.rb +2 -1
  7. data/app/components/avo/edit/fields/trix_field_component.html.erb +1 -1
  8. data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
  9. data/app/components/avo/index/fields/belongs_to_field_component.html.erb +1 -5
  10. data/app/components/avo/index/fields/boolean_group_field_component.html.erb +1 -1
  11. data/app/components/avo/index/fields/gravatar_field_component.html.erb +2 -1
  12. data/app/components/avo/index/fields/has_one_field_component.html.erb +1 -5
  13. data/app/components/avo/index/fields/id_field_component.html.erb +1 -1
  14. data/app/components/avo/index/grid_item_component.html.erb +8 -8
  15. data/app/components/avo/index/grid_item_component.rb +6 -12
  16. data/app/components/avo/index/resource_controls_component.html.erb +12 -4
  17. data/app/components/avo/index/resource_grid_component.html.erb +1 -1
  18. data/app/components/avo/index/resource_table_component.html.erb +2 -2
  19. data/app/components/avo/index/table_row_component.html.erb +1 -1
  20. data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
  21. data/app/components/avo/show/fields/boolean_group_field_component.html.erb +1 -1
  22. data/app/components/avo/show/fields/external_image_field_component.html.erb +1 -1
  23. data/app/components/avo/views/resource_show_component.html.erb +14 -2
  24. data/app/controllers/avo/actions_controller.rb +6 -8
  25. data/app/controllers/avo/application_controller.rb +30 -6
  26. data/app/controllers/avo/base_controller.rb +5 -16
  27. data/app/controllers/avo/relations_controller.rb +2 -2
  28. data/app/controllers/avo/search_controller.rb +1 -1
  29. data/app/helpers/avo/application_helper.rb +1 -1
  30. data/app/{frontend/css → packs/entrypoints}/application.css +12 -11
  31. data/app/{frontend/packs → packs/entrypoints}/application.js +4 -3
  32. data/app/{frontend → packs}/fonts/nunito-v16-latin-700.eot +0 -0
  33. data/app/{frontend → packs}/fonts/nunito-v16-latin-700.svg +0 -0
  34. data/app/{frontend → packs}/fonts/nunito-v16-latin-700.ttf +0 -0
  35. data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff +0 -0
  36. data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff2 +0 -0
  37. data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.eot +0 -0
  38. data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.svg +0 -0
  39. data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.ttf +0 -0
  40. data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff +0 -0
  41. data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff2 +0 -0
  42. data/app/{frontend → packs}/images/logo.png +0 -0
  43. data/app/{frontend → packs}/importmap.json.erb +0 -0
  44. data/app/{frontend → packs}/js/controllers/action_controller.js +0 -0
  45. data/app/{frontend → packs}/js/controllers/actions_picker_controller.js +0 -0
  46. data/app/{frontend → packs}/js/controllers/alerts_controller.js +0 -0
  47. data/app/{frontend → packs}/js/controllers/attachments_controller.js +0 -0
  48. data/app/{frontend → packs}/js/controllers/boolean_filter_controller.js +0 -0
  49. data/app/{frontend → packs}/js/controllers/fields/code_field_controller.js +0 -0
  50. data/app/{frontend → packs}/js/controllers/fields/date_field_controller.js +0 -0
  51. data/app/{frontend → packs}/js/controllers/fields/simple_mde_controller.js +0 -0
  52. data/app/{frontend → packs}/js/controllers/filter_controller.js +19 -3
  53. data/app/{frontend → packs}/js/controllers/hidden_input_controller.js +0 -0
  54. data/app/{frontend → packs}/js/controllers/item_selector_controller.js +0 -0
  55. data/app/{frontend → packs}/js/controllers/modal_controller.js +0 -0
  56. data/app/{frontend → packs}/js/controllers/per_page_controller.js +5 -1
  57. data/app/{frontend → packs}/js/controllers/select_filter_controller.js +0 -0
  58. data/app/{frontend → packs}/js/controllers/tippy_controller.js +0 -0
  59. data/app/{frontend → packs}/js/controllers/toggle_panel_controller.js +0 -0
  60. data/app/{frontend → packs}/js/helpers/cast_boolean.js +0 -0
  61. data/app/{frontend → packs}/js/toastr.js +0 -0
  62. data/app/{frontend/css → packs/stylesheets}/alerts.css +0 -0
  63. data/app/{frontend/css → packs/stylesheets}/components/code.css +0 -0
  64. data/app/{frontend/css → packs/stylesheets}/components/status.css +0 -0
  65. data/app/{frontend/css → packs/stylesheets}/fonts.css +0 -0
  66. data/app/{frontend/css → packs/stylesheets}/loader.css +0 -0
  67. data/app/{frontend/css → packs/stylesheets}/pagination.css +0 -0
  68. data/app/{frontend/css → packs/stylesheets}/tailwindcss/base.css +0 -0
  69. data/app/{frontend/css → packs/stylesheets}/tailwindcss/components.css +0 -0
  70. data/app/{frontend/css → packs/stylesheets}/tailwindcss/utilities.css +0 -0
  71. data/app/{frontend/css → packs/stylesheets}/tooltips.css +0 -0
  72. data/app/{frontend/css → packs/stylesheets}/typography.css +0 -0
  73. data/app/{frontend → packs}/svgs/arrow-circle-right.svg +0 -0
  74. data/app/{frontend → packs}/svgs/arrow-left.svg +0 -0
  75. data/app/{frontend → packs}/svgs/avocado.svg +0 -0
  76. data/app/{frontend → packs}/svgs/badge-check-sm.svg +0 -0
  77. data/app/{frontend → packs}/svgs/check-circle.svg +0 -0
  78. data/app/{frontend → packs}/svgs/chevron-down.svg +0 -0
  79. data/app/{frontend → packs}/svgs/chevron-up.svg +0 -0
  80. data/app/{frontend → packs}/svgs/code.svg +0 -0
  81. data/app/{frontend → packs}/svgs/color-swatch.svg +0 -0
  82. data/app/{frontend → packs}/svgs/document-text.svg +0 -0
  83. data/app/{frontend → packs}/svgs/download.svg +0 -0
  84. data/app/{frontend → packs}/svgs/edit.svg +0 -0
  85. data/app/{frontend → packs}/svgs/exclamation-circle-sm.svg +0 -0
  86. data/app/{frontend → packs}/svgs/exclamation-sm.svg +0 -0
  87. data/app/{frontend → packs}/svgs/exclamation.svg +0 -0
  88. data/app/{frontend → packs}/svgs/eye.svg +0 -0
  89. data/app/{frontend → packs}/svgs/filter.svg +0 -0
  90. data/app/{frontend → packs}/svgs/fire.svg +0 -0
  91. data/app/{frontend → packs}/svgs/game-board.svg +0 -0
  92. data/app/{frontend → packs}/svgs/globe.svg +0 -0
  93. data/app/{frontend → packs}/svgs/information-circle-sm.svg +0 -0
  94. data/app/{frontend → packs}/svgs/information-circle.svg +0 -0
  95. data/app/{frontend → packs}/svgs/library.svg +0 -0
  96. data/app/{frontend → packs}/svgs/photograph.svg +0 -0
  97. data/app/{frontend → packs}/svgs/play.svg +0 -0
  98. data/app/{frontend → packs}/svgs/plus-circle.svg +0 -0
  99. data/app/{frontend → packs}/svgs/plus.svg +0 -0
  100. data/app/{frontend → packs}/svgs/question-mark-circle.svg +0 -0
  101. data/app/{frontend → packs}/svgs/save.svg +0 -0
  102. data/app/{frontend → packs}/svgs/selector.svg +0 -0
  103. data/app/{frontend → packs}/svgs/sort-ascending.svg +0 -0
  104. data/app/{frontend → packs}/svgs/sort-descending.svg +0 -0
  105. data/app/{frontend → packs}/svgs/switch-horizontal.svg +0 -0
  106. data/app/{frontend → packs}/svgs/thumbs-down.svg +0 -0
  107. data/app/{frontend → packs}/svgs/thumbs-up.svg +0 -0
  108. data/app/{frontend → packs}/svgs/times.svg +0 -0
  109. data/app/{frontend → packs}/svgs/trash-sm.svg +0 -0
  110. data/app/{frontend → packs}/svgs/trash.svg +0 -0
  111. data/app/{frontend → packs}/svgs/view-grid-add.svg +0 -0
  112. data/app/{frontend → packs}/svgs/view-grid.svg +0 -0
  113. data/app/{frontend → packs}/svgs/view-list.svg +0 -0
  114. data/app/{frontend → packs}/svgs/x-circle.svg +0 -0
  115. data/app/views/avo/actions/show.html.erb +3 -39
  116. data/app/views/avo/attachments/show.html.erb +8 -1
  117. data/app/views/avo/base/_actions.html.erb +0 -6
  118. data/app/views/avo/base/_boolean_filter.html.erb +2 -1
  119. data/app/views/avo/base/_filters.html.erb +4 -11
  120. data/app/views/avo/base/_select_filter.html.erb +2 -1
  121. data/app/views/avo/home/_resources.html.erb +0 -1
  122. data/app/views/avo/partials/_paginator.html.erb +24 -5
  123. data/app/views/avo/relations/new.html.erb +5 -1
  124. data/app/views/layouts/avo/_filter_wrapper.html.erb +1 -1
  125. data/avo.gemspec +1 -1
  126. data/bin/helpers.rb +0 -0
  127. data/bin/rspec +1 -0
  128. data/bin/webpack +2 -1
  129. data/config/webpack/aliases.js +1 -1
  130. data/config/webpack/base.js +14 -0
  131. data/config/webpack/development.js +2 -2
  132. data/config/webpack/production.js +2 -2
  133. data/config/webpack/test.js +2 -2
  134. data/config/webpacker.yml +10 -62
  135. data/db/factories.rb +1 -0
  136. data/lib/avo.rb +5 -16
  137. data/lib/avo/action_model.rb +20 -0
  138. data/lib/avo/app.rb +162 -0
  139. data/lib/avo/base_action.rb +126 -0
  140. data/lib/avo/base_resource.rb +301 -0
  141. data/lib/avo/configuration.rb +6 -4
  142. data/lib/avo/engine.rb +17 -20
  143. data/lib/avo/{app/fields → fields}/badge_field.rb +1 -1
  144. data/lib/avo/{app/fields/field.rb → fields/base_field.rb} +22 -16
  145. data/lib/avo/{app/fields/belongs_to.rb → fields/belongs_to_field.rb} +3 -3
  146. data/lib/avo/{app/fields → fields}/boolean_field.rb +1 -1
  147. data/lib/avo/{app/fields → fields}/boolean_group_field.rb +1 -1
  148. data/lib/avo/{app/fields → fields}/code_field.rb +1 -1
  149. data/lib/avo/{app/fields → fields}/country_field.rb +1 -1
  150. data/lib/avo/{app/fields → fields}/currency_field.rb +1 -1
  151. data/lib/avo/{app/fields → fields}/date_field.rb +0 -2
  152. data/lib/avo/{app/fields → fields}/date_time_field.rb +0 -2
  153. data/lib/avo/{app/fields → fields}/external_image_field.rb +1 -1
  154. data/lib/avo/{app/fields → fields}/field_extensions/has_field_name.rb +2 -9
  155. data/lib/avo/{app/fields → fields}/field_extensions/visible_in_different_views.rb +1 -1
  156. data/lib/avo/{app/fields → fields}/file_field.rb +1 -2
  157. data/lib/avo/{app/fields → fields}/files_field.rb +1 -2
  158. data/lib/avo/{app/fields → fields}/gravatar_field.rb +2 -2
  159. data/lib/avo/{app/fields/has_and_belongs_to_many.rb → fields/has_and_belongs_to_many_field.rb} +1 -1
  160. data/lib/avo/{app/fields/has_many.rb → fields/has_many_field.rb} +1 -1
  161. data/lib/avo/{app/fields/has_one.rb → fields/has_one_field.rb} +1 -1
  162. data/lib/avo/{app/fields → fields}/heading_field.rb +1 -1
  163. data/lib/avo/{app/fields → fields}/hidden_field.rb +0 -2
  164. data/lib/avo/{app/fields → fields}/id_field.rb +1 -1
  165. data/lib/avo/{app/fields → fields}/key_value_field.rb +1 -1
  166. data/lib/avo/{app/fields → fields}/markdown_field.rb +1 -3
  167. data/lib/avo/{app/fields → fields}/number_field.rb +0 -2
  168. data/lib/avo/{app/fields → fields}/password_field.rb +0 -2
  169. data/lib/avo/{app/fields → fields}/select_field.rb +1 -1
  170. data/lib/avo/{app/fields → fields}/status_field.rb +1 -1
  171. data/lib/avo/{app/fields → fields}/text_field.rb +1 -1
  172. data/lib/avo/{app/fields → fields}/textarea_field.rb +0 -2
  173. data/lib/avo/{app/fields → fields}/trix_field.rb +1 -3
  174. data/lib/avo/fields_collector.rb +31 -0
  175. data/lib/avo/filters/base_filter.rb +20 -0
  176. data/lib/avo/filters/boolean_filter.rb +7 -0
  177. data/lib/avo/filters/select_filter.rb +7 -0
  178. data/lib/avo/grid_collector.rb +39 -0
  179. data/lib/avo/{app/grid_fields → grid_fields}/body_field.rb +0 -2
  180. data/lib/avo/{app/grid_fields → grid_fields}/grid_field.rb +0 -0
  181. data/lib/avo/{app/grid_fields → grid_fields}/preview_field.rb +0 -2
  182. data/lib/avo/{app/grid_fields → grid_fields}/title_field.rb +0 -2
  183. data/lib/avo/has_context.rb +7 -0
  184. data/lib/avo/licensing/community_license.rb +6 -0
  185. data/lib/avo/licensing/h_q.rb +88 -0
  186. data/lib/avo/licensing/license.rb +50 -0
  187. data/lib/avo/licensing/license_manager.rb +22 -0
  188. data/lib/avo/licensing/null_license.rb +14 -0
  189. data/lib/avo/licensing/pro_license.rb +11 -0
  190. data/lib/avo/loaders/actions_loader.rb +6 -0
  191. data/lib/avo/loaders/fields_loader.rb +27 -0
  192. data/lib/avo/loaders/filters_loader.rb +6 -0
  193. data/lib/avo/loaders/loader.rb +15 -0
  194. data/lib/avo/services/authorization_service.rb +93 -0
  195. data/lib/avo/services/panel_service.rb +27 -0
  196. data/lib/avo/{app/tools_manager.rb → tools_manager.rb} +0 -0
  197. data/lib/avo/version.rb +1 -1
  198. data/lib/generators/avo/action_generator.rb +11 -5
  199. data/lib/generators/avo/controller_generator.rb +14 -8
  200. data/lib/generators/avo/filter_generator.rb +14 -8
  201. data/lib/generators/avo/install_generator.rb +14 -10
  202. data/lib/generators/avo/locales_generator.rb +11 -7
  203. data/lib/generators/avo/partials_generator.rb +11 -5
  204. data/lib/generators/avo/resource_generator.rb +33 -15
  205. data/lib/generators/avo/templates/{action.rb → action.tt} +4 -6
  206. data/lib/generators/avo/templates/filters/boolean_filter.tt +11 -0
  207. data/lib/generators/avo/templates/filters/select_filter.tt +11 -0
  208. data/lib/generators/avo/templates/initializer/{avo.rb → avo.tt} +6 -0
  209. data/lib/generators/avo/templates/resource/controller.tt +2 -0
  210. data/lib/generators/avo/templates/resource/resource.tt +17 -0
  211. data/public/avo-packs/css/application-5bb09ba4.css +6024 -0
  212. data/public/avo-packs/css/application-5bb09ba4.css.br +0 -0
  213. data/public/avo-packs/css/application-5bb09ba4.css.gz +0 -0
  214. data/public/avo-packs/css/application-5bb09ba4.css.map +1 -0
  215. data/public/avo-packs/css/application-5bb09ba4.css.map.br +0 -0
  216. data/public/avo-packs/css/application-5bb09ba4.css.map.gz +0 -0
  217. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js +2 -0
  218. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.br +0 -0
  219. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.gz +0 -0
  220. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map +1 -0
  221. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br +0 -0
  222. data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz +0 -0
  223. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js +26 -0
  224. data/public/avo-packs/js/{application-6ba2bd1bca05d69b96e0.js.LICENSE.txt → application-86a3ea5a835b0c758203.js.LICENSE.txt} +17 -17
  225. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.br +0 -0
  226. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.gz +0 -0
  227. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map +1 -0
  228. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map.br +0 -0
  229. data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map.gz +0 -0
  230. data/public/avo-packs/manifest.json +46 -23
  231. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg → images/13ae283c0d7cc04efe7e.svg} +0 -0
  232. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.br → images/13ae283c0d7cc04efe7e.svg.br} +0 -0
  233. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.gz → images/13ae283c0d7cc04efe7e.svg.gz} +0 -0
  234. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg → images/195026a50008c53526ef.svg} +0 -0
  235. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.br → images/195026a50008c53526ef.svg.br} +0 -0
  236. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.gz → images/195026a50008c53526ef.svg.gz} +0 -0
  237. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-cb632c9fe211ba2c2bf1564c9a9295cc.woff → images/1f30e08faa7c60d1f7ac.woff} +0 -0
  238. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf → images/1fd17dabf6b7d2b15348.ttf} +0 -0
  239. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.br → images/1fd17dabf6b7d2b15348.ttf.br} +0 -0
  240. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.gz → images/1fd17dabf6b7d2b15348.ttf.gz} +0 -0
  241. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-bcf84d6cb8a0ac214c8c14ba9af834f3.woff2 → images/39a18f443d434999b89b.woff2} +0 -0
  242. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-412073df419ad5f6f8f2ea76eb4aced9.woff2 → images/4ad349571e28bb59c5a5.woff2} +0 -0
  243. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-2fae1e2418251b68fe5d0505ab93dd5c.eot → images/57a5470848663767abbf.eot} +0 -0
  244. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf → images/b2e4cf0fab6c8ca66b7f.ttf} +0 -0
  245. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.br → images/b2e4cf0fab6c8ca66b7f.ttf.br} +0 -0
  246. data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.gz → images/b2e4cf0fab6c8ca66b7f.ttf.gz} +0 -0
  247. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-df7e79af617f98cd3b95d320e8b2a1af.eot → images/b78d61ab7e046de8c156.eot} +0 -0
  248. data/public/avo-packs/media/{fonts/nunito-v16-latin-700-7c472b19cb573f537bad8ef62ca917ac.woff → images/c9ab29becb76ddab01d0.woff} +0 -0
  249. data/public/avo-packs/media/images/{logo-edf8d8d0d263e0c1f73bb32a222d9991.png → f1b4befac91a3336db9a.png} +0 -0
  250. metadata +195 -193
  251. data/app/views/layouts/avo/application_vue.html.erb +0 -61
  252. data/config/webpack/environment.js +0 -18
  253. data/config/webpacker_packed.yml +0 -86
  254. data/db/migrate/20210305082639_add_url_to_teams.rb +0 -5
  255. data/lib/avo/app/action.rb +0 -145
  256. data/lib/avo/app/actions_loader.rb +0 -11
  257. data/lib/avo/app/app.rb +0 -183
  258. data/lib/avo/app/fields_loader.rb +0 -29
  259. data/lib/avo/app/filter.rb +0 -23
  260. data/lib/avo/app/filters/boolean_filter.rb +0 -13
  261. data/lib/avo/app/filters/select_filter.rb +0 -13
  262. data/lib/avo/app/licensing/community_license.rb +0 -4
  263. data/lib/avo/app/licensing/hq.rb +0 -86
  264. data/lib/avo/app/licensing/license.rb +0 -48
  265. data/lib/avo/app/licensing/license_manager.rb +0 -25
  266. data/lib/avo/app/licensing/null_license.rb +0 -12
  267. data/lib/avo/app/licensing/pro_license.rb +0 -9
  268. data/lib/avo/app/resource.rb +0 -291
  269. data/lib/avo/app/resource_grid_fields.rb +0 -30
  270. data/lib/avo/app/services/authorization_service.rb +0 -110
  271. data/lib/avo/app/services/panel_service.rb +0 -25
  272. data/lib/avo/app/tool.rb +0 -5
  273. data/lib/generators/avo/templates/filters/boolean_filter.rb +0 -17
  274. data/lib/generators/avo/templates/filters/select_filter.rb +0 -17
  275. data/lib/generators/avo/templates/resource/%plural_name%_controller.tt +0 -2
  276. data/lib/generators/avo/templates/resource/%singular_name%.tt +0 -20
  277. data/public/avo-packs/css/application-3598cfbb.css +0 -6
  278. data/public/avo-packs/css/application-3598cfbb.css.br +0 -0
  279. data/public/avo-packs/css/application-3598cfbb.css.gz +0 -0
  280. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js +0 -2
  281. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.br +0 -0
  282. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.gz +0 -0
  283. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map +0 -1
  284. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.br +0 -0
  285. data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.gz +0 -0
  286. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js +0 -26
  287. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js.br +0 -0
  288. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js.gz +0 -0
  289. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js.map +0 -1
  290. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js.map.br +0 -0
  291. data/public/avo-packs/js/application-6ba2bd1bca05d69b96e0.js.map.gz +0 -0
  292. data/public/avo-packs/manifest.json.br +0 -0
  293. data/public/avo-packs/manifest.json.gz +0 -0
@@ -1,10 +1,10 @@
1
1
  <div class="w-full">
2
2
  <% if @resources.present?%>
3
3
  <table class="w-full px-4 overflow-hidden">
4
- <%= render partial: 'avo/partials/table_header', locals: {fields: @resource.get_fields(view_type: :table, reflection: @reflection)} %>
4
+ <%= render partial: 'avo/partials/table_header', locals: {fields: @resource.get_fields(reflection: @reflection)} %>
5
5
  <tbody>
6
6
  <% @resources.each_with_index do |resource, index| %>
7
- <% cache_if Avo.configuration.cache_resources_on_index_view, [resource.model, resource.file_hash] do %>
7
+ <% cache_if Avo.configuration.cache_resources_on_index_view, resource.cache_hash(@parent_model) do %>
8
8
  <%= render Avo::Index::TableRowComponent.new(resource: resource, reflection: @reflection, parent_model: @parent_model) %>
9
9
  <% end %>
10
10
  <% end %>
@@ -7,7 +7,7 @@
7
7
  <%== item_selector_input floating: false %>
8
8
  </div>
9
9
  </td>
10
- <% @resource.get_fields(view_type: :table, reflection: @reflection).each_with_index do |field, index| %>
10
+ <% @resource.get_fields(reflection: @reflection).each_with_index do |field, index| %>
11
11
  <%= index_field field, index, @resource %>
12
12
  <% end %>
13
13
  <td class="text-right whitespace-nowrap px-2">
@@ -1,4 +1,4 @@
1
- <div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>">
1
+ <div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
2
2
  <div class="h-16 flex self-start items-center text-blue-gray-800">
3
3
  <div class="w-48 md:w-64 px-8" data-slot="label">
4
4
  <%= @field.name %> <% if @field.required %> <span class="text-red-600">*</span> <% end %>
@@ -1,3 +1,3 @@
1
- <%= show_field_wrapper field: @field, index: @index do %>
1
+ <%= show_field_wrapper field: @field, index: @index, dash_if_blank: false do %>
2
2
  <%= render Avo::Common::BooleanGroupComponent.new options: @field.options, value: @field.value %>
3
3
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= show_field_wrapper field: @field, field: @field do %>
1
+ <%= show_field_wrapper field: @field do %>
2
2
  <% if @field.value.present? %>
3
3
  <%= image_tag @field.value, style: 'max-width: 340px;' %>
4
4
  <% end %>
@@ -18,8 +18,20 @@
18
18
  <% end %>
19
19
 
20
20
  <% if @resource.authorization.authorize_action(:destroy, raise_exception: false) %>
21
- <%= a_link destroy_path, color: 'red', variant: 'outlined', method: :delete, data: {confirm: 'Are you sure?'} do %>
22
- <%= svg 'trash' %> <%= t('avo.delete').capitalize %>
21
+ <%= form_with url: helpers.resource_path(@resource.model), method: :delete, html: { 'data-turbo-frame': params[:turbo_frame] } do |form| %>
22
+ <%= a_button title: t('avo.delete_item', { item: @resource.model.model_name.name.downcase }).capitalize,
23
+ color: 'red',
24
+ variant: 'outlined',
25
+ type: :submit,
26
+ data: {
27
+ confirm: t('avo.are_you_sure', { item: @resource.model.model_name.name.downcase }),
28
+ control: :destroy,
29
+ 'resource-id': @resource.model.id,
30
+ 'tippy': 'tooltip',
31
+ } do
32
+ %>
33
+ <%= svg 'trash' %> <%= t('avo.delete').capitalize %>
34
+ <% end %>
23
35
  <% end %>
24
36
  <% end %>
25
37
 
@@ -6,7 +6,9 @@ module Avo
6
6
  before_action :set_resource
7
7
  before_action :set_action, only: [:show, :handle]
8
8
 
9
- def show; end
9
+ def show
10
+ @model = ActionModel.new @action.get_attributes_for_action
11
+ end
10
12
 
11
13
  def handle
12
14
  resource_ids = action_params[:fields][:resource_ids].split(',').map(&:to_i)
@@ -16,7 +18,7 @@ module Avo
16
18
  key != 'resource_ids'
17
19
  end
18
20
 
19
- performed_action = @action.handle_action(request, models, fields)
21
+ performed_action = @action.handle_action(models: models, fields: fields)
20
22
 
21
23
  respond performed_action.response
22
24
  end
@@ -27,17 +29,13 @@ module Avo
27
29
  end
28
30
 
29
31
  def set_action
30
- action_class = params[:action_id].gsub('avo_actions_', '').classify
31
- action_name = "Avo::Actions::#{action_class}"
32
+ action_class = params[:action_id].gsub('avo_actions_', '').classify.safe_constantize
32
33
 
33
34
  if params[:id].present?
34
35
  model = @resource.model_class.find params[:id]
35
36
  end
36
37
 
37
- @action = action_name.safe_constantize.new
38
- @action.configure
39
- @action.hydrate(model: model, resource: resource, user: _current_user)
40
- @action.boot_fields request
38
+ @action = action_class.new(model: model, resource: resource, user: _current_user)
41
39
  end
42
40
 
43
41
  def respond(response)
@@ -11,12 +11,11 @@ module Avo
11
11
  rescue_from Pundit::NotAuthorizedError, with: :render_unauthorized
12
12
  rescue_from ActiveRecord::RecordInvalid, with: :exception_logger
13
13
 
14
- helper_method :_current_user, :resources_path, :resource_path, :new_resource_path, :edit_resource_path, :resource_attach_path, :resource_detach_path
14
+ helper_method :_current_user, :resources_path, :resource_path, :new_resource_path, :edit_resource_path, :resource_attach_path, :resource_detach_path, :related_resources_path
15
15
  add_flash_types :info, :warning, :success, :error
16
16
 
17
17
  def init_app
18
- Avo::App.boot if Avo::IN_DEVELOPMENT
19
- Avo::App.init request
18
+ Avo::App.init request: request, context: context
20
19
 
21
20
  @license = Avo::App.license
22
21
  end
@@ -25,7 +24,7 @@ module Avo
25
24
  respond_to do |format|
26
25
  format.html { raise exception }
27
26
  format.json { render json: {
28
- errors: exception.record.present? ? exception.record.errors : [],
27
+ errors: exception.respond_to?(:record) && exception.record.present? ? exception.record.errors : [],
29
28
  message: exception.message,
30
29
  traces: exception.backtrace,
31
30
  }, status: ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name) }
@@ -36,6 +35,10 @@ module Avo
36
35
  instance_eval(&Avo.configuration.current_user)
37
36
  end
38
37
 
38
+ def context
39
+ instance_eval(&Avo.configuration.context)
40
+ end
41
+
39
42
  def resources_path(model, keep_query_params: false, **args)
40
43
  return if model.nil?
41
44
 
@@ -50,6 +53,22 @@ module Avo
50
53
  send :"resources_#{model.model_name.route_key}_path", **existing_params, **args
51
54
  end
52
55
 
56
+ def related_resources_path(parent_model, model, keep_query_params: false, **args)
57
+ return if model.nil?
58
+
59
+ existing_params = {}
60
+
61
+ begin
62
+ if keep_query_params
63
+ existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
64
+ end
65
+ rescue;end
66
+
67
+ Addressable::Template.new("#{Avo.configuration.root_path}/resources/#{@parent_resource.model.model_name.route_key}/#{@parent_resource.model.id}/#{@resource.route_key}{?query*}")
68
+ .expand({query: {**existing_params, **args}})
69
+ .to_str
70
+ end
71
+
53
72
  def resource_path(model = nil, resource_id: nil, keep_query_params: false, **args)
54
73
  existing_params = {}
55
74
 
@@ -152,7 +171,12 @@ module Avo
152
171
  # Gets the Avo resource for this request based on the request from the `resource_name` "param"
153
172
  # Ex: Avo::Resources::Project, Avo::Resources::Team, Avo::Resources::User
154
173
  def resource
155
- App.get_resource @resource_name.to_s.camelize.singularize
174
+
175
+ resource = App.get_resource @resource_name.to_s.camelize.singularize
176
+
177
+ return resource if resource.present?
178
+
179
+ App.get_resource_by_controller_name @resource_name
156
180
  end
157
181
 
158
182
  def related_resource
@@ -221,7 +245,7 @@ module Avo
221
245
  end
222
246
 
223
247
  def set_authorization
224
- @authorization = AuthorizationService.new _current_user
248
+ @authorization = Services::AuthorizationService.new _current_user
225
249
  end
226
250
 
227
251
  def set_container_classes
@@ -103,7 +103,7 @@ module Avo
103
103
  @model.destroy!
104
104
 
105
105
  respond_to do |format|
106
- format.html { redirect_to params[:referrer] || resources_path(@model), notice: t('avo.resource_destroyed', attachment_class: @attachment_class) }
106
+ format.html { redirect_to params[:referrer] || resources_path(@model, turbo_frame: params[:turbo_frame], view_type: params[:view_type]), notice: t('avo.resource_destroyed', attachment_class: @attachment_class) }
107
107
  format.json { head :no_content }
108
108
  end
109
109
  end
@@ -161,18 +161,15 @@ module Avo
161
161
  @index_params[:per_page] = cookies[:per_page]
162
162
  end
163
163
 
164
- if params[:per_page].present?
165
- @index_params[:per_page] = params[:per_page]
164
+ if @parent_model.present?
165
+ @index_params[:per_page] = Avo.configuration.via_per_page
166
166
  end
167
167
 
168
168
  if params[:per_page].present?
169
+ @index_params[:per_page] = params[:per_page]
169
170
  cookies[:per_page] = params[:per_page]
170
171
  end
171
172
 
172
- if @parent_model.present?
173
- @index_params[:per_page] = Avo.configuration.via_per_page
174
- end
175
-
176
173
  # Sorting
177
174
  @index_params[:sort_by] = params[:sort_by] || :created_at
178
175
  @index_params[:sort_direction] = params[:sort_direction] || :desc
@@ -186,8 +183,6 @@ module Avo
186
183
  @filters = @resource.get_filters.map do |filter_class|
187
184
  filter = filter_class.new
188
185
 
189
- filter.configure
190
-
191
186
  filter
192
187
  end
193
188
  end
@@ -198,12 +193,7 @@ module Avo
198
193
  end
199
194
 
200
195
  @actions = @resource.get_actions.map do |action|
201
- action = action.new
202
-
203
- action.hydrate(model: model, resource: @resource)
204
- action.boot_fields request
205
-
206
- action
196
+ action.new(model: model, resource: @resource)
207
197
  end
208
198
  end
209
199
 
@@ -216,7 +206,6 @@ module Avo
216
206
 
217
207
  @resource.get_filters.each do |filter_class|
218
208
  filter = filter_class.new
219
- filter.configure
220
209
 
221
210
  if filter.default.present?
222
211
  filter_defaults[filter_class.to_s] = filter.default
@@ -35,7 +35,7 @@ module Avo
35
35
  @options = query.all.map do |model|
36
36
  {
37
37
  value: model.id,
38
- label: model.send(@attachment_resource.title)
38
+ label: model.send(@attachment_resource.class.title)
39
39
  }
40
40
  end
41
41
  end
@@ -66,7 +66,7 @@ module Avo
66
66
  end
67
67
 
68
68
  respond_to do |format|
69
- format.html { redirect_to params[:referrer] || resources_path(@model), notice: t('avo.attachment_class_detached', attachment_class: @attachment_class) }
69
+ format.html { redirect_to params[:referrer] || resource_path(@model), notice: t('avo.attachment_class_detached', attachment_class: @attachment_class) }
70
70
  end
71
71
  end
72
72
 
@@ -35,7 +35,7 @@ module Avo
35
35
  resources.map do |model|
36
36
  {
37
37
  id: model.id,
38
- search_label: model.send(avo_resource.title),
38
+ search_label: model.send(avo_resource.class.title),
39
39
  link: "/resources/#{model.class.to_s.singularize.underscore}/#{model.id}",
40
40
  }
41
41
  end
@@ -130,7 +130,7 @@ module Avo
130
130
  options[:class] += args[:extra_class].present? ? " #{args[:extra_class]}" : ''
131
131
 
132
132
  # Create the path to the svgs directory
133
- file_path = "#{Avo::Engine.root}/app/frontend/svgs/#{file_name}"
133
+ file_path = "#{Avo::Engine.root}/app/packs/svgs/#{file_name}"
134
134
  file_path = "#{file_path}.svg" unless file_path.end_with? '.svg'
135
135
 
136
136
  # Create a cache hash
@@ -5,20 +5,21 @@
5
5
  @import './../../../node_modules/trix/dist/trix.css';
6
6
  @import './../../../node_modules/flatpickr/dist/flatpickr.css';
7
7
 
8
- @import './tailwindcss/base.css';
9
- @import './tailwindcss/components.css';
10
8
 
11
- @import './fonts.css';
12
- @import './typography.css';
13
- @import './tooltips.css';
14
- @import './alerts.css';
15
- @import './loader.css';
16
- @import './pagination.css';
9
+ @import './../stylesheets/tailwindcss/base.css';
17
10
 
18
- @import './components/status.css';
19
- @import './components/code.css';
11
+ @import './../stylesheets/fonts.css';
12
+ @import './../stylesheets/typography.css';
13
+ @import './../stylesheets/tooltips.css';
14
+ @import './../stylesheets/alerts.css';
15
+ @import './../stylesheets/loader.css';
16
+ @import './../stylesheets/pagination.css';
20
17
 
21
- @import './tailwindcss/utilities.css';
18
+ @import './../stylesheets/components/status.css';
19
+ @import './../stylesheets/components/code.css';
20
+ @import './../stylesheets/tailwindcss/components.css';
21
+
22
+ @import './../stylesheets/tailwindcss/utilities.css';
22
23
 
23
24
  html,
24
25
  body {
@@ -1,5 +1,3 @@
1
- import '@/css/application.css'
2
-
3
1
  import 'regenerator-runtime/runtime'
4
2
  import 'trix'
5
3
  import * as Mousetrap from 'mousetrap'
@@ -7,11 +5,14 @@ import { Application } from 'stimulus'
7
5
  import { Turbo } from '@hotwired/turbo-rails'
8
6
  import { definitionsFromContext } from 'stimulus/webpack-helpers'
9
7
  import tippy from 'tippy.js'
8
+ import Rails from '@rails/ujs';
9
+
10
+ Rails.start();
10
11
 
11
12
  // Toastr alerts
12
13
  import '../js/toastr'
13
14
 
14
- Mousetrap.bind('r r r', () => Turbo.visit(window.location.href))
15
+ Mousetrap.bind('r r r', () => Turbo.visit(window.location.href, { action: "replace" }))
15
16
 
16
17
  const application = Application.start()
17
18
 
File without changes
File without changes
@@ -1,5 +1,4 @@
1
1
  import { Controller } from 'stimulus'
2
- import { Turbo } from '@hotwired/turbo-rails'
3
2
  import URI from 'urijs'
4
3
 
5
4
  export default class extends Controller {
@@ -35,13 +34,30 @@ export default class extends Controller {
35
34
  }
36
35
 
37
36
  filters[filterClass] = value
38
- const encodedFilters = btoa(JSON.stringify(filters))
37
+
38
+ const filtered = Object.keys(filters)
39
+ .filter(key => filters[key] !== '')
40
+ .reduce((obj, key) => {
41
+ obj[key] = filters[key];
42
+ return obj;
43
+ }, {});
44
+
45
+ let encodedFilters;
46
+
47
+ if (filtered && Object.keys(filtered).length > 0) {
48
+ encodedFilters = btoa(JSON.stringify(filtered))
49
+ }
39
50
 
40
51
  const url = new URI(this.urlRedirectTarget.href)
41
52
 
42
53
  const query = {
43
54
  ...url.query(true),
44
- filters: encodedFilters,
55
+ }
56
+
57
+ if (encodedFilters) {
58
+ query['filters'] = encodedFilters
59
+ } else {
60
+ delete query['filters']
45
61
  }
46
62
 
47
63
  url.query(query)
@@ -3,7 +3,11 @@ import { Controller } from 'stimulus'
3
3
  export default class extends Controller {
4
4
  static targets = ['selector']
5
5
 
6
+ get turboFrame() {
7
+ return this.selectorTarget.dataset.turboFrame
8
+ }
9
+
6
10
  reload() {
7
- document.querySelector(`[data-per-page-option="${this.selectorTarget.value}"]`).click()
11
+ document.querySelector(`[data-per-page-option="${this.selectorTarget.value}"][data-turbo-frame="${this.turboFrame}"]`).click()
8
12
  }
9
13
  }