avo 1.21.0.pre.1 → 1.21.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.

@@ -1,10 +1,9 @@
1
1
  module Avo
2
2
  module Fields
3
3
  class BelongsToField < BaseField
4
- attr_reader :searchable
5
4
  attr_reader :polymorphic_as
6
5
  attr_reader :relation_method
7
- attr_reader :types
6
+ attr_reader :types # for Polymorphic associations
8
7
 
9
8
  def initialize(id, **args, &block)
10
9
  args[:placeholder] ||= I18n.t("avo.choose_an_option")
@@ -17,10 +16,28 @@ module Avo
17
16
  @relation_method = name.to_s.parameterize.underscore
18
17
  end
19
18
 
19
+ def searchable
20
+ @searchable && ::Avo::App.license.has_with_trial(:searchable_belongs_to)
21
+ end
22
+
20
23
  def value
21
24
  super(polymorphic_as)
22
25
  end
23
26
 
27
+ # The value
28
+ def field_value
29
+ value.send(database_value)
30
+ rescue
31
+ nil
32
+ end
33
+
34
+ # What the user sees in the text field
35
+ def field_label
36
+ value.send(target_resource.class.title)
37
+ rescue
38
+ nil
39
+ end
40
+
24
41
  def options
25
42
  ::Avo::Services::AuthorizationService.apply_policy(user, target_resource.class.query_scope).all.map do |model|
26
43
  {
@@ -1,14 +1,15 @@
1
1
  module Avo
2
2
  module Fields
3
3
  class FilesField < BaseField
4
+ attr_accessor :is_audio
4
5
  attr_accessor :is_image
5
6
  attr_accessor :direct_upload
6
7
 
7
8
  def initialize(id, **args, &block)
8
9
  super(id, **args, &block)
9
10
 
10
- @is_image = args[:is_image].present? ? args[:is_image] : @is_avatar
11
11
  @is_audio = args[:is_audio].present? ? args[:is_audio] : false
12
+ @is_image = args[:is_image].present? ? args[:is_image] : @is_avatar
12
13
  @direct_upload = args[:direct_upload].present? ? args[:direct_upload] : false
13
14
  end
14
15
 
@@ -7,7 +7,8 @@ module Avo
7
7
  :custom_tools,
8
8
  :custom_fields,
9
9
  :global_search,
10
- :enhanced_search_results
10
+ :enhanced_search_results,
11
+ :searchable_belongs_to,
11
12
  ]
12
13
  end
13
14
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.21.0.pre.1"
2
+ VERSION = "1.21.0"
3
3
  end
@@ -93,3 +93,4 @@ en:
93
93
  delete_row: 'Delete row'
94
94
  was_successfully_created: 'was successfully created'
95
95
  was_successfully_updated: 'was successfully updated'
96
+ clear_value: "Clear value"
@@ -6402,6 +6402,14 @@ progress[value]::-moz-progress-bar{
6402
6402
  top:-1px
6403
6403
  }
6404
6404
 
6405
+ .left-auto{
6406
+ left:auto
6407
+ }
6408
+
6409
+ .right-3{
6410
+ right:0.75rem
6411
+ }
6412
+
6405
6413
  .z-10{
6406
6414
  z-index:10
6407
6415
  }
@@ -6571,6 +6579,14 @@ progress[value]::-moz-progress-bar{
6571
6579
  margin-left:0.5rem
6572
6580
  }
6573
6581
 
6582
+ .mr-px{
6583
+ margin-right:1px
6584
+ }
6585
+
6586
+ .-mt-2{
6587
+ margin-top:-0.5rem
6588
+ }
6589
+
6574
6590
  .ml-6{
6575
6591
  margin-left:1.5rem
6576
6592
  }