activeadmin_decorator 0.1.0 → 0.2.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: 0dbd1ee7dba87fb7db7df96d74b0c9f7ad65f228d49501eeb0dc6dcb375c543d
4
- data.tar.gz: a6857c139caad372f9c969aacd1dd4c635f3517580c6958b657203a71f3644a5
3
+ metadata.gz: 9066952cd77bd579269b0bf534618271ad135a974fdf9d837ea35e416c8508d6
4
+ data.tar.gz: 93750f0e9c841dbf9408c5463d9453895c8f796e059290faf761fdad14123001
5
5
  SHA512:
6
- metadata.gz: 61a35efbc1eea4be20001404d3a3ff3789c25493d7e61b08c3a962d0987d94e5a659e2dc7303670d5316c3d63ca4b74e9fba0f8c58460fdeb206db9cc201e505
7
- data.tar.gz: 49c9d04c49fd4d6c2471d5f65c530b91268885e70048ac3388f454a085539a233f69bc2185f2ca9862de615d1ee961e5d2763b880cd6e7a5bd3594f7a59a32bd
6
+ metadata.gz: 351b713fde7f9a5c868861cb75e1ed6d91646d5657f07955a1c6ab0b0ea6af8e45b13121cfeba35bfbe5d809cc07861dd6b688d4a78752c0fff6b036a983ad21
7
+ data.tar.gz: f812a8602b9365810bc9d8da56c40d09b677e4622ee8bc102f11b4bbdbf4c660596e2309b90630cdcfd05f0c2f1e5f6407459dc54cf75dfbd65efa9d02b7f84f
data/README.md CHANGED
@@ -45,15 +45,15 @@ With `ActiveAdmin::ArbreDecorator` you can keep your show/index blocks in AA cle
45
45
  ```ruby
46
46
  class UserDecorator < ActiveAdmin::ArbreDecorator
47
47
  def full_name
48
- ul do |list|
49
- list.li first_name
50
- list.li last_name
48
+ ul do
49
+ li first_name
50
+ li last_name
51
51
  end
52
52
  end
53
53
  end
54
54
  ```
55
55
 
56
- Also included: `ActiveAdmin::ViewHelpers`, `ActionView::Helpers` and `Rails.application.routes.url_helpers`,
56
+ Also included: `ActionView::Helpers` and `Rails.application.routes.url_helpers`,
57
57
  so you can:
58
58
  ```ruby
59
59
  class CommentDecorator < ActiveAdmin::ArbreDecorator
@@ -4,43 +4,16 @@ require_relative 'decorator'
4
4
 
5
5
  module ActiveAdmin
6
6
  class ArbreDecorator < Decorator
7
- include ActiveAdmin::ViewHelpers
8
7
  include ActionView::Helpers
9
-
10
- CONFLICTING_METHODS = %i[display_name title].freeze
8
+ include Arbre::Element::BuilderMethods
11
9
 
12
10
  def initialize(obj)
13
11
  super
14
12
  singleton_class.include Rails.application.routes.url_helpers
15
- CONFLICTING_METHODS.each do |method|
16
- define_singleton_method(method) { obj.send(method) } if !custom_method?(method) && obj.respond_to?(method)
17
- end
18
- end
19
-
20
- ruby2_keywords def method_missing(method, *args, &block)
21
- if cached_arbre_element.respond_to?(method) && !model.respond_to?(method)
22
- Arbre::Context.new(model:) do
23
- __send__(method, *args, &block)
24
- end
25
- else
26
- super
27
- end
28
- end
29
-
30
- def respond_to?(method, include_private = false)
31
- return false if CONFLICTING_METHODS.include?(method) && !model.respond_to?(method) && !custom_method?(method)
32
-
33
- super
34
13
  end
35
14
 
36
15
  private
37
16
 
38
- def cached_arbre_element
39
- @cached_arbre_element ||= Arbre::Element.new
40
- end
41
-
42
- def custom_method?(method_name)
43
- methods.include?(method_name) && method(method_name).owner < ArbreDecorator
44
- end
17
+ def arbre_context = @arbre_context ||= Arbre::Context.new
45
18
  end
46
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveadminDecorator
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Papis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin