avo 2.14.3.pre.4.tosqlfix → 2.14.3.pre.5.nosprockets
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.lock +1 -1
- data/app/assets/stylesheets/{avo.css → avo.base.css} +0 -0
- data/app/components/avo/base_component.rb +2 -3
- data/app/components/avo/resource_component.rb +3 -2
- data/app/components/avo/sidebar_component.html.erb +1 -1
- data/app/components/avo/views/resource_edit_component.rb +0 -2
- data/app/controllers/avo/debug_controller.rb +3 -5
- data/app/controllers/avo/team_users_controller.rb +4 -0
- data/app/javascript/{avo.js → avo.base.js} +0 -0
- data/app/views/avo/debug/index.html.erb +13 -10
- data/app/views/avo/sidebar/_license_warnings.html.erb +1 -1
- data/app/views/layouts/avo/application.html.erb +5 -5
- data/lib/avo/app.rb +2 -2
- data/lib/avo/base_resource.rb +5 -1
- data/lib/avo/concerns/fetches_things.rb +13 -2
- data/lib/avo/configuration.rb +2 -0
- data/lib/avo/licensing/h_q.rb +23 -1
- data/lib/avo/licensing/license_manager.rb +1 -1
- data/lib/avo/svg_finder.rb +8 -5
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/base_generator.rb +5 -1
- data/lib/generators/avo/js/install_generator.rb +64 -0
- data/lib/generators/avo/tailwindcss/install_generator.rb +54 -0
- data/lib/generators/avo/templates/initializer/avo.tt +10 -7
- data/lib/generators/avo/templates/js/avo.custom.js +2 -0
- data/lib/generators/avo/templates/tailwindcss/Procfile.dev +2 -0
- data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +13 -0
- data/lib/tasks/avo_tasks.rake +8 -8
- data/lib/tasks/tailwindcss_rails.rake +24 -0
- data/public/avo-assets/{avo.css → avo.base.css} +0 -0
- data/public/avo-assets/{avo.js → avo.base.js} +1 -1
- data/public/avo-assets/{avo.js.map → avo.base.js.map} +1 -1
- metadata +14 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b277fe8fdc0cd240ea697b7d68a43af06761d12d5be000c6717da4eda00e5a88
|
4
|
+
data.tar.gz: 9e9fad003131d2188bec5eee8358571e2ccb841c4fb9fc3f8f03f17688cf177a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f9bfe06002beb679269d7011f94ab229fa27b48edb6a7bec44f5e5e59fa0ec2593c2b94da575bfc419bd814f99f4ca7451cddb1240ce96b56936a43437bd2f
|
7
|
+
data.tar.gz: 26fd511e67b214f81959f404272cd4878d1f8d6396fd2b3e886a7fd985cf7bc9892ac8abb55ea61d9bee8aef0e8844d56f6bbe4adc0d5b42b0e4b6b978075df1
|
data/Gemfile.lock
CHANGED
File without changes
|
@@ -9,10 +9,9 @@ class Avo::BaseComponent < ViewComponent::Base
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
#
|
12
|
+
# Use the @parent_resource to fetch the field using the @reflection name.
|
13
13
|
def field
|
14
|
-
|
15
|
-
fields.find { |f| f.id == @reflection.name }
|
14
|
+
@parent_resource.get_field_definitions.find { |f| f.id == @reflection.name }
|
16
15
|
rescue
|
17
16
|
nil
|
18
17
|
end
|
@@ -4,6 +4,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
4
4
|
attr_reader :has_many_panels
|
5
5
|
attr_reader :has_as_belongs_to_many_panels
|
6
6
|
attr_reader :resource_tools
|
7
|
+
attr_reader :resource
|
7
8
|
attr_reader :view
|
8
9
|
|
9
10
|
def can_create?
|
@@ -19,7 +20,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def can_detach?
|
22
|
-
authorize_association_for(
|
23
|
+
authorize_association_for(:detach)
|
23
24
|
end
|
24
25
|
|
25
26
|
def detach_path
|
@@ -53,7 +54,7 @@ class Avo::ResourceComponent < Avo::BaseComponent
|
|
53
54
|
|
54
55
|
if @reflection.present?
|
55
56
|
# Fetch the appropiate resource
|
56
|
-
reflection_resource =
|
57
|
+
reflection_resource = field.resource
|
57
58
|
# Fetch the model
|
58
59
|
# Hydrate the resource with the model if we have one
|
59
60
|
reflection_resource.hydrate(model: @parent_model) if @parent_model.present?
|
@@ -57,7 +57,7 @@
|
|
57
57
|
<%= render partial: "/avo/partials/sidebar_extra" %>
|
58
58
|
</div>
|
59
59
|
</div>
|
60
|
-
<%= helpers.render_license_warnings %>
|
60
|
+
<%= helpers.render_license_warnings unless Rails.env.production? %>
|
61
61
|
<%= render Avo::SidebarProfileComponent.new user: helpers._current_user %>
|
62
62
|
</div>
|
63
63
|
</div>
|
@@ -13,12 +13,10 @@ module Avo
|
|
13
13
|
|
14
14
|
if license.valid?
|
15
15
|
flash[:notice] = "avohq.io responded: \"#{license.id.humanize} license is valid\"."
|
16
|
+
elsif license.response['reason'].present?
|
17
|
+
flash[:error] = "avohq.io responded: \"#{license.response['reason']}\"."
|
16
18
|
else
|
17
|
-
|
18
|
-
flash[:error] = "avohq.io responded: \"#{license.response['reason']}\"."
|
19
|
-
else
|
20
|
-
flash[:error] = license.response['error']
|
21
|
-
end
|
19
|
+
flash[:error] = license.response['error']
|
22
20
|
end
|
23
21
|
|
24
22
|
redirect_back fallback_location: avo.avo_private_debug_index_path
|
File without changes
|
@@ -20,7 +20,20 @@
|
|
20
20
|
<% c.bare_content do %>
|
21
21
|
<div class="grid gap-4 sm:grid-cols-3">
|
22
22
|
<div class="relative flex flex-col bg-white rounded shadow-panel p-4 space-y-4 h-full col-span-1">
|
23
|
+
<div class="flex justify-between w-full">
|
23
24
|
<div class="font-semibold">License info</div>
|
25
|
+
<div class="flex justify-self-end">
|
26
|
+
<%= a_button style: :outline,
|
27
|
+
color: :blue,
|
28
|
+
url: "#{root_path}avo_private/debug/refresh_license",
|
29
|
+
method: :post,
|
30
|
+
loading: true,
|
31
|
+
size: :xs,
|
32
|
+
icon: 'heroicons/outline/refresh' do %>
|
33
|
+
Refresh license
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
</div>
|
24
37
|
<div class="flex flex-col flex-1">
|
25
38
|
<div>
|
26
39
|
<div class="text-xl font-semibold"><%= license.name %></div>
|
@@ -54,16 +67,6 @@
|
|
54
67
|
</dl>
|
55
68
|
</div>
|
56
69
|
</div>
|
57
|
-
<div class="flex justify-end mt-4">
|
58
|
-
<%= a_button style: :outline,
|
59
|
-
color: :blue,
|
60
|
-
url: "#{root_path}avo_private/debug/refresh_license",
|
61
|
-
method: :post,
|
62
|
-
loading: true,
|
63
|
-
icon: 'heroicons/outline/refresh' do %>
|
64
|
-
Refresh license
|
65
|
-
<% end %>
|
66
|
-
</div>
|
67
70
|
</div>
|
68
71
|
</div>
|
69
72
|
<div class="relative bg-white rounded shadow-panel p-4 space-y-4 col-span-2">
|
@@ -2,5 +2,5 @@
|
|
2
2
|
<%= render_license_warning title: 'Trial Mode', message: 'You are experiencing paid features that need to be licensed before deploying this site. Enjoy!' %>
|
3
3
|
<% end %>
|
4
4
|
<% if license[:error].present? && !(Avo.configuration.display_license_request_timeout_error === false && license[:error] === "Request timeout.") %>
|
5
|
-
<%= render_license_warning title: 'Avo HQ Error', message: "#{license[:error]}
|
5
|
+
<%= render_license_warning title: 'Avo HQ Error', message: "#{license[:error]} Checking back every 5 minutes." %>
|
6
6
|
<% end %>
|
@@ -6,17 +6,17 @@
|
|
6
6
|
<%= csrf_meta_tags %>
|
7
7
|
<%= csp_meta_tag %>
|
8
8
|
<%= render partial: 'avo/partials/javascript' %>
|
9
|
-
<%= render partial: 'avo/partials/head' %>
|
10
9
|
<% if Avo::PACKED %>
|
11
|
-
<%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
12
|
-
<%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
10
|
+
<%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
|
11
|
+
<%= stylesheet_link_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
|
13
12
|
<% else %>
|
14
|
-
<%= javascript_include_tag "avo", "data-turbo-track": "reload", defer: true %>
|
15
|
-
<%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
|
13
|
+
<%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
|
14
|
+
<%= stylesheet_link_tag "avo.base", "data-turbo-track": "reload", defer: true %>
|
16
15
|
<% if Rails.env.development? %>
|
17
16
|
<%= javascript_include_tag "hotwire-livereload", defer: true %>
|
18
17
|
<% end %>
|
19
18
|
<% end %>
|
19
|
+
<%= render partial: 'avo/partials/head' %>
|
20
20
|
</head>
|
21
21
|
<body class="bg-application os-mac">
|
22
22
|
<div class="relative flex flex-1 w-full min-h-full" data-controller="sidebar" data-sidebar-open-value="<%= @sidebar_open %>">
|
data/lib/avo/app.rb
CHANGED
@@ -161,12 +161,12 @@ module Avo
|
|
161
161
|
|
162
162
|
hq = Avo::Licensing::HQ.new(request)
|
163
163
|
|
164
|
-
payload[:thread_count] = get_thread_count
|
165
|
-
payload[:hq_payload] = hq&.payload
|
166
164
|
payload[:license_id] = Avo::App&.license&.id
|
167
165
|
payload[:license_valid] = Avo::App&.license&.valid?
|
168
166
|
payload[:license_payload] = Avo::App&.license&.payload
|
169
167
|
payload[:license_response] = Avo::App&.license&.response
|
168
|
+
payload[:hq_payload] = hq&.payload
|
169
|
+
payload[:thread_count] = get_thread_count
|
170
170
|
payload[:license_abilities] = Avo::App&.license&.abilities
|
171
171
|
payload[:cache_store] = self.cache_store&.class&.to_s
|
172
172
|
payload[:avo_metadata] = hq&.avo_metadata
|
data/lib/avo/base_resource.rb
CHANGED
@@ -20,7 +20,6 @@ module Avo
|
|
20
20
|
delegate :context, to: ::Avo::App
|
21
21
|
|
22
22
|
attr_accessor :view
|
23
|
-
attr_accessor :model
|
24
23
|
attr_accessor :reflection
|
25
24
|
attr_accessor :user
|
26
25
|
attr_accessor :params
|
@@ -111,6 +110,11 @@ module Avo
|
|
111
110
|
end
|
112
111
|
end
|
113
112
|
|
113
|
+
def record
|
114
|
+
@model
|
115
|
+
end
|
116
|
+
alias :model :record
|
117
|
+
|
114
118
|
def hydrate(model: nil, view: nil, user: nil, params: nil)
|
115
119
|
@view = view if view.present?
|
116
120
|
@user = user if user.present?
|
@@ -51,10 +51,15 @@ module Avo
|
|
51
51
|
#
|
52
52
|
# get_resource_by_name('User') => UserResource
|
53
53
|
# get_resource_by_name(User) => UserResource
|
54
|
-
def get_resource_by_model_name(
|
54
|
+
def get_resource_by_model_name(klass)
|
55
|
+
# Fetch the mappings imposed by the user.
|
56
|
+
# If they are present, use those ones.
|
57
|
+
mapping = get_mapping_for_model klass
|
58
|
+
return get_resource(mapping) if mapping.present?
|
59
|
+
|
55
60
|
valid_resources
|
56
61
|
.find do |resource|
|
57
|
-
resource.model_class.model_name.name ==
|
62
|
+
resource.model_class.model_name.name == klass.to_s
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
@@ -128,6 +133,12 @@ module Avo
|
|
128
133
|
|
129
134
|
get_sidebar_partials
|
130
135
|
end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def get_mapping_for_model(klass)
|
140
|
+
(Avo.configuration.model_resource_mapping || {}).stringify_keys.transform_values(&:to_s)[klass.to_s]
|
141
|
+
end
|
131
142
|
end
|
132
143
|
end
|
133
144
|
end
|
data/lib/avo/configuration.rb
CHANGED
@@ -34,6 +34,7 @@ module Avo
|
|
34
34
|
attr_accessor :buttons_on_form_footers
|
35
35
|
attr_accessor :main_menu
|
36
36
|
attr_accessor :profile_menu
|
37
|
+
attr_accessor :model_resource_mapping
|
37
38
|
attr_accessor :tabs_style
|
38
39
|
|
39
40
|
def initialize
|
@@ -79,6 +80,7 @@ module Avo
|
|
79
80
|
@buttons_on_form_footers = false
|
80
81
|
@main_menu = nil
|
81
82
|
@profile_menu = nil
|
83
|
+
@model_resource_mapping = {}
|
82
84
|
@tabs_style = :tabs
|
83
85
|
end
|
84
86
|
|
data/lib/avo/licensing/h_q.rb
CHANGED
@@ -153,6 +153,8 @@ module Avo
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def cache_response(response: nil, time: CACHE_TIME)
|
156
|
+
response = normalize_response response
|
157
|
+
|
156
158
|
response.merge!(
|
157
159
|
expiry: time,
|
158
160
|
fetched_at: Time.now,
|
@@ -164,6 +166,21 @@ module Avo
|
|
164
166
|
response
|
165
167
|
end
|
166
168
|
|
169
|
+
def normalize_response(response)
|
170
|
+
if response.is_a? Hash
|
171
|
+
response
|
172
|
+
else
|
173
|
+
{
|
174
|
+
normalized_response: JSON.stringify(response)
|
175
|
+
}
|
176
|
+
end
|
177
|
+
response.merge({})
|
178
|
+
rescue
|
179
|
+
{
|
180
|
+
normalized_response: "rescued"
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
167
184
|
def perform_request
|
168
185
|
::Rails.logger.debug "[Avo] Performing request to avohq.io API to check license availability." if Rails.env.development?
|
169
186
|
|
@@ -199,7 +216,12 @@ module Avo
|
|
199
216
|
end
|
200
217
|
|
201
218
|
def cache_and_return_error(error, exception_message = "")
|
202
|
-
cache_response response: {
|
219
|
+
cache_response response: {
|
220
|
+
id: Avo.configuration.license,
|
221
|
+
valid: true,
|
222
|
+
error: error,
|
223
|
+
exception_message: exception_message
|
224
|
+
}.stringify_keys, time: 5.minutes.to_i
|
203
225
|
end
|
204
226
|
|
205
227
|
def has_cached_response
|
data/lib/avo/svg_finder.rb
CHANGED
@@ -22,18 +22,22 @@ class Avo::SvgFinder
|
|
22
22
|
Avo::Engine.root.join(@filename).to_s,
|
23
23
|
]
|
24
24
|
|
25
|
-
|
25
|
+
paths.find do |path|
|
26
26
|
File.exist? path
|
27
27
|
end
|
28
|
-
|
29
|
-
path
|
30
28
|
end
|
31
29
|
|
32
30
|
def default_strategy
|
33
|
-
|
31
|
+
# If the app uses Propshaft, grab it from there
|
32
|
+
if defined?(Propshaft)
|
33
|
+
asset_path = ::Rails.application.assets.load_path.find(@filename)
|
34
|
+
asset_path&.path
|
35
|
+
elsif ::Rails.application.config.assets.compile
|
36
|
+
# Grab the asset from the compiled asset manifest
|
34
37
|
asset = ::Rails.application.assets[@filename]
|
35
38
|
Pathname.new(asset.filename) if asset.present?
|
36
39
|
else
|
40
|
+
# Grab the asset from the manifest
|
37
41
|
manifest = ::Rails.application.assets_manifest
|
38
42
|
asset_path = manifest.assets[@filename]
|
39
43
|
unless asset_path.nil?
|
@@ -42,4 +46,3 @@ class Avo::SvgFinder
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
45
|
-
|
data/lib/avo/version.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative "../base_generator"
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
module Avo
|
5
|
+
module Js
|
6
|
+
class InstallGenerator < BaseGenerator
|
7
|
+
source_root File.expand_path("../templates", __dir__)
|
8
|
+
|
9
|
+
namespace "avo:js:install"
|
10
|
+
desc "Add custom JavaScript assets to your Avo project."
|
11
|
+
|
12
|
+
# possible values: importmap or esbuild
|
13
|
+
class_option :bundler, type: :string, default: "importmap"
|
14
|
+
|
15
|
+
def create_files
|
16
|
+
case options[:bundler].to_s
|
17
|
+
when "importmap"
|
18
|
+
install_for_importmap
|
19
|
+
when "esbuild"
|
20
|
+
install_for_esbuild
|
21
|
+
else
|
22
|
+
say "We don't know how to install Avo JS for this bundler \"#{options[:bundler]}\""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
no_tasks do
|
27
|
+
def install_for_importmap
|
28
|
+
unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
|
29
|
+
say "Add default app/javascript/avo.custom.js"
|
30
|
+
copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
|
31
|
+
end
|
32
|
+
|
33
|
+
say "Ejecting the _head.html.erb partial"
|
34
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
35
|
+
|
36
|
+
say "Adding the JS asset to the partial"
|
37
|
+
append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_importmap_tags \"avo.custom\" %>"
|
38
|
+
|
39
|
+
# pin to importmap
|
40
|
+
say "Pin the new entrypoint to your importmap config"
|
41
|
+
append_to_file Rails.root.join("config", "importmap.rb"), "\n# Avo custom JS entrypoint\npin \"avo.custom\", preload: true\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
def install_for_esbuild
|
45
|
+
unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
|
46
|
+
say "Add default app/javascript/avo.custom.js"
|
47
|
+
copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
|
48
|
+
end
|
49
|
+
|
50
|
+
say "Ejecting the _head.html.erb partial"
|
51
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
52
|
+
|
53
|
+
say "Adding the JS asset to the partial"
|
54
|
+
append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_include_tag \"avo.custom\", \"data-turbo-track\": \"reload\", defer: true %>"
|
55
|
+
end
|
56
|
+
|
57
|
+
def template_path(filename)
|
58
|
+
Pathname.new(__dir__).join("..", "templates", "js", filename).to_s
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "../base_generator"
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
module Avo
|
5
|
+
module Tailwindcss
|
6
|
+
class InstallGenerator < BaseGenerator
|
7
|
+
source_root File.expand_path("../templates", __dir__)
|
8
|
+
|
9
|
+
namespace "avo:tailwindcss:install"
|
10
|
+
desc "Add Tailwindcss to your Avo project."
|
11
|
+
|
12
|
+
def create_files
|
13
|
+
unless tailwindcss_installed?
|
14
|
+
system "./bin/bundle add tailwindcss-rails"
|
15
|
+
system "./bin/rails tailwindcss:install"
|
16
|
+
end
|
17
|
+
|
18
|
+
unless Rails.root.join("app", "assets", "stylesheets", "avo.tailwind.css").exist?
|
19
|
+
say "Add default app/assets/stylesheets/avo.tailwind.css"
|
20
|
+
copy_file template_path("avo.tailwind.css"), "app/assets/stylesheets/avo.tailwind.css"
|
21
|
+
end
|
22
|
+
|
23
|
+
if Rails.root.join("Procfile.dev").exist?
|
24
|
+
append_to_file "Procfile.dev", "css: bin/rails avo:tailwindcss:watch\n"
|
25
|
+
else
|
26
|
+
say "Add default Procfile.dev"
|
27
|
+
copy_file template_path("Procfile.dev"), "Procfile.dev"
|
28
|
+
|
29
|
+
say "Ensure foreman is installed"
|
30
|
+
run "gem install foreman"
|
31
|
+
end
|
32
|
+
|
33
|
+
append_to_file "Procfile.dev", "avo_css: bin/rails tailwindcss:watch\n"
|
34
|
+
|
35
|
+
say "Ejecting the _head.html.erb partial"
|
36
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
37
|
+
|
38
|
+
say "Adding the CSS asset to the partial"
|
39
|
+
prepend_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= stylesheet_link_tag \"avo.tailwind.css\", media: \"all\" %>"
|
40
|
+
end
|
41
|
+
|
42
|
+
no_tasks do
|
43
|
+
def template_path(filename)
|
44
|
+
Pathname.new(__dir__).join("..", "templates", "tailwindcss", filename).to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
def tailwindcss_installed?
|
48
|
+
Rails.root.join("config", "tailwind.config.js").exist? || Rails.root.join("tailwind.config.js").exist?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -34,19 +34,23 @@ Avo.configure do |config|
|
|
34
34
|
## == Localization ==
|
35
35
|
# config.locale = 'en-US'
|
36
36
|
|
37
|
+
## == Resource options ==
|
38
|
+
# config.resource_controls = :right
|
39
|
+
# config.model_resource_mapping = {}
|
40
|
+
# config.default_view_type = :table
|
41
|
+
# config.per_page = 24
|
42
|
+
# config.per_page_steps = [12, 24, 48, 72]
|
43
|
+
# config.via_per_page = 8
|
44
|
+
# config.id_links_to_resource = false
|
45
|
+
# config.cache_resources_on_index_view = true
|
46
|
+
|
37
47
|
## == Customization ==
|
38
48
|
# config.app_name = 'Avocadelicious'
|
39
49
|
# config.timezone = 'UTC'
|
40
50
|
# config.currency = 'USD'
|
41
|
-
# config.per_page = 24
|
42
|
-
# config.per_page_steps = [12, 24, 48, 72]
|
43
|
-
# config.via_per_page = 8
|
44
|
-
# config.default_view_type = :table
|
45
51
|
# config.hide_layout_when_printing = false
|
46
|
-
# config.id_links_to_resource = false
|
47
52
|
# config.full_width_container = false
|
48
53
|
# config.full_width_index_view = false
|
49
|
-
# config.cache_resources_on_index_view = true
|
50
54
|
# config.search_debounce = 300
|
51
55
|
# config.view_component_path = "app/components"
|
52
56
|
# config.display_license_request_timeout_error = true
|
@@ -54,7 +58,6 @@ Avo.configure do |config|
|
|
54
58
|
# config.resource_controls = :right
|
55
59
|
# config.tabs_style = :tabs # can be :tabs or :pills
|
56
60
|
|
57
|
-
|
58
61
|
## == Breadcrumbs ==
|
59
62
|
# config.display_breadcrumbs = true
|
60
63
|
# config.set_initial_breadcrumbs do
|
data/lib/tasks/avo_tasks.rake
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
# # Task goes here
|
4
4
|
# end
|
5
5
|
|
6
|
-
desc
|
7
|
-
task
|
8
|
-
spec = get_gem_spec
|
6
|
+
desc "Installs Avo assets and bundles them for when you want to use the GitHub repo in your app"
|
7
|
+
task "avo:build-assets" do
|
8
|
+
spec = get_gem_spec "avo"
|
9
9
|
# Uncomment to enable only when the source is github.com
|
10
10
|
# enabled = spec.source.to_s.include?('https://github.com/avo-hq/avo')
|
11
11
|
enabled = true
|
@@ -15,8 +15,8 @@ task 'avo:build-assets' do
|
|
15
15
|
path = spec.full_gem_path
|
16
16
|
|
17
17
|
Dir.chdir(path) do
|
18
|
-
system
|
19
|
-
system
|
18
|
+
system "yarn"
|
19
|
+
system "yarn prod:build"
|
20
20
|
end
|
21
21
|
|
22
22
|
puts "Done"
|
@@ -28,10 +28,10 @@ end
|
|
28
28
|
# From
|
29
29
|
# https://stackoverflow.com/questions/9322078/programmatically-determine-gems-path-using-bundler
|
30
30
|
def get_gem_spec(name)
|
31
|
-
spec = Bundler.load.specs.find{|s| s.name == name }
|
31
|
+
spec = Bundler.load.specs.find { |s| s.name == name }
|
32
32
|
raise GemNotFound, "Could not find gem '#{name}' in the current bundle." unless spec
|
33
|
-
if spec.name ==
|
34
|
-
return File.expand_path(
|
33
|
+
if spec.name == "bundler"
|
34
|
+
return File.expand_path("../../../", __FILE__)
|
35
35
|
end
|
36
36
|
|
37
37
|
spec
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Use the user provided asset or use the default
|
2
|
+
ASSET_FILE = ARGV[0] || "app/assets/builds/avo.tailwind.css"
|
3
|
+
# Se the tailwindcss-rails package name
|
4
|
+
TAILWINDCSS_RAILS = "tailwindcss-rails"
|
5
|
+
|
6
|
+
# Check if tailwindcss-rails is being used
|
7
|
+
if Gem.loaded_specs.key? TAILWINDCSS_RAILS
|
8
|
+
# Get the path
|
9
|
+
GEM_PATH = Gem.loaded_specs[TAILWINDCSS_RAILS].full_gem_path
|
10
|
+
# Compose the compile command
|
11
|
+
AVO_TAILWIND_COMPILE_COMMAND = "#{RbConfig.ruby} #{Pathname.new(GEM_PATH)}/exe/tailwindcss -i '#{Rails.root.join("app/assets/stylesheets/avo.css")}' -o '#{Rails.root.join(ASSET_FILE)}' -c '#{Rails.root.join("config/tailwind.config.js")}' --minify"
|
12
|
+
|
13
|
+
namespace "avo:tailwindcss" do
|
14
|
+
desc "Build your Tailwind CSS"
|
15
|
+
task :build do
|
16
|
+
system(AVO_TAILWIND_COMPILE_COMMAND, exception: true)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Watch and build your Tailwind CSS on file changes"
|
20
|
+
task :watch do
|
21
|
+
system "#{AVO_TAILWIND_COMPILE_COMMAND} -w"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
@@ -510,4 +510,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
510
510
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
511
511
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
512
512
|
*/
|
513
|
-
//# sourceMappingURL=avo.js.map
|
513
|
+
//# sourceMappingURL=avo.base.js.map
|