avo 0.5.0.beta1 → 0.5.0.beta2
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 +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/app/components/avo/index/resource_controls_component.html.erb +1 -1
- data/app/controllers/avo/actions_controller.rb +1 -0
- data/app/controllers/avo/base_controller.rb +12 -1
- data/app/views/avo/base/_actions.html.erb +1 -1
- data/app/views/avo/sidebar/_sidebar.html.erb +1 -1
- data/lib/avo/app/action.rb +2 -19
- data/lib/avo/app/fields/external_image_field.rb +4 -3
- data/lib/avo/app/filter.rb +0 -11
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/locales_generator.rb +12 -0
- data/lib/generators/avo/partials_generator.rb +8 -0
- data/lib/generators/avo/templates/action.rb +3 -3
- data/lib/generators/avo/templates/filters/boolean_filter.rb +2 -2
- data/lib/generators/avo/templates/filters/select_filter.rb +2 -2
- data/lib/generators/avo/templates/initializer/avo.rb +0 -4
- data/lib/generators/avo/templates/locales/avo.en.yml +17 -0
- data/lib/generators/avo/templates/partials/_footer.html.erb +3 -0
- data/lib/generators/avo/templates/partials/_header.html.erb +1 -0
- data/lib/generators/avo/templates/{views → partials}/_logo.html.erb +0 -0
- data/lib/generators/avo/templates/{views → partials}/_scripts.html.erb +0 -0
- metadata +8 -8
- data/app/controllers/avo/resource_overview_controller.rb +0 -26
- data/lib/generators/avo/templates/views/_footer.html.erb +0 -3
- data/lib/generators/avo/templates/views/_header.html.erb +0 -1
- data/lib/generators/avo/views_generator.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 714d80a0c55444d87252f30e9233fe5db432136e9cd4ba0ad9851a57fd73b37e
|
4
|
+
data.tar.gz: 184d84ab6338864f1b0479c344278544422cb3967acff3dd6063148a446211fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc03e6bcd02b5f628e063f94188cf3293f747ee0f53bfcae46cf198bd1074c5da9304c94024e7a3fbcada4a6ee7342f0f20e9c9659dd57e2a6cd8d4d3bd686c2
|
7
|
+
data.tar.gz: b7a1c8fdf844e0064eef6df2449b501a75e0ed4f06499c6f74187654f16b02f316690076c00f3bafe98641a651b05c722cabd1c81f080eac0ffab03302754ac3
|
data/Gemfile
CHANGED
@@ -60,7 +60,6 @@ gem 'listen', '>= 3.0.5', '< 3.2'
|
|
60
60
|
gem 'spring'
|
61
61
|
|
62
62
|
gem 'factory_bot_rails'
|
63
|
-
gem 'faker', require: false
|
64
63
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
65
64
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
66
65
|
|
@@ -79,6 +78,7 @@ group :development do
|
|
79
78
|
# Release helper
|
80
79
|
gem 'bump', require: false
|
81
80
|
gem 'gem-release', require: false
|
81
|
+
gem 'faker', require: false
|
82
82
|
|
83
83
|
# gem 'rack-mini-profiler'
|
84
84
|
# gem 'memory_profiler'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
<% if can_detach? %>
|
26
26
|
<%= form_with url: helpers.resource_detach_path(params[:resource_name], params[:id], params[:related_name], @resource.model.id), method: :delete, html: {'data-turbo-frame': params[:turbo_frame]} do |form| %>
|
27
|
-
<%= form.button helpers.svg('trash', class: 'text-gray-400 h-6 hover:text-gray-600'),
|
27
|
+
<%= form.button helpers.svg('trash-sm', class: 'text-gray-400 h-6 hover:text-gray-600'),
|
28
28
|
title: t('avo.detach_item', { item: @resource.model.model_name.name.downcase }).capitalize,
|
29
29
|
type: :submit,
|
30
30
|
data: {
|
@@ -169,6 +169,10 @@ module Avo
|
|
169
169
|
cookies[:per_page] = params[:per_page]
|
170
170
|
end
|
171
171
|
|
172
|
+
if @parent_model.present?
|
173
|
+
@index_params[:per_page] = Avo.configuration.via_per_page
|
174
|
+
end
|
175
|
+
|
172
176
|
# Sorting
|
173
177
|
@index_params[:sort_by] = params[:sort_by] || :created_at
|
174
178
|
@index_params[:sort_direction] = params[:sort_direction] || :desc
|
@@ -179,7 +183,13 @@ module Avo
|
|
179
183
|
end
|
180
184
|
|
181
185
|
def set_filters
|
182
|
-
@filters = @resource.get_filters.map
|
186
|
+
@filters = @resource.get_filters.map do |filter_class|
|
187
|
+
filter = filter_class.new
|
188
|
+
|
189
|
+
filter.configure
|
190
|
+
|
191
|
+
filter
|
192
|
+
end
|
183
193
|
end
|
184
194
|
|
185
195
|
def set_actions
|
@@ -206,6 +216,7 @@ module Avo
|
|
206
216
|
|
207
217
|
@resource.get_filters.each do |filter_class|
|
208
218
|
filter = filter_class.new
|
219
|
+
filter.configure
|
209
220
|
|
210
221
|
if filter.default.present?
|
211
222
|
filter_defaults[filter_class.to_s] = filter.default
|
@@ -28,7 +28,7 @@
|
|
28
28
|
'data-turbo-frame': 'actions_show',
|
29
29
|
'data-action': 'click->actions-picker#visitAction',
|
30
30
|
class: 'flex items-center w-full py-2 px-4 font-bold text-gray-700 hover:text-white hover:bg-blue-500' do %>
|
31
|
-
<%= svg 'play',
|
31
|
+
<%= svg 'play', class: 'h-5 mr-1 inline' %> <%= action.name %>
|
32
32
|
<% end %>
|
33
33
|
<% end %>
|
34
34
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<div class="flex-1 flex flex-col justify-between">
|
8
8
|
<div class="tools py-4">
|
9
|
-
<%= render Avo::NavigationLinkComponent.new label:
|
9
|
+
<%= render Avo::NavigationLinkComponent.new label: 'Get started', path: '/avo', active: :exclusive if Rails.env.development? %>
|
10
10
|
<%= render Avo::NavigationHeadingComponent.new label: t('avo.resources') %>
|
11
11
|
|
12
12
|
<div class="w-full">
|
data/lib/avo/app/action.rb
CHANGED
@@ -35,8 +35,8 @@ module Avo
|
|
35
35
|
@message ||= I18n.t('avo.are_you_sure_you_want_to_run_this_option')
|
36
36
|
@default ||= ''
|
37
37
|
@fields ||= []
|
38
|
-
@confirm_text
|
39
|
-
@cancel_text
|
38
|
+
@confirm_text ||= I18n.t('avo.run')
|
39
|
+
@cancel_text ||= I18n.t('avo.cancel')
|
40
40
|
@response ||= {}
|
41
41
|
@response[:message_type] ||= :notice
|
42
42
|
@response[:message] ||= I18n.t('avo.action_ran_successfully')
|
@@ -64,23 +64,6 @@ module Avo
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def render_response
|
68
|
-
fields = get_fields.map { |field| field.fetch_for_action(model, resource) }
|
69
|
-
|
70
|
-
{
|
71
|
-
id: id,
|
72
|
-
name: name,
|
73
|
-
fields: fields,
|
74
|
-
message: message,
|
75
|
-
theme: theme,
|
76
|
-
confirm_text: confirm_text,
|
77
|
-
cancel_text: cancel_text,
|
78
|
-
default: default,
|
79
|
-
action_class: self.class.to_s,
|
80
|
-
no_confirmation: no_confirmation,
|
81
|
-
}
|
82
|
-
end
|
83
|
-
|
84
67
|
def hydrate(model: nil, resource: nil, user: nil)
|
85
68
|
@model = model if model.present?
|
86
69
|
@resource = resource if resource.present?
|
@@ -14,9 +14,10 @@ module Avo
|
|
14
14
|
super(name, **args, &block)
|
15
15
|
|
16
16
|
@link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
|
17
|
-
|
18
|
-
@
|
19
|
-
@
|
17
|
+
|
18
|
+
@width = args[:width].present? ? args[:width] : 32
|
19
|
+
@height = args[:height].present? ? args[:height] : 32
|
20
|
+
@radius = args[:radius].present? ? args[:radius] : 0
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
data/lib/avo/app/filter.rb
CHANGED
@@ -10,17 +10,6 @@ module Avo
|
|
10
10
|
@default ||= ''
|
11
11
|
end
|
12
12
|
|
13
|
-
def render_response
|
14
|
-
{
|
15
|
-
id: id,
|
16
|
-
name: name,
|
17
|
-
options: options,
|
18
|
-
component: component,
|
19
|
-
default: default,
|
20
|
-
filter_class: self.class.to_s,
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
13
|
def apply_query(request, query, value)
|
25
14
|
value.symbolize_keys! if value.is_a? Hash
|
26
15
|
|
data/lib/avo/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('templates', __dir__)
|
5
|
+
|
6
|
+
namespace 'avo:locales'
|
7
|
+
desc 'Creates an Avo initializer adds the route to the routes file.'
|
8
|
+
|
9
|
+
def create_files
|
10
|
+
template 'locales/avo.en.yml', 'config/locales/avo.en.yml'
|
11
|
+
end
|
12
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Avo
|
2
2
|
module Actions
|
3
3
|
class <%= class_name.camelize %> < Action
|
4
|
-
def
|
5
|
-
'<%= name.underscore.humanize %>'
|
4
|
+
def configure
|
5
|
+
@name = '<%= name.underscore.humanize %>'
|
6
6
|
end
|
7
7
|
|
8
8
|
def handle(request, models, fields)
|
@@ -11,7 +11,7 @@ module Avo
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
fields
|
14
|
+
def fields(request)
|
15
15
|
# Add desired fields here.
|
16
16
|
end
|
17
17
|
end
|
@@ -37,8 +37,4 @@ Avo.configure do |config|
|
|
37
37
|
# config.id_links_to_resource = false
|
38
38
|
# config.full_width_container = false
|
39
39
|
# config.full_width_index_view = false
|
40
|
-
|
41
|
-
## == Beta version ==
|
42
|
-
# config.hide_resource_overview_component = false
|
43
|
-
# config.hide_documentation_link = false
|
44
40
|
end
|
@@ -16,11 +16,18 @@ en:
|
|
16
16
|
resource_updated: 'Resource updated'
|
17
17
|
resource_created: 'Resource created'
|
18
18
|
resource_destroyed: 'Resource destroyed'
|
19
|
+
switch_to_view: "Switch to %{view_type} view"
|
20
|
+
click_to_reveal_filters: "Click to reveal filters"
|
21
|
+
attachment_destroyed: 'Attachment destroyed'
|
22
|
+
failed_to_find_attachment: 'Failed to find attachment'
|
23
|
+
you_missed_something_check_form: 'You might have missed something. Please check the form.'
|
19
24
|
remove_selection: 'Remove selection'
|
25
|
+
select_item: 'Select item'
|
20
26
|
delete_file: 'Delete file'
|
21
27
|
delete: 'delete'
|
22
28
|
delete_item: 'Delete %{item}'
|
23
29
|
download_item: 'Download %{item}'
|
30
|
+
download_file: 'Download file'
|
24
31
|
download: 'Download'
|
25
32
|
view: 'View'
|
26
33
|
view_item: 'view %{item}'
|
@@ -60,5 +67,15 @@ en:
|
|
60
67
|
next_page: 'Next page'
|
61
68
|
prev_page: 'Previous page'
|
62
69
|
list_is_empty: 'List is empty'
|
70
|
+
field_translations:
|
71
|
+
file:
|
72
|
+
zero: 'files'
|
73
|
+
one: 'file'
|
74
|
+
other: 'files'
|
75
|
+
resource_translations:
|
76
|
+
user:
|
77
|
+
zero: 'users'
|
78
|
+
one: 'user'
|
79
|
+
other: 'users'
|
63
80
|
reset_filters: 'Reset filters'
|
64
81
|
not_authorized: 'You are not authorized to perform this action.'
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to Avo.configuration.app_name, '/', class: 'text-green-600 font-semibold', target: :_blank, title: 'Navigate to the homepage' %>
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -393,7 +393,6 @@ files:
|
|
393
393
|
- app/controllers/avo/base_controller.rb
|
394
394
|
- app/controllers/avo/home_controller.rb
|
395
395
|
- app/controllers/avo/relations_controller.rb
|
396
|
-
- app/controllers/avo/resource_overview_controller.rb
|
397
396
|
- app/controllers/avo/resources_controller.rb
|
398
397
|
- app/controllers/avo/search_controller.rb
|
399
398
|
- app/frontend/css/alerts.css
|
@@ -612,19 +611,20 @@ files:
|
|
612
611
|
- lib/generators/avo/controller_generator.rb
|
613
612
|
- lib/generators/avo/filter_generator.rb
|
614
613
|
- lib/generators/avo/install_generator.rb
|
614
|
+
- lib/generators/avo/locales_generator.rb
|
615
|
+
- lib/generators/avo/partials_generator.rb
|
615
616
|
- lib/generators/avo/resource_generator.rb
|
616
617
|
- lib/generators/avo/templates/action.rb
|
617
618
|
- lib/generators/avo/templates/filters/boolean_filter.rb
|
618
619
|
- lib/generators/avo/templates/filters/select_filter.rb
|
619
620
|
- lib/generators/avo/templates/initializer/avo.rb
|
620
621
|
- lib/generators/avo/templates/locales/avo.en.yml
|
622
|
+
- lib/generators/avo/templates/partials/_footer.html.erb
|
623
|
+
- lib/generators/avo/templates/partials/_header.html.erb
|
624
|
+
- lib/generators/avo/templates/partials/_logo.html.erb
|
625
|
+
- lib/generators/avo/templates/partials/_scripts.html.erb
|
621
626
|
- lib/generators/avo/templates/resource/%plural_name%_controller.tt
|
622
627
|
- lib/generators/avo/templates/resource/%singular_name%.tt
|
623
|
-
- lib/generators/avo/templates/views/_footer.html.erb
|
624
|
-
- lib/generators/avo/templates/views/_header.html.erb
|
625
|
-
- lib/generators/avo/templates/views/_logo.html.erb
|
626
|
-
- lib/generators/avo/templates/views/_scripts.html.erb
|
627
|
-
- lib/generators/avo/views_generator.rb
|
628
628
|
- lib/tasks/avo_tasks.rake
|
629
629
|
- public/avo-packs/css/application-3598cfbb.css
|
630
630
|
- public/avo-packs/css/application-3598cfbb.css.br
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require_dependency 'avo/application_controller'
|
2
|
-
|
3
|
-
module Avo
|
4
|
-
class ResourceOverviewController < ApplicationController
|
5
|
-
def index
|
6
|
-
resources = App.get_resources
|
7
|
-
.select do |resource|
|
8
|
-
AuthorizationService::authorize _current_user, resource.model, Avo.configuration.authorization_methods.stringify_keys['index']
|
9
|
-
end
|
10
|
-
.sort_by(&:name)
|
11
|
-
.map do |resource|
|
12
|
-
{
|
13
|
-
name: resource.name,
|
14
|
-
url: resource.url,
|
15
|
-
count: resource.model.count,
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
render json: {
|
20
|
-
resources: resources,
|
21
|
-
hidden: Avo.configuration.hide_resource_overview_component,
|
22
|
-
hide_docs: Avo.configuration.hide_documentation_link,
|
23
|
-
}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= link_to Avo.configuration.app_name, '/', class: 'text-green-600 font-semibold', target: :_blank %>
|