rails_com 1.2.5 → 1.2.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/rails_com/application.js +11 -27
  3. data/app/assets/javascripts/rails_com/attachment.js +24 -19
  4. data/app/assets/javascripts/rails_com/fetch_xhr_script.js +13 -2
  5. data/app/assets/javascripts/rails_com/footer.js +7 -1
  6. data/app/assets/javascripts/rails_com/picture.js +1 -0
  7. data/app/assets/javascripts/rails_com/time_local.js +10 -0
  8. data/app/controllers/active_storage_ext/admin/blob_defaults_controller.rb +2 -1
  9. data/app/controllers/concerns/rails_common_api.rb +25 -15
  10. data/app/controllers/concerns/rails_common_controller.rb +46 -0
  11. data/app/helpers/rails_com/assets_helper.rb +32 -14
  12. data/app/models/active_storage/blob_default.rb +19 -0
  13. data/app/views/active_storage_ext/admin/blob_defaults/_form.html.erb +1 -0
  14. data/app/views/active_storage_ext/admin/blob_defaults/index.html.erb +3 -2
  15. data/app/views/active_storage_ext/attachments/_default_image_item.html.erb +9 -1
  16. data/app/views/active_storage_ext/attachments/_list_edit.html.erb +11 -9
  17. data/app/views/active_storage_ext/attachments/_list_field.html.erb +6 -0
  18. data/db/migrate/20181012025833_rails_com_init.rb +1 -0
  19. data/lib/active_record/type/i18n.rb +19 -0
  20. data/lib/rails_com.rb +11 -21
  21. data/lib/rails_com/action_controller.rb +3 -0
  22. data/lib/rails_com/{helpers → action_controller}/controller_helper.rb +8 -9
  23. data/lib/rails_com/{rails_ext → action_controller}/errors.rb +0 -0
  24. data/lib/rails_com/action_controller/parameters.rb +16 -0
  25. data/lib/rails_com/action_view.rb +2 -0
  26. data/lib/rails_com/{rails_ext → action_view}/template_renderer.rb +5 -17
  27. data/lib/rails_com/{rails_ext → action_view}/translation_helper.rb +3 -1
  28. data/lib/rails_com/active_record.rb +3 -0
  29. data/lib/rails_com/{helpers → active_record}/model_helper.rb +0 -0
  30. data/lib/rails_com/{rails_ext → active_record}/persistence_sneakily.rb +0 -0
  31. data/lib/rails_com/active_record/translation.rb +66 -0
  32. data/lib/rails_com/active_storage.rb +4 -0
  33. data/lib/rails_com/{rails_ext → active_storage}/activestorage_attached.rb +1 -0
  34. data/lib/rails_com/active_storage/attached_macros.rb +20 -0
  35. data/lib/rails_com/{rails_ext → active_storage}/attachment_transfer.rb +4 -2
  36. data/lib/rails_com/active_storage/blob_ext.rb +34 -0
  37. data/lib/rails_com/{rails_ext → active_storage}/video_response.rb +2 -1
  38. data/lib/rails_com/core.rb +7 -0
  39. data/lib/rails_com/{core_ext → core}/array.rb +0 -0
  40. data/lib/rails_com/{core_ext → core}/date.rb +0 -0
  41. data/lib/rails_com/{core_ext → core}/hash.rb +0 -0
  42. data/lib/rails_com/{core_ext → core}/nil.rb +0 -0
  43. data/lib/rails_com/{core_ext → core}/numeric.rb +0 -0
  44. data/lib/rails_com/{core_ext → core}/string.rb +0 -0
  45. data/lib/rails_com/engine.rb +9 -4
  46. data/lib/rails_com/{rails_ext → generators}/named_base.rb +0 -0
  47. data/lib/rails_com/{rails_ext → generators}/scaffold_generator.rb +2 -2
  48. data/lib/rails_com/utils/uid_helper.rb +7 -1
  49. data/lib/rails_com/version.rb +1 -1
  50. data/lib/templates/erb/scaffold/{_search_form.html.erb.tt → _filter.html.erb.tt} +3 -0
  51. data/lib/templates/erb/scaffold/index.html.erb.tt +2 -4
  52. metadata +54 -23
  53. data/app/views/active_storage_ext/attachments/_list_form.html.erb +0 -28
  54. data/lib/rails_com/rails_ext/attached_macros.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d89a903e9f829ba767afbef9f90d9a7ddf635ce8d108223ca745f9dc6578f48f
4
- data.tar.gz: 389b8a92919cda43adc6024090f3c8aa67bfb33aaa3d2aaf710e27e0235b31e5
3
+ metadata.gz: 87299107f1442c24126546dff21a4d484162bbad8549d6424d15a6eb880d05db
4
+ data.tar.gz: a700869e1a3db98b654616814724a47952323e0d70ad7ec66ddedbdbd9f5c72e
5
5
  SHA512:
6
- metadata.gz: 1d0616448bc813c6da2eb8794f2a5894bb671bf2e2a47cf0231bd46d30814046b25d7737ecb7b26f5df89cc40e013fed5731b1ab80722ec8c84bcf0b9570af34
7
- data.tar.gz: 85f715d2616e82f7fba685963964524c71b49e6575a217ea6b1022bf7ee3c4e10640578fe14210f0818d399187a3432582f1bc612d05db5c35e950aac1fd309f
6
+ metadata.gz: e4c1af32eeec4d14e445347ebd89cb776439833f71ed81ddce6ea371243306adfbbe8a46cfbff3b309119bfcbf539157785fb76d43f4ed3d6186be9ca46d7faf
7
+ data.tar.gz: 4a65adc64a1d6c38b49e76f7cc6be115d13277d8db192a6b7ba2ee77e461c1b5fd91b0b7fe89c1208851819b30a68add5c580d96348934aec812c5d5679eceb4
@@ -1,45 +1,29 @@
1
1
  //= require rails-ujs
2
2
  //= require turbolinks
3
- //= require stimulus
4
- //= require activestorage
3
+ //= require ./time_local
5
4
  //= require_self
6
5
 
7
- function timeForLocalized(){
8
- $('time[data-localized!="true"]').each(function(){
9
- if (this.textContent.length > 0) {
10
- var format = this.dataset['format'] || 'YYYY-MM-DD HH:mm:ss';
11
- this.textContent = moment.utc(this.textContent).local().format(format);
12
- this.dataset['localized'] = 'true'
13
- }
14
- })
15
- }
16
-
17
- function clickCallback(e) {
18
- if (e.target.tagName !== 'A') {
19
- return;
20
- }
21
- (new Date).getTimezoneOffset();
22
- }
23
- //document.addEventListener('click', clickCallback, false);
24
-
25
- function htmlToElement(html_str) {
26
- var template = document.createElement('template');
27
- template.innerHTML = html_str.trim();
28
- return template.content.firstChild;
29
- }
30
-
31
6
  document.addEventListener('DOMContentLoaded', function() {
32
7
  timeForLocalized()
33
8
  });
9
+ document.addEventListener('ajax:beforeSend', function(event) {
10
+ var detail = event.detail;
11
+ var xhr = detail[0];
12
+ var offset = (new Date).getTimezoneOffset();
13
+ xhr.setRequestHeader('Utc-Offset', offset);
14
+ xhr.setRequestHeader('X-Csp-Nonce', Rails.cspNonce())
15
+ });
16
+
34
17
  document.addEventListener('turbolinks:load', function() {
35
18
  timeForLocalized()
36
19
  });
37
20
  document.addEventListener('turbolinks:visit', function() {
38
21
  timeForLocalized()
39
22
  });
40
-
41
23
  document.addEventListener('turbolinks:request-start', function(event) {
42
24
  var xhr = event.data.xhr;
43
25
  var offset = (new Date).getTimezoneOffset();
44
26
  xhr.setRequestHeader('Utc-Offset', offset);
27
+ xhr.setRequestHeader('X-Csp-Nonce', Rails.cspNonce())
45
28
  });
29
+
@@ -3,14 +3,14 @@
3
3
 
4
4
  /*
5
5
  * Input Field with Attachment
6
- * based on https://github.com/Rovak/InlineAttachment/blob/master/LICENSE
6
+ * based on https://github.com/Rovak/inlineAttachment/blob/master/LICENSE
7
7
  */
8
8
 
9
9
  (function(document, window) {
10
10
  'use strict';
11
11
 
12
12
  var InputAttachment = function(options) {
13
- this.settings = Object.assign(options, InputAttachment.defaults);
13
+ this.settings = Object.assign(InputAttachment.defaults, options);
14
14
  this.editor = this.settings['editor'];
15
15
  this.filenameTag = '{filename}';
16
16
  this.lastValue = null;
@@ -39,7 +39,7 @@
39
39
 
40
40
  uploadFileInput: '',
41
41
 
42
- previewDiv: 'file_preview',
42
+ templateDiv: 'file_template',
43
43
 
44
44
  /**
45
45
  * Extension which will be used when a file extension could not
@@ -196,17 +196,22 @@
196
196
  return xhr;
197
197
  };
198
198
 
199
- InputAttachment.prototype.previewFile = function(file, obj) {
200
- var fileList = document.getElementById(this.settings.previewDiv)
199
+ InputAttachment.prototype.previewFile = function(file, previewDiv) {
200
+ var fileList = document.getElementById(previewDiv);
201
+ var templateDiv = document.getElementById(this.settings.templateDiv);
201
202
  var template = document.createElement('template');
202
- template.innerHTML = fileList.firstElementChild.outerHTML.trim();
203
+ fileList.querySelectorAll('[data-preview=true]').forEach(e => e.parentNode.removeChild(e));
204
+ template.innerHTML = templateDiv.outerHTML.trim();
203
205
  var img_div = template.content.firstChild;
206
+ img_div.style.display = 'inline-block';
207
+ img_div.dataset['preview'] = true;
208
+ img_div.id = null;
204
209
  var img = img_div.lastElementChild;
205
210
 
206
211
  img.src = window.URL.createObjectURL(file); //创建一个object URL,并不是你的本地路径
207
212
  img.onload = function(e) {
208
213
  window.URL.revokeObjectURL(this.src); //图片加载后,释放object URL
209
- }
214
+ };
210
215
 
211
216
  fileList.appendChild(img_div);
212
217
  };
@@ -243,7 +248,7 @@
243
248
  } else {
244
249
  newValue = this.settings.urlText.replace(this.filenameTag, filename);
245
250
  }
246
- this.editor.input.value.replace(this.lastValue, newValue);
251
+ this.editor.value.replace(this.lastValue, newValue);
247
252
  this.settings.onFileUploaded.call(this, filename, result);
248
253
  }
249
254
  }
@@ -258,7 +263,7 @@
258
263
  */
259
264
  InputAttachment.prototype.onFileUploadError = function(xhr) {
260
265
  if (this.settings.onFileUploadError.call(this, xhr) !== false) {
261
- this.editor.input.value.replace(this.lastValue, '');
266
+ this.editor.value.replace(this.lastValue, '');
262
267
  }
263
268
  };
264
269
 
@@ -272,7 +277,7 @@
272
277
  if (this.settings.onFileReceived.call(this, file) !== false) {
273
278
  this.lastValue = this.settings.progressText;
274
279
 
275
- var scrollPos = el.scrollTop
280
+ var scrollPos = el.scrollTop;
276
281
  el.value = this.lastValue;
277
282
  el.scrollTop = scrollPos;
278
283
  }
@@ -338,14 +343,14 @@
338
343
  return result;
339
344
  };
340
345
 
341
- InputAttachment.prototype.imagePreview = function(e){
346
+ InputAttachment.prototype.imagePreview = function(e, previewDiv){
342
347
  var result = false;
343
348
 
344
349
  for (var i = 0; i < e.target.files.length; i++) {
345
350
  var file = e.target.files[i];
346
351
  if (this.isFileAllowed(file)) {
347
352
  result = true;
348
- this.previewFile(file, e.target);
353
+ this.previewFile(file, previewDiv);
349
354
  }
350
355
  }
351
356
 
@@ -364,17 +369,17 @@
364
369
  var fileInput = document.getElementById(options['fileInput']);
365
370
  options['editor'] = input;
366
371
  options['fileInput'] = fileInput;
367
- var inlineattach = new InputAttachment(options);
372
+ var inlineAttach = new InputAttachment(options);
368
373
 
369
374
  if (input) {
370
375
  input.addEventListener('paste', function(e) {
371
- inlineattach.onPaste(e);
376
+ inlineAttach.onPaste(e);
372
377
  }, false);
373
378
 
374
379
  input.addEventListener('drop', function(e) {
375
380
  e.stopPropagation();
376
381
  e.preventDefault();
377
- inlineattach.onDrop(e);
382
+ inlineAttach.onDrop(e);
378
383
  }, false);
379
384
 
380
385
  input.addEventListener('dragenter', function(e) {
@@ -389,11 +394,11 @@
389
394
  }
390
395
  if (fileInput) {
391
396
  fileInput.addEventListener('click', function(e) {
392
- inlineattach.onFileInputClick(e)
397
+ inlineAttach.onFileInputClick(e)
393
398
  }, false);
394
399
 
395
400
  fileInput.addEventListener('change', function(e) {
396
- inlineattach.onFileInputChange(e)
401
+ inlineAttach.onFileInputChange(e)
397
402
  }, false);
398
403
  }
399
404
  }
@@ -402,11 +407,11 @@
402
407
  options = options || {};
403
408
  var fileInput = document.getElementById(options['fileInput']);
404
409
  options['fileInput'] = fileInput;
405
- var inlineattach = new InputAttachment(options);
410
+ var inlineAttach = new InputAttachment(options);
406
411
 
407
412
  if (fileInput) {
408
413
  fileInput.addEventListener('change', function(e) {
409
- inlineattach.imagePreview(e)
414
+ inlineAttach.imagePreview(e, options['previewDiv'])
410
415
  }, false);
411
416
  }
412
417
  }
@@ -6,15 +6,26 @@ function fetch_xhr_script(url, params){
6
6
  'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
7
7
  }
8
8
  };
9
- var _params = Object.assign(default_params, params)
9
+ var _params = Object.assign(default_params, params);
10
10
 
11
11
  fetch(url, _params).then(function(response) {
12
12
  return response.text();
13
13
  }).then(function(text) {
14
14
  var script = document.createElement('script');
15
+ script.setAttribute('nonce', Rails.cspNonce());
15
16
  script.text = text;
16
17
  document.head.appendChild(script).parentNode.removeChild(script);
17
18
  }).catch(function(ex) {
18
19
  console.log('parsing failed', ex);
19
20
  })
20
- }
21
+ }
22
+
23
+ function remote_js_load(paths) {
24
+ for (i = 0; i < paths.length; i++) {
25
+ Rails.ajax({
26
+ url: paths[i],
27
+ type: 'GET',
28
+ dataType: 'script'
29
+ })
30
+ }
31
+ }
@@ -1,3 +1,9 @@
1
1
  $('.message .close').on('click', function() {
2
2
  $(this).closest('.message').fadeOut();
3
- });
3
+ });
4
+ $('.ui.toggle.checkbox').checkbox();
5
+ document.querySelectorAll('input[data-submit="true"]').forEach(function (el) {
6
+ el.addEventListener('change', function () {
7
+ this.dataset['params'] = this.name + '=' + this.checked;
8
+ });
9
+ });
@@ -1,4 +1,5 @@
1
1
  //= require ./attachment
2
+ //= require stimulus
2
3
 
3
4
  class PictureController extends Stimulus.Controller {
4
5
  greet() {
@@ -0,0 +1,10 @@
1
+ //= require moment
2
+ function timeForLocalized(){
3
+ $('time[data-localized!="true"]').each(function(){
4
+ if (this.textContent.length > 0) {
5
+ var format = this.dataset['format'] || 'YYYY-MM-DD HH:mm:ss';
6
+ this.textContent = moment.utc(this.textContent).local().format(format);
7
+ this.dataset['localized'] = 'true'
8
+ }
9
+ })
10
+ }
@@ -47,7 +47,8 @@ class ActiveStorageExt::Admin::BlobDefaultsController < ActiveStorageExt::Admin:
47
47
  params.fetch(:blob_default, {}).permit(
48
48
  :record_class,
49
49
  :name,
50
- :file
50
+ :file,
51
+ :private
51
52
  )
52
53
  end
53
54
 
@@ -4,47 +4,57 @@ module RailsCommonApi
4
4
  included do
5
5
  rescue_from 'StandardError' do |exp|
6
6
  puts nil, exp.full_message(highlight: true, order: :top)
7
- render json: { code: 500, error: { class: exp.class.inspect }, message: exp.message }, status: 500
7
+ render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 500
8
8
  end
9
9
 
10
10
  rescue_from 'ActiveRecord::RecordNotFound' do |exp|
11
11
  puts nil, exp.full_message(highlight: true, order: :top)
12
- render json: { code: 404, error: { class: exp.class.inspect }, message: exp.message }, status: 404
12
+ render json: { error: { class: exp.class.inspect, id: exp.id }, message: exp.message }, status: 404
13
+ end
14
+
15
+ rescue_from 'AbstractController::ActionNotFound', 'ActionController::RoutingError' do |exp|
16
+ puts nil, exp.full_message(highlight: true, order: :top)
17
+ render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 404
13
18
  end
14
19
 
15
20
  rescue_from 'ActionController::ForbiddenError' do |exp|
16
21
  puts nil, exp.full_message(highlight: true, order: :top)
17
- render json: { code: 403, error: { class: exp.class.inspect }, message: exp.message }, status: 403
22
+ render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 403
18
23
  end
19
24
 
20
25
  rescue_from 'ActionController::UnauthorizedError' do |exp|
21
26
  puts nil, exp.full_message(highlight: true, order: :top)
22
- render json: { code: 401, error: { class: exp.class.inspect }, message: exp.message }, status: 401
27
+ render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 401
23
28
  end
24
29
 
25
30
  rescue_from 'ActionController::ParameterMissing' do |exp|
26
31
  puts nil, exp.full_message(highlight: true, order: :top)
27
- render json: { code: 400, error: { class: exp.class.inspect }, message: exp.message }, status: 400
32
+ render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 400
28
33
  end
34
+ before_action :set_locale
29
35
  end
30
36
 
31
37
  def process_errors(model)
32
38
  render json: {
33
- code: 406,
34
39
  error: model.errors.as_json(full_messages: true),
35
40
  message: model.errors.full_messages.join("\n")
36
- }, status: 200
41
+ }, status: :bad_request
37
42
  end
38
43
 
39
- def render *args
40
- options = args.extract_options!
41
-
42
- if options[:json]
43
- options[:json].merge! code: 200
44
+ # Accept-Language: "en,zh-CN;q=0.9,zh;q=0.8,en-US;q=0.7,zh-TW;q=0.6"
45
+ def set_locale
46
+ request_locales = request.headers['Accept-Language'].to_s.split(',')
47
+ available_locales = I18n.available_locales.map(&:to_s)
48
+ locale = (available_locales & request_locales)[0]
49
+ unless locale.present?
50
+ locale = request_locales.first.to_s.split('-').first
44
51
  end
45
-
46
- args << options
47
- super *args
52
+ locale ||= I18n.default_locale
53
+ I18n.locale = locale
54
+ if current_user && current_user.locale.to_s != I18n.locale.to_s
55
+ current_user.update locale: I18n.locale
56
+ end
57
+ logger.debug " ==========> Locale: #{I18n.locale}"
48
58
  end
49
59
 
50
60
  end
@@ -0,0 +1,46 @@
1
+ module RailsCommonController
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action :set_locale,
6
+ :set_timezone
7
+ end
8
+
9
+ def set_timezone
10
+ if session[:zone]
11
+ Time.zone = session[:zone]
12
+ elsif request.headers['HTTP_UTC_OFFSET'].present?
13
+ zone = -(request.headers['HTTP_UTC_OFFSET'].to_i / 60)
14
+ Time.zone = zone
15
+ session[:zone] = zone
16
+ end
17
+
18
+ if current_user && current_user.timezone.blank?
19
+ current_user.update timezone: Time.zone.name
20
+ end
21
+ logger.debug " ==========> Zone: #{Time.zone}"
22
+ end
23
+
24
+ def set_locale
25
+ if params[:locale]
26
+ session[:locale] = params[:locale]
27
+ end
28
+
29
+ I18n.locale = session[:locale] || I18n.default_locale
30
+ if current_user && current_user.locale.to_s != session[:locale].to_s
31
+ current_user.update locale: session[:locale]
32
+ end
33
+ logger.debug " ==========> Locale: #{I18n.locale}"
34
+ end
35
+
36
+ def set_country
37
+ if params[:country]
38
+ session[:country] = params[:country]
39
+ elsif current_user
40
+ session[:country] = current_user.country
41
+ end
42
+
43
+ logger.debug " ==========> Country: #{session[:country]}"
44
+ end
45
+
46
+ end
@@ -3,32 +3,44 @@ module RailsCom::AssetsHelper
3
3
 
4
4
  # Assets path: app/assets/javascripts/controllers
5
5
  # Packs Path: app/javascript/packs/javascripts
6
- def js_load(**options)
6
+ def origin_js_load(**options)
7
7
  ext = ['.js', '.js.erb'] + Array(options.delete(:ext))
8
8
  suffix = options.delete(:suffix)
9
9
 
10
10
  asset_filename = "controllers/#{controller_path}/#{action_name}"
11
- if suffix
12
- asset_filename += ['.', suffix].join
13
- end
14
- asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/javascripts', ext: ext)
11
+ pack_filename = "javascripts/#{controller_path}/#{action_name}"
15
12
 
16
- pack_filename ||= "javascripts/#{controller_path}/#{action_name}"
17
13
  if suffix
18
- pack_filename += ['-', suffix].join
14
+ asset_filename = [asset_filename, '-', suffix].join
15
+ pack_filename = [pack_filename, '-', suffix].join
19
16
  end
20
- pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext)
17
+
18
+ asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/javascripts', ext: ext, suffix: suffix)
19
+ pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext, suffix: suffix)
21
20
 
22
21
  r = []
22
+ ar = []
23
23
  if asset_paths.any? { |path| File.exist?(path) }
24
24
  r << javascript_include_tag(asset_filename, options)
25
+ ar << javascript_path(asset_filename)
25
26
  end
26
27
 
27
28
  if pack_paths.any? { |path| File.exist?(path) }
28
29
  r << javascript_pack_tag(pack_filename, options)
30
+ ar << asset_pack_path(pack_filename + '.js')
29
31
  end
30
32
 
31
- r.join("\n ").html_safe
33
+ [r.join("\n ").html_safe, ar]
34
+ end
35
+
36
+ def js_load(**options)
37
+ r, _ = origin_js_load(options)
38
+ r
39
+ end
40
+
41
+ def remote_js_load(**options)
42
+ _, r = origin_js_load(options)
43
+ r
32
44
  end
33
45
 
34
46
  def js_ready(**options)
@@ -39,12 +51,18 @@ module RailsCom::AssetsHelper
39
51
  # Packs Path: app/javascript/packs/stylesheets
40
52
  def css_load(**options)
41
53
  ext = ['.css', '.css.erb'] + Array(options.delete(:ext))
54
+ suffix = options.delete(:suffix)
42
55
 
43
56
  asset_filename = "controllers/#{controller_path}/#{action_name}"
44
- asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/stylesheets', ext: ext )
45
-
46
57
  pack_filename = "stylesheets/#{controller_path}/#{action_name}"
47
- pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext)
58
+
59
+ if suffix
60
+ asset_filename = [asset_filename, '-', suffix].join
61
+ pack_filename = [pack_filename, '-', suffix].join
62
+ end
63
+
64
+ asset_paths = assets_load_path(asset_filename, relative_path: 'app/assets/stylesheets', ext: ext, suffix: suffix)
65
+ pack_paths = assets_load_path(pack_filename, relative_path: 'app/javascript/packs', ext: ext, suffix: suffix)
48
66
 
49
67
  r = []
50
68
  if asset_paths.any? { |path| File.exist?(path) }
@@ -52,7 +70,7 @@ module RailsCom::AssetsHelper
52
70
  end
53
71
 
54
72
  if pack_paths.any? { |path| File.exist?(path) }
55
-
73
+
56
74
  begin
57
75
  rs = stylesheet_pack_tag(pack_filename, options)
58
76
  rescue
@@ -70,7 +88,7 @@ module RailsCom::AssetsHelper
70
88
  end
71
89
 
72
90
  private
73
- def assets_load_path(filename, relative_path:, ext:)
91
+ def assets_load_path(filename, relative_path:, ext:, suffix: nil)
74
92
  paths = []
75
93
 
76
94
  file_path = Pathname.new(relative_path).join filename