avo 1.19.1.pre.1 → 1.19.1.pre.5
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 +3 -7
- data/Gemfile.lock +31 -51
- data/README.md +3 -0
- data/app/assets/builds/avo.css +8590 -0
- data/app/assets/builds/avo.js +87755 -0
- data/app/assets/builds/avo.js.map +7 -0
- data/app/assets/config/avo_manifest.js +2 -1
- data/app/{packs/images → assets/images/avo}/logo.png +0 -0
- data/app/{packs/entrypoints/application.css → assets/stylesheets/avo.css} +31 -24
- data/app/{packs/stylesheets → assets/stylesheets/css}/active-storage.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/alerts.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/breadcrumbs.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/code.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/progress.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/components/status.css +0 -0
- data/app/assets/stylesheets/css/fonts.css +26 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/loader.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/pagination.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/search.css +1 -1
- data/app/{packs/stylesheets → assets/stylesheets/css}/spinner.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/base.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/components.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tailwindcss/utilities.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/tooltips.css +0 -0
- data/app/{packs/stylesheets → assets/stylesheets/css}/typography.css +0 -0
- data/app/{packs → assets}/svgs/arrow-circle-right.svg +0 -0
- data/app/{packs → assets}/svgs/arrow-left.svg +0 -0
- data/app/{packs → assets}/svgs/avocado.svg +0 -0
- data/app/{packs → assets}/svgs/badge-check-sm.svg +0 -0
- data/app/{packs → assets}/svgs/check-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/check-circle.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-down.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-right.svg +0 -0
- data/app/{packs → assets}/svgs/chevron-up.svg +0 -0
- data/app/{packs → assets}/svgs/code.svg +0 -0
- data/app/{packs → assets}/svgs/color-swatch.svg +0 -0
- data/app/{packs → assets}/svgs/document-text.svg +0 -0
- data/app/{packs → assets}/svgs/download.svg +0 -0
- data/app/{packs → assets}/svgs/edit.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation-sm.svg +0 -0
- data/app/{packs → assets}/svgs/exclamation.svg +0 -0
- data/app/{packs → assets}/svgs/eye.svg +0 -0
- data/app/{packs → assets}/svgs/filter.svg +0 -0
- data/app/{packs → assets}/svgs/fire.svg +0 -0
- data/app/{packs → assets}/svgs/game-board.svg +0 -0
- data/app/{packs → assets}/svgs/globe.svg +0 -0
- data/app/{packs → assets}/svgs/information-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/information-circle.svg +0 -0
- data/app/{packs → assets}/svgs/library.svg +0 -0
- data/app/{packs → assets}/svgs/photograph.svg +0 -0
- data/app/{packs → assets}/svgs/play.svg +0 -0
- data/app/{packs → assets}/svgs/plus-circle.svg +0 -0
- data/app/{packs → assets}/svgs/plus.svg +0 -0
- data/app/{packs → assets}/svgs/question-mark-circle.svg +0 -0
- data/app/{packs → assets}/svgs/save.svg +0 -0
- data/app/{packs → assets}/svgs/selector.svg +0 -0
- data/app/{packs → assets}/svgs/sort-ascending.svg +0 -0
- data/app/{packs → assets}/svgs/sort-descending.svg +0 -0
- data/app/{packs → assets}/svgs/switch-horizontal.svg +0 -0
- data/app/{packs → assets}/svgs/thumbs-down.svg +0 -0
- data/app/{packs → assets}/svgs/thumbs-up.svg +0 -0
- data/app/{packs → assets}/svgs/times.svg +0 -0
- data/app/{packs → assets}/svgs/trash-sm.svg +0 -0
- data/app/{packs → assets}/svgs/trash.svg +0 -0
- data/app/{packs → assets}/svgs/view-grid-add.svg +0 -0
- data/app/{packs → assets}/svgs/view-grid.svg +0 -0
- data/app/{packs → assets}/svgs/view-list.svg +0 -0
- data/app/{packs → assets}/svgs/x-circle-sm.svg +0 -0
- data/app/{packs → assets}/svgs/x-circle.svg +0 -0
- data/app/components/avo/edit/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/fields/common/files_list_viewer_component.html.erb +1 -1
- data/app/components/avo/fields/common/heading_component.html.erb +1 -1
- data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/index/table_row_component.html.erb +1 -1
- data/app/components/avo/resource_component.rb +0 -4
- data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.rb +6 -0
- data/app/components/avo/views/resource_index_component.html.erb +1 -1
- data/app/components/avo/views/resource_index_component.rb +21 -9
- data/app/components/avo/views/resource_new_component.html.erb +6 -4
- data/app/components/avo/views/resource_new_component.rb +6 -0
- data/app/components/avo/views/resource_show_component.html.erb +2 -2
- data/app/components/avo/views/resource_show_component.rb +9 -1
- data/app/controllers/avo/application_controller.rb +15 -0
- data/app/controllers/avo/base_controller.rb +40 -12
- data/app/helpers/avo/application_helper.rb +3 -14
- data/app/{packs/entrypoints/application.js → javascript/avo.js} +15 -18
- data/{public/avo-packs/media/images/dadf2db36589607d107d.png → app/javascript/images/logo.png} +0 -0
- data/app/{packs → javascript}/js/active-storage.js +0 -0
- data/app/javascript/js/application.js +9 -0
- data/app/{packs → javascript}/js/controllers/action_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/actions_picker_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/alerts_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/attachments_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/boolean_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/belongs_to_field_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/code_field_controller.js +2 -1
- data/app/{packs → javascript}/js/controllers/fields/date_field_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/fields/key_value_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/fields/simple_mde_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/fields/trix_field_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/hidden_input_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/item_select_all_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/item_selector_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/loading_button_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/modal_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/multiple_select_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/per_page_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/search_controller.js +1 -1
- data/app/{packs → javascript}/js/controllers/select_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/text_filter_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/tippy_controller.js +0 -0
- data/app/{packs → javascript}/js/controllers/toggle_panel_controller.js +0 -0
- data/app/javascript/js/controllers.js +53 -0
- data/app/{packs → javascript}/js/helpers/cast_boolean.js +0 -0
- data/app/{packs → javascript}/js/helpers/debounce_promise.js +0 -0
- data/app/{packs → javascript}/js/toastr.js +0 -0
- data/app/views/avo/actions/show.html.erb +1 -1
- data/app/views/avo/base/_actions.html.erb +1 -1
- data/app/views/avo/base/_filters.html.erb +3 -3
- data/app/views/avo/home/_actions.html.erb +1 -1
- data/app/views/avo/home/_filters.html.erb +1 -1
- data/app/views/avo/home/_resources.html.erb +2 -2
- data/app/views/avo/partials/_footer.html.erb +1 -1
- data/app/views/avo/partials/_global_search.html.erb +4 -1
- data/app/views/avo/partials/_logo.html.erb +1 -1
- data/app/views/avo/partials/_paginator.html.erb +3 -3
- data/app/views/avo/partials/_table_header.html.erb +2 -2
- data/app/views/layouts/avo/application.html.erb +9 -4
- data/avo.gemspec +1 -2
- data/bin/dev +9 -0
- data/bin/test +2 -1
- data/lib/avo/base_resource.rb +4 -3
- data/lib/avo/configuration.rb +6 -0
- data/lib/avo/engine.rb +2 -16
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -18
- data/lib/generators/avo/filter_generator.rb +2 -0
- data/lib/generators/avo/templates/filters/text_filter.tt +8 -0
- data/public/avo-assets/avo.css +8590 -0
- data/public/avo-assets/avo.js +87755 -0
- data/public/avo-assets/avo.js.map +7 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.eot +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.svg +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.ttf +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.woff +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-700.woff2 +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.eot +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.svg +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.ttf +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.woff +0 -0
- data/{app/packs → public/avo-assets}/fonts/nunito-v16-latin-regular.woff2 +0 -0
- metadata +116 -168
- data/app/assets/stylesheets/avo/application.css +0 -15
- data/app/packs/importmap.json.erb +0 -5
- data/app/packs/stylesheets/fonts.css +0 -26
- data/bin/webpack +0 -20
- data/bin/webpack-dev-server +0 -18
- data/config/webpack/aliases.js +0 -10
- data/config/webpack/base.js +0 -14
- data/config/webpack/development.js +0 -5
- data/config/webpack/production.js +0 -5
- data/config/webpack/test.js +0 -5
- data/config/webpacker.yml +0 -79
- data/public/avo-packs/css/application-c3b50b28.css +0 -6329
- data/public/avo-packs/css/application-c3b50b28.css.br +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.gz +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.map +0 -1
- data/public/avo-packs/css/application-c3b50b28.css.map.br +0 -0
- data/public/avo-packs/css/application-c3b50b28.css.map.gz +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js +0 -2
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.br +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.gz +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map +0 -1
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.br +0 -0
- data/public/avo-packs/js/actioncable-7119dbc1a908641fb263.chunk.js.map.gz +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js +0 -26
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.LICENSE.txt +0 -77
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.br +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.gz +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map +0 -1
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.br +0 -0
- data/public/avo-packs/js/application-6fc968cfa52976c4582b.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +0 -52
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg +0 -380
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.br +0 -0
- data/public/avo-packs/media/images/13ae283c0d7cc04efe7e.svg.gz +0 -0
- data/public/avo-packs/media/images/195026a50008c53526ef.svg +0 -388
- data/public/avo-packs/media/images/195026a50008c53526ef.svg.br +0 -0
- data/public/avo-packs/media/images/195026a50008c53526ef.svg.gz +0 -0
- data/public/avo-packs/media/images/1f30e08faa7c60d1f7ac.woff +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf.br +0 -0
- data/public/avo-packs/media/images/1fd17dabf6b7d2b15348.ttf.gz +0 -0
- data/public/avo-packs/media/images/39a18f443d434999b89b.woff2 +0 -0
- data/public/avo-packs/media/images/4ad349571e28bb59c5a5.woff2 +0 -0
- data/public/avo-packs/media/images/57a5470848663767abbf.eot +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf.br +0 -0
- data/public/avo-packs/media/images/b2e4cf0fab6c8ca66b7f.ttf.gz +0 -0
- data/public/avo-packs/media/images/b78d61ab7e046de8c156.eot +0 -0
- data/public/avo-packs/media/images/c9ab29becb76ddab01d0.woff +0 -0
@@ -6,12 +6,12 @@ module Avo
|
|
6
6
|
before_action :set_resource
|
7
7
|
before_action :hydrate_resource
|
8
8
|
before_action :set_model, only: [:show, :edit, :destroy, :update]
|
9
|
+
before_action :set_model_to_fill
|
9
10
|
before_action :authorize_action
|
10
11
|
before_action :reset_pagination_if_filters_changed, only: :index
|
11
12
|
before_action :cache_applied_filters, only: :index
|
12
13
|
|
13
14
|
def index
|
14
|
-
@view = :index
|
15
15
|
@page_title = resource_name.humanize
|
16
16
|
add_breadcrumb resource_name.humanize
|
17
17
|
|
@@ -24,8 +24,8 @@ module Avo
|
|
24
24
|
@query = @resource.class.query_scope
|
25
25
|
end
|
26
26
|
|
27
|
-
# Remove default_scope for index view
|
28
|
-
if @resource.unscoped_queries_on_index
|
27
|
+
# Remove default_scope for index view if no parent_resource present
|
28
|
+
if @resource.unscoped_queries_on_index && @parent_resource.blank?
|
29
29
|
@query = @query.unscoped
|
30
30
|
end
|
31
31
|
|
@@ -59,7 +59,6 @@ module Avo
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def show
|
62
|
-
@view = :show
|
63
62
|
set_actions
|
64
63
|
|
65
64
|
@resource = @resource.hydrate(model: @model, view: :show, user: _current_user, params: params)
|
@@ -82,7 +81,6 @@ module Avo
|
|
82
81
|
end
|
83
82
|
|
84
83
|
def new
|
85
|
-
@view = :new
|
86
84
|
@model = @resource.model_class.new
|
87
85
|
@resource = @resource.hydrate(model: @model, view: :new, user: _current_user)
|
88
86
|
|
@@ -92,7 +90,6 @@ module Avo
|
|
92
90
|
end
|
93
91
|
|
94
92
|
def edit
|
95
|
-
@view = :edit
|
96
93
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
97
94
|
|
98
95
|
@page_title = @resource.default_panel_name
|
@@ -114,17 +111,47 @@ module Avo
|
|
114
111
|
end
|
115
112
|
|
116
113
|
def create
|
117
|
-
|
114
|
+
# model gets instantiated and filled in the fill_model method
|
115
|
+
fill_model
|
118
116
|
saved = @model.save
|
119
117
|
@resource.hydrate(model: @model, view: :new, user: _current_user)
|
120
118
|
|
119
|
+
# This means that the record has been created through another parent record and we need to attach it somehow.
|
120
|
+
if params[:via_resource_id].present?
|
121
|
+
@reflection = @model._reflections[params[:via_relation]]
|
122
|
+
# Figure out what kind of association does the record have with the parent record
|
123
|
+
|
124
|
+
# belongs_to
|
125
|
+
# has_many
|
126
|
+
# Get the foreign key and set it to the id we received in the params
|
127
|
+
if @reflection.is_a?(ActiveRecord::Reflection::BelongsToReflection) || @reflection.is_a?(ActiveRecord::Reflection::HasManyReflection)
|
128
|
+
foreign_key = @reflection.foreign_key
|
129
|
+
@model.send("#{foreign_key}=", params[:via_resource_id])
|
130
|
+
@model.save
|
131
|
+
end
|
132
|
+
|
133
|
+
# has_one
|
134
|
+
# has_one_through
|
135
|
+
|
136
|
+
# has_many_through
|
137
|
+
# has_and_belongs_to_many
|
138
|
+
# polymorphic
|
139
|
+
if @reflection.is_a? ActiveRecord::Reflection::ThroughReflection
|
140
|
+
# find the record
|
141
|
+
via_resource = ::Avo::App.get_resource_by_model_name params[:via_relation_class]
|
142
|
+
@related_record = via_resource.model_class.find params[:via_resource_id]
|
143
|
+
|
144
|
+
@model.send(params[:via_relation]) << @related_record
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
121
148
|
respond_to do |format|
|
122
149
|
if saved
|
123
|
-
redirect_path =
|
150
|
+
redirect_path = resource_path(model: @model, resource: @resource)
|
151
|
+
|
152
|
+
if params[:via_relation_class].present? && params[:via_resource_id].present?
|
124
153
|
parent_resource = ::Avo::App.get_resource_by_model_name params[:via_relation_class].safe_constantize
|
125
|
-
resource_path(model: params[:via_relation_class].safe_constantize, resource: parent_resource, resource_id: params[:via_resource_id])
|
126
|
-
else
|
127
|
-
resource_path(model: @model, resource: @resource)
|
154
|
+
redirect_path = resource_path(model: params[:via_relation_class].safe_constantize, resource: parent_resource, resource_id: params[:via_resource_id])
|
128
155
|
end
|
129
156
|
|
130
157
|
format.html { redirect_to redirect_path, notice: "#{@model.class.name} #{t("avo.was_successfully_created")}." }
|
@@ -138,7 +165,8 @@ module Avo
|
|
138
165
|
end
|
139
166
|
|
140
167
|
def update
|
141
|
-
|
168
|
+
# model gets instantiated and filled in the fill_model method
|
169
|
+
fill_model
|
142
170
|
saved = @model.save
|
143
171
|
@resource = @resource.hydrate(model: @model, view: :edit, user: _current_user)
|
144
172
|
|
@@ -1,18 +1,7 @@
|
|
1
1
|
module Avo
|
2
2
|
module ApplicationHelper
|
3
|
-
include ::Manifester::Helper
|
4
3
|
include ::Pagy::Frontend
|
5
4
|
|
6
|
-
def current_webpacker_instance
|
7
|
-
return Avo.webpacker if Avo::IN_DEVELOPMENT
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def current_manifester_instance
|
13
|
-
Avo.manifester
|
14
|
-
end
|
15
|
-
|
16
5
|
def render_license_warnings
|
17
6
|
render partial: "avo/sidebar/license_warnings", locals: {
|
18
7
|
license: Avo::App.license.properties
|
@@ -116,7 +105,7 @@ module Avo
|
|
116
105
|
options[:class] += args[:extra_class].present? ? " #{args[:extra_class]}" : ""
|
117
106
|
|
118
107
|
# Create the path to the svgs directory
|
119
|
-
file_path = "#{Avo::Engine.root}/app/
|
108
|
+
file_path = "#{Avo::Engine.root}/app/assets/svgs/#{file_name}"
|
120
109
|
file_path = "#{file_path}.svg" unless file_path.end_with? ".svg"
|
121
110
|
|
122
111
|
# Create a cache hash
|
@@ -146,12 +135,12 @@ module Avo
|
|
146
135
|
end
|
147
136
|
|
148
137
|
def input_classes(extra_classes = "", has_error: false)
|
149
|
-
classes = "appearance-none inline-flex bg-
|
138
|
+
classes = "appearance-none inline-flex bg-slate-100 disabled:bg-slate-300 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-700 rounded-md py-2 px-3 leading-tight border outline-none outline"
|
150
139
|
|
151
140
|
classes += if has_error
|
152
141
|
" border-red-600"
|
153
142
|
else
|
154
|
-
" border-
|
143
|
+
" border-slate-300"
|
155
144
|
end
|
156
145
|
|
157
146
|
classes += " #{extra_classes}"
|
@@ -4,15 +4,14 @@ import 'core-js/stable'
|
|
4
4
|
import 'regenerator-runtime/runtime'
|
5
5
|
import * as ActiveStorage from '@rails/activestorage'
|
6
6
|
import * as Mousetrap from 'mousetrap'
|
7
|
-
import { Application } from 'stimulus'
|
8
7
|
import { Turbo } from '@hotwired/turbo-rails'
|
9
|
-
import { definitionsFromContext } from 'stimulus/webpack-helpers'
|
10
8
|
import Rails from '@rails/ujs'
|
11
9
|
import tippy from 'tippy.js'
|
12
10
|
|
13
11
|
// Toastr alerts
|
14
|
-
import '
|
15
|
-
import '
|
12
|
+
import './js/active-storage'
|
13
|
+
import './js/controllers'
|
14
|
+
import './js/toastr'
|
16
15
|
|
17
16
|
Rails.start()
|
18
17
|
|
@@ -20,6 +19,17 @@ window.Turbolinks = Turbo
|
|
20
19
|
|
21
20
|
Mousetrap.bind('r r r', () => Turbo.visit(window.location.href, { action: 'replace' }))
|
22
21
|
|
22
|
+
function isMac() {
|
23
|
+
const isMac = window.navigator.userAgent.indexOf('Mac OS X')
|
24
|
+
|
25
|
+
if (isMac) {
|
26
|
+
document.body.classList.add('os-mac')
|
27
|
+
document.body.classList.remove('os-pc')
|
28
|
+
} else {
|
29
|
+
document.body.classList.add('os-pc')
|
30
|
+
document.body.classList.remove('os-mac')
|
31
|
+
}
|
32
|
+
}
|
23
33
|
function initTippy() {
|
24
34
|
tippy('[data-tippy="tooltip"]', {
|
25
35
|
theme: 'light',
|
@@ -33,18 +43,12 @@ function initTippy() {
|
|
33
43
|
}
|
34
44
|
window.initTippy = initTippy
|
35
45
|
|
36
|
-
const application = Application.start()
|
37
46
|
ActiveStorage.start()
|
38
47
|
|
39
|
-
const context = require.context('./../js/controllers', true, /\.js$/)
|
40
|
-
application.load(definitionsFromContext(context))
|
41
|
-
|
42
|
-
const fieldsContext = require.context('./../js/controllers/fields', true, /\.js$/)
|
43
|
-
application.load(definitionsFromContext(fieldsContext))
|
44
|
-
|
45
48
|
document.addEventListener('turbo:load', () => {
|
46
49
|
document.body.classList.remove('turbo-loading')
|
47
50
|
initTippy()
|
51
|
+
isMac()
|
48
52
|
})
|
49
53
|
|
50
54
|
document.addEventListener('turbo:before-fetch-response', (e) => {
|
@@ -58,10 +62,3 @@ document.addEventListener('turbo:submit-start', () => document.body.classList.ad
|
|
58
62
|
document.addEventListener('turbo:before-cache', () => {
|
59
63
|
document.querySelectorAll('[data-turbo-remove-before-cache]').forEach((element) => element.remove())
|
60
64
|
})
|
61
|
-
|
62
|
-
// Uncomment to copy all static images under ../images to the output folder and reference
|
63
|
-
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
64
|
-
// or the `imagePath` JavaScript helper below.
|
65
|
-
//
|
66
|
-
const images = require.context('../images', true)
|
67
|
-
const imagePath = (name) => images(name, true)
|
data/{public/avo-packs/media/images/dadf2db36589607d107d.png → app/javascript/images/logo.png}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -15,9 +15,10 @@ import 'codemirror/mode/xml/xml'
|
|
15
15
|
import 'codemirror/mode/yaml/yaml'
|
16
16
|
|
17
17
|
import { Controller } from 'stimulus'
|
18
|
-
import { castBoolean } from '@/js/helpers/cast_boolean'
|
19
18
|
import CodeMirror from 'codemirror'
|
20
19
|
|
20
|
+
import { castBoolean } from '../../helpers/cast_boolean'
|
21
|
+
|
21
22
|
export default class extends Controller {
|
22
23
|
static targets = ['element']
|
23
24
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Controller } from 'stimulus'
|
2
2
|
import { DateTime } from 'luxon'
|
3
|
-
import { castBoolean } from '
|
3
|
+
import { castBoolean } from '../../helpers/cast_boolean'
|
4
4
|
import flatpickr from 'flatpickr'
|
5
5
|
|
6
6
|
export default class extends Controller {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* eslint-disable max-len */
|
2
2
|
import { Controller } from 'stimulus'
|
3
|
-
import { castBoolean } from '
|
3
|
+
import { castBoolean } from '../../helpers/cast_boolean'
|
4
4
|
|
5
5
|
export default class extends Controller {
|
6
6
|
static targets = ['input', 'controller', 'rows']
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,7 +3,7 @@ import * as Mousetrap from 'mousetrap'
|
|
3
3
|
import { Controller } from 'stimulus'
|
4
4
|
import { Turbo } from '@hotwired/turbo-rails'
|
5
5
|
import { autocomplete } from '@algolia/autocomplete-js'
|
6
|
-
import debouncePromise from '
|
6
|
+
import debouncePromise from '../helpers/debounce_promise'
|
7
7
|
|
8
8
|
export default class extends Controller {
|
9
9
|
static targets = ['autocomplete', 'button']
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { application } from './application'
|
2
|
+
|
3
|
+
import ActionController from './controllers/action_controller'
|
4
|
+
import ActionsPickerController from './controllers/actions_picker_controller'
|
5
|
+
import AlertsController from './controllers/alerts_controller'
|
6
|
+
import AttachmentsController from './controllers/attachments_controller'
|
7
|
+
import BelongsToFieldController from './controllers/fields/belongs_to_field_controller'
|
8
|
+
import BooleanFilterController from './controllers/boolean_filter_controller'
|
9
|
+
import CodeFieldController from './controllers/fields/code_field_controller'
|
10
|
+
import DateFieldController from './controllers/fields/date_field_controller'
|
11
|
+
import FilterController from './controllers/filter_controller'
|
12
|
+
import HiddenInputController from './controllers/hidden_input_controller'
|
13
|
+
import ItemSelectAllController from './controllers/item_select_all_controller'
|
14
|
+
import ItemSelectorController from './controllers/item_selector_controller'
|
15
|
+
import KeyValueController from './controllers/fields/key_value_controller'
|
16
|
+
import LoadingButtonController from './controllers/loading_button_controller'
|
17
|
+
import ModalController from './controllers/modal_controller'
|
18
|
+
import MultipleSelectFilterController from './controllers/multiple_select_filter_controller'
|
19
|
+
import PerPageController from './controllers/per_page_controller'
|
20
|
+
import SearchController from './controllers/search_controller'
|
21
|
+
import SelectFilterController from './controllers/select_filter_controller'
|
22
|
+
import SimpleMdeController from './controllers/fields/simple_mde_controller'
|
23
|
+
import TextFilterController from './controllers/text_filter_controller'
|
24
|
+
import TippyController from './controllers/tippy_controller'
|
25
|
+
import TogglePanelController from './controllers/toggle_panel_controller'
|
26
|
+
import TrixFieldController from './controllers/fields/trix_field_controller'
|
27
|
+
|
28
|
+
application.register('action', ActionController)
|
29
|
+
application.register('actions-picker', ActionsPickerController)
|
30
|
+
application.register('alerts', AlertsController)
|
31
|
+
application.register('attachments', AttachmentsController)
|
32
|
+
application.register('boolean-filter', BooleanFilterController)
|
33
|
+
application.register('filter', FilterController)
|
34
|
+
application.register('hidden-input', HiddenInputController)
|
35
|
+
application.register('item-select-all', ItemSelectAllController)
|
36
|
+
application.register('item-selector', ItemSelectorController)
|
37
|
+
application.register('loading-button', LoadingButtonController)
|
38
|
+
application.register('modal', ModalController)
|
39
|
+
application.register('multiple-select-filter', MultipleSelectFilterController)
|
40
|
+
application.register('per-page', PerPageController)
|
41
|
+
application.register('search', SearchController)
|
42
|
+
application.register('select-filter', SelectFilterController)
|
43
|
+
application.register('text-filter', TextFilterController)
|
44
|
+
application.register('tippy', TippyController)
|
45
|
+
application.register('toggle-panel', TogglePanelController)
|
46
|
+
|
47
|
+
// Field controllers
|
48
|
+
application.register('belongs-to-field', BelongsToFieldController)
|
49
|
+
application.register('code-field', CodeFieldController)
|
50
|
+
application.register('date-field', DateFieldController)
|
51
|
+
application.register('key-value', KeyValueController)
|
52
|
+
application.register('simple-mde', SimpleMdeController)
|
53
|
+
application.register('trix-field', TrixFieldController)
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@
|
|
5
5
|
data-action-target="controllerDiv"
|
6
6
|
data-resource-name="<%= @resource.model_key %>"
|
7
7
|
data-resource-id="<%= params[:id] %>"
|
8
|
-
class="hidden text-
|
8
|
+
class="hidden text-slate-800"
|
9
9
|
>
|
10
10
|
<%= form_with model: @model, scope: 'fields', url: "#{@resource.records_path}/actions/#{@action.param_id}", data: {'turbo-frame': '_top', 'action-target': 'form'} do |form| %>
|
11
11
|
<%= render Avo::ModalComponent.new do |c| %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if @actions.count > 0 %>
|
2
2
|
<div class="relative z-40 js-actions-dropdown" data-controller="toggle-panel actions-picker">
|
3
3
|
<%= a_button class: "focus:outline-none",
|
4
|
-
color: '
|
4
|
+
color: 'sky',
|
5
5
|
'data-action': "click->toggle-panel#togglePanel",
|
6
6
|
'data-actions-dropdown-button': @resource.model_key do
|
7
7
|
%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div data-controller="toggle-panel">
|
2
2
|
<div class="relative w-full flex justify-between z-30">
|
3
3
|
<%= a_button class: 'focus:outline-none',
|
4
|
-
color: '
|
4
|
+
color: 'slate',
|
5
5
|
title: t('avo.click_to_reveal_filters'),
|
6
6
|
'data-button': 'resource-filters',
|
7
7
|
'data-action': 'click->toggle-panel#togglePanel',
|
@@ -24,9 +24,9 @@
|
|
24
24
|
|
25
25
|
<div class="p-4 border-gray-300 border-t">
|
26
26
|
<% if params[:filters].present? %>
|
27
|
-
<%= a_link t('avo.reset_filters'), resources_path(resource: @resource, filters: nil, keep_query_params: true), color: '
|
27
|
+
<%= a_link t('avo.reset_filters'), resources_path(resource: @resource, filters: nil, keep_query_params: true), color: 'slate', class: 'w-full justify-center' %>
|
28
28
|
<% else %>
|
29
|
-
<%= a_button t('avo.reset_filters'), color: '
|
29
|
+
<%= a_button t('avo.reset_filters'), color: 'slate', class: 'w-full justify-center', disabled: true %>
|
30
30
|
<% end %>
|
31
31
|
</div>
|
32
32
|
</div>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="mt-2">
|
8
8
|
<code class="text-lg">Toggle published</code>
|
9
9
|
<div class="mt-1">
|
10
|
-
<code class="p-1 rounded bg-
|
10
|
+
<code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:action toggle_published</code>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
13
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="mt-2">
|
8
8
|
<code class="text-lg">Published filter</code>
|
9
9
|
<div class="mt-1">
|
10
|
-
<code class="p-1 rounded bg-
|
10
|
+
<code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:filter published_filter</code>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
13
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
<% models.each do |model| %>
|
21
21
|
<code class="text-lg"><%= model.to_s %></code>
|
22
22
|
<div>
|
23
|
-
<code class="p-1 rounded bg-
|
23
|
+
<code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:resource <%= model.to_s %></code>
|
24
24
|
</div>
|
25
25
|
<% end %>
|
26
26
|
</div>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
You may generate a resource using the following command:
|
31
31
|
<br>
|
32
32
|
|
33
|
-
<code class="p-1 rounded bg-
|
33
|
+
<code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:resource post</code>
|
34
34
|
</div>
|
35
35
|
<% end %>
|
36
36
|
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<div class="text-center text-sm text-gray-700">
|
2
|
-
<a href="https://avohq.io/" target="_blank">Avo</a> · © <%= Date.today.year %> AvoHQ · v<%= Avo::VERSION
|
2
|
+
<a href="https://avohq.io/" target="_blank">Avo</a> · © <%= Date.today.year %> AvoHQ · <span title="<%= Avo::App.license.id %>">v<%= Avo::VERSION %></span>
|
3
3
|
</div>
|
@@ -10,7 +10,10 @@
|
|
10
10
|
data-search-target="button"
|
11
11
|
>
|
12
12
|
<span class="sr-only">Press </span>
|
13
|
-
<kbd class="font-sans"
|
13
|
+
<kbd class="font-sans">
|
14
|
+
<abbr title="Command" class="no-underline pc:hidden">⌘</abbr>
|
15
|
+
<abbr title="CTRL" class="no-underline mac:hidden">CTRL + </abbr>
|
16
|
+
</kbd>
|
14
17
|
<span class="sr-only"> and </span>
|
15
18
|
<kbd class="font-sans">K</kbd><span class="sr-only"> to search</span>
|
16
19
|
</div>
|
@@ -1 +1 @@
|
|
1
|
-
<%=
|
1
|
+
<%= image_tag 'avo/logo.png', class: 'h-full', title: 'Avo' %>
|
@@ -8,17 +8,17 @@
|
|
8
8
|
per_page_options = per_page_options.sort.uniq
|
9
9
|
%>
|
10
10
|
|
11
|
-
<div class="bg-white px-4 flex items-center justify-between aborder-t aborder-
|
11
|
+
<div class="bg-white px-4 flex items-center justify-between aborder-t aborder-slate-200 sm:px-6 rounded-xl">
|
12
12
|
<div class="hidden sm:flex-2 sm:flex sm:items-center sm:justify-between">
|
13
13
|
<div>
|
14
|
-
<div class="text-sm leading-5 text-
|
14
|
+
<div class="text-sm leading-5 text-slate-600 flex items-center">
|
15
15
|
<div class="mr-2"><%== pagy_info @pagy %></div>
|
16
16
|
|
17
17
|
<div data-controller="per-page">
|
18
18
|
<div class="flex items-center">
|
19
19
|
<%= select_tag 'per_page',
|
20
20
|
options_for_select(per_page_options, @index_params[:per_page]),
|
21
|
-
class: 'appearance-none inline-flex bg-
|
21
|
+
class: 'appearance-none inline-flex bg-slate-100 disabled:bg-slate-400 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-600 rounded-md py-1 px-2 leading-tight border border-slate-300 outline-none focus:border-slate-400 outline w-16 mr-1 text-sm',
|
22
22
|
data: {
|
23
23
|
'turbo-frame': turbo_frame,
|
24
24
|
'per-page-target': 'selector',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
<thead class="bg-
|
2
|
+
<thead class="bg-slate-100 border-t border-b border-gray-300 pb-1">
|
3
3
|
<th>
|
4
4
|
<%== item_select_all_input %>
|
5
5
|
</th>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
sort_by = field.id
|
29
29
|
sort_direction = 'desc'
|
30
30
|
end
|
31
|
-
classes = "text-
|
31
|
+
classes = "text-slate-600 tracking-tight leading-tight text-xs font-semibold"
|
32
32
|
%>
|
33
33
|
<th class="text-left uppercase px-3 py-2 whitespace-nowrap">
|
34
34
|
<% if field.sortable %>
|
@@ -9,10 +9,15 @@
|
|
9
9
|
<%= render partial: 'avo/partials/javascript' %>
|
10
10
|
<%= render partial: 'avo/partials/head' %>
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
<% if Avo::PACKED %>
|
13
|
+
<%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
14
|
+
<%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
15
|
+
<% else %>
|
16
|
+
<%= javascript_include_tag "avo", "data-turbo-track": "reload", defer: true %>
|
17
|
+
<%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
|
18
|
+
<% end %>
|
14
19
|
</head>
|
15
|
-
<body class="bg-
|
20
|
+
<body class="bg-slate-200 os-mac">
|
16
21
|
|
17
22
|
<div id="app" class="flex min-h-screen flex-row h-full">
|
18
23
|
<div class="flex flex-1 w-full">
|
@@ -24,7 +29,7 @@
|
|
24
29
|
<%= render partial: "avo/partials/header" %>
|
25
30
|
</div>
|
26
31
|
<div class="flex-1 flex ml-4 pl-4">
|
27
|
-
<%= render partial: "avo/partials/global_search" if ::Avo::App.license.has_with_trial(:global_search) %>
|
32
|
+
<%= render partial: "avo/partials/global_search" if ::Avo::App.license.has_with_trial(:global_search) && ::Avo.configuration.feature_enabled?(:global_search) %>
|
28
33
|
</div>
|
29
34
|
<div class="align-end">
|
30
35
|
<%= render partial: "avo/partials/profile_dropdown" %>
|
data/avo.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
"public gem pushes."
|
28
28
|
end
|
29
29
|
|
30
|
-
spec.post_install_message = "Thank you for using Avo
|
30
|
+
spec.post_install_message = "Thank you for using Avo 💪 Docs are available at https://docs.avohq.io"
|
31
31
|
|
32
32
|
spec.files = Dir["{bin,app,config,db,lib,public}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "avo.gemspec", "Gemfile", "Gemfile.lock"]
|
33
33
|
|
@@ -44,5 +44,4 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_dependency "addressable"
|
45
45
|
spec.add_dependency "meta-tags"
|
46
46
|
spec.add_dependency "breadcrumbs_on_rails"
|
47
|
-
spec.add_dependency "manifester"
|
48
47
|
end
|
data/bin/dev
ADDED
data/bin/test
CHANGED
data/lib/avo/base_resource.rb
CHANGED
@@ -343,8 +343,9 @@ module Avo
|
|
343
343
|
|
344
344
|
reflection = @model._reflections[@params[:via_relation]]
|
345
345
|
|
346
|
-
if field.polymorphic_as.present? && field.types.map(&:to_s).include?(@params[
|
347
|
-
value
|
346
|
+
if field.polymorphic_as.present? && field.types.map(&:to_s).include?(@params[:via_relation_class])
|
347
|
+
# set the value to the actual record
|
348
|
+
value = @params[:via_relation_class].safe_constantize.find(@params[:via_resource_id])
|
348
349
|
elsif reflection.present? && reflection.foreign_key.present? && field.id.to_s == @params[:via_relation].to_s
|
349
350
|
value = @params[:via_resource_id]
|
350
351
|
end
|
@@ -441,7 +442,7 @@ module Avo
|
|
441
442
|
end
|
442
443
|
|
443
444
|
def form_scope
|
444
|
-
model.class.base_class.to_s.downcase
|
445
|
+
model.class.base_class.to_s.underscore.downcase
|
445
446
|
end
|
446
447
|
end
|
447
448
|
end
|