active_element 0.0.15 → 0.0.16

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: cb1aee3153ca04daa45cd99c868afb986df934e6a84e1be8675fcb01d9ed5097
4
- data.tar.gz: 060f791791440d2d0d880384bd2bfd2c6d6724041bd2451035521f8f8ddd954a
3
+ metadata.gz: a5061acace969c49903b783f1395dfcac9683001fca5b18099b50222b62ce25d
4
+ data.tar.gz: b884bb15effdeca54b82c1a27140418304e09d10c17f3b8d49253d75f9dc8a76
5
5
  SHA512:
6
- metadata.gz: c9b7a77759b27826038b895f9acc941620d4477192c22c0a13dc33ba03b64c61e292ff94520fc3ff7c2dc0abeb409483aa1f86aa3268e4e271fb3810d558e9e4
7
- data.tar.gz: 652d599381d599a7186c654c49c87d3d7eca73c6373241b3900bd7c9c61718efa715ea83f32dfff6b9951ee7a737f79629440bf9b16c1858cedf235e94eed52e
6
+ metadata.gz: b3b3b9df909c578397d11260209daabfe8e6e9af8424ce9865c28da05be980f3cea7614dc898fd585e0ab695befe8e214ec16d5cf40ddb2b69e05c8067a3d3c0
7
+ data.tar.gz: ce25ad80b730f77837e06967e4e4d5217878af9609c1c88bfbaa09eb5f86cbaebbe92233465c3a542b58bf27d842b2cc9ef7a91b2f4b4e565044d9bc030adda9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_element (0.0.15)
4
+ active_element (0.0.16)
5
5
  bootstrap (~> 5.3.0alpha3)
6
6
  kaminari (~> 1.2)
7
7
  paintbrush (~> 0.1.2)
@@ -150,14 +150,14 @@ GEM
150
150
  mini_mime (1.1.5)
151
151
  mini_portile2 (2.8.2)
152
152
  minitest (5.18.1)
153
- net-imap (0.4.8)
153
+ net-imap (0.4.9.1)
154
154
  date
155
155
  net-protocol
156
156
  net-pop (0.1.2)
157
157
  net-protocol
158
158
  net-protocol (0.2.2)
159
159
  timeout
160
- net-smtp (0.4.0)
160
+ net-smtp (0.4.0.1)
161
161
  net-protocol
162
162
  nio4r (2.7.0)
163
163
  nokogiri (1.15.2)
@@ -144,8 +144,6 @@ module ActiveElement
144
144
  end
145
145
 
146
146
  nil
147
- rescue
148
- byebug
149
147
  end
150
148
 
151
149
  def link_to(value)
@@ -90,6 +90,7 @@ module ActiveElement
90
90
  end
91
91
 
92
92
  def default_record_path
93
+ return record.controller_name.constantize.controller_path.underscore.singularize.tr('/', '_') + '_path' if record.try(:controller_name).present?
93
94
  "#{record_path_prefix}#{namespace_prefix}#{record_name}_path"
94
95
  end
95
96
 
@@ -52,6 +52,10 @@ module ActiveElement
52
52
  state.deletable = true
53
53
  end
54
54
 
55
+ def model=(model)
56
+ state.model = model.constantize
57
+ end
58
+
55
59
  def application_name
56
60
  RailsComponent.new(::Rails).application_name
57
61
  end
@@ -8,7 +8,7 @@ module ActiveElement
8
8
  attr_reader :permissions, :listable_fields, :viewable_fields, :editable_fields, :searchable_fields,
9
9
  :field_options
10
10
  attr_accessor :sign_in_path, :sign_in, :sign_in_method, :sign_out_path, :sign_out_method,
11
- :deletable, :authorizor, :authenticator, :list_order, :search_required
11
+ :deletable, :authorizor, :authenticator, :list_order, :search_required, :model
12
12
 
13
13
  def initialize(controller:)
14
14
  @controller = controller
@@ -21,6 +21,7 @@ module ActiveElement
21
21
  @editable_fields = []
22
22
  @searchable_fields = []
23
23
  @field_options = {}
24
+ @model = nil
24
25
  end
25
26
 
26
27
  def deletable?
@@ -116,7 +116,7 @@ module ActiveElement
116
116
  end
117
117
 
118
118
  def model
119
- controller.controller_name.classify.constantize
119
+ state.model || controller.controller_name.classify.constantize
120
120
  end
121
121
 
122
122
  def record
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveElement
4
- VERSION = '0.0.15'
4
+ VERSION = '0.0.16'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_element
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap