shopapp 0.76.06 → 0.77.07
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 +4 -4
- data/README.md +1 -1
- data/app/controllers/concerns/remote_request_manager.rb +20 -7
- data/app/helpers/euro_helper.rb +18 -1
- data/app/views/shopapp/modal_errors.js.erb +6 -5
- data/shopapp.gemspec +2 -2
- 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: 9802f951ba4ef09c8d2cd5b41eb4096216831f14862a0e4929329d84d95a90c9
|
|
4
|
+
data.tar.gz: '04863306ac254d2ee9f96c7fa2738fcbc63c6c4582a2bcfb4e1635f8fe2abc86'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
data/app/helpers/euro_helper.rb
CHANGED
|
@@ -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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.
|
|
5
|
-
s.date = '2024-
|
|
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.
|
|
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-
|
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: haml-rails
|