rails_base 0.75.4 → 0.75.6

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: d9dc8c47a6ae993e4288c6ed4ea52f8e267ec215a39b3e805a6cfcd87acb3452
4
- data.tar.gz: ea5c66cc9fb0583563789ca708aaa7c956a589c361527a1dd7c452a8542646d7
3
+ metadata.gz: 7be240ad162cad85b3a70e4163f99eea08a0eec55d8ce97ab6a9e83f59d6559a
4
+ data.tar.gz: 8357b2607d6eae820b73be0e794ad6cab80912d7cf02d6524f4ba95d47626caf
5
5
  SHA512:
6
- metadata.gz: 85591d23ed22d32f04ab8d1ff0ba58289c583b7362a4dd210983fcc13d7d6376b91dc3c3bc16142c9c2accdcf005be2b42d93fcf5faf6fe1b36b2c34ae7ad1d4
7
- data.tar.gz: '0931ddc951078439afb0c84b4cef6acc885b75962b4e858bddcea8c82e5ba5dccda27fe8fdb916b99cfda941106934f067451d2a62f03602778fb853f2c7a62b'
6
+ metadata.gz: 11ff5f552ba5e901555fdfd4df622a0c3bccef9e0e1f169fcfd50778143814ba7796483c2876121c67885ffc7dc9145c5ebc12954f47016497924a53c5c43d0a
7
+ data.tar.gz: 2ae800d156442306b2f34374c1e0c5ab417e233c57c1aa341c516da5df110c2af3c0227dcee5112fb28ba51ed549b8cd598b0f15e38b77a3bad5c4f27d7bb02d
@@ -15,6 +15,7 @@
15
15
  close_display = start_open ? 'inline' : 'none'
16
16
  open_display = !start_open ? 'inline' : 'none'
17
17
  id_transposed = "id_transposed_#{rand(100_000..999_999)}"
18
+ function_name = options.fetch(:function_name, id_transposed)
18
19
  %>
19
20
 
20
21
  <% if use_fa_icon %>
@@ -49,6 +50,33 @@
49
50
  <% end %>
50
51
  });
51
52
 
53
+ function <%= function_name %>_collapse_open(){
54
+ _rails_base_toggle_base_footer('hide')
55
+ $(`#<%= body %>`).collapse('show')
56
+ <% if use_fa_icon %>
57
+ $(`#<%= fa_icon_span_id %> .open`).hide()
58
+ $(`#<%= fa_icon_span_id %> .closed`).show()
59
+ <% end %>
60
+ }
61
+
62
+ function <%= function_name %>_collapse_close(){
63
+ _rails_base_toggle_base_footer('hide')
64
+ $(`#<%= body %>`).collapse('hide')
65
+ <% if use_fa_icon %>
66
+ $(`#<%= fa_icon_span_id %> .open`).show()
67
+ $(`#<%= fa_icon_span_id %> .closed`).hide()
68
+ <% end %>
69
+ }
70
+
71
+ function <%= function_name %>_collapse_toggle(){
72
+ _rails_base_toggle_base_footer('hide')
73
+ $(`#<%= body %>`).collapse('toggle')
74
+ <% if use_fa_icon %>
75
+ $(`#<%= fa_icon_span_id %> .open`).toggle()
76
+ $(`#<%= fa_icon_span_id %> .closed`).toggle()
77
+ <% end %>
78
+ }
79
+
52
80
  $(`#<%= body %>`).on('shown.bs.collapse', function () {
53
81
  _rails_base_reload_base_footer();
54
82
  _rails_base_toggle_base_footer('show')
@@ -140,5 +140,3 @@ module RailsBase
140
140
  end
141
141
  end
142
142
  end
143
-
144
-
@@ -1,7 +1,7 @@
1
1
  module RailsBase
2
2
  MAJOR = '0'
3
3
  MINOR = '75'
4
- PATCH = '4'
4
+ PATCH = '6'
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
 
7
7
  def self.print_version
data/lib/rails_base.rb CHANGED
@@ -73,17 +73,30 @@ module RailsBase
73
73
  # This can be very useful if you want to add new methods to already defined classes from RailsBase
74
74
  # EG: You want to add a new method to the User Model
75
75
  # EG: You want to overload a method for the services/rails_base/name_change.rb
76
- def self.reloadable_paths!(relative_path:, skip_files: [])
76
+ def self.reloadable_paths!(relative_path: nil, only_files: [], skip_files: [])
77
77
  unless Array === skip_files
78
78
  raise ArgumentError, "When `skip_files` provided, it is expected to be an array"
79
79
  end
80
80
 
81
- overrides = Rails.root.join(relative_path)
82
- Rails.autoloaders.main.ignore(overrides)
81
+ unless Array === only_files
82
+ raise ArgumentError, "When `only_files` provided, it is expected to be an array"
83
+ end
84
+
85
+ override_files = if relative_path
86
+ Dir.glob("#{Rails.root.join(relative_path)}/**/*.rb")
87
+ elsif only_files.presence
88
+ only_files.map { Rails.root.join(_1) }
89
+ else
90
+ []
91
+ end
92
+
93
+ Rails.autoloaders.main.ignore(*override_files)
83
94
 
84
95
  Rails.configuration.to_prepare do
85
- Dir.glob("#{overrides}/**/*.rb").sort.each do |override|
86
- next if skip_files.any? { override.include?(_1) }
96
+ override_files.sort.each do |override|
97
+ if skip_files.any? { override.include?(_1) }
98
+ next
99
+ end
87
100
 
88
101
  load override
89
102
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.75.4
4
+ version: 0.75.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-20 00:00:00.000000000 Z
11
+ date: 2024-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails