five-two-nw-olivander 0.1.2.45 → 0.1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba4f9dbeed1514a03779ee98689bf49f07d604a494b37b28f8cfd6bcf371afba
4
- data.tar.gz: f3b1d97003eac15db5a922fb708ab1045bbc90e438566966fdbd154c93cc3786
3
+ metadata.gz: 6a3e404238fed9729daec685e3012bceaf41309a41b8ea3a18afa0d7380c7f0f
4
+ data.tar.gz: 7cfddd1873f16e872f4babe5081fd80f217b90881a8c7baa6686c8b750c91dc1
5
5
  SHA512:
6
- metadata.gz: 791870070c907f93452a9492ded3aeaacc869fef869ac7097f105cbb7876e7d4b8e5da3223534b102671b555384b55b8bc6db67363ae9e2c9202e228ec51de3e
7
- data.tar.gz: 0f9fb63a3e04530081db4cc89f40fad5a2f5cb1a88fe1ed59939e92d8df419fab909d4f67acac343b5d156b7027490e1aefece3339a500158f9556541958a2f0
6
+ metadata.gz: 0dd476db5ea95b5738920477a7d6d60c0e6bb9a7d155c1ca96fdc112c902bdefba9d2e4a64b45a5a2e0aa50d0b19905da17d0b535bdb88edb4047e9a71bb1fdb
7
+ data.tar.gz: 0a5ac894a7c708a8e599fc0035d1b429d039cfb641ac0d937b1a7e090797f6aa34786692baaab8d2ae726ed3009dad40ae65173cc8ff3a0b78fc5f35fcbef739
@@ -16,8 +16,8 @@
16
16
  %td{ colspan: colspan }
17
17
  - val = @resource.send(f.sym)
18
18
  - case f.type
19
- - when :string
20
- = val
19
+ - when :string, :text
20
+ = simple_format(val)
21
21
  - when :boolean
22
22
  - icon_class = val ? 'fa-check text-success' : 'fa-times text-danger'
23
23
  %i.fa{ class: icon_class }
@@ -29,7 +29,14 @@
29
29
  %li= link_to val1
30
30
  - else
31
31
  = link_to val if val.present?
32
+ - when :file
33
+ - if val.present?
34
+ - if val.content_type.include?('image')
35
+ %img{ src: val.expiring_url }
36
+ - else
37
+ = link_to val, val.expiring_url
32
38
  - else
39
+ = f.type
33
40
  = val
34
41
  - (section.columns-slice.size).times do
35
42
  %th
@@ -49,16 +49,23 @@ module Olivander
49
49
  sym = att.name.to_sym
50
50
  type = att.type
51
51
  next unless inc == sym
52
+
52
53
  resource_field sym, type
53
54
  end
54
55
 
55
56
  reflections.map{ |x| x[1] }
56
- .filter{ |x| x.foreign_key == inc || x.name == inc }
57
- .each do |r|
57
+ .filter{ |x| x.foreign_key == inc || x.name == inc }
58
+ .each do |r|
58
59
  sym = r.name
59
60
  type = :association
60
61
  resource_field sym, type
61
62
  end
63
+
64
+ next unless respond_to?(:attachment_definitions)
65
+
66
+ attachment_definitions.filter{ |x| puts x; puts inc; x == inc }.each do |ad|
67
+ resource_field ad[0], :file
68
+ end
62
69
  end
63
70
  end
64
71
  end
@@ -49,7 +49,7 @@ module Olivander
49
49
  if ma.confirm
50
50
  bulk_action ma.sym, url_for(controller: ma.controller, action: "confirm_#{ma.action}")
51
51
  else
52
- bulk_action ma.sym, url_for(controller: ma.controller, action: ma.action), data: { turbo_frame: ma.turbo_frame }
52
+ bulk_action ma.sym, send(ma.path_helper), data: { turbo_frame: ma.turbo_frame }
53
53
  end
54
54
  end
55
55
  end
@@ -54,6 +54,14 @@ module Olivander
54
54
  action.to_s.titleize
55
55
  end
56
56
 
57
+ def resource_form_action_icon(resource, action)
58
+ key = resource.class.name.underscore
59
+ return I18n.t("activerecord.actions.#{key}.#{action}-icon") if I18n.exists?("activerecord.actions.#{key}.#{action}-icon")
60
+ return I18n.t("activerecord.actions.#{action}-icon") if I18n.exists?("activerecord.actions.#{action}-icon")
61
+
62
+ action.to_s.titleize
63
+ end
64
+
57
65
  def resource_field_group_label(resource_class, key)
58
66
  i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.resource_field_groups.#{key}"
59
67
  I18n.exists?(i18n_key) ? I18n.t(i18n_key) : key.to_s.titleize
@@ -1,15 +1,16 @@
1
- - actions.each_with_index do |a, idx|
2
- - cf_sym = "link_inner#{idx}".to_sym
3
- = content_for cf_sym do
4
- - icon_key = "activerecord.actions.icons.#{a.sym}"
5
- - if I18n.exists?(icon_key)
6
- %i.fa{ class: I18n.t(icon_key)}
7
- = resource_form_action_label(@resource, a.sym)
1
+ - actions.group_by(&:crud_action).reverse_each.with_index do |g, gidx|
2
+ - g[1].each_with_index do |a, idx|
3
+ - cf_sym = "link_inner#{gidx}-#{idx}".to_sym
4
+ = content_for cf_sym do
5
+ - icon_key = "activerecord.actions.icons.#{a.sym}"
6
+ - if I18n.exists?(icon_key)
7
+ %i.fa{ class: I18n.t(icon_key)}
8
+ = resource_form_action_label(@resource, a.sym)
8
9
 
9
- - if a.turbo_frame.blank?
10
- = link_to({ controller: a.controller, action: a.action }, method: a.verb, class: 'btn btn-tool', data: { confirm: 'are you sure?' }) do
11
- = yield cf_sym
12
- - else
13
- = link_to({ controller: a.controller, action: a.action }, class: 'btn btn-tool', data: { turbo: true, turbo_method: a.verb, turbo_frame: a.turbo_frame }) do
14
- = yield cf_sym
15
-  
10
+ - if a.turbo_frame.blank?
11
+ = link_to({ controller: a.controller, action: a.action }, method: a.verb, class: 'btn btn-tool') do
12
+ = yield cf_sym
13
+ - else
14
+ = link_to({ controller: a.controller, action: a.action }, class: 'btn btn-tool', data: { turbo: true, turbo_method: a.verb, turbo_frame: a.turbo_frame }) do
15
+ = yield cf_sym
16
+  
@@ -4,7 +4,7 @@
4
4
 
5
5
  - if @datatable
6
6
  - content_for :datatable do
7
- = render_datatable(@datatable, charts: false)
7
+ = render_datatable(@datatable, charts: false, input_js: { "stripeClasses": [] })
8
8
  - content_for :datatable_charts do
9
9
  - keys = @datatable._charts.keys
10
10
  - ks = keys.size
@@ -4,10 +4,23 @@
4
4
  -# - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
5
5
  -# - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
6
6
  -# = dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data
7
- .text-center
8
- - authorized_resource_actions(route_builder, resource, for_action: action_name).select{ |x| x.show_in_datatable }.each do |a|
7
+ - actions = authorized_resource_actions(route_builder, resource, for_action: action_name).select{ |x| x.show_in_datatable }
8
+ - crud_actions = actions.select{ |a| a.crud_action }
9
+ - non_crud_actions = actions.select{ |a| !a.crud_action }
10
+ .btn-group
11
+ - if non_crud_actions.size.positive?
12
+ .btn-group
13
+ %button.btn.btn-sm.dropdown-toggle{ type: :button, data: { toggle: 'dropdown' }}
14
+ %ul.dropdown-menu
15
+ - non_crud_actions.each do |a|
16
+ - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
17
+ - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
18
+ %li
19
+ = dropdown_link_to resource_form_action_label(resource, a.sym), path, data: data, method: a.verb
20
+ - crud_actions.each do |a|
9
21
  - path = a.path_helper.is_a?(Proc) ? a.path_helper.call(resource) : send(a.path_helper, resource.id)
10
22
  - data = a.turbo_frame.present? ? { turbo: true, turbo_frame: a.turbo_frame } : {}
11
- = link_to path, data: data, method: a.verb, title: resource_form_action_label(resource, a.sym) do
12
- - icon_class = (a.verb == :delete ? 'text-danger' : '')
13
- %i.fa.fa-edit{ class: icon_class }
23
+ - icon_class = (a.verb == :delete ? '' : '')
24
+ = link_to path, data: data, method: a.verb, title: resource_form_action_label(resource, a.sym), class: "btn btn-sm #{icon_class}" do
25
+ %i{ class: resource_form_action_icon(resource, a.sym), style: 'display: block; font-size: 10px' }
26
+ %span{ style: 'font-size: 12px' }= resource_form_action_label(resource, a.sym)
@@ -101,13 +101,13 @@
101
101
  -# %a.dropdown-item.dropdown-footer{:href => "#"} See All Notifications
102
102
  %li.nav-item.dropdown.user-menu
103
103
  %a.nav-link.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
104
- %img.user-image.img-circle.elevation-2{:alt => "User Image", :src => image_path(user_image_path(nil))}/
104
+ %img.user-image.img-circle.elevation-2{:alt => "User Image", :src => image_path(user_image_path(current_user))}/
105
105
 
106
106
  %span.d-none.d-md-inline= current_user.display_name
107
107
  %ul.dropdown-menu.dropdown-menu-lg.dropdown-menu-right
108
108
  / User image
109
109
  %li.user-header.bg-primary
110
- %img.img-circle.elevation-2{:alt => "User Image", src: image_path(user_image_path(nil))}/
110
+ %img.img-circle.elevation-2{:alt => "User Image", src: image_path(user_image_path(current_user))}/
111
111
  %p= current_user.display_name
112
112
  / Menu Footer
113
113
  %li.user-footer
@@ -1,3 +1,3 @@
1
1
  module Olivander
2
- VERSION = '0.1.2.45'.freeze
2
+ VERSION = '0.1.2.46'.freeze
3
3
  end
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.1.2.45
4
+ version: 0.1.2.46
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-01-18 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick