spree_mobility 1.1.0 → 1.2.0

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: 30f3cdb07e980914cb9e50dc2ac6f2ece8ab75547b12f811e772bfacb06a0942
4
- data.tar.gz: 2d4091a9e0399685cdfbab7f3df2c7067f567a32d133eb94f41d473caf9efbf4
3
+ metadata.gz: 47c7d870ccec1b09bab4ed9a685bcaee8ba979f0d3fc73aeda5efed47d9793b5
4
+ data.tar.gz: 1846c0f5c3dc91fd624195f4735cc07b1427aa69458e1df7dca21fc77142e0c3
5
5
  SHA512:
6
- metadata.gz: ddd330d66753f527b3f705a0957389f3f8b2cda6f410acfd3faa9e120a45583c98969f352fee5a4b9e44972c10bf6d42ff31ef03a5b42973330beeb0f3832913
7
- data.tar.gz: cabd47580f96da77e9dc017f421a2b56f47f70e8e46f074569b3900afeb961a77118cbaa68d3ab0f11416e3e0ae6c3a96f035fc7e39441053712308bc7f77bc8
6
+ metadata.gz: 7e7e2ae4f8f9144bdb863bdffe892a655159bf911917e519007f85918534c9791466951157127847941e48e141af539a1b902dbbfdbdee1119742f15cdcc58ff
7
+ data.tar.gz: 5386ecc2b8d96cbda9e898f4d7d5732a708782fd8df8eba4ef1a6f6ede0d714155b1b6647fa7954b31ce8628171d8121f12d8fcf0fb7ed95925100e6f85ddccd
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2015 Spree Commerce Inc., and other contributors.
1
+ Copyright (c) 2022 mrbrdo, Spree Commerce Inc., and other contributors.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -16,9 +16,9 @@
16
16
  <div class="panel-body">
17
17
  <% field_type = @resource.class.translation_class.columns_hash[attr.to_s].type %>
18
18
  <% if @resource.kind_of?(Spree::Product) && attr.to_sym == :description %>
19
- <%= g.text_area :description, { rows: "30", class: "form-control #{"spree-rte" if Spree::Config[:product_wysiwyg_editor_enabled] }" } %>
19
+ <%= g.text_area :description, { rows: "30", class: "form-control #{"spree-rte" if SpreeMobility.product_wysiwyg_editor_enabled? }" } %>
20
20
  <% elsif @resource.kind_of?(Spree::Taxon) && attr.to_sym == :description %>
21
- <%= g.text_area :description, { rows: "30", class: "form-control #{"spree-rte" if Spree::Config[:taxon_wysiwyg_editor_enabled] }" } %>
21
+ <%= g.text_area :description, { rows: "30", class: "form-control #{"spree-rte" if SpreeMobility.taxon_wysiwyg_editor_enabled? }" } %>
22
22
  <% elsif field_type == :text %>
23
23
  <%= g.text_area attr, class: 'form-control', rows: 4 %>
24
24
  <% else %>
@@ -9,7 +9,7 @@ module SpreeMobility
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 1
12
+ MINOR = 2
13
13
  TINY = 0
14
14
  PRE = nil # 'beta'
15
15
 
@@ -9,13 +9,13 @@ module SpreeMobility
9
9
  def self.prepend_once(to_klass, klass)
10
10
  to_klass.prepend(klass) unless to_klass.ancestors.include?(klass)
11
11
  end
12
-
12
+
13
13
  def self.clear_validations_for(klass, *attrs)
14
14
  attrs.each do |attr|
15
15
  klass.validators_on(attr).each { |val| val.attributes.delete(attr) }
16
16
  end
17
17
  end
18
-
18
+
19
19
  def self.translates_for(klass, *attrs)
20
20
  klass.translates(*attrs)
21
21
  klass.accepts_nested_attributes_for :translations
@@ -44,4 +44,20 @@ module SpreeMobility
44
44
  end
45
45
  result
46
46
  end
47
- end
47
+
48
+ def self.product_wysiwyg_editor_enabled?
49
+ spree_backend_config :product_wysiwyg_editor_enabled
50
+ end
51
+
52
+ def self.taxon_wysiwyg_editor_enabled?
53
+ spree_backend_config :taxon_wysiwyg_editor_enabled
54
+ end
55
+
56
+ def self.spree_backend_config(key)
57
+ if defined?(Spree::Backend::Config) && Spree::Backend::Config.has_preference?(key)
58
+ Spree::Backend::Config[key]
59
+ else
60
+ Spree::Config[key]
61
+ end
62
+ end
63
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_mobility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Berdajs