avo 2.47.0 → 2.49.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38ab852dd9e98b8a3096344f2fd4e3145e937a2cbbef3524adea0fb7339c6949
4
- data.tar.gz: 5140ed4d3a7075d2ed3c539ea87134026b43eba770d0615ad3ffb1694ed9dc77
3
+ metadata.gz: 90b4bd0f7e6b9826427c149aa77090a5c5a3ed37818c9c53c55b36eed32500cd
4
+ data.tar.gz: b65a1cd540a5e130cca20d19fe6d064dba6788b95789551f5f12487c466504b9
5
5
  SHA512:
6
- metadata.gz: 149111feccf530c8da825b8367632a04bb35960e6d9ec3f95c5b2379abcff11a6e1e6e75661c506c9211af56ac4416fe54fb08f0ca9dd849ae934d3e54fa7628
7
- data.tar.gz: 5016d7212fa9dac1aa76868e1fa0bd84930e27c4f5e800892c14bc96c1bf5876aca88357bfd77c1a7995300b3aba75dabce0d6d97eafb09090af49e1676e9862
6
+ metadata.gz: b362eb0a92f9be0d53e2ba6cb8117b56726cce1495346793c26ea1ac05f2db65a7e1fee842316f9608c20113dcb9e5eaba40d7899c8e86f0fe9d3f18d7cadd2f
7
+ data.tar.gz: 5fa3e7fb6e9ff428cdac5250b6ecb31e459a297b007be70c7614bd67c9fcd725fbb56d4715d1b63e788b845a261eb48b4f89f8d55f3612895c4746c4f50d983b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.47.0)
4
+ avo (2.49.0)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -82,6 +82,12 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
82
82
  **@data
83
83
  }
84
84
 
85
+ # Fetch the data attributes off the html option
86
+ wrapper_data_attributes = @field.get_html :data, view: view, element: :wrapper
87
+ if wrapper_data_attributes.present?
88
+ attributes.merge! wrapper_data_attributes
89
+ end
90
+
85
91
  # Add the built-in stimulus integration data tags.
86
92
  if @resource.present?
87
93
  add_stimulus_attributes_for(@resource, attributes)
@@ -91,12 +97,6 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
91
97
  add_stimulus_attributes_for(@action, attributes)
92
98
  end
93
99
 
94
- # Fetch the data attributes off the html option
95
- wrapper_data_attributes = @field.get_html :data, view: view, element: :wrapper
96
- if wrapper_data_attributes.present?
97
- attributes.merge! wrapper_data_attributes
98
- end
99
-
100
100
  attributes
101
101
  end
102
102
 
@@ -1,8 +1,8 @@
1
1
  <div id="<%= dom_id file %>" class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-2">
2
2
  <% if file.present? %>
3
- <div class="flex h-full">
3
+ <div class="flex flex-col h-full">
4
4
  <% if file.representable? && is_image? %>
5
- <%= image_tag helpers.main_app.url_for(file), class: "rounded-lg max-w-full #{@extra_classes}" %>
5
+ <%= image_tag helpers.main_app.url_for(file), class: "rounded-lg max-w-full self-start #{@extra_classes}" %>
6
6
  <% elsif is_audio? %>
7
7
  <%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
8
8
  <% elsif is_video? %>
@@ -1,5 +1,6 @@
1
1
  <%= @form.hidden_field @field.id,
2
2
  class: @field.get_html(:classes, view: view, element: :input),
3
3
  data: @field.get_html(:data, view: view, element: :input),
4
- style: @field.get_html(:style, view: view, element: :input)
4
+ style: @field.get_html(:style, view: view, element: :input),
5
+ value: @field.value
5
6
  %>
@@ -204,18 +204,22 @@ export default class extends Controller {
204
204
  return
205
205
  }
206
206
 
207
+ const timezonedDate = DateTime.fromISO(selectedDates[0].toISOString())
208
+ .setZone(this.displayTimezone, { keepLocalTime: true })
209
+ .setZone('UTC', { keepLocalTime: !this.relativeValue })
210
+
207
211
  let value
208
212
  switch (this.fieldTypeValue) {
209
213
  case 'time':
210
214
  // For time values, we should maintain the real value and format it to a time-friendly format.
211
- value = DateTime.fromISO(selectedDates[0].toISOString()).setZone('UTC', { keepLocalTime: !this.relativeValue }).toFormat(RAW_TIME_FORMAT)
215
+ value = timezonedDate.toFormat(RAW_TIME_FORMAT)
212
216
  break
213
217
  case 'date':
214
- value = DateTime.fromISO(selectedDates[0].toISOString()).setZone('UTC', { keepLocalTime: true }).toFormat(RAW_DATE_FORMAT)
218
+ value = timezonedDate.toFormat(RAW_DATE_FORMAT)
215
219
  break
216
220
  default:
217
221
  case 'dateTime':
218
- value = DateTime.fromISO(selectedDates[0].toISOString()).setZone('UTC', { keepLocalTime: !this.relativeValue }).toISO()
222
+ value = timezonedDate.toISO()
219
223
  break
220
224
  }
221
225
 
data/avo.gemspec CHANGED
@@ -7,12 +7,13 @@ require "avo/version"
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "avo"
9
9
  spec.version = Avo::VERSION
10
- spec.authors = ["Adrian Marin", "Mihai Marin"]
10
+ spec.authors = ["Adrian Marin", "Mihai Marin", "Paul Bob"]
11
11
  spec.email = ["avo@avohq.io"]
12
12
  spec.homepage = "https://avohq.io"
13
- spec.summary = "Configuration-based, no-maintenance, extendable Ruby on Rails admin panel framework."
14
- spec.description = "Avo abstracts away the common parts of building apps, letting your engineers work on your app's essential components. The result is a full-featured admin panel that works out of the box, ready to give to your end-users."
15
- spec.license = "Commercial"
13
+ spec.summary = "Admin panel framework and Content Management System for Ruby on Rails."
14
+ spec.description = "Avo is a very custom Content Management System for Ruby on Rails that saves engineers and teams months of development time by building user interfaces and logic using configuration rather than traditional coding; When configuration is not enough, you can fallback to familiar Ruby on Rails code."
15
+ spec.license = "LGPL-3.0"
16
+ spec.licenses = ["LGPL-3.0", "Commercial"]
16
17
 
17
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -43,19 +43,26 @@ module Avo
43
43
  end
44
44
 
45
45
  def utc_time(value)
46
- if timezone.present?
47
- ActiveSupport::TimeZone.new(timezone).local_to_utc(Time.parse(value))
46
+ time = Time.parse(value)
47
+
48
+ if timezone.present? && !time.utc?
49
+ ActiveSupport::TimeZone.new(timezone).local_to_utc(time)
48
50
  else
49
51
  value
50
52
  end
51
53
  end
52
54
 
53
55
  def timezone
54
- if @timezone.respond_to?(:call)
56
+ timezone = if @timezone.respond_to?(:call)
55
57
  return Avo::Hosts::ResourceViewRecordHost.new(block: @timezone, record: resource.model, resource: resource, view: view).handle
58
+ else
59
+ @timezone
56
60
  end
57
61
 
58
- @timezone
62
+ # Fix for https://github.com/moment/luxon/issues/1358#issuecomment-2017477897
63
+ return "Etc/UTC" if timezone&.downcase == "utc" && view.in?([:new, :create, :edit, :update])
64
+
65
+ timezone
59
66
  end
60
67
  end
61
68
  end
@@ -32,16 +32,12 @@ module Avo
32
32
  private
33
33
 
34
34
  def encryption_key
35
- secret_key_base[0..31]
35
+ Rails.application.secret_key_base[0..31]
36
36
  rescue
37
37
  # This will fail the decryption process.
38
38
  # It's here only to keep Avo from crashing
39
39
  SecureRandom.random_bytes(32)
40
40
  end
41
-
42
- def secret_key_base
43
- ENV["SECRET_KEY_BASE"] || Rails.application.credentials.secret_key_base || Rails.application.secrets.secret_key_base
44
- end
45
41
  end
46
42
  end
47
43
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.47.0" unless const_defined?(:VERSION)
2
+ VERSION = "2.49.0" unless const_defined?(:VERSION)
3
3
  end