avo 0.5.0.beta5 → 0.5.0.beta6

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9ed4bc1c98f78365b9b2a50dda9ed809b6c598c2d0b745e6f706f3456974532
4
- data.tar.gz: 71cf2d32d71b19316e36cc2e4a7688d2581f668044ac2975a786c3ce753b11a9
3
+ metadata.gz: feb0f2107251ad2cef1a10c6980d4ffecde53332b8c584697ebcefb2f341edb5
4
+ data.tar.gz: 49d8bedcfd86bfdb44e8426c393e485451020ca5825528948a199af78f722995
5
5
  SHA512:
6
- metadata.gz: 19ecbf7fb7b632eb4e00d17c88eff0f613ed03051f9b527313515b953c31c847f6328a4faa58ae6a2eb87ceab94ab62cf4be3c0d89efd6f74669fa403bb73b74
7
- data.tar.gz: 61d6eef278896616b12cc4b3d3b996de8068ba93e7017a06885871f7d8a15b365621762360c2577ec5691cd37ab643a8e34318efc7be3ee99429e38ce6947dc8
6
+ metadata.gz: c5fc2c13d27849cc5c7b5456b9bbb1dea9798f8209746e38cc1d26cbd8f7cd158beab29c8407be0eca1cd0feedc4bfb03a8290941b9a5e66d55dc300cffada06
7
+ data.tar.gz: cd2c38578315087e25b5584de1145bba9bb0454c301f8587ad620f1799158dcddab644e6a8d73677a463b8d344f082cba93aaf53fd2e5a5d1cc9a0a2b0573ff4
data/Gemfile CHANGED
@@ -118,8 +118,6 @@ gem 'httparty'
118
118
 
119
119
  gem 'iso'
120
120
 
121
- gem 'i18n-js'
122
-
123
121
  gem 'hotwire-rails'
124
122
 
125
123
  gem 'active_link_to'
data/Gemfile.lock CHANGED
@@ -1,12 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (0.5.0.beta5)
4
+ avo (0.5.0.beta6)
5
5
  active_link_to
6
6
  countries
7
7
  hotwire-rails
8
8
  httparty
9
- i18n-js
10
9
  image_processing
11
10
  inline_svg
12
11
  pagy
@@ -144,8 +143,6 @@ GEM
144
143
  multi_xml (>= 0.5.2)
145
144
  i18n (1.8.9)
146
145
  concurrent-ruby (~> 1.0)
147
- i18n-js (3.8.0)
148
- i18n (>= 0.6.6)
149
146
  i18n_data (0.10.0)
150
147
  image_processing (1.12.1)
151
148
  mini_magick (>= 4.9.5, < 5)
@@ -368,7 +365,6 @@ DEPENDENCIES
368
365
  gem-release
369
366
  hotwire-rails
370
367
  httparty
371
- i18n-js
372
368
  image_processing (~> 1.2)
373
369
  inline_svg
374
370
  iso
@@ -35,7 +35,6 @@ module Avo
35
35
 
36
36
  @action = action_class.new
37
37
  @action.hydrate(model: model, resource: resource, user: _current_user)
38
- @action.boot_fields request
39
38
  end
40
39
 
41
40
  def respond(response)
@@ -196,12 +196,7 @@ module Avo
196
196
  end
197
197
 
198
198
  @actions = @resource.get_actions.map do |action|
199
- action = action.new
200
-
201
- action.hydrate(model: model, resource: @resource)
202
- action.boot_fields request
203
-
204
- action
199
+ action.new.hydrate(model: model, resource: @resource)
205
200
  end
206
201
  end
207
202
 
data/avo.gemspec CHANGED
@@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency 'countries'
40
40
  spec.add_dependency 'pundit'
41
41
  spec.add_dependency 'httparty'
42
- spec.add_dependency 'i18n-js'
43
42
  spec.add_dependency 'active_link_to'
44
43
  spec.add_dependency 'image_processing'
45
44
  spec.add_dependency 'view_component'
@@ -1,33 +1,39 @@
1
1
  module Avo
2
2
  class BaseAction
3
3
  class_attribute :name, default: self.class.to_s.demodulize.underscore.humanize(keep_id_suffix: true)
4
- class_attribute :message, default: I18n.t('avo.are_you_sure_you_want_to_run_this_option')
5
- class_attribute :confirm_text, default: I18n.t('avo.run')
6
- class_attribute :cancel_text, default: I18n.t('avo.cancel')
4
+ class_attribute :message
5
+ class_attribute :confirm_text
6
+ class_attribute :cancel_text
7
7
  class_attribute :no_confirmation, default: false
8
+ class_attribute :fields_loader
8
9
 
9
10
  attr_accessor :response
10
11
  attr_accessor :model
11
12
  attr_accessor :resource
12
13
  attr_accessor :user
13
14
 
14
- attr_accessor :field_loader
15
+ class << self
16
+ def fields(&block)
17
+ self.fields_loader ||= Avo::Loaders::FieldsLoader.new
15
18
 
16
- alias :field :field_loader
17
- alias :f :field
19
+ yield(fields_loader)
20
+ end
21
+
22
+ def context
23
+ App.context
24
+ end
25
+ end
18
26
 
19
27
  def initialize
20
- @fields ||= []
28
+ self.class.message ||= I18n.t('avo.are_you_sure_you_want_to_run_this_option')
29
+ self.class.confirm_text ||= I18n.t('avo.run')
30
+ self.class.cancel_text ||= I18n.t('avo.cancel')
31
+
21
32
  @response ||= {}
22
33
  @response[:message_type] ||= :notice
23
34
  @response[:message] ||= I18n.t('avo.action_ran_successfully')
24
35
  end
25
36
 
26
- def boot_fields(request)
27
- @field_loader = Avo::Loaders::FieldsLoader.new
28
- fields request if self.respond_to? :fields
29
- end
30
-
31
37
  def get_fields(view_type: :table)
32
38
  get_field_definitions.map do |field|
33
39
  field.hydrate(action: self, model: @model)
@@ -38,7 +44,9 @@ module Avo
38
44
  end
39
45
 
40
46
  def get_field_definitions
41
- @field_loader.bag.map do |field|
47
+ return [] if self.class.fields_loader.blank?
48
+
49
+ self.class.fields_loader.bag.map do |field|
42
50
  field.hydrate(action: self)
43
51
  end
44
52
  end
@@ -125,6 +125,8 @@ module Avo
125
125
  end
126
126
 
127
127
  def get_field_definitions
128
+ return [] if self.class.fields_loader.blank?
129
+
128
130
  self.class.fields_loader.bag.map do |field|
129
131
  field.hydrate(resource: self, panel_name: default_panel_name, user: user)
130
132
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = '0.5.0.beta5'
2
+ VERSION = '0.5.0.beta6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.beta5
4
+ version: 0.5.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -123,20 +123,6 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: i18n-js
128
- requirement: !ruby/object:Gem::Requirement
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '0'
133
- type: :runtime
134
- prerelease: false
135
- version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
126
  - !ruby/object:Gem::Dependency
141
127
  name: active_link_to
142
128
  requirement: !ruby/object:Gem::Requirement