avo 2.23.2 → 2.23.3.pre.1.pr1529

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: 1d0033894890862fb1e3c93972610cfdd75d80c70f7fb4e0ef8708ad03bbb070
4
- data.tar.gz: 2037e1fbc262c121f3e3c1344c976b76d290435f242c335da038492129e4ddae
3
+ metadata.gz: de77547d8082b94984a6b224a19834113f65d52f9c0afd1d169d83026ecbc3fe
4
+ data.tar.gz: a0eed9b9260291aea7951067164d2dafc0d36dead3b57d189e0263434c5eb831
5
5
  SHA512:
6
- metadata.gz: 15054cc05402bd5dffe378494d22e6ce5c47cc3961fc6965163d43e0e3b189b8d4df80074f3ee30181899a1b7c7c2706f9600730eae13090d426156106bf3e73
7
- data.tar.gz: bfa46f52ebf8873531760e8fb0ff9b3bedb2c03eaf2f93b75919d2e354a95d9a83b7caafc50104f35c2432aaa1d3edbcf8aca54a21140a7ab4cdf663fbc39448
6
+ metadata.gz: d478cf9410b3437f0ef998857b5f71e27c43b245030dbe5f21acc81ae9d751123bd5c3a6131dd7618fdeb9c12de23c0c6fca7bf36e2d285dd7793144946e40f9
7
+ data.tar.gz: e9426307d3d13a23aea64ca185c211821f29460cd85ee2b74d876eb538d91d41ee8802d5a2961ede266d0bbe2922d9b8206ac68fc8982002b57cc311df15cbb8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.23.2)
4
+ avo (2.23.3.pre.1.pr1529)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -407,7 +407,7 @@ GEM
407
407
  tzinfo (2.0.5)
408
408
  concurrent-ruby (~> 1.0)
409
409
  unicode-display_width (2.4.0)
410
- view_component (2.80.0)
410
+ view_component (2.81.0)
411
411
  activesupport (>= 5.2.0, < 8.0)
412
412
  concurrent-ruby (~> 1.0)
413
413
  method_source (~> 1.0)
@@ -52,7 +52,7 @@
52
52
  style: @field.get_html(:style, view: view, element: :input),
53
53
  type: type,
54
54
  classes: classes("w-full"),
55
- view: @resource.view
55
+ view: view
56
56
  %>
57
57
  <% else %>
58
58
  <%= @form.select @field.id_input_foreign_key,
@@ -88,7 +88,7 @@
88
88
  resource: @resource,
89
89
  disabled: disabled,
90
90
  classes: classes("w-full"),
91
- view: @resource.view,
91
+ view: view,
92
92
  style: @field.get_html(:style, view: view, element: :input)
93
93
  %>
94
94
  <% else %>
@@ -50,7 +50,7 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
50
50
  end
51
51
 
52
52
  def field_html_action
53
- @field.get_html(:data, view: @resource.view, element: :input).fetch(:action, nil)
53
+ @field.get_html(:data, view: view, element: :input).fetch(:action, nil)
54
54
  end
55
55
 
56
56
  private
@@ -1,29 +1,22 @@
1
1
  <%= field_wrapper **field_wrapper_args do %>
2
- <% if @field.display_value %>
3
- <div class="text-center text-sm font-semibold w-full leading-none mb-1">
4
- <span class="js-progress-bar-value-<%= @field.id %>"><%= @field.value %></span><%= @field.value_suffix if @field.value_suffix.present? %>
5
- </div>
2
+ <%= content_tag :div, data: {controller: "progress-bar-field"} do %>
3
+ <% if @field.display_value %>
4
+ <div class="text-center text-sm font-semibold w-full leading-none mb-1">
5
+ <span data-progress-bar-field-target="label"><%= @field.value %></span><%= @field.value_suffix if @field.value_suffix.present? %>
6
+ </div>
7
+ <% end %>
8
+ <%= @form.range_field @field.id,
9
+ class: "w-full #{@field.get_html(:classes, view: view, element: :input)}",
10
+ data: {
11
+ action: "input->progress-bar-field#update",
12
+ **@field.get_html(:data, view: view, element: :input)
13
+ },
14
+ disabled: disabled?,
15
+ max: @field.max,
16
+ min: 0,
17
+ placeholder: @field.placeholder,
18
+ step: @field.step,
19
+ style: @field.get_html(:style, view: view, element: :input)
20
+ %>
6
21
  <% end %>
7
- <%= @form.range_field @field.id,
8
- class: "w-full #{@field.get_html(:classes, view: view, element: :input)}",
9
- data: @field.get_html(:data, view: view, element: :input),
10
- disabled: disabled?,
11
- max: @field.max,
12
- min: 0,
13
- placeholder: @field.placeholder,
14
- step: @field.step,
15
- style: @field.get_html(:style, view: view, element: :input)
16
- %>
17
22
  <% end %>
18
-
19
-
20
- <script>
21
- var input = document.getElementById('project_progress');
22
- var log = document.querySelector('.js-progress-bar-value-<%= @field.id %>');
23
-
24
- input.addEventListener('input', updateValue);
25
-
26
- function updateValue(e) {
27
- log.textContent = e.target.value;
28
- }
29
- </script>
@@ -133,7 +133,7 @@ module Avo
133
133
  field = field_klass.new id, form: form, view: view, **args, &block
134
134
 
135
135
  # Add the form record to the field so all fields have access to it.
136
- field.hydrate(model: form.object)
136
+ field.hydrate(model: form.object) if form.present?
137
137
 
138
138
  render field.component_for_view(view).new field: field, form: form, **component_options
139
139
  end
@@ -0,0 +1,9 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ export default class extends Controller {
4
+ static targets = ['label']
5
+
6
+ update(e) {
7
+ this.labelTarget.textContent = e.target.value
8
+ }
9
+ }
@@ -19,6 +19,7 @@ import MenuController from './controllers/menu_controller'
19
19
  import ModalController from './controllers/modal_controller'
20
20
  import MultipleSelectFilterController from './controllers/multiple_select_filter_controller'
21
21
  import PerPageController from './controllers/per_page_controller'
22
+ import ProgressBarFieldController from './controllers/fields/progress_bar_field_controller'
22
23
  import ResourceEditController from './controllers/resource_edit_controller'
23
24
  import ResourceIndexController from './controllers/resource_index_controller'
24
25
  import ResourceShowController from './controllers/resource_show_controller'
@@ -67,6 +68,7 @@ application.register('belongs-to-field', BelongsToFieldController)
67
68
  application.register('code-field', CodeFieldController)
68
69
  application.register('date-field', DateFieldController)
69
70
  application.register('key-value', KeyValueController)
71
+ application.register('progress-bar-field', ProgressBarFieldController)
70
72
  application.register('simple-mde', SimpleMdeController)
71
73
  application.register('trix-field', TrixFieldController)
72
74
 
data/config/master.key ADDED
@@ -0,0 +1 @@
1
+ 2aeb23d82b909d9c6b5abb62f7058c2a
@@ -82,6 +82,7 @@ module Avo
82
82
  @view = args[:view] || nil
83
83
  @value = args[:value] || nil
84
84
  @stacked = args[:stacked] || nil
85
+ @resource = args[:resource]
85
86
 
86
87
  @args = args
87
88
 
@@ -1,6 +1,5 @@
1
1
  module Avo
2
2
  module Fields
3
-
4
3
  # The field can be in multiple scenarios where it needs different types of data and displays the state differently.
5
4
  # For example the non-polymorphic, non-searchable variant is the easiest to support. You only need to populate a simple select with the ID of the associated record and the list of records.
6
5
  # For the searchable polymorphic variant you need to provide the type of the association (Post, Project, Team), the label of the associated record ("Cool post title") and the ID of that record.
@@ -118,7 +117,7 @@ module Avo
118
117
  resource = target_resource
119
118
  resource = App.get_resource_by_model_name model if model.present?
120
119
 
121
- query = Avo::Services::AuthorizationService.apply_policy(user, resource.class.query_scope)
120
+ query = resource.class.query_scope
122
121
 
123
122
  if attach_scope.present?
124
123
  query = Avo::Hosts::AssociationScopeHost.new(block: attach_scope, query: query, parent: get_model).handle
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.23.2" unless const_defined?(:VERSION)
2
+ VERSION = "2.23.3.pre.1.pr1529" unless const_defined?(:VERSION)
3
3
  end