avo 2.14.3.pre.7.polytranslations1 → 2.15.0

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -3
  3. data/app/assets/stylesheets/avo.base.css +1 -34
  4. data/app/assets/stylesheets/css/fields/progress.css +3 -3
  5. data/app/assets/stylesheets/css/fields/trix.css +10 -0
  6. data/app/assets/stylesheets/css/pagination.css +0 -4
  7. data/app/assets/stylesheets/css/search.css +1 -1
  8. data/app/assets/stylesheets/css/sidebar.css +1 -1
  9. data/app/assets/stylesheets/css/tags.css +7 -0
  10. data/app/assets/svgs/failed_to_load.svg +4 -5
  11. data/app/assets/svgs/grid-empty-state.svg +10 -11
  12. data/app/assets/svgs/table-empty-state.svg +11 -12
  13. data/app/components/avo/actions_component.html.erb +2 -2
  14. data/app/components/avo/actions_component.rb +1 -1
  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 +11 -1
  19. data/app/components/avo/fields/progress_bar_field/index_component.html.erb +1 -1
  20. data/app/components/avo/fields/progress_bar_field/show_component.html.erb +1 -1
  21. data/app/components/avo/fields/tags_field/edit_component.html.erb +1 -1
  22. data/app/components/avo/index/resource_grid_component.html.erb +2 -1
  23. data/app/components/avo/index/resource_table_component.html.erb +2 -1
  24. data/app/components/avo/profile_item_component.html.erb +1 -1
  25. data/app/components/avo/sidebar_component.html.erb +1 -1
  26. data/app/components/avo/sidebar_profile_component.html.erb +1 -1
  27. data/app/controllers/avo/base_controller.rb +2 -2
  28. data/app/helpers/avo/resources_helper.rb +20 -16
  29. data/app/javascript/avo.base.js +0 -1
  30. data/app/javascript/js/controllers/action_controller.js +6 -1
  31. data/app/javascript/js/controllers/fields/trix_field_controller.js +4 -3
  32. data/app/javascript/js/controllers/item_select_all_controller.js +16 -9
  33. data/app/javascript/js/controllers/item_selector_controller.js +1 -1
  34. data/app/views/avo/actions/show.html.erb +2 -2
  35. data/app/views/avo/associations/new.html.erb +2 -2
  36. data/app/views/avo/base/_multiple_select_filter.html.erb +1 -1
  37. data/app/views/avo/base/_text_filter.html.erb +1 -1
  38. data/app/views/avo/partials/_branding.html.erb +5 -0
  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/layouts/avo/application.html.erb +2 -0
  44. data/lib/avo/configuration/branding.rb +70 -0
  45. data/lib/avo/configuration.rb +5 -0
  46. data/lib/avo/dashboards/chartkick_card.rb +1 -1
  47. data/lib/avo/licensing/pro_license.rb +1 -0
  48. data/lib/avo/services/encryption_service.rb +1 -1
  49. data/lib/avo/version.rb +1 -1
  50. data/lib/generators/avo/templates/initializer/avo.tt +15 -0
  51. data/public/avo-assets/avo.base.css +310 -284
  52. data/public/avo-assets/avo.base.js +3 -3
  53. data/public/avo-assets/avo.base.js.map +2 -2
  54. metadata +6 -13
  55. data/app/components/avo/button_component.html.erb +0 -1
  56. data/app/helpers/avo/actions_helper.rb +0 -4
  57. data/app/helpers/avo/attachments_helper.rb +0 -4
  58. data/app/views/kaminari/_first_page.html.erb +0 -3
  59. data/app/views/kaminari/_last_page.html.erb +0 -3
  60. data/app/views/kaminari/_next_page.html.erb +0 -9
  61. data/app/views/kaminari/_page.html.erb +0 -12
  62. data/app/views/kaminari/_prev_page.html.erb +0 -9
  63. data/config/master.key +0 -1
@@ -32,11 +32,11 @@
32
32
  <% c.controls do %>
33
33
  <%= a_button data: { action: 'click->modal#close' },
34
34
  size: :sm,
35
- color: :primary do %>
35
+ color: :gray do %>
36
36
  <%= @action.cancel_button_label %>
37
37
  <% end %>
38
38
  <%= a_button type: :submit,
39
- color: :primary,
39
+ color: :green,
40
40
  style: :primary,
41
41
  size: :sm,
42
42
  data: @action.class.submit_button_data_attributes do %>
@@ -35,10 +35,10 @@
35
35
  </div>
36
36
 
37
37
  <% c.controls do %>
38
- <%= a_button 'data-action': 'click->modal#close', size: :sm do %>
38
+ <%= a_button 'data-action': 'click->modal#close', size: :sm, style: :outline, color: :gray do %>
39
39
  <%= t('avo.cancel') %>
40
40
  <% end %>
41
- <%= a_button type: :submit, color: :green, size: :sm do %>
41
+ <%= a_button type: :submit, style: :primary, 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: :blue, size: :xs, data: { action: "multiple-select-filter#changeFilter" } do %>
15
+ <%= a_button class: 'mt-4', color: :primary, 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: :blue, data: { action: "text-filter#changeFilter" }, size: :xs do %>
16
+ <%= a_button class: 'mt-4', color: :primary, data: { action: "text-filter#changeFilter" }, size: :xs do %>
17
17
  <%= filter.button_label || "Filter by #{filter.name}" %>
18
18
  <% end %>
19
19
  </div>
@@ -0,0 +1,5 @@
1
+ <style>
2
+ :root {
3
+ <%= Avo.configuration.branding.css_colors %>
4
+ }
5
+ </style>
@@ -1 +1 @@
1
- <%= link_to Avo.configuration.app_name, '/', class: 'text-blue-500 font-semibold', target: :_blank %>
1
+ <%= link_to Avo.configuration.app_name, '/', class: 'text-primary-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-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' %>
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' %>
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, :gray, :red, :orange, :green]
5
+ colors = [:primary, :blue, :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
- Secondary
9
+ Outline
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: :outline, color: :orange, is_link: true) do %>
17
- Red
16
+ <%= a_link('/admin', icon: 'arrow-left', style: :text, color: :orange, is_link: true) do %>
17
+ Text
18
18
  <% end %>
19
19
  <% end %>
20
20
 
@@ -6,6 +6,8 @@
6
6
  <%= csrf_meta_tags %>
7
7
  <%= csp_meta_tag %>
8
8
  <%= render partial: 'avo/partials/javascript' %>
9
+ <%= render partial: 'avo/partials/head' %>
10
+ <%= render partial: 'avo/partials/branding' %>
9
11
  <% if Avo::PACKED %>
10
12
  <%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
11
13
  <%= stylesheet_link_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
@@ -0,0 +1,70 @@
1
+ class Avo::Configuration::Branding
2
+ def initialize(colors: nil, chart_colors: nil, logo: nil, logomark: nil)
3
+ @colors = colors
4
+ @chart_colors = chart_colors
5
+ @logo = logo
6
+ @logomark = logomark
7
+
8
+ @default_colors = {
9
+ background: "#F6F6F7",
10
+ 100 => "206 231 248",
11
+ 400 => "57 158 229",
12
+ 500 => "8 134 222",
13
+ 600 => "6 107 178"
14
+ }
15
+ @default_chart_colors = ["#0B8AE2", "#34C683", "#2AB1EE", "#34C6A8"]
16
+ @default_logo = "/avo-assets/logo.png"
17
+ @default_logomark = "/avo-assets/logomark.png"
18
+ end
19
+
20
+ def css_colors
21
+ rgb_colors.map do |color, value|
22
+ if color == :background
23
+ "--color-application-#{color}: #{value};"
24
+ else
25
+ "--color-primary-#{color}: #{value};"
26
+ end
27
+ end.join("\n")
28
+ end
29
+
30
+ def logo
31
+ return @default_logo if Avo::App.license.lacks_with_trial(:branding)
32
+
33
+ @logo || @default_logo
34
+ end
35
+
36
+ def logomark
37
+ return @default_logomark if Avo::App.license.lacks_with_trial(:branding)
38
+
39
+ @logomark || @default_logomark
40
+ end
41
+
42
+ def chart_colors
43
+ return @default_chart_colors if Avo::App.license.lacks_with_trial(:branding)
44
+
45
+ @chart_colors || @default_chart_colors
46
+ end
47
+
48
+ private
49
+
50
+ def colors
51
+ return @default_colors if Avo::App.license.lacks_with_trial(:branding)
52
+
53
+ @default_colors.merge(@colors) || @default_colors
54
+ end
55
+
56
+ def rgb_colors
57
+ colors.map do |key, value|
58
+ rgb_value = is_hex?(value) ? hex_to_rgb(value) : value
59
+ [key, rgb_value]
60
+ end.to_h
61
+ end
62
+
63
+ def is_hex?(value)
64
+ value.include? "#"
65
+ end
66
+
67
+ def hex_to_rgb(value)
68
+ value.to_s.match(/^#(..)(..)(..)$/).captures.map(&:hex).join(" ")
69
+ end
70
+ end
@@ -36,6 +36,7 @@ module Avo
36
36
  attr_accessor :profile_menu
37
37
  attr_accessor :model_resource_mapping
38
38
  attr_accessor :tabs_style
39
+ attr_writer :branding
39
40
 
40
41
  def initialize
41
42
  @root_path = "/avo"
@@ -125,6 +126,10 @@ module Avo
125
126
  def feature_enabled?(feature)
126
127
  !@disabled_features.map(&:to_sym).include?(feature.to_sym)
127
128
  end
129
+
130
+ def branding
131
+ Avo::Configuration::Branding.new(**@branding || {})
132
+ end
128
133
  end
129
134
 
130
135
  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: %w[#0B8AE2 #34C683 #2AB1EE #34C6A8],
32
+ colors: ::Avo.configuration.branding.chart_colors,
33
33
  library: {
34
34
  discrete: false,
35
35
  points: false,
@@ -16,6 +16,7 @@ module Avo
16
16
  :menu_editor,
17
17
  :stimulus_js_integration,
18
18
  :resource_show_controls,
19
+ :branding,
19
20
  :advanced_fields
20
21
  ]
21
22
  end
@@ -40,7 +40,7 @@ module Avo
40
40
  end
41
41
 
42
42
  def secret_key_base
43
- Rails.application.secrets.secret_key_base || ENV['SECRET_KEY_BASE']
43
+ ENV['SECRET_KEY_BASE'] || Rails.application.credentials.secret_key_base || Rails.application.secrets.secret_key_base
44
44
  end
45
45
  end
46
46
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.14.3.pre.7.polytranslations1" unless const_defined?(:VERSION)
2
+ VERSION = "2.15.0" unless const_defined?(:VERSION)
3
3
  end
@@ -57,6 +57,21 @@ Avo.configure do |config|
57
57
  # config.disabled_features = []
58
58
  # config.resource_controls = :right
59
59
  # config.tabs_style = :tabs # can be :tabs or :pills
60
+ # config.buttons_on_form_footers = true
61
+
62
+ ## == Branding ==
63
+ # config.branding = {
64
+ # colors: {
65
+ # background => "248 246 242",
66
+ # 100 => "#CEE7F8",
67
+ # 400 => "#399EE5",
68
+ # 500 => "#0886DE",
69
+ # 600 => "#066BB2",
70
+ # },
71
+ # chart_colors: ["#0B8AE2", "#34C683", "#2AB1EE", "#34C6A8"],
72
+ # logo: "/avo-assets/logo.png",
73
+ # logomark: "/avo-assets/logomark.png"
74
+ # }
60
75
 
61
76
  ## == Breadcrumbs ==
62
77
  # config.display_breadcrumbs = true