avo 1.19.1.pre.4 → 1.19.1.pre.8

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -4
  3. data/app/assets/builds/avo.css +388 -275
  4. data/app/assets/builds/avo.js +14 -3
  5. data/app/assets/builds/avo.js.map +2 -2
  6. data/app/assets/stylesheets/avo.css +8 -0
  7. data/app/assets/stylesheets/css/search.css +1 -1
  8. data/app/components/avo/edit/field_wrapper_component.html.erb +1 -1
  9. data/app/components/avo/fields/common/files_list_viewer_component.html.erb +1 -1
  10. data/app/components/avo/fields/common/heading_component.html.erb +1 -1
  11. data/app/components/avo/index/field_wrapper_component.html.erb +1 -1
  12. data/app/components/avo/index/table_row_component.html.erb +1 -1
  13. data/app/components/avo/show/field_wrapper_component.html.erb +1 -1
  14. data/app/helpers/avo/application_helper.rb +3 -4
  15. data/app/javascript/avo.js +12 -0
  16. data/app/views/avo/actions/show.html.erb +1 -1
  17. data/app/views/avo/base/_actions.html.erb +1 -1
  18. data/app/views/avo/base/_filters.html.erb +3 -3
  19. data/app/views/avo/home/_actions.html.erb +1 -1
  20. data/app/views/avo/home/_filters.html.erb +1 -1
  21. data/app/views/avo/home/_resources.html.erb +2 -2
  22. data/app/views/avo/partials/_footer.html.erb +1 -1
  23. data/app/views/avo/partials/_global_search.html.erb +4 -1
  24. data/app/views/avo/partials/_logo.html.erb +1 -1
  25. data/app/views/avo/partials/_paginator.html.erb +3 -3
  26. data/app/views/avo/partials/_table_header.html.erb +2 -2
  27. data/app/views/layouts/avo/application.html.erb +2 -2
  28. data/bin/test +1 -1
  29. data/lib/avo/configuration.rb +6 -0
  30. data/lib/avo/version.rb +1 -1
  31. data/lib/generators/avo/filter_generator.rb +2 -0
  32. data/lib/generators/avo/templates/filters/text_filter.tt +8 -0
  33. data/lib/generators/avo/templates/initializer/avo.tt +4 -5
  34. data/public/avo-assets/avo.css +376 -263
  35. data/public/avo-assets/avo.js +14 -3
  36. data/public/avo-assets/avo.js.map +2 -2
  37. metadata +3 -3
  38. data/app/javascript/images/logo.png +0 -0
@@ -76,3 +76,11 @@ body {
76
76
  .turbo-progress-bar {
77
77
  @apply bg-green-500;
78
78
  }
79
+
80
+ body.os-mac .mac\:hidden {
81
+ display: none;
82
+ }
83
+
84
+ body.os-pc .pc\:hidden {
85
+ display: none;
86
+ }
@@ -27,7 +27,7 @@
27
27
 
28
28
  .aa-DetachedFormContainer,
29
29
  .aa-DetachedContainer .aa-Panel {
30
- @apply bg-blue-gray-100 border-b-0;
30
+ @apply bg-slate-100 border-b-0;
31
31
  }
32
32
 
33
33
  .aa-Form {
@@ -1,5 +1,5 @@
1
1
  <div class="flex items-center py-0 leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
2
- <div class="h-16 flex self-start items-center text-blue-gray-800">
2
+ <div class="h-16 flex self-start items-center text-slate-800">
3
3
  <div class="<% if @displayed_in_modal %> md:w-48 <% else %> md:w-64 <% end %> w-48 px-8 flex" data-slot="label">
4
4
  <%= @form.label @field.id, label %> <% if @field.required %> <span class="text-red-600">*</span> <% end %>
5
5
  </div>
@@ -1,4 +1,4 @@
1
- <div class="relative p-3 bg-blue-gray-200 grid grid-cols-3 xl:grid-cols-4 gap-3 rounded-xl">
1
+ <div class="relative p-3 bg-slate-200 grid grid-cols-3 xl:grid-cols-4 gap-3 rounded-xl">
2
2
  <% @field.value.attachments.each do |file| %>
3
3
  <%= render Avo::Fields::Common::MultipleFileViewerComponent.new id: @field.id, file: file, is_image: @field.is_image, button_size: :xs, resource: @resource %>
4
4
  <% end %>
@@ -1,4 +1,4 @@
1
- <div class="flex items-start py-1 leading-tight border-t bg-blue-gray-600 text-white text-xs">
1
+ <div class="flex items-start py-1 leading-tight border-t bg-slate-600 text-white text-xs">
2
2
  <div class="p-3 pl-6 h-full w-full">
3
3
  <% if @value.present? %>
4
4
  <% if @as_html %>
@@ -1,4 +1,4 @@
1
- <td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-blue-gray-800 <%= @classes %>" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
1
+ <td class="px-4 py-2 leading-tight whitespace-nowrap h-12 text-slate-800 <%= @classes %>" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
2
2
  <% if @field.value.blank? && @dash_if_blank %>
3
3
 
4
4
  <% else %>
@@ -1,5 +1,5 @@
1
1
  <tr
2
- class="hover:bg-light-blue-50 hover:shadow-row relative z-20 border-b"
2
+ class="hover:bg-sky-50 hover:shadow-row relative z-20 border-b"
3
3
  <%== item_selector_init @resource %>
4
4
  >
5
5
  <td class="w-10">
@@ -1,5 +1,5 @@
1
1
  <div class="flex items-start leading-tight <%= @classes %> min-h-16" data-field-id="<%= @field.id %>" data-field-type="<%= @field.type %>">
2
- <div class="h-16 flex self-start items-center text-blue-gray-800">
2
+ <div class="h-16 flex self-start items-center text-slate-800">
3
3
  <div class="w-48 md:w-64 px-8" data-slot="label">
4
4
  <%= @field.name %> <% if @field.required %> <span class="text-red-600">*</span> <% end %>
5
5
  </div>
@@ -29,8 +29,7 @@ module Avo
29
29
  def a_button(label = nil, **args, &block)
30
30
  args[:class] = button_classes(args[:class], color: args[:color], variant: args[:variant], size: args[:size])
31
31
  if args[:spinner]
32
- args["data-controller"] = "loading-button"
33
- # args["data-action"] = "click->loading-button#onClick"
32
+ args[:"data-controller"] = "loading-button"
34
33
  end
35
34
 
36
35
  locals = {
@@ -135,12 +134,12 @@ module Avo
135
134
  end
136
135
 
137
136
  def input_classes(extra_classes = "", has_error: false)
138
- classes = "appearance-none inline-flex bg-blue-gray-100 disabled:bg-blue-gray-300 disabled:cursor-not-allowed focus:bg-white text-blue-gray-700 disabled:text-blue-gray-700 rounded-md py-2 px-3 leading-tight border outline-none outline"
137
+ classes = "appearance-none inline-flex bg-slate-100 disabled:bg-slate-300 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-700 rounded-md py-2 px-3 leading-tight border outline-none outline"
139
138
 
140
139
  classes += if has_error
141
140
  " border-red-600"
142
141
  else
143
- " border-blue-gray-300"
142
+ " border-slate-300"
144
143
  end
145
144
 
146
145
  classes += " #{extra_classes}"
@@ -19,6 +19,17 @@ window.Turbolinks = Turbo
19
19
 
20
20
  Mousetrap.bind('r r r', () => Turbo.visit(window.location.href, { action: 'replace' }))
21
21
 
22
+ function isMac() {
23
+ const isMac = window.navigator.userAgent.indexOf('Mac OS X')
24
+
25
+ if (isMac) {
26
+ document.body.classList.add('os-mac')
27
+ document.body.classList.remove('os-pc')
28
+ } else {
29
+ document.body.classList.add('os-pc')
30
+ document.body.classList.remove('os-mac')
31
+ }
32
+ }
22
33
  function initTippy() {
23
34
  tippy('[data-tippy="tooltip"]', {
24
35
  theme: 'light',
@@ -37,6 +48,7 @@ ActiveStorage.start()
37
48
  document.addEventListener('turbo:load', () => {
38
49
  document.body.classList.remove('turbo-loading')
39
50
  initTippy()
51
+ isMac()
40
52
  })
41
53
 
42
54
  document.addEventListener('turbo:before-fetch-response', (e) => {
@@ -5,7 +5,7 @@
5
5
  data-action-target="controllerDiv"
6
6
  data-resource-name="<%= @resource.model_key %>"
7
7
  data-resource-id="<%= params[:id] %>"
8
- class="hidden text-blue-gray-800"
8
+ class="hidden text-slate-800"
9
9
  >
10
10
  <%= form_with model: @model, scope: 'fields', url: "#{@resource.records_path}/actions/#{@action.param_id}", data: {'turbo-frame': '_top', 'action-target': 'form'} do |form| %>
11
11
  <%= render Avo::ModalComponent.new do |c| %>
@@ -1,7 +1,7 @@
1
1
  <% if @actions.count > 0 %>
2
2
  <div class="relative z-40 js-actions-dropdown" data-controller="toggle-panel actions-picker">
3
3
  <%= a_button class: "focus:outline-none",
4
- color: 'light-blue',
4
+ color: 'sky',
5
5
  'data-action': "click->toggle-panel#togglePanel",
6
6
  'data-actions-dropdown-button': @resource.model_key do
7
7
  %>
@@ -1,7 +1,7 @@
1
1
  <div data-controller="toggle-panel">
2
2
  <div class="relative w-full flex justify-between z-30">
3
3
  <%= a_button class: 'focus:outline-none',
4
- color: 'blue-gray',
4
+ color: 'slate',
5
5
  title: t('avo.click_to_reveal_filters'),
6
6
  'data-button': 'resource-filters',
7
7
  'data-action': 'click->toggle-panel#togglePanel',
@@ -24,9 +24,9 @@
24
24
 
25
25
  <div class="p-4 border-gray-300 border-t">
26
26
  <% if params[:filters].present? %>
27
- <%= a_link t('avo.reset_filters'), resources_path(resource: @resource, filters: nil, keep_query_params: true), color: 'blue-gray', class: 'w-full justify-center' %>
27
+ <%= a_link t('avo.reset_filters'), resources_path(resource: @resource, filters: nil, keep_query_params: true), color: 'slate', class: 'w-full justify-center' %>
28
28
  <% else %>
29
- <%= a_button t('avo.reset_filters'), color: 'blue-gray', class: 'w-full justify-center', disabled: true %>
29
+ <%= a_button t('avo.reset_filters'), color: 'slate', class: 'w-full justify-center', disabled: true %>
30
30
  <% end %>
31
31
  </div>
32
32
  </div>
@@ -7,7 +7,7 @@
7
7
  <div class="mt-2">
8
8
  <code class="text-lg">Toggle published</code>
9
9
  <div class="mt-1">
10
- <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:action toggle_published</code>
10
+ <code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:action toggle_published</code>
11
11
  </div>
12
12
  </div>
13
13
 
@@ -7,7 +7,7 @@
7
7
  <div class="mt-2">
8
8
  <code class="text-lg">Published filter</code>
9
9
  <div class="mt-1">
10
- <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:filter published_filter</code>
10
+ <code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:filter published_filter</code>
11
11
  </div>
12
12
  </div>
13
13
 
@@ -20,7 +20,7 @@
20
20
  <% models.each do |model| %>
21
21
  <code class="text-lg"><%= model.to_s %></code>
22
22
  <div>
23
- <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:resource <%= model.to_s %></code>
23
+ <code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:resource <%= model.to_s %></code>
24
24
  </div>
25
25
  <% end %>
26
26
  </div>
@@ -30,7 +30,7 @@
30
30
  You may generate a resource using the following command:
31
31
  <br>
32
32
 
33
- <code class="p-1 rounded bg-light-blue-500 text-white">bin/rails generate avo:resource post</code>
33
+ <code class="p-1 rounded bg-sky-500 text-white">bin/rails generate avo:resource post</code>
34
34
  </div>
35
35
  <% end %>
36
36
 
@@ -1,3 +1,3 @@
1
1
  <div class="text-center text-sm text-gray-700">
2
- <a href="https://avohq.io/" target="_blank">Avo</a> · &copy; <%= Date.today.year %> AvoHQ · v<%= Avo::VERSION %>
2
+ <a href="https://avohq.io/" target="_blank">Avo</a> · &copy; <%= Date.today.year %> AvoHQ · <span title="<%= Avo::App.license.valid ? 'valid' : 'invalid'%> <%= Avo::App.license.id %> license">v<%= Avo::VERSION %></span>
3
3
  </div>
@@ -10,7 +10,10 @@
10
10
  data-search-target="button"
11
11
  >
12
12
  <span class="sr-only">Press </span>
13
- <kbd class="font-sans"><abbr title="Command" class="no-underline">⌘</abbr></kbd>
13
+ <kbd class="font-sans">
14
+ <abbr title="Command" class="no-underline pc:hidden">⌘</abbr>
15
+ <abbr title="CTRL" class="no-underline mac:hidden">CTRL +&nbsp; </abbr>
16
+ </kbd>
14
17
  <span class="sr-only"> and </span>
15
18
  <kbd class="font-sans">K</kbd><span class="sr-only"> to search</span>
16
19
  </div>
@@ -1 +1 @@
1
- <%= image_tag 'avo/logo.png', class: 'h-full', title: 'Avo' %>
1
+ <%= image_tag '/avo-assets/logo.png', class: 'h-full', title: 'Avo' %>
@@ -8,17 +8,17 @@
8
8
  per_page_options = per_page_options.sort.uniq
9
9
  %>
10
10
 
11
- <div class="bg-white px-4 flex items-center justify-between aborder-t aborder-blue-gray-200 sm:px-6 rounded-xl">
11
+ <div class="bg-white px-4 flex items-center justify-between aborder-t aborder-slate-200 sm:px-6 rounded-xl">
12
12
  <div class="hidden sm:flex-2 sm:flex sm:items-center sm:justify-between">
13
13
  <div>
14
- <div class="text-sm leading-5 text-blue-gray-600 flex items-center">
14
+ <div class="text-sm leading-5 text-slate-600 flex items-center">
15
15
  <div class="mr-2"><%== pagy_info @pagy %></div>
16
16
 
17
17
  <div data-controller="per-page">
18
18
  <div class="flex items-center">
19
19
  <%= select_tag 'per_page',
20
20
  options_for_select(per_page_options, @index_params[:per_page]),
21
- class: 'appearance-none inline-flex bg-blue-gray-100 disabled:bg-blue-gray-400 disabled:cursor-not-allowed focus:bg-white text-blue-gray-700 disabled:text-blue-gray-600 rounded-md py-1 px-2 leading-tight border border-blue-gray-300 outline-none focus:border-blue-gray-400 outline w-16 mr-1 text-sm',
21
+ class: 'appearance-none inline-flex bg-slate-100 disabled:bg-slate-400 disabled:cursor-not-allowed focus:bg-white text-slate-700 disabled:text-slate-600 rounded-md py-1 px-2 leading-tight border border-slate-300 outline-none focus:border-slate-400 outline w-16 mr-1 text-sm',
22
22
  data: {
23
23
  'turbo-frame': turbo_frame,
24
24
  'per-page-target': 'selector',
@@ -1,5 +1,5 @@
1
1
 
2
- <thead class="bg-blue-gray-100 border-t border-b border-gray-300 pb-1">
2
+ <thead class="bg-slate-100 border-t border-b border-gray-300 pb-1">
3
3
  <th>
4
4
  <%== item_select_all_input %>
5
5
  </th>
@@ -28,7 +28,7 @@
28
28
  sort_by = field.id
29
29
  sort_direction = 'desc'
30
30
  end
31
- classes = "text-blue-gray-600 tracking-tight leading-tight text-xs font-semibold"
31
+ classes = "text-slate-600 tracking-tight leading-tight text-xs font-semibold"
32
32
  %>
33
33
  <th class="text-left uppercase px-3 py-2 whitespace-nowrap">
34
34
  <% if field.sortable %>
@@ -17,7 +17,7 @@
17
17
  <%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
18
18
  <% end %>
19
19
  </head>
20
- <body class="bg-blue-gray-200">
20
+ <body class="bg-slate-200 os-mac">
21
21
 
22
22
  <div id="app" class="flex min-h-screen flex-row h-full">
23
23
  <div class="flex flex-1 w-full">
@@ -29,7 +29,7 @@
29
29
  <%= render partial: "avo/partials/header" %>
30
30
  </div>
31
31
  <div class="flex-1 flex ml-4 pl-4">
32
- <%= render partial: "avo/partials/global_search" if ::Avo::App.license.has_with_trial(:global_search) %>
32
+ <%= render partial: "avo/partials/global_search" if ::Avo::App.license.has_with_trial(:global_search) && ::Avo.configuration.feature_enabled?(:global_search) %>
33
33
  </div>
34
34
  <div class="align-end">
35
35
  <%= render partial: "avo/partials/profile_dropdown" %>
data/bin/test CHANGED
@@ -11,7 +11,7 @@ fi;
11
11
 
12
12
  # Run system tests
13
13
  if [[ -z "$1" ]] || [[ "$1" == "system" ]]; then
14
- yarn build
14
+ yarn build:js
15
15
  yarn build:css
16
16
  bundle exec rspec ./spec --tag type:system
17
17
  fi;
@@ -27,6 +27,7 @@ module Avo
27
27
  attr_accessor :display_license_request_timeout_error
28
28
  attr_accessor :current_user_resource_name
29
29
  attr_accessor :raise_error_on_missing_policy
30
+ attr_accessor :disabled_features
30
31
 
31
32
  def initialize
32
33
  @root_path = "/avo"
@@ -66,6 +67,7 @@ module Avo
66
67
  @display_license_request_timeout_error = true
67
68
  @current_user_resource_name = "user"
68
69
  @raise_error_on_missing_policy = false
70
+ @disabled_features = []
69
71
  end
70
72
 
71
73
  def locale_tag
@@ -115,6 +117,10 @@ module Avo
115
117
  def computed_root_path
116
118
  Avo::App.root_path
117
119
  end
120
+
121
+ def feature_enabled?(feature)
122
+ !@disabled_features.map(&:to_sym).include?(feature.to_sym)
123
+ end
118
124
  end
119
125
 
120
126
  def self.configuration
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.19.1.pre.4"
2
+ VERSION = "1.19.1.pre.8"
3
3
  end
@@ -5,6 +5,7 @@ module Generators
5
5
  class FilterGenerator < ::Rails::Generators::NamedBase
6
6
  source_root File.expand_path("templates", __dir__)
7
7
  class_option :select, type: :boolean
8
+ class_option :text, type: :boolean
8
9
 
9
10
  namespace "avo:filter"
10
11
 
@@ -12,6 +13,7 @@ module Generators
12
13
  type = "boolean"
13
14
 
14
15
  type = "select" if options[:select]
16
+ type = "text" if options[:text]
15
17
 
16
18
  template "filters/#{type}_filter.tt", "app/avo/filters/#{singular_name}.rb"
17
19
  end
@@ -0,0 +1,8 @@
1
+ class <%= class_name.camelize %> < Avo::Filters::TextFilter
2
+ self.name = '<%= name.underscore.humanize %>'
3
+ self.button_label = 'Filter by <%= class_name.underscore.humanize.downcase.gsub(' filter', '') %>'
4
+
5
+ def apply(request, query, value)
6
+ query
7
+ end
8
+ end
@@ -1,9 +1,10 @@
1
+ # For more information regaring these settings check out our docs https://docs.avohq.io
1
2
  Avo.configure do |config|
2
3
  ## == Routing ==
3
4
  config.root_path = '/<%= options[:path] %>'
4
5
 
5
6
  ## == Licensing ==
6
- config.license = 'community'
7
+ config.license = 'community' # change this to 'pro' when you add the license key
7
8
  # config.license_key = ENV['AVO_LICENSE_KEY']
8
9
 
9
10
  ## == Set the context ==
@@ -12,10 +13,8 @@ Avo.configure do |config|
12
13
  end
13
14
 
14
15
  ## == Authentication ==
15
- # config.current_user_method = :current_user
16
- # config.authenticate_with do
17
- # warden.authenticate! scope: :user
18
- # end
16
+ # config.current_user_method = {}
17
+ # config.authenticate_with = {}
19
18
 
20
19
  ## == Authorization ==
21
20
  # config.authorization_methods = {