five-two-nw-olivander 0.1.2.3 → 0.1.2.4

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: 597764e454652e4a42b1d81c7d63db17f9495a662886fd9184c7fc3790d16c75
4
- data.tar.gz: faa979538cb5fa01390a65e0378054b3f916b3f3630ac45e586ff64fb43e9ffa
3
+ metadata.gz: d551785ee277728e208fb537527d00e201b93b89f796de075295f271c90ff879
4
+ data.tar.gz: f079e183a76a7724c16099542aeaef9159f5d4ff64ef227267a8de6dcd03b7c0
5
5
  SHA512:
6
- metadata.gz: b1d0847e4694082bcbf22f3717f4ea551f1144697b51e809539118402f347e46158767a8fdca8eab49b1262dde97e09ad964f8722b0d3701cfbfe3789478da34
7
- data.tar.gz: 92df52efda623339deb45a35ad86c5a52e0205ba5eb49e71aa70d5683eb2df079825531407f58634c0970c0a6802b8c62081e6c910fdedd494dec4a88fbd90a6
6
+ metadata.gz: 1abaa3d2a03cb74f5d38077e2070a90ca63a12f27799a6d000fdb3506272c9890b284fbc76a59049bd1b5fe1766d51f11658f96fe28298baf83e80ab7436719e
7
+ data.tar.gz: dadd557fabc44933a35bf795173c37d3753b7f40cfae8fa2979978923b78312904e96c8a66e12da01a46fbb24917f22476a5ca72ea815f7358f56fc7766a6a90
@@ -17,18 +17,18 @@ module Olivander
17
17
  "avatar#{SecureRandom.random_number(4)}.png"
18
18
  end
19
19
 
20
- def authorized_resource_actions(resource, for_action: :show)
20
+ def authorized_resource_actions(route_builder, resource, for_action: :show)
21
21
  plural_name = resource.is_a?(Class) ? resource.table_name : resource.class.table_name
22
- routed_resource = @context.route_builder.resources[plural_name.to_sym]
22
+ routed_resource = route_builder.resources[plural_name.to_sym]
23
23
  actions = resource.is_a?(Class) ?
24
24
  (routed_resource.unpersisted_crud_actions | routed_resource.collection_actions) :
25
25
  (resource.persisted? ? (routed_resource.persisted_crud_actions | routed_resource.member_actions): [])
26
26
  actions.reject{ |a| a.sym == for_action }
27
27
  end
28
28
 
29
- def resource_form_actions(resource, for_action: :show)
29
+ def resource_form_actions(route_builder, resource, for_action: :show)
30
30
  [].tap do |output|
31
- authorized_resource_actions(resource, for_action: for_action).select{ |x| x.show_in_form }.each do |a|
31
+ authorized_resource_actions(route_builder, resource, for_action: for_action).select{ |x| x.show_in_form }.each do |a|
32
32
  output << link_to(a.sym, {controller: a.controller, action: a.action}, method: a.verb, class: 'btn btn-primary', data: { turbo: true })
33
33
  end
34
34
  end.join('&nbsp;').html_safe
@@ -3,7 +3,7 @@
3
3
  .card
4
4
  .card-header
5
5
  .card-tools
6
- = resource_form_actions(@resource, for_action: action_name.to_sym)
6
+ = resource_form_actions(@context.route_builder, @resource, for_action: action_name.to_sym)
7
7
  .card-body
8
8
  =f.error_notification
9
9
  =f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present?
@@ -6,7 +6,7 @@
6
6
  .card-header
7
7
  %h3.card-title= @page_title
8
8
  .card-tools
9
- = resource_form_actions(resource.klass, for_action: :index)
9
+ = resource_form_actions(@context.route_builder, resource.klass, for_action: :index)
10
10
  .card-body
11
11
  - if @datatable
12
12
  = render_datatable(@datatable)
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = "0.1.2.3"
2
+ VERSION = "0.1.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: five-two-nw-olivander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.3
4
+ version: 0.1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dennis