avo 0.5.0.beta7 → 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.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/Gemfile.lock +28 -18
- data/app/components/avo/common/badge_viewer_component.html.erb +1 -1
- data/app/components/avo/common/gravatar_viewer_component.html.erb +2 -2
- data/app/components/avo/common/gravatar_viewer_component.rb +2 -1
- data/app/components/avo/edit/fields/trix_field_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/index/fields/belongs_to_field_component.html.erb +1 -5
- data/app/components/avo/index/fields/boolean_group_field_component.html.erb +1 -1
- data/app/components/avo/index/fields/gravatar_field_component.html.erb +2 -1
- data/app/components/avo/index/fields/has_one_field_component.html.erb +1 -5
- data/app/components/avo/index/fields/id_field_component.html.erb +1 -1
- data/app/components/avo/index/grid_item_component.html.erb +2 -2
- data/app/components/avo/index/grid_item_component.rb +3 -3
- data/app/components/avo/index/resource_controls_component.html.erb +12 -4
- data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/show/fields/boolean_group_field_component.html.erb +1 -1
- data/app/components/avo/show/fields/external_image_field_component.html.erb +1 -1
- data/app/components/avo/views/resource_show_component.html.erb +14 -2
- data/app/controllers/avo/actions_controller.rb +5 -4
- data/app/controllers/avo/application_controller.rb +18 -2
- data/app/controllers/avo/base_controller.rb +5 -8
- data/app/controllers/avo/relations_controller.rb +1 -1
- data/app/helpers/avo/application_helper.rb +1 -1
- data/app/{frontend/css → packs/entrypoints}/application.css +12 -11
- data/app/{frontend/packs → packs/entrypoints}/application.js +3 -2
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.eot +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.svg +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.ttf +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-700.woff2 +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.eot +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.svg +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.ttf +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff +0 -0
- data/app/{frontend → packs}/fonts/nunito-v16-latin-regular.woff2 +0 -0
- data/app/{frontend → packs}/images/logo.png +0 -0
- data/app/{frontend → packs}/importmap.json.erb +0 -0
- data/app/{frontend → packs}/js/controllers/action_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/actions_picker_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/alerts_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/attachments_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/boolean_filter_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/fields/code_field_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/fields/date_field_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/fields/simple_mde_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/filter_controller.js +19 -3
- data/app/{frontend → packs}/js/controllers/hidden_input_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/item_selector_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/modal_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/per_page_controller.js +5 -1
- data/app/{frontend → packs}/js/controllers/select_filter_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/tippy_controller.js +0 -0
- data/app/{frontend → packs}/js/controllers/toggle_panel_controller.js +0 -0
- data/app/{frontend → packs}/js/helpers/cast_boolean.js +0 -0
- data/app/{frontend → packs}/js/toastr.js +0 -0
- data/app/{frontend/css → packs/stylesheets}/alerts.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/components/code.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/components/status.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/fonts.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/loader.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/pagination.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/base.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/components.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tailwindcss/utilities.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/tooltips.css +0 -0
- data/app/{frontend/css → packs/stylesheets}/typography.css +0 -0
- data/app/{frontend → packs}/svgs/arrow-circle-right.svg +0 -0
- data/app/{frontend → packs}/svgs/arrow-left.svg +0 -0
- data/app/{frontend → packs}/svgs/avocado.svg +0 -0
- data/app/{frontend → packs}/svgs/badge-check-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/check-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/chevron-down.svg +0 -0
- data/app/{frontend → packs}/svgs/chevron-up.svg +0 -0
- data/app/{frontend → packs}/svgs/code.svg +0 -0
- data/app/{frontend → packs}/svgs/color-swatch.svg +0 -0
- data/app/{frontend → packs}/svgs/document-text.svg +0 -0
- data/app/{frontend → packs}/svgs/download.svg +0 -0
- data/app/{frontend → packs}/svgs/edit.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation-circle-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/exclamation.svg +0 -0
- data/app/{frontend → packs}/svgs/eye.svg +0 -0
- data/app/{frontend → packs}/svgs/filter.svg +0 -0
- data/app/{frontend → packs}/svgs/fire.svg +0 -0
- data/app/{frontend → packs}/svgs/game-board.svg +0 -0
- data/app/{frontend → packs}/svgs/globe.svg +0 -0
- data/app/{frontend → packs}/svgs/information-circle-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/information-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/library.svg +0 -0
- data/app/{frontend → packs}/svgs/photograph.svg +0 -0
- data/app/{frontend → packs}/svgs/play.svg +0 -0
- data/app/{frontend → packs}/svgs/plus-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/plus.svg +0 -0
- data/app/{frontend → packs}/svgs/question-mark-circle.svg +0 -0
- data/app/{frontend → packs}/svgs/save.svg +0 -0
- data/app/{frontend → packs}/svgs/selector.svg +0 -0
- data/app/{frontend → packs}/svgs/sort-ascending.svg +0 -0
- data/app/{frontend → packs}/svgs/sort-descending.svg +0 -0
- data/app/{frontend → packs}/svgs/switch-horizontal.svg +0 -0
- data/app/{frontend → packs}/svgs/thumbs-down.svg +0 -0
- data/app/{frontend → packs}/svgs/thumbs-up.svg +0 -0
- data/app/{frontend → packs}/svgs/times.svg +0 -0
- data/app/{frontend → packs}/svgs/trash-sm.svg +0 -0
- data/app/{frontend → packs}/svgs/trash.svg +0 -0
- data/app/{frontend → packs}/svgs/view-grid-add.svg +0 -0
- data/app/{frontend → packs}/svgs/view-grid.svg +0 -0
- data/app/{frontend → packs}/svgs/view-list.svg +0 -0
- data/app/{frontend → packs}/svgs/x-circle.svg +0 -0
- data/app/views/avo/actions/show.html.erb +3 -39
- data/app/views/avo/attachments/show.html.erb +8 -1
- data/app/views/avo/base/_boolean_filter.html.erb +1 -0
- data/app/views/avo/base/_filters.html.erb +1 -0
- data/app/views/avo/base/_select_filter.html.erb +1 -0
- data/app/views/avo/partials/_paginator.html.erb +24 -5
- data/app/views/avo/relations/new.html.erb +5 -1
- data/app/views/layouts/avo/application.html.erb +0 -5
- data/avo.gemspec +1 -0
- data/bin/helpers.rb +0 -0
- data/bin/rspec +1 -0
- data/bin/webpack +2 -1
- data/config/webpack/aliases.js +1 -1
- data/config/webpack/base.js +14 -0
- data/config/webpack/development.js +2 -2
- data/config/webpack/production.js +2 -2
- data/config/webpack/test.js +2 -2
- data/config/webpacker.yml +5 -44
- data/db/factories.rb +1 -0
- data/lib/avo/action_model.rb +20 -0
- data/lib/avo/app.rb +0 -42
- data/lib/avo/base_action.rb +40 -37
- data/lib/avo/base_resource.rb +26 -51
- data/lib/avo/configuration.rb +0 -4
- data/lib/avo/engine.rb +16 -0
- data/lib/avo/fields/base_field.rb +19 -9
- data/lib/avo/fields/field_extensions/has_field_name.rb +2 -9
- data/lib/avo/fields/gravatar_field.rb +1 -1
- data/lib/avo/fields_collector.rb +31 -0
- data/lib/avo/grid_collector.rb +39 -0
- data/lib/avo/has_context.rb +7 -0
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/templates/action.tt +2 -2
- data/public/avo-packs/css/application-5bb09ba4.css +6024 -0
- data/public/avo-packs/css/application-5bb09ba4.css.br +0 -0
- data/public/avo-packs/css/application-5bb09ba4.css.gz +0 -0
- data/public/avo-packs/css/application-5bb09ba4.css.map +1 -0
- data/public/avo-packs/css/application-5bb09ba4.css.map.br +0 -0
- data/public/avo-packs/css/application-5bb09ba4.css.map.gz +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js +2 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.br +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.gz +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map +1 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.br +0 -0
- data/public/avo-packs/js/219-9aa2b689f44613118203.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js +26 -0
- data/public/avo-packs/js/{application-8849c6e2c8f75d55c666.js.LICENSE.txt → application-86a3ea5a835b0c758203.js.LICENSE.txt} +17 -17
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.br +0 -0
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.gz +0 -0
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map +1 -0
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map.br +0 -0
- data/public/avo-packs/js/application-86a3ea5a835b0c758203.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +46 -23
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg → images/13ae283c0d7cc04efe7e.svg} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.br → images/13ae283c0d7cc04efe7e.svg.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-00fbd8a72a3708b8314cce5f0515640e.svg.gz → images/13ae283c0d7cc04efe7e.svg.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg → images/195026a50008c53526ef.svg} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.br → images/195026a50008c53526ef.svg.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-35bd1c96bc2e402cf22ea812ae067995.svg.gz → images/195026a50008c53526ef.svg.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-cb632c9fe211ba2c2bf1564c9a9295cc.woff → images/1f30e08faa7c60d1f7ac.woff} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf → images/1fd17dabf6b7d2b15348.ttf} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.br → images/1fd17dabf6b7d2b15348.ttf.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-2cc22f9c0cf217cbfc371f3b74992305.ttf.gz → images/1fd17dabf6b7d2b15348.ttf.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-bcf84d6cb8a0ac214c8c14ba9af834f3.woff2 → images/39a18f443d434999b89b.woff2} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-412073df419ad5f6f8f2ea76eb4aced9.woff2 → images/4ad349571e28bb59c5a5.woff2} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-2fae1e2418251b68fe5d0505ab93dd5c.eot → images/57a5470848663767abbf.eot} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf → images/b2e4cf0fab6c8ca66b7f.ttf} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.br → images/b2e4cf0fab6c8ca66b7f.ttf.br} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-regular-df8c4bee41b6ca0ed2b7b71456ed7fbb.ttf.gz → images/b2e4cf0fab6c8ca66b7f.ttf.gz} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-df7e79af617f98cd3b95d320e8b2a1af.eot → images/b78d61ab7e046de8c156.eot} +0 -0
- data/public/avo-packs/media/{fonts/nunito-v16-latin-700-7c472b19cb573f537bad8ef62ca917ac.woff → images/c9ab29becb76ddab01d0.woff} +0 -0
- data/public/avo-packs/media/images/{logo-edf8d8d0d263e0c1f73bb32a222d9991.png → f1b4befac91a3336db9a.png} +0 -0
- metadata +144 -127
- data/app/views/layouts/avo/application_vue.html.erb +0 -61
- data/config/webpack/environment.js +0 -18
- data/db/migrate/20210305082639_add_url_to_teams.rb +0 -5
- data/public/avo-packs/css/application-c75ac28c.css +0 -6
- data/public/avo-packs/css/application-c75ac28c.css.br +0 -0
- data/public/avo-packs/css/application-c75ac28c.css.gz +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js +0 -2
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.br +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.gz +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map +0 -1
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.br +0 -0
- data/public/avo-packs/js/1-0565987ca0c3045602ad.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js +0 -26
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.br +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.gz +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map +0 -1
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.br +0 -0
- data/public/avo-packs/js/application-8849c6e2c8f75d55c666.js.map.gz +0 -0
- data/public/avo-packs/manifest.json.br +0 -0
- data/public/avo-packs/manifest.json.gz +0 -0
@@ -11,6 +11,7 @@
|
|
11
11
|
<%= select_tag filter.id, options_for_select(filter.options.invert, set_value),
|
12
12
|
class: input_classes('w-full mb-0'),
|
13
13
|
include_blank: '—',
|
14
|
+
id: "avo_filters_#{filter.id.parameterize.underscore}",
|
14
15
|
'data-filter-class': filter.class,
|
15
16
|
'data-select-filter-target': 'selector',
|
16
17
|
'data-action': "change->select-filter#changeFilter"
|
@@ -1,6 +1,11 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
2
|
+
per_page_options = [*Avo.configuration.per_page_steps, Avo.configuration.per_page.to_i, @index_params[:per_page].to_i]
|
3
|
+
|
4
|
+
if @parent_resource.present?
|
5
|
+
per_page_options.prepend Avo.configuration.via_per_page
|
6
|
+
end
|
7
|
+
|
8
|
+
per_page_options = per_page_options.sort.uniq
|
4
9
|
%>
|
5
10
|
|
6
11
|
<div class="bg-white px-4 flex items-center justify-between aborder-t aborder-blue-gray-200 sm:px-6 rounded-xl">
|
@@ -11,11 +16,23 @@
|
|
11
16
|
|
12
17
|
<div data-controller="per-page">
|
13
18
|
<div class="flex items-center">
|
14
|
-
<%= select_tag 'per_page',
|
19
|
+
<%= select_tag 'per_page',
|
20
|
+
options_for_select(per_page_options, @index_params[:per_page]),
|
21
|
+
class: 'appearance-none inline-flex bg-blue-gray-100 disabled:bg-blue-gray-400 disabled:cursor-not-allowed focus:bg-white text-blue-gray-700 disabled:text-blue-gray-600 rounded-md py-1 px-2 leading-tight border border-blue-gray-300 outline-none focus:border-blue-gray-400 outline w-16 mr-1 text-sm',
|
22
|
+
data: {
|
23
|
+
'turbo-frame': turbo_frame,
|
24
|
+
'per-page-target': 'selector',
|
25
|
+
action: 'change->per-page#reload'
|
26
|
+
}
|
27
|
+
%> <%= t('avo.per_page').downcase %>
|
15
28
|
</div>
|
16
29
|
|
17
30
|
<% per_page_options.each do |option| %>
|
18
|
-
|
31
|
+
<% if @parent_resource.present? %>
|
32
|
+
<%= link_to "Change to #{option} items per page", related_resources_path(@parent_resource.model, @resource.model_class, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
33
|
+
<% else %>
|
34
|
+
<%= link_to "Change to #{option} items per page", resources_path(@resource.model_class, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
35
|
+
<% end %>
|
19
36
|
<% end %>
|
20
37
|
</div>
|
21
38
|
</div>
|
@@ -24,7 +41,9 @@
|
|
24
41
|
<div class="flex">
|
25
42
|
<div class="flex-2 sm:flex sm:items-center sm:justify-between">
|
26
43
|
<%# @todo: add first & last page. make the first and last buttons rounded %>
|
27
|
-
|
44
|
+
<% if @pagy.pages > 1 %>
|
45
|
+
<%== pagy_nav @pagy %>
|
46
|
+
<% end %>
|
28
47
|
</div>
|
29
48
|
</div>
|
30
49
|
</div>
|
@@ -1,5 +1,9 @@
|
|
1
1
|
<%= turbo_frame_tag 'attach_modal' do %>
|
2
|
-
<%= form_with scope: 'fields',
|
2
|
+
<%= form_with scope: 'fields',
|
3
|
+
url: "/avo/resources/#{params[:resource_name]}/#{params[:id]}/#{params[:related_name]}/",
|
4
|
+
data: {
|
5
|
+
'turbo-frame': '_top'
|
6
|
+
} do |form| %>
|
3
7
|
<%= render Avo::ModalComponent.new do |c| %>
|
4
8
|
<% c.with :heading do %>
|
5
9
|
<%= t('avo.choose_item', { item: params[:related_name].downcase }) %>
|
@@ -8,11 +8,6 @@
|
|
8
8
|
|
9
9
|
<%= render partial: 'avo/partials/javascript' %>
|
10
10
|
|
11
|
-
<%# if Avo::PACKED %>
|
12
|
-
<%#= stylesheet_link_tag 'application', media: 'all', "data-turbo-track": "reload" %>
|
13
|
-
<%#= javascript_include_tag 'avo-packs/application', "data-turbo-track": "reload" %>
|
14
|
-
<%# else %>
|
15
|
-
<%# end %>
|
16
11
|
<%= javascript_pack_tag 'application' %>
|
17
12
|
<%= stylesheet_pack_tag 'application', media: 'all' %>
|
18
13
|
</head>
|
data/avo.gemspec
CHANGED
data/bin/helpers.rb
CHANGED
File without changes
|
data/bin/rspec
CHANGED
data/bin/webpack
CHANGED
@@ -4,7 +4,8 @@ ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] || 'development'
|
|
4
4
|
ENV['NODE_ENV'] ||= 'development'
|
5
5
|
|
6
6
|
require 'pathname'
|
7
|
-
ENV[
|
7
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
8
|
+
Pathname.new(__FILE__).realpath)
|
8
9
|
|
9
10
|
require 'rubygems'
|
10
11
|
require 'bundler/setup'
|
data/config/webpack/aliases.js
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
const { webpackConfig, merge } = require('@rails/webpacker')
|
2
|
+
const aliases = require('./aliases')
|
3
|
+
|
4
|
+
const customConfig = {
|
5
|
+
resolve: {
|
6
|
+
extensions: ['.css']
|
7
|
+
}
|
8
|
+
}
|
9
|
+
const config = merge(webpackConfig, aliases, customConfig)
|
10
|
+
|
11
|
+
delete config.optimization
|
12
|
+
console.log('config->', config)
|
13
|
+
|
14
|
+
module.exports = config
|
data/config/webpack/test.js
CHANGED
data/config/webpacker.yml
CHANGED
@@ -1,66 +1,30 @@
|
|
1
1
|
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
2
2
|
|
3
3
|
default: &default
|
4
|
-
source_path: app/
|
5
|
-
source_entry_path:
|
4
|
+
source_path: app/packs
|
5
|
+
source_entry_path: entrypoints
|
6
6
|
public_root_path: public
|
7
7
|
cache_path: tmp/cache/webpacker
|
8
8
|
check_yarn_integrity: false
|
9
9
|
# use a different sub-folder name
|
10
10
|
public_output_path: avo-packs
|
11
11
|
webpack_compile_output: true
|
12
|
+
extract_css: true
|
12
13
|
|
13
14
|
# Additional paths webpack should lookup modules
|
14
15
|
# ['app/assets', 'engine/foo/app/assets']
|
15
|
-
|
16
|
+
additional_paths_paths: []
|
16
17
|
|
17
18
|
# Reload manifest.json on all requests so we reload latest compiled packs
|
18
19
|
cache_manifest: false
|
19
20
|
|
20
|
-
# Extract and emit a css file
|
21
|
-
extract_css: true
|
22
|
-
|
23
|
-
static_assets_extensions:
|
24
|
-
- .jpg
|
25
|
-
- .jpeg
|
26
|
-
- .png
|
27
|
-
- .gif
|
28
|
-
- .tiff
|
29
|
-
- .ico
|
30
|
-
- .svg
|
31
|
-
- .eot
|
32
|
-
- .otf
|
33
|
-
- .ttf
|
34
|
-
- .woff
|
35
|
-
- .woff2
|
36
|
-
|
37
|
-
extensions:
|
38
|
-
- .ts
|
39
|
-
- .vue
|
40
|
-
- .mjs
|
41
|
-
- .js
|
42
|
-
- .sass
|
43
|
-
- .scss
|
44
|
-
- .css
|
45
|
-
- .module.sass
|
46
|
-
- .module.scss
|
47
|
-
- .module.css
|
48
|
-
- .png
|
49
|
-
- .svg
|
50
|
-
- .gif
|
51
|
-
- .jpeg
|
52
|
-
- .jpg
|
53
|
-
|
54
21
|
# We override the development env. when packed.
|
55
22
|
# Avo needs to be packed and compiled for when the dev uses it in his development env.
|
56
23
|
development:
|
57
24
|
<<: *default
|
58
25
|
|
59
26
|
# Production depends on precompilation of packs prior to booting for performance.
|
60
|
-
compile:
|
61
|
-
|
62
|
-
# Extract and emit a css file
|
63
|
-
extract_css: true
|
27
|
+
compile: true
|
64
28
|
|
65
29
|
# Cache manifest.json for performance
|
66
30
|
cache_manifest: true
|
@@ -79,8 +43,5 @@ production:
|
|
79
43
|
# Production depends on precompilation of packs prior to booting for performance.
|
80
44
|
compile: false
|
81
45
|
|
82
|
-
# Extract and emit a css file
|
83
|
-
extract_css: true
|
84
|
-
|
85
46
|
# Cache manifest.json for performance
|
86
47
|
cache_manifest: true
|
data/db/factories.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Avo
|
2
|
+
class ActionModel
|
3
|
+
include ActiveModel::Model
|
4
|
+
|
5
|
+
# This class augments a model the action form declaration.
|
6
|
+
def initialize(attributes = {})
|
7
|
+
set_attr_accessors attributes
|
8
|
+
|
9
|
+
super(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def set_attr_accessors(attributes)
|
15
|
+
attributes.each do |k, v|
|
16
|
+
self.class.class_eval { attr_accessor k }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/avo/app.rb
CHANGED
@@ -10,23 +10,6 @@ module Avo
|
|
10
10
|
class_attribute :license, default: nil
|
11
11
|
|
12
12
|
class << self
|
13
|
-
# def load_controllers
|
14
|
-
# BaseResource.descendants.each do |resource|
|
15
|
-
# controller_name = "#{resource.to_s.gsub('Resource', '').pluralize}Controller"
|
16
|
-
# puts controller_name.inspect
|
17
|
-
# # eval <<DYNAMIC
|
18
|
-
# # class #{controller_name} < Avo::ResourcesController
|
19
|
-
# # # title :Person
|
20
|
-
# # # attribute :name, String
|
21
|
-
# # # ...or substitute other stuff in here.
|
22
|
-
# # end
|
23
|
-
# # DYNAMIC
|
24
|
-
|
25
|
-
# Avo.const_set(controller_name.to_sym, Class.new(Avo::ResourcesController))
|
26
|
-
# # puts controller_name.inspect
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
|
30
13
|
def boot
|
31
14
|
init_fields
|
32
15
|
|
@@ -77,31 +60,6 @@ module Avo
|
|
77
60
|
name: method_name,
|
78
61
|
class: klass,
|
79
62
|
)
|
80
|
-
|
81
|
-
# Avo::Loaders::FieldsLoader.define_method method_name.to_sym do |*args, &block|
|
82
|
-
# puts ['Avo::Loaders::FieldsLoader.define_method->', args, block.present?].inspect
|
83
|
-
|
84
|
-
# if block.present?
|
85
|
-
# puts '111->'.inspect
|
86
|
-
# field = klass.new(args[0], **args[1] || {}, &block)
|
87
|
-
# else
|
88
|
-
# puts '222->'.inspect
|
89
|
-
# field = klass.new(args[0], **args[1] || {})
|
90
|
-
# end
|
91
|
-
|
92
|
-
# puts field.inspect
|
93
|
-
|
94
|
-
# self.bag.push field
|
95
|
-
|
96
|
-
# # field
|
97
|
-
# # if block.present?
|
98
|
-
# # field_class = klass::new(args[0], **args[1] || {}, &block)
|
99
|
-
# # else
|
100
|
-
# # field_class = klass::new(args[0], **args[1] || {})
|
101
|
-
# # end
|
102
|
-
|
103
|
-
# # klass_entity.add_field(self, field_class)
|
104
|
-
# end
|
105
63
|
end
|
106
64
|
|
107
65
|
def init_resources
|
data/lib/avo/base_action.rb
CHANGED
@@ -1,78 +1,81 @@
|
|
1
1
|
module Avo
|
2
2
|
class BaseAction
|
3
|
+
extend FieldsCollector
|
4
|
+
extend HasContext
|
5
|
+
|
3
6
|
class_attribute :name, default: self.class.to_s.demodulize.underscore.humanize(keep_id_suffix: true)
|
4
7
|
class_attribute :message
|
5
|
-
class_attribute :
|
6
|
-
class_attribute :
|
8
|
+
class_attribute :confirm_button_label
|
9
|
+
class_attribute :cancel_button_label
|
7
10
|
class_attribute :no_confirmation, default: false
|
8
|
-
class_attribute :
|
11
|
+
class_attribute :model
|
12
|
+
class_attribute :view
|
13
|
+
class_attribute :user
|
14
|
+
class_attribute :resource
|
15
|
+
class_attribute :fields
|
9
16
|
|
10
17
|
attr_accessor :response
|
11
18
|
attr_accessor :model
|
12
19
|
attr_accessor :resource
|
13
20
|
attr_accessor :user
|
21
|
+
attr_accessor :fields_loader
|
14
22
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
yield(fields_loader)
|
20
|
-
end
|
21
|
-
|
22
|
-
def context
|
23
|
-
App.context
|
24
|
-
end
|
25
|
-
end
|
23
|
+
def initialize(model: nil, resource: nil, user: nil)
|
24
|
+
self.class.model = model if model.present?
|
25
|
+
self.class.resource = resource if resource.present?
|
26
|
+
self.class.user = user if user.present?
|
26
27
|
|
27
|
-
def initialize
|
28
28
|
self.class.message ||= I18n.t('avo.are_you_sure_you_want_to_run_this_option')
|
29
|
-
self.class.
|
30
|
-
self.class.
|
29
|
+
self.class.confirm_button_label ||= I18n.t('avo.run')
|
30
|
+
self.class.cancel_button_label ||= I18n.t('avo.cancel')
|
31
31
|
|
32
32
|
@response ||= {}
|
33
33
|
@response[:message_type] ||= :notice
|
34
34
|
@response[:message] ||= I18n.t('avo.action_ran_successfully')
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
|
39
|
-
field.hydrate(action: self, model: @model)
|
40
|
-
end
|
41
|
-
.select do |field|
|
42
|
-
field.can_see.present? ? field.can_see.call : true
|
43
|
-
end
|
37
|
+
def context
|
38
|
+
self.class.context
|
44
39
|
end
|
45
40
|
|
46
41
|
def get_field_definitions
|
47
|
-
return [] if self.class.
|
42
|
+
return [] if self.class.fields.blank?
|
48
43
|
|
49
|
-
self.class.
|
44
|
+
self.class.fields.map do |field|
|
50
45
|
field.hydrate(action: self)
|
51
46
|
end
|
52
47
|
end
|
53
48
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
|
49
|
+
def get_fields
|
50
|
+
get_field_definitions.map do |field|
|
51
|
+
field.hydrate(action: self, model: @model)
|
52
|
+
end
|
53
|
+
.select do |field|
|
54
|
+
field.visible?
|
55
|
+
end
|
56
|
+
end
|
58
57
|
|
59
|
-
|
58
|
+
def get_attributes_for_action
|
59
|
+
get_fields.map do |field|
|
60
|
+
[field.id, field.value]
|
61
|
+
end
|
62
|
+
.to_h
|
60
63
|
end
|
61
64
|
|
62
|
-
def handle_action(
|
65
|
+
def handle_action(models:, fields:)
|
63
66
|
avo_fields = get_fields.map { |field| [field.id, field] }.to_h
|
64
67
|
|
65
|
-
if
|
66
|
-
|
68
|
+
if fields.present?
|
69
|
+
processed_fields = fields.to_unsafe_h.map do |name, value|
|
67
70
|
[name, avo_fields[name.to_sym].resolve_attribute(value)]
|
68
71
|
end
|
69
72
|
|
70
|
-
|
73
|
+
processed_fields = processed_fields.to_h
|
71
74
|
else
|
72
|
-
|
75
|
+
processed_fields = {}
|
73
76
|
end
|
74
77
|
|
75
|
-
result = self.handle
|
78
|
+
result = self.handle models: models, fields: processed_fields
|
76
79
|
|
77
80
|
self
|
78
81
|
end
|