shopapp 0.76.05 → 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: ba66cce2f3541a827ff4526b546b0017141951403102b28ae052457acd6b2151
4
- data.tar.gz: 68c7bf6f0c79d30ef16aa34b835be5ea208671cd82696caefee1b71436a5869e
3
+ metadata.gz: 9802f951ba4ef09c8d2cd5b41eb4096216831f14862a0e4929329d84d95a90c9
4
+ data.tar.gz: '04863306ac254d2ee9f96c7fa2738fcbc63c6c4582a2bcfb4e1635f8fe2abc86'
5
5
  SHA512:
6
- metadata.gz: faf94e28764653181b8991cf1588a5411075b13e7bbed9490ec6e265af622fb33f811a7198be5fe1068252f12a7cd3a84bdfff5d9b5641e2c6622c9290db1860
7
- data.tar.gz: c9a6e23f79d9c85763bbfcd00573dc0ef92185205af2fa11afc517cd4f9a1acc5add7bf154db9276755b8f86d232a84618245d58ab50313c07db55827582679b
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.05.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
@@ -7,9 +7,7 @@
7
7
  -# %link{:href => "https://fonts.googleapis.com/css?family=Fira+Sans:400,500,700", :rel => "stylesheet"}/
8
8
  = csrf_meta_tags
9
9
  = stylesheet_link_tag 'application', media: 'all'
10
- - fail "please check shopapp/app/views/login_message.haml"
11
10
  = javascript_importmap_tags
12
- = javascript_include_tag 'application', type: "module"
13
11
  = shopapp3_favicon
14
12
  %body.bg-light
15
13
  .row.justify-content-center
@@ -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.05'
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.05
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