shopapp 0.76.06 → 0.77.07

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: dafbd7799d470d9bbcf24578dd097c933200c58ec83b90956848d01d78f8164b
4
- data.tar.gz: f036cfd03a0635e3b902c3ab30c251e6e19212bde4c6d2617e07aa83236c5a27
3
+ metadata.gz: 9802f951ba4ef09c8d2cd5b41eb4096216831f14862a0e4929329d84d95a90c9
4
+ data.tar.gz: '04863306ac254d2ee9f96c7fa2738fcbc63c6c4582a2bcfb4e1635f8fe2abc86'
5
5
  SHA512:
6
- metadata.gz: 620e14e52aa49411808b5881eab11911af70ddcb6a82a9b34aa92119385d117f60516dd825a4c91dd682da522a06fb1cb41ab0c637dcc194247982d8bd2e503b
7
- data.tar.gz: b7ff9262caa5a86cf1ef85a959f16a23a592a2799a74810c1bd209d8394bfc5bceb0497e565ee7cf3ceb8ff45518f289d0853f3d123d4b63273773a87574a1a9
6
+ metadata.gz: 47031f63b195a44c07395d327763107da293eb7d67eb92158547ae71468400eff724aa649eae0fa844e5643348b09fd961fa808b6a685dff883475d841d666b7
7
+ data.tar.gz: 9964525e49da455a91148b6b8930c1c0ce86ac9865536a9d08c59f12b1ddb300d9102f11b255a1d79b2e8ef7bcf18b20ee179df507f14173cd370f1fbd515623
data/README.md CHANGED
@@ -95,4 +95,4 @@ shopapp to support i18n, add two methods to your ApplicationController:
95
95
 
96
96
  To build new version of this gem, change the version in shopapp.gemspec and run:
97
97
 
98
- gem build shopapp.gemspec ; gem push shopapp-0.76.06.gem; gem install shopapp
98
+ gem build shopapp.gemspec ; gem push shopapp-0.77.07.gem; gem install shopapp
@@ -25,22 +25,35 @@ module RemoteRequestManager
25
25
  if error.instance_of?(ActiveRecord::RecordInvalid)
26
26
  respond_to_js(error.record.errors.messages)
27
27
  else
28
- respond_to_js(error)
28
+ respond_to_js(error.message)
29
29
  end
30
30
  end
31
31
 
32
32
  private
33
33
 
34
34
  def respond_to_js(error_message)
35
- flash.now[:danger] = error_message
36
- respond_to do |format|
37
- format.js do
38
- render PATH_TO_JS_FILE, locals: { flash: flash }
39
- end
40
- end
35
+ Rails.logger.debug "Request format: #{request.format}"
36
+ flash.now[:danger] = format_error_message(error_message)
37
+ render PATH_TO_JS_FILE, locals: { flash: flash }
38
+ # respond_to do |format|
39
+ # format.js do
40
+ # render PATH_TO_JS_FILE, locals: { flash: flash }
41
+ # end
42
+ # end
41
43
  end
42
44
 
43
45
  def redirect_path(args)
44
46
  args[:to].presence || request.referer || root_path
45
47
  end
48
+
49
+ def format_error_message(message)
50
+ case message
51
+ when Array
52
+ message.join(", ")
53
+ when Hash
54
+ message.map { |k, v| "#{k}: #{v.join(', ')}" }.join("; ")
55
+ else
56
+ message.to_s
57
+ end
58
+ end
46
59
  end
@@ -8,7 +8,7 @@ module EuroHelper
8
8
  end
9
9
 
10
10
  def mdi_tag(name = nil, included_classes: '', size: 16, icon: 'highlight_off', **other_named_params)
11
- if name.match?(/^([\w\-\_]+)( (\d\d)px)?$/) && size == 16 && icon == 'highlight_off'
11
+ if icon == 'highlight_off' && name.to_s.match?(/^([\w\-\_]+)( (\d\d)px)?$/) && size == 16
12
12
  results = name.match(/^([\w\-\_]+)( (\d\d)px)?$/)
13
13
  icon = results[1]
14
14
  size = results[3].to_i if results[3].present?
@@ -23,4 +23,21 @@ module EuroHelper
23
23
 
24
24
  "<i class=\"material-icons md-#{size} #{name} #{included_classes}\" #{other_actions}>#{icon}</i>".html_safe
25
25
  end
26
+
27
+ def mdi_tag(name = nil, included_classes: '', size: 16, icon: 'highlight_off', **other_named_params)
28
+ if name.to_s.match?(/^([\w\-\_]+)( (\d\d)px)?$/) && size == 16 && icon == 'highlight_off'
29
+ results = name.to_s.match(/^([\w\-\_]+)( (\d\d)px)?$/)
30
+ icon = results[1]
31
+ size = results[3].to_i if results[3].present?
32
+ end
33
+
34
+ included_classes += " " + other_named_params[:class] if other_named_params[:class].present?
35
+ other_actions = other_named_params.except(:class).keys.map { |key| "#{key}=\"#{other_named_params[key]}\"" }.join(' ')
36
+
37
+ icon = 'edit' if icon == 'stylus'
38
+ icon = 'person_add' if icon == 'account-plus-outline'
39
+ icon = 'earth' if icon == 'language'
40
+
41
+ "<i class=\"material-icons md-#{size} #{name} #{included_classes}\" #{other_actions}>#{icon}</i>".html_safe
42
+ end
26
43
  end
@@ -1,5 +1,6 @@
1
- $(".modal-errors").html(
2
- "<%= escape_javascript(render partial: 'shopapp/modal_errors',
3
- locals: { flash: flash })
4
- %>"
5
- );
1
+ <% if flash.any? %>
2
+ $(".modal-errors").html("<%= escape_javascript(render partial: 'shopapp/modal_errors', locals: { flash: flash }) %>");
3
+ $(".modal-errors").show();
4
+ <% else %>
5
+ $(".modal-errors").hide();
6
+ <% end %>
data/shopapp.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'shopapp'
3
3
  # Version for Rails 7 / Ruby 3 start with 0.74
4
- s.version = '0.76.06'
5
- s.date = '2024-07-12'
4
+ s.version = '0.77.07'
5
+ s.date = '2024-08-13'
6
6
  s.summary = 'Do a shoplift.'
7
7
  s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
8
8
  I am qualmish at the smell of leek.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.76.06
4
+ version: 0.77.07
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-12 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml-rails