five-two-nw-olivander 0.2.0.31 → 0.2.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/olivander/resources/auto_form_attributes.rb +10 -2
- data/app/controllers/concerns/olivander/resources/route_builder.rb +1 -1
- data/app/helpers/olivander/application_helper.rb +9 -9
- data/app/views/application/_form.html.haml +1 -1
- data/lib/olivander/menus/menu_item.rb +4 -4
- data/lib/olivander/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2488764b16b7943eac6350511c32575af3e60d154eac16a3cd2b834f849fdfc
|
4
|
+
data.tar.gz: 56f377cfc38c89759ff1047036217b8e6f536b9f97081ff34ea5200bfeacb335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcbd6cf9861cfbfa95455a2f38ac26c9273ca5f46459602f87770295fff0b2c427d1343245e6204481765e71115449a5dbf8db3467b7edb256167d4443749b45
|
7
|
+
data.tar.gz: 874a8a647b8bc5e860b79793775ee9778a918dda189367efa9885c8e9948370a1f5a41f0aa4b082259a192d11fe2f3404a9192ccfc1da21f4626386d2a14bfe3
|
@@ -67,9 +67,10 @@ module Olivander
|
|
67
67
|
.filter{ |x| x.foreign_key == inc || x.name == inc }
|
68
68
|
.each do |r|
|
69
69
|
begin
|
70
|
-
|
70
|
+
type = r.association_class.name.demodulize.underscore.to_sym
|
71
|
+
resource_field(r.name, type, editable: editable && !uneditable_association?(r, type))
|
71
72
|
rescue NotImplementedError
|
72
|
-
resource_field(r.name, :association, editable: editable && !
|
73
|
+
resource_field(r.name, :association, editable: editable && !uneditable_association?(r, type))
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
@@ -82,6 +83,13 @@ module Olivander
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
86
|
+
def self.uneditable_association?(r, type)
|
87
|
+
return false unless r.options.keys.include?(:through)
|
88
|
+
|
89
|
+
# this collection may prove to be larger than one...
|
90
|
+
%i[has_one_through_association].include?(type)
|
91
|
+
end
|
92
|
+
|
85
93
|
def self.resource_field_group(key = :default, editable: true, &block)
|
86
94
|
self.resource_field_group_collection ||= []
|
87
95
|
self.current_resource_field_group = resource_field_group_collection.select{ |x| x.key == key}.first
|
@@ -48,7 +48,7 @@ module Olivander
|
|
48
48
|
|
49
49
|
def confirmation_message
|
50
50
|
return confirm_with if confirm_with.present?
|
51
|
-
return
|
51
|
+
return O18n.t('activerecord.actions.delete-confirmation') if verb == :delete
|
52
52
|
|
53
53
|
nil
|
54
54
|
end
|
@@ -21,7 +21,7 @@ module Olivander
|
|
21
21
|
|
22
22
|
controller_key = controller.class.name.underscore
|
23
23
|
key = "page_titles.#{controller_key}.#{action_name}"
|
24
|
-
return
|
24
|
+
return O18n.t(key) if I18n.exists?(key)
|
25
25
|
|
26
26
|
return @page_title if @page_title
|
27
27
|
|
@@ -75,31 +75,31 @@ module Olivander
|
|
75
75
|
|
76
76
|
def resource_form_action_tooltip(resource, action)
|
77
77
|
key = resource.class.name.underscore
|
78
|
-
return
|
79
|
-
return
|
78
|
+
return O18n.t("activerecord.actions.#{key}.#{action}-tooltip") if I18n.exists?("activerecord.actions.#{key}.#{action}-tooltip")
|
79
|
+
return O18n.t("activerecord.actions.#{action}-tooltip") if I18n.exists?("activerecord.actions.#{action}-tooltip")
|
80
80
|
|
81
81
|
action.to_s.titleize
|
82
82
|
end
|
83
83
|
|
84
84
|
def resource_form_action_label(resource, action)
|
85
85
|
key = resource.class.name.underscore
|
86
|
-
return
|
87
|
-
return
|
86
|
+
return O18n.t("activerecord.actions.#{key}.#{action}") if I18n.exists?("activerecord.actions.#{key}.#{action}")
|
87
|
+
return O18n.t("activerecord.actions.#{action}") if I18n.exists?("activerecord.actions.#{action}")
|
88
88
|
|
89
89
|
action.to_s.titleize
|
90
90
|
end
|
91
91
|
|
92
92
|
def resource_form_action_icon(resource, action)
|
93
93
|
key = resource.class.name.underscore
|
94
|
-
return
|
95
|
-
return
|
94
|
+
return O18n.t("activerecord.actions.#{key}.#{action}-icon") if I18n.exists?("activerecord.actions.#{key}.#{action}-icon")
|
95
|
+
return O18n.t("activerecord.actions.#{action}-icon") if I18n.exists?("activerecord.actions.#{action}-icon")
|
96
96
|
|
97
97
|
action.to_s.titleize
|
98
98
|
end
|
99
99
|
|
100
100
|
def resource_field_group_label(resource_class, key)
|
101
101
|
i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.resource_field_groups.#{key}"
|
102
|
-
I18n.exists?(i18n_key) ?
|
102
|
+
I18n.exists?(i18n_key) ? O18n.t(i18n_key) : key.to_s.titleize
|
103
103
|
end
|
104
104
|
|
105
105
|
def current_user
|
@@ -128,7 +128,7 @@ module Olivander
|
|
128
128
|
def field_label_for(resource_class, sym)
|
129
129
|
sym_s = sym.to_s.gsub('.', '_')
|
130
130
|
i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.#{sym_s}"
|
131
|
-
return
|
131
|
+
return O18n.t(i18n_key) if I18n.exists?(i18n_key)
|
132
132
|
|
133
133
|
sym.to_s.titleize
|
134
134
|
end
|
@@ -12,6 +12,6 @@
|
|
12
12
|
= render Olivander::Components::ResourceFormComponent.new(@resource, f)
|
13
13
|
= render_optional_partial 'form_inside_after', locals: {f: f}
|
14
14
|
.card-footer.text-right
|
15
|
-
= link_to 'Cancel', @_effective_resource.action_path(:index), class: 'btn btn-secondary'
|
15
|
+
= link_to 'Cancel', @cancel_path || @_effective_resource.action_path(:index), class: 'btn btn-secondary'
|
16
16
|
- unless read_only
|
17
17
|
= f.button :submit, class: 'btn btn-primary'
|
@@ -77,9 +77,9 @@ module Olivander
|
|
77
77
|
return nil unless raw
|
78
78
|
|
79
79
|
if key && I18n.exists?(key)
|
80
|
-
|
80
|
+
O18n.t(key)
|
81
81
|
elsif fallback && I18n.exists?(fallback)
|
82
|
-
|
82
|
+
O18n.t(fallback)
|
83
83
|
else
|
84
84
|
raw.titleize
|
85
85
|
end
|
@@ -88,12 +88,12 @@ module Olivander
|
|
88
88
|
|
89
89
|
class Badge
|
90
90
|
attr_accessor :text, :badge_class
|
91
|
-
|
91
|
+
|
92
92
|
def initialize(text = nil, badge_class = nil)
|
93
93
|
@text = text
|
94
94
|
@badge_class = badge_class
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
def with_proc
|
98
98
|
yield(self)
|
99
99
|
self
|
data/lib/olivander/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: five-two-nw-olivander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dennis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|