avo 2.14.3.pre.1.branding → 2.14.3.pre.2.tailwindcss

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.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/assets/stylesheets/{avo.css → avo.base.css} +34 -1
  4. data/app/assets/stylesheets/css/fields/progress.css +3 -3
  5. data/app/assets/stylesheets/css/pagination.css +4 -0
  6. data/app/assets/stylesheets/css/search.css +1 -1
  7. data/app/assets/stylesheets/css/sidebar.css +1 -1
  8. data/app/assets/stylesheets/css/tags.css +0 -7
  9. data/app/assets/svgs/failed_to_load.svg +5 -4
  10. data/app/assets/svgs/grid-empty-state.svg +11 -10
  11. data/app/assets/svgs/table-empty-state.svg +12 -11
  12. data/app/components/avo/actions_component.html.erb +2 -2
  13. data/app/components/avo/actions_component.rb +1 -1
  14. data/app/components/avo/button_component.html.erb +1 -0
  15. data/app/components/avo/button_component.rb +2 -2
  16. data/app/components/avo/fields/boolean_field/edit_component.html.erb +1 -1
  17. data/app/components/avo/fields/common/progress_bar_component.html.erb +1 -1
  18. data/app/components/avo/fields/common/progress_bar_component.rb +1 -11
  19. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +1 -1
  20. data/app/components/avo/fields/progress_bar_field/index_component.html.erb +1 -1
  21. data/app/components/avo/fields/progress_bar_field/show_component.html.erb +1 -1
  22. data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -1
  23. data/app/components/avo/index/resource_grid_component.html.erb +1 -2
  24. data/app/components/avo/index/resource_table_component.html.erb +1 -2
  25. data/app/components/avo/profile_item_component.html.erb +1 -1
  26. data/app/components/avo/sidebar_component.html.erb +1 -1
  27. data/app/components/avo/sidebar_profile_component.html.erb +1 -1
  28. data/app/helpers/avo/actions_helper.rb +4 -0
  29. data/app/helpers/avo/attachments_helper.rb +4 -0
  30. data/app/helpers/avo/resources_helper.rb +16 -20
  31. data/app/javascript/{avo.js → avo.base.js} +1 -0
  32. data/app/javascript/js/controllers/fields/trix_field_controller.js +3 -4
  33. data/app/javascript/js/controllers/item_select_all_controller.js +9 -16
  34. data/app/javascript/js/controllers/item_selector_controller.js +1 -1
  35. data/app/views/avo/actions/show.html.erb +2 -2
  36. data/app/views/avo/associations/new.html.erb +2 -2
  37. data/app/views/avo/base/_multiple_select_filter.html.erb +1 -1
  38. data/app/views/avo/base/_text_filter.html.erb +1 -1
  39. data/app/views/avo/partials/_header.html.erb +1 -1
  40. data/app/views/avo/partials/_logo.html.erb +2 -2
  41. data/app/views/avo/private/_links_and_buttons.html.erb +1 -1
  42. data/app/views/avo/private/design.html.erb +3 -3
  43. data/app/views/kaminari/_first_page.html.erb +3 -0
  44. data/app/views/kaminari/_last_page.html.erb +3 -0
  45. data/app/views/kaminari/_next_page.html.erb +9 -0
  46. data/app/views/kaminari/_page.html.erb +12 -0
  47. data/app/views/kaminari/_prev_page.html.erb +9 -0
  48. data/app/views/layouts/avo/application.html.erb +4 -5
  49. data/lib/avo/configuration.rb +0 -5
  50. data/lib/avo/dashboards/chartkick_card.rb +1 -1
  51. data/lib/avo/licensing/pro_license.rb +0 -1
  52. data/lib/avo/version.rb +1 -1
  53. data/lib/generators/avo/base_generator.rb +5 -1
  54. data/lib/generators/avo/tailwindcss/install_generator.rb +54 -0
  55. data/lib/generators/avo/templates/initializer/avo.tt +0 -15
  56. data/lib/generators/avo/templates/tailwindcss/Procfile.dev +2 -0
  57. data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +13 -0
  58. data/lib/tasks/avo_tasks.rake +8 -8
  59. data/lib/tasks/tailwindcss_rails.rake +24 -0
  60. data/public/avo-assets/{avo.css → avo.base.css} +284 -298
  61. data/public/avo-assets/{avo.js → avo.base.js} +3 -3
  62. data/public/avo-assets/{avo.js.map → avo.base.js.map} +3 -3
  63. metadata +19 -9
  64. data/app/views/avo/partials/_branding.html.erb +0 -5
  65. data/lib/avo/configuration/branding.rb +0 -70
@@ -35,10 +35,10 @@
35
35
  </div>
36
36
 
37
37
  <% c.controls do %>
38
- <%= a_button 'data-action': 'click->modal#close', size: :sm, style: :outline, color: :gray do %>
38
+ <%= a_button 'data-action': 'click->modal#close', size: :sm do %>
39
39
  <%= t('avo.cancel') %>
40
40
  <% end %>
41
- <%= a_button type: :submit, style: :primary, color: :green, size: :sm do %>
41
+ <%= a_button type: :submit, color: :green, size: :sm do %>
42
42
  <%= t('avo.attach') %>
43
43
  <% end %>
44
44
  <% end %>
@@ -12,7 +12,7 @@
12
12
  'data-multiple-select-filter-target': 'selector'
13
13
  %>
14
14
  <div class="flex justify-end">
15
- <%= a_button class: 'mt-4', color: :primary, size: :xs, data: { action: "multiple-select-filter#changeFilter" } do %>
15
+ <%= a_button class: 'mt-4', color: :blue, size: :xs, data: { action: "multiple-select-filter#changeFilter" } do %>
16
16
  Filter by <%=filter.name %>
17
17
  <% end %>
18
18
  </div>
@@ -13,7 +13,7 @@
13
13
  'data-action': 'keypress->text-filter#tryToSubmit'
14
14
  %>
15
15
  <div class="flex justify-end">
16
- <%= a_button class: 'mt-4', color: :primary, data: { action: "text-filter#changeFilter" }, size: :xs do %>
16
+ <%= a_button class: 'mt-4', color: :blue, data: { action: "text-filter#changeFilter" }, size: :xs do %>
17
17
  <%= filter.button_label || "Filter by #{filter.name}" %>
18
18
  <% end %>
19
19
  </div>
@@ -1 +1 @@
1
- <%= link_to Avo.configuration.app_name, '/', class: 'text-primary-500 font-semibold', target: :_blank %>
1
+ <%= link_to Avo.configuration.app_name, '/', class: 'text-blue-500 font-semibold', target: :_blank %>
@@ -1,4 +1,4 @@
1
1
  <%= link_to root_path, class: 'logo-placeholder h-full w-full flex justify-start' do %>
2
- <%= image_tag Avo.configuration.branding.logo, class: 'hidden sm:block object-contain', title: 'Avo' %>
3
- <%= image_tag Avo.configuration.branding.logomark, class: 'sm:hidden object-contain', title: 'Avo' %>
2
+ <%= image_tag '/avo-assets/logo.png', class: 'hidden sm:block object-contain', title: 'Avo' %>
3
+ <%= image_tag '/avo-assets/logomark.png', class: 'sm:hidden object-contain', title: 'Avo' %>
4
4
  <% end %>
@@ -2,7 +2,7 @@
2
2
  entities = [:button, :link]
3
3
  sizes = [:xl, :lg, :md, :sm, :xs].reverse
4
4
  styles = [:primary, :outline, :text]
5
- colors = [:primary, :blue, :gray, :red, :orange, :green]
5
+ colors = [:primary, :gray, :red, :orange, :green]
6
6
  states = [:regular, :hover, :disabled, :active]
7
7
  %>
8
8
  <div class="px-6 space-y-4">
@@ -6,15 +6,15 @@
6
6
  <% end %>
7
7
 
8
8
  <%= a_link('/admin', icon: 'arrow-left', style: :outline, is_link: true) do %>
9
- Outline
9
+ Secondary
10
10
  <% end %>
11
11
 
12
12
  <%= a_link('/admin', icon: 'arrow-left', style: :outline, color: :red, is_link: true) do %>
13
13
  Red
14
14
  <% end %>
15
15
 
16
- <%= a_link('/admin', icon: 'arrow-left', style: :text, color: :orange, is_link: true) do %>
17
- Text
16
+ <%= a_link('/admin', icon: 'arrow-left', style: :outline, color: :orange, is_link: true) do %>
17
+ Red
18
18
  <% end %>
19
19
  <% end %>
20
20
 
@@ -0,0 +1,3 @@
1
+ <span class="first">
2
+ <%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote, class: 'relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm leading-5 font-medium rounded-md text-gray-700 bg-white hover:text-gray-500 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150' %>
3
+ </span>
@@ -0,0 +1,3 @@
1
+ <span class="last">
2
+ <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote, class: 'ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm leading-5 font-medium rounded-md text-gray-700 bg-white hover:text-gray-500 focus:outline-none focus:shadow-outline-blue focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150' %>
3
+ </span>
@@ -0,0 +1,9 @@
1
+ <% if !current_page.last? %>
2
+ <%= link_to url, :id => 'pnnext',:remote => remote do %>
3
+ <button type="button" class="-ml-px relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-500 hover:text-gray-400 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150">
4
+ <svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
5
+ <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
6
+ </svg>
7
+ </button>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% url = resources_path(resource: @resource, page: page, keep_query_params: true) %>
2
+ <% if page.current? %>
3
+ <button type="button" class="hidden md:inline-flex -ml-px relative items-center px-4 py-2 border bg-gray-100 text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 z-10 outline-none border-primary-300 active:bg-gray-100 transition ease-in-out duration-150">
4
+ <%= page %>
5
+ </button>
6
+ <% else %>
7
+ <%= link_to url, :remote => remote do %>
8
+ <button type="button" class="hidden md:inline-flex -ml-px relative items-center px-4 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
9
+ <%= page %>
10
+ </button>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if !current_page.first? %>
2
+ <%= link_to url, :id => 'pnprev', :remote => remote do %>
3
+ <button type="button" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-500 hover:text-gray-400 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150">
4
+ <svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
5
+ <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd"/>
6
+ </svg>
7
+ </button>
8
+ <% end %>
9
+ <% end %>
@@ -7,13 +7,12 @@
7
7
  <%= csp_meta_tag %>
8
8
  <%= render partial: 'avo/partials/javascript' %>
9
9
  <%= render partial: 'avo/partials/head' %>
10
- <%= render partial: 'avo/partials/branding' %>
11
10
  <% if Avo::PACKED %>
12
- <%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
13
- <%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
11
+ <%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
12
+ <%= stylesheet_link_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
14
13
  <% else %>
15
- <%= javascript_include_tag "avo", "data-turbo-track": "reload", defer: true %>
16
- <%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
14
+ <%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
15
+ <%= stylesheet_link_tag "avo.base", "data-turbo-track": "reload", defer: true %>
17
16
  <% if Rails.env.development? %>
18
17
  <%= javascript_include_tag "hotwire-livereload", defer: true %>
19
18
  <% end %>
@@ -35,7 +35,6 @@ module Avo
35
35
  attr_accessor :main_menu
36
36
  attr_accessor :profile_menu
37
37
  attr_accessor :tabs_style
38
- attr_writer :branding
39
38
 
40
39
  def initialize
41
40
  @root_path = "/avo"
@@ -124,10 +123,6 @@ module Avo
124
123
  def feature_enabled?(feature)
125
124
  !@disabled_features.map(&:to_sym).include?(feature.to_sym)
126
125
  end
127
-
128
- def branding
129
- Avo::Configuration::Branding.new(**@branding || {})
130
- end
131
126
  end
132
127
 
133
128
  def self.configuration
@@ -29,7 +29,7 @@ module Avo
29
29
  default = {
30
30
  # figure our the available height for the chart
31
31
  height: "#{(rows * card_height) - card_heading}px",
32
- colors: ::Avo.configuration.branding.chart_colors,
32
+ colors: %w[#0B8AE2 #34C683 #2AB1EE #34C6A8],
33
33
  library: {
34
34
  discrete: false,
35
35
  points: false,
@@ -16,7 +16,6 @@ module Avo
16
16
  :menu_editor,
17
17
  :stimulus_js_integration,
18
18
  :resource_show_controls,
19
- :branding,
20
19
  :advanced_fields
21
20
  ]
22
21
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.14.3.pre.1.branding" unless const_defined?(:VERSION)
2
+ VERSION = "2.14.3.pre.2.tailwindcss" unless const_defined?(:VERSION)
3
3
  end
@@ -7,7 +7,11 @@ module Generators
7
7
 
8
8
  def initialize(*args)
9
9
  super(*args)
10
- invoke "avo:version", *args
10
+
11
+ # Don't output the version if requested so
12
+ unless args.include?(["--no-avo-version"])
13
+ invoke "avo:version", *args
14
+ end
11
15
  end
12
16
  end
13
17
  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
@@ -53,21 +53,6 @@ Avo.configure do |config|
53
53
  # config.disabled_features = []
54
54
  # config.resource_controls = :right
55
55
  # config.tabs_style = :tabs # can be :tabs or :pills
56
- # config.buttons_on_form_footers = true
57
-
58
- ## == Branding ==
59
- # config.branding = {
60
- # colors: {
61
- # background: "248 246 242",
62
- # 100 => "#CEE7F8",
63
- # 400 => "#399EE5",
64
- # 500 => "#0886DE",
65
- # 600 => "#066BB2",
66
- # },
67
- # chart_colors: ["#0B8AE2", "#34C683", "#2AB1EE", "#34C6A8"],
68
- # logo: "/avo-assets/logo.png"
69
- # logomark: "/avo-assets/logomark.png",
70
- # }
71
56
 
72
57
 
73
58
  ## == Breadcrumbs ==
@@ -0,0 +1,2 @@
1
+ web: bin/rails server -p 3000
2
+ css: bin/rails avo:tailwindcss:watch
@@ -0,0 +1,13 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ /*
6
+
7
+ @layer components {
8
+ .btn-primary {
9
+ @apply py-2 px-4 bg-blue-200;
10
+ }
11
+ }
12
+
13
+ */
@@ -3,9 +3,9 @@
3
3
  # # Task goes here
4
4
  # end
5
5
 
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'
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 'yarn'
19
- system 'yarn prod:build'
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 == 'bundler'
34
- return File.expand_path('../../../', __FILE__)
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