brick 1.0.36 → 1.0.37
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/lib/brick/frameworks/rails/engine.rb +56 -13
- 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: '0178c8135edf190cf65ae2a4b274bde10cc5410f33adab7337798d98636f810f'
|
4
|
+
data.tar.gz: c4c51e9e22548f9f49a08a7550eb003c0075b65bac70fffea82b919b7aa07131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6ad8492e3b19f526af3cc69f53f30e3a4de0f172f73362d36f6dbac884f7137bb7a3944f99054f61279c2fdc27989e9b840e68cb48c23aa378f6ac4bd4d2cfb
|
7
|
+
data.tar.gz: def025f413aa8c89f8f603f4e3422427f9d71b10b7c57c0db6d5fb750b0e26352dc88f3d85f01b526127d54a789e6b056dc7acee64e9046909a039e576421587
|
@@ -141,9 +141,14 @@ module Brick
|
|
141
141
|
display: none;
|
142
142
|
}
|
143
143
|
|
144
|
+
#headerTop {
|
145
|
+
position: sticky;
|
146
|
+
top: 0px;
|
147
|
+
background-color: white;
|
148
|
+
z-index: 1;
|
149
|
+
}
|
144
150
|
table {
|
145
151
|
border-collapse: collapse;
|
146
|
-
margin: 25px 0;
|
147
152
|
font-size: 0.9em;
|
148
153
|
font-family: sans-serif;
|
149
154
|
min-width: 400px;
|
@@ -255,6 +260,7 @@ end %>"
|
|
255
260
|
var schemaSelect = document.getElementById(\"schema\");
|
256
261
|
var tblSelect = document.getElementById(\"tbl\");
|
257
262
|
var brickSchema;
|
263
|
+
var #{table_name}HtColumns;
|
258
264
|
|
259
265
|
// This PageTransitionEvent fires when the page first loads, as well as after any other history
|
260
266
|
// transition such as when using the browser's Back and Forward buttons.
|
@@ -316,6 +322,42 @@ function changeout(href, param, value, trimAfter) {
|
|
316
322
|
params[param] = value;
|
317
323
|
return hrefParts[0] + \"?\" + Object.keys(params).reduce(function (s, v) { s.push(v + \"=\" + params[v]); return s; }, []).join(\"&\");
|
318
324
|
}
|
325
|
+
|
326
|
+
// Snag first TR for sticky header
|
327
|
+
var grid = document.getElementById(\"#{table_name}\");
|
328
|
+
#{table_name}HtColumns = grid && [grid.getElementsByTagName(\"TR\")[0]];
|
329
|
+
var headerTop = document.getElementById(\"headerTop\");
|
330
|
+
function setHeaderSizes() {
|
331
|
+
// console.log(\"start\");
|
332
|
+
// See if the headerTop is already populated
|
333
|
+
// %%% Grab the TRs from headerTop, clear it out, do this stuff, add them back
|
334
|
+
headerTop.innerHTML = \"\"; // %%% Would love to not have to clear it out like this every time! (Currently doing this to support resize events.)
|
335
|
+
var isEmpty = headerTop.childElementCount === 0;
|
336
|
+
// Set up proper sizings of sticky column header
|
337
|
+
var node;
|
338
|
+
for (var j = 0; j < #{table_name}HtColumns.length; ++j) {
|
339
|
+
var row = #{table_name}HtColumns[j];
|
340
|
+
var tr = isEmpty ? document.createElement(\"TR\") : headerTop.childNodes[j];
|
341
|
+
tr.innerHTML = row.innerHTML.trim();
|
342
|
+
// Match up widths from the original column headers
|
343
|
+
for (var i = 0; i < row.childNodes.length; ++i) {
|
344
|
+
node = row.childNodes[i];
|
345
|
+
if (node.nodeType === 1) {
|
346
|
+
var style = tr.childNodes[i].style;
|
347
|
+
style.minWidth = style.maxWidth = getComputedStyle(node).width;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
if (isEmpty) headerTop.appendChild(tr);
|
351
|
+
}
|
352
|
+
grid.style.marginTop = \"-\" + getComputedStyle(headerTop).height;
|
353
|
+
// console.log(\"end\");
|
354
|
+
}
|
355
|
+
if (headerTop) {
|
356
|
+
setHeaderSizes();
|
357
|
+
window.addEventListener('resize', function(event) {
|
358
|
+
setHeaderSizes();
|
359
|
+
}, true);
|
360
|
+
}
|
319
361
|
</script>"
|
320
362
|
inline = case args.first
|
321
363
|
when 'index'
|
@@ -415,7 +457,7 @@ function changeout(href, param, value, trimAfter) {
|
|
415
457
|
end
|
416
458
|
# %%% Instead of our current "for Janet Leverling (Employee)" kind of link we previously had this code that did a "where x = 123" thing:
|
417
459
|
# (where <%= @_brick_params.each_with_object([]) { |v, s| s << \"#\{v.first\} = #\{v.last.inspect\}\" }.join(', ') %>)
|
418
|
-
|
460
|
+
"#{css}
|
419
461
|
<p style=\"color: green\"><%= notice %></p>#{"
|
420
462
|
<select id=\"schema\">#{schema_options}</select>" if ::Brick.config.schema_behavior[:multitenant] && ::Brick.db_schemas.length > 1}
|
421
463
|
<select id=\"tbl\">#{table_options}</select>
|
@@ -435,16 +477,18 @@ x = "#{css}
|
|
435
477
|
end %>
|
436
478
|
(<%= link_to 'See all #{model_plural.split('::').last}', #{path_obj_name.pluralize}_path %>)
|
437
479
|
<% end %>
|
480
|
+
<br>
|
481
|
+
<table id=\"headerTop\">
|
438
482
|
<table id=\"#{table_name}\">
|
439
|
-
<thead><tr>#{'<th></th>' if pk.present?}
|
440
|
-
|
483
|
+
<thead><tr>#{'<th></th>' if pk.present?}<%
|
484
|
+
col_order = []
|
441
485
|
@#{table_name}.columns.each do |col|
|
442
486
|
col_name = col.name
|
443
487
|
next if (#{(pk || []).inspect}.include?(col_name) && col.type == :integer && !bts.key?(col_name)) ||
|
444
488
|
::Brick.config.metadata_columns.include?(col_name) || poly_cols.include?(col_name)
|
445
489
|
|
446
|
-
col_order << col_name
|
447
|
-
|
490
|
+
col_order << col_name
|
491
|
+
%><th<%= \" title = \\\"#\{col.comment}\\\"\".html_safe unless col.comment.blank? %>><%
|
448
492
|
if (bt = bts[col_name]) %>
|
449
493
|
BT <%
|
450
494
|
bt[1].each do |bt_pair| %><%=
|
@@ -453,11 +497,11 @@ x = "#{css}
|
|
453
497
|
else %><%=
|
454
498
|
col_name %><%
|
455
499
|
end
|
456
|
-
%></th
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
</tr></thead>
|
500
|
+
%></th><%
|
501
|
+
end
|
502
|
+
# Consider getting the name from the association -- h.first.name -- if a more \"friendly\" alias should be used for a screwy table name
|
503
|
+
%>#{hms_headers.map { |h| "<th>#{h[1]} <%= link_to('#{h[2]}', #{h.first.klass.name.underscore.tr('/', '_').pluralize}_path) %></th>" }.join
|
504
|
+
}</tr></thead>
|
461
505
|
|
462
506
|
<tbody>
|
463
507
|
<% @#{table_name}.each do |#{obj_name}| %>
|
@@ -495,8 +539,6 @@ x = "#{css}
|
|
495
539
|
|
496
540
|
#{"<hr><%= link_to \"New #{obj_name}\", new_#{path_obj_name}_path %>" unless @_brick_model.is_view?}
|
497
541
|
#{script}"
|
498
|
-
puts x
|
499
|
-
x
|
500
542
|
when 'show', 'update'
|
501
543
|
"#{css}
|
502
544
|
<p style=\"color: green\"><%= notice %></p>#{"
|
@@ -508,6 +550,7 @@ if (relation = Brick.relations[#{model_name}.table_name])[:description] %><%=
|
|
508
550
|
end
|
509
551
|
%><%= link_to '(See all #{obj_name.pluralize})', #{path_obj_name.pluralize}_path %>
|
510
552
|
<% if obj %>
|
553
|
+
<br><br>
|
511
554
|
<%= # path_options = [obj.#{pk}]
|
512
555
|
# path_options << { '_brick_schema': } if
|
513
556
|
# url = send(:#{model_name.underscore}_path, obj.#{pk})
|
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.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|