avo 3.0.1.beta16 → 3.0.1.beta18

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.

@@ -320,7 +320,7 @@ module Avo
320
320
  def default_panel_name
321
321
  return @params[:related_name].capitalize if @params.present? && @params[:related_name].present?
322
322
 
323
- case @view
323
+ case @view.to_sym
324
324
  when :show
325
325
  record_title
326
326
  when :edit
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.0.1.beta16" unless const_defined?(:VERSION)
2
+ VERSION = "3.0.1.beta18" unless const_defined?(:VERSION)
3
3
  end
@@ -32,8 +32,9 @@ module Generators
32
32
  copy_file template_path("avo.tailwind.css"), path
33
33
  end
34
34
 
35
+ script_name = "avo:tailwind:css"
35
36
  if Rails.root.join("Procfile.dev").exist?
36
- say "Add #{cmd = "avo_css: yarn avo:tailwindcss --watch"} to Procfile.dev"
37
+ say "Add #{cmd = "avo_css: yarn #{script_name} --watch"} to Procfile.dev"
37
38
  append_to_file "Procfile.dev", "#{cmd}\n"
38
39
  else
39
40
  say "Add default Procfile.dev"
@@ -43,7 +44,6 @@ module Generators
43
44
  run "gem install foreman"
44
45
  end
45
46
 
46
- script_name = "avo:tailwindcss"
47
47
  script_command = "tailwindcss -i ./app/assets/stylesheets/avo/tailwind.css -o ./app/assets/builds/avo.tailwind.css -c ./config/avo/tailwind.config.js --minify"
48
48
  pretty_script_command = "\"#{script_name}\": \"#{script_command}\""
49
49
 
@@ -66,7 +66,17 @@ module Generators
66
66
 
67
67
  rake_enhance = <<~RUBY
68
68
 
69
+ # When running `rake assets:precompile` this is the order of events:
70
+ # 1 - Task `avo:yarn_install`
71
+ # 2 - Task `avo:sym_link`
72
+ # 3 - Cmd `yarn avo:tailwind:css`
73
+ # 4 - Task `assets:precompile`
69
74
  Rake::Task["assets:precompile"].enhance(["avo:sym_link"])
75
+ Rake::Task["avo:sym_link"].enhance(["avo:yarn_install"])
76
+ Rake::Task["avo:sym_link"].enhance do
77
+ `yarn avo:tailwind:css`
78
+ end
79
+
70
80
  RUBY
71
81
 
72
82
  if (path = Rails.root.join("Rakefile")).exist?
@@ -78,12 +88,14 @@ module Generators
78
88
  say rake_enhance, :green
79
89
  end
80
90
 
81
- say "Make sure you run \"bundle exec rake avo:sym_link\" before compiling the assets with the \"#{script_name}\" task.", :green
91
+ say "Make sure you run \"bundle exec rake avo:sym_link\" and \"bundle exec rake avo:yarn_install\" before compiling the assets with the \"#{script_name}\" task.", :green
82
92
  if (path = Rails.root.join("bin", "dev")).exist?
83
93
  lines = File.read(path).lines
84
94
 
85
95
  # Insert the task after the shebang line (the first line)
86
- lines.insert(1, "bundle exec rake avo:sym_link")
96
+ shebang = lines.first
97
+ lines[0] = "#{shebang}\nbundle exec rake avo:sym_link\nbundle exec rake avo:yarn_install\n"
98
+
87
99
 
88
100
  File.write(path, lines.join)
89
101
  end
@@ -1,12 +1,12 @@
1
1
  <div class="flex flex-col">
2
2
  <%%= render Avo::PanelComponent.new(name: "<%= human_name %>") do |c| %>
3
- <%% c.tools do %>
3
+ <%% c.with_tools do %>
4
4
  <%%= a_link('/avo', icon: 'heroicons/solid/academic-cap', color: :primary, style: :primary) do %>
5
5
  Dummy link
6
6
  <%% end %>
7
7
  <%% end %>
8
8
 
9
- <%% c.body do %>
9
+ <%% c.with_body do %>
10
10
  <div class="flex flex-col p-4 min-h-24">
11
11
  <div class="space-y-4">
12
12
  <h3>🪧 This partial is waiting to be updated</h3>
@@ -1,2 +1,2 @@
1
1
  web: bin/rails server -p 3000
2
- avo_css: yarn avo:tailwindcss --watch
2
+ avo_css: yarn avo:tailwind:css --watch
@@ -1,5 +1,5 @@
1
1
  @import 'tailwindcss/base';
2
- # Have all of Avo's custom and plugins styles available.
2
+ /* Have all of Avo's custom and plugins styles available. */
3
3
  @import '../../../../tmp/avo/base.css';
4
4
  @import 'tailwindcss/components';
5
5
  @import 'tailwindcss/utilities';
@@ -1,10 +1,10 @@
1
1
  <div class="flex flex-col">
2
2
  <%%= render Avo::PanelComponent.new(name: '<%= human_name %>', display_breadcrumbs: true) do |c| %>
3
- <%% c.tools do %>
3
+ <%% c.with_tools do %>
4
4
  <div class="text-sm italic">This is the panels tools section.</div>
5
5
  <%% end %>
6
6
 
7
- <%% c.body do %>
7
+ <%% c.with_body do %>
8
8
  <div class="flex flex-col justify-between py-6 min-h-24">
9
9
  <div class="px-6 space-y-4">
10
10
  <h3>What a nice new tool 👋</h3>
@@ -71,7 +71,7 @@ task "avo:sym_link" do
71
71
  `touch #{packages_path}/.keep`
72
72
  end
73
73
 
74
- ["avo", "avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu"].each do |gem|
74
+ ["avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu"].each do |gem|
75
75
  path = `bundle show #{gem} 2> /dev/null`.chomp
76
76
 
77
77
  # If path is emty we check if package is defined outside of root (on release process it is)
data/tailwind.preset.js CHANGED
@@ -4,17 +4,24 @@ const defaultTheme = require('tailwindcss/defaultTheme')
4
4
 
5
5
  const { primary, blue, gray } = require('./tailwind.custom')
6
6
 
7
+ function contentPaths(basePath) {
8
+ return [
9
+ `${basePath}/safelist.txt`,
10
+ `${basePath}/lib/avo/**/*.rb`,
11
+ `${basePath}/app/helpers/**/*.rb`,
12
+ `${basePath}/app/views/**/*.erb`,
13
+ `${basePath}/app/javascript/**/*.js`,
14
+ `${basePath}/app/components/**/*.{html.erb,rb}`,
15
+ `${basePath}/app/controllers/**/*.rb`,
16
+ `${basePath}/lib/**/*.rb`,
17
+ `${basePath}/public/**/*.{js,css}`,
18
+ ]
19
+ }
20
+
7
21
  module.exports = {
8
22
  content: [
9
- './tmp/avo/packages/*/safelist.txt',
10
- './tmp/avo/packages/*/lib/avo/**/*.rb',
11
- './tmp/avo/packages/*/app/helpers/**/*.rb',
12
- './tmp/avo/packages/*/app/views/**/*.erb',
13
- './tmp/avo/packages/*/app/javascript/**/*.js',
14
- './tmp/avo/packages/*/app/components/**/*.{html.erb,rb}',
15
- './tmp/avo/packages/*/app/controllers/**/*.rb',
16
- './tmp/avo/packages/*/lib/**/*.rb',
17
- './tmp/avo/packages/*/public/**/*.{js,css}',
23
+ ...contentPaths('./tmp/avo/packages/*'),
24
+ ...contentPaths('.'),
18
25
  ],
19
26
  theme: {
20
27
  extend: {
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: 3.0.1.beta16
4
+ version: 3.0.1.beta18
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: 2023-09-20 00:00:00.000000000 Z
12
+ date: 2023-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord