brick 1.0.118 → 1.0.119
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/extensions.rb +3 -2
- data/lib/brick/frameworks/rails/engine.rb +37 -5
- data/lib/brick/version_number.rb +1 -1
- 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: 6dfec2ebe501c46c17a7466bd98a9fb510ce6676f74c9b914da52e789e279036
|
4
|
+
data.tar.gz: 803598a5b59f73e81ed94079dd2b7dd55328c5c12de6d6968937b6518b68cef7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1618ef1ff14f0198d45aa0aafc5ee9e0272c82a886b0129e14cfe6c47fea1cbb55c76f32cf2a98eb93915c68a62275ad53e5ab32621da45b9a7397e2d1f95f3f
|
7
|
+
data.tar.gz: f34063a9ebc164bf352d96b1149f1ed501a351c3e786219a29593be13359162c9bb140cf822d9ce1494be9ea43b655afb0422008d6fcc64f59ee7050a1e84072
|
data/lib/brick/extensions.rb
CHANGED
@@ -1846,11 +1846,12 @@ class Object
|
|
1846
1846
|
|
1847
1847
|
instance_variable_set("@#{singular_table_name}".to_sym, (obj = find_obj))
|
1848
1848
|
upd_params = send(params_name_sym)
|
1849
|
-
|
1849
|
+
json_overrides = ::Brick.config.json_columns&.fetch(table_name, nil)
|
1850
|
+
if (json_cols = model.columns.select { |c| c.type == :json || json_overrides&.include?(c.name) }.map(&:name)).present?
|
1850
1851
|
upd_hash = upd_params.to_h
|
1851
1852
|
json_cols.each do |c|
|
1852
1853
|
begin
|
1853
|
-
upd_hash[c] = JSON.parse(upd_hash[c])
|
1854
|
+
upd_hash[c] = JSON.parse(upd_hash[c].tr('`', '"').gsub('^^br_btick__', '`'))
|
1854
1855
|
rescue
|
1855
1856
|
end
|
1856
1857
|
end
|
@@ -186,6 +186,21 @@ function linkSchemas() {
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
# class Fields::TextField
|
190
|
+
# alias _original_initialize initialize
|
191
|
+
# def initialize(id, **args, &block)
|
192
|
+
# if instance_of?(::Avo::Fields::TextField) || instance_of?(::Avo::Fields::TextareaField)
|
193
|
+
# args[:format_using] ||= ->(value) do
|
194
|
+
# if value.is_a?(String) && value.encoding != Encoding::UTF_8
|
195
|
+
# value = value.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "?")
|
196
|
+
# end
|
197
|
+
# value
|
198
|
+
# end
|
199
|
+
# end
|
200
|
+
# _original_initialize(id, **args, &block)
|
201
|
+
# end
|
202
|
+
# end
|
203
|
+
|
189
204
|
class App
|
190
205
|
class << self
|
191
206
|
alias _brick_eager_load eager_load
|
@@ -451,6 +466,13 @@ window.addEventListener(\"popstate\", linkSchemas);
|
|
451
466
|
end
|
452
467
|
end
|
453
468
|
|
469
|
+
# Spina compatibility
|
470
|
+
if Object.const_defined?('Spina')
|
471
|
+
# Add JSON fields
|
472
|
+
(::Brick.config.json_columns['spina_accounts'] ||= []) << 'json_attributes' if ::Spina.const_defined?('Account')
|
473
|
+
(::Brick.config.json_columns['spina_pages'] ||= []) << 'json_attributes' if ::Spina.const_defined?('Page')
|
474
|
+
end
|
475
|
+
|
454
476
|
# ====================================
|
455
477
|
# Dynamically create generic templates
|
456
478
|
# ====================================
|
@@ -1551,8 +1573,11 @@ end
|
|
1551
1573
|
# path_options << { '_brick_schema': } if
|
1552
1574
|
# url = send(:#\{model._brick_index(:singular)}_path, obj.#{pk})
|
1553
1575
|
options = {}
|
1554
|
-
|
1555
|
-
|
1576
|
+
if ::Brick.config.path_prefix
|
1577
|
+
path_helper = obj.new_record? ? #{model_name}._brick_index : #{model_name}._brick_index(:singular)
|
1578
|
+
options[:url] = send(\"#\{path_helper}_path\".to_sym, obj)
|
1579
|
+
end
|
1580
|
+
%>
|
1556
1581
|
<br><br>
|
1557
1582
|
<%= form_for(obj.becomes(#{model_name}), options) do |f| %>
|
1558
1583
|
<table class=\"shadow\">
|
@@ -1666,10 +1691,17 @@ end
|
|
1666
1691
|
<% when :primary_key
|
1667
1692
|
is_revert = false %>
|
1668
1693
|
<% when :json
|
1669
|
-
is_includes_json = true
|
1694
|
+
is_includes_json = true
|
1695
|
+
if val.is_a?(String)
|
1696
|
+
val_str = val
|
1697
|
+
else
|
1698
|
+
eheij = ActiveSupport::JSON::Encoding.escape_html_entities_in_json
|
1699
|
+
ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false if eheij
|
1700
|
+
val_str = val.to_json
|
1701
|
+
ActiveSupport::JSON::Encoding.escape_html_entities_in_json = eheij
|
1702
|
+
end %>
|
1670
1703
|
<%= # Because there are so danged many quotes in JSON, escape them specially by converting to backticks.
|
1671
1704
|
# (and previous to this, escape backticks with our own goofy code of ^^br_btick__ )
|
1672
|
-
val_str = val.is_a?(String) ? val : val.to_json # Clean up bogus JSON if necessary
|
1673
1705
|
json_field = f.hidden_field k.to_sym, { class: 'jsonpicker', value: val_str.gsub('`', '^^br_btick__').tr('\"', '`').html_safe } %>
|
1674
1706
|
<div id=\"_br_json_<%= f.field_id(k) %>\"></div>
|
1675
1707
|
<% else %>
|
@@ -1797,7 +1829,7 @@ flatpickr(\".timepicker\", {enableTime: true, noCalendar: true});
|
|
1797
1829
|
onChange: (function (inp2) {
|
1798
1830
|
return function (updatedContent, previousContent, contentErrors, patchResult) {
|
1799
1831
|
// console.log('onChange', updatedContent.json, updatedContent.text);
|
1800
|
-
inp2.value = updatedContent.text || JSON.stringify(updatedContent.json);
|
1832
|
+
inp2.value = (updatedContent.text || JSON.stringify(updatedContent.json)).replace(/`/g, \"\\^\\^br_btick__\").replace(/\"/g, '`');
|
1801
1833
|
};
|
1802
1834
|
})(inp)
|
1803
1835
|
}
|
data/lib/brick/version_number.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.119
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|