active_scaffold 4.0.0.rc2 → 4.0.0.rc3

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: 4bccfcf8d4c225ac40c3065df81306ddd3dd481c730c8154ba9f3c739a5521c0
4
- data.tar.gz: 52eeca24fb5823cb0be1c6e9996ea5cde658902956158177e9175623d018426e
3
+ metadata.gz: 0ce97fc27fd6db228fc8c934c9559a9af750b0e19837c5eb30e6bb868fc108ef
4
+ data.tar.gz: d3568381187bb6ab2fb1245d5588063a09db42057704d0645abd5e04139f2cf2
5
5
  SHA512:
6
- metadata.gz: 06a2c2bf3b3e7f1dc622ec0f7ddb678156d61e6ade22d60ba30bd33c1b9843e310b6e2424af1f016e8bb9b6099926986f7882ebec17190173e69f29372dcdbbc
7
- data.tar.gz: 90641599e80840772a26f2249819474cca3153927c30d20c69980d95343ebfed3fca3c2c599ee935c67859440caf53d59b3c35a47d9cac43bae1156e01f3d8f6
6
+ metadata.gz: 445f89948894b2989ce7f20efb69ce649b1bbd045a124b7c0243e1ea8e4168922a54b901ee653a51fde2ad7b61b3014fa47521d62fa17120ab58671032a7afb4
7
+ data.tar.gz: ab62a6b00a0c403eeaa4bc94c346fa46871350d4b9a5ebcbe7d6d9c63c7e8d8b862f5083ba5c3045ff3ce533ea015e441f8adea9d35c7d6807d876a88202043f
data/CHANGELOG.rdoc CHANGED
@@ -5,7 +5,17 @@
5
5
  - Action links can't be changed, added or removed, add all links and use ignore_method to control when they are displayed
6
6
  - Require using active_scaffold_config.override_columns to exclude or add columns
7
7
  - Thread safety enabled by default, can't be disabled, deprecate ActiveScaffold.threadsafe!
8
+
9
+ = 3.7.11 (not released yet)
10
+ - Add partial list_messages_content to reduce code duplication, and better support replacing list view with other way to render records
11
+ - Support selector for records body in create_record_row JS method, better support replacing list view with other way to render records
12
+ - Improve detection of member action links when list view is replaced with other structure, based on 'record' html class, instead of tags
13
+ - Support :table position for member action links, replacing the whole table
14
+ - Support changing the view partial used to render a record, default to 'list_record', better support refreshing a record when list view is replaced with other way to render records
8
15
  - Support separators in action links
16
+ - Support :popup position, using jquery-ui dialog, but can be replaced with other library overriding ActiveScaffold.open_popup and ActiveScaffold.close_popup JS functions
17
+ - Use column.label in human conditions, same as form
18
+ - Don't overlap 'click to reset' with long human conditions message
9
19
 
10
20
  = 3.7.10
11
21
  - Move code from on_create.js.erb to partials, so it's easier to change parts, e.g. how new record is rendered
@@ -800,7 +800,7 @@
800
800
 
801
801
  create_record_row: function(active_scaffold_id, html, options) {
802
802
  if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
803
- var tbody = jQuery(active_scaffold_id).find('tbody.records').first(), new_row;
803
+ var tbody = jQuery(active_scaffold_id).find(options.body_selector || 'tbody.records').first(), new_row;
804
804
 
805
805
  if (options.insert_at == 'top') {
806
806
  tbody.prepend(html);
@@ -840,10 +840,10 @@
840
840
  });
841
841
  },
842
842
 
843
- delete_record_row: function(row, page_reload_url) {
843
+ delete_record_row: function(row, page_reload_url, body_selector) {
844
844
  if (typeof(row) == 'string') row = '#' + row;
845
845
  row = jQuery(row);
846
- var tbody = row.closest('tbody.records');
846
+ var tbody = row.closest(body_selector || 'tbody.records');
847
847
 
848
848
  row.find('a.disabled').each(function() {;
849
849
  var action_link = ActiveScaffold.ActionLink.get(this);
@@ -1229,8 +1229,21 @@
1229
1229
  $footer.removeClass('floating');
1230
1230
  if ($form.visible(true) && !$footer.visible(true)) $footer.addClass('floating');
1231
1231
  });
1232
- }
1232
+ },
1233
+
1234
+ open_popup: function(content, link) {
1235
+ var element = jQuery(content).dialog({
1236
+ modal: true,
1237
+ close: function() { link.close(); },
1238
+ width: ActiveScaffold.config.popup_width || '80%'
1239
+ });
1240
+ link.set_adapter(element);
1241
+ },
1233
1242
 
1243
+ close_popup: function(link, callback) {
1244
+ link.adapter.dialog('close');
1245
+ if (callback) callback();
1246
+ }
1234
1247
  }
1235
1248
 
1236
1249
 
@@ -1285,18 +1298,15 @@
1285
1298
  if (element.length > 0) {
1286
1299
  element.data(); // $ 1.4.2 workaround
1287
1300
  if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
1288
- var parent = element.closest('.actions');
1289
- if (parent.length === 0 || parent.is('td')) {
1290
- // maybe an column action_link
1291
- parent = element.closest('tr.record');
1292
- }
1293
- if (parent.is('tr')) {
1301
+ var parent = element.closest('.record');
1302
+ if (parent.length === 0) parent = element.closest('.actions');
1303
+ if (parent.is('.record')) {
1294
1304
  // record action
1295
1305
  var target = parent.find('a.as_action');
1296
- var loading_indicator = parent.find('td.actions .loading-indicator');
1306
+ var loading_indicator = parent.find('.actions .loading-indicator');
1297
1307
  if (!loading_indicator.length) loading_indicator = element.parent().find('.loading-indicator');
1298
1308
  new ActiveScaffold.Actions.Record(target, parent, loading_indicator);
1299
- } else if (parent && parent.is('div')) {
1309
+ } else if (parent.is('.active-scaffold-header .actions')) {
1300
1310
  //table action
1301
1311
  new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header').first(), parent.find('.loading-indicator').first());
1302
1312
  }
@@ -1333,14 +1343,18 @@
1333
1343
  },
1334
1344
 
1335
1345
  close: function() {
1336
- if (this.adapter) {
1337
- var link = this;
1338
- ActiveScaffold.remove(this.adapter, function() {
1339
- link.enable();
1340
- if (link.hide_target) link.target.show();
1341
- if (link.hide_content) link.content.show();
1342
- if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(link.target.attr('id'), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
1343
- });
1346
+ var link = this, callback = function() {
1347
+ link.enable();
1348
+ if (link.hide_target) link.target.show();
1349
+ if (link.hide_content) link.content.show();
1350
+ if (ActiveScaffold.config.scroll_on_close) {
1351
+ ActiveScaffold.scroll_to(link.target.attr('id'), ActiveScaffold.config.scroll_on_close === 'checkInViewport');
1352
+ }
1353
+ };
1354
+ if (this.position === 'popup') {
1355
+ ActiveScaffold.close_popup(this, callback);
1356
+ } else if (this.adapter) {
1357
+ ActiveScaffold.remove(this.adapter, callback);
1344
1358
  }
1345
1359
  },
1346
1360
 
@@ -1401,7 +1415,7 @@
1401
1415
  if (refresh) l.refresh_url = this.target.closest('.records').data('refresh-record').replace('--ID--', refresh);
1402
1416
 
1403
1417
  if (l.position) {
1404
- l.url = l.url.append_params({adapter: '_list_inline_adapter'});
1418
+ l.url = l.url.append_params({adapter: l.position == 'popup' ? '_popup_adapter' : '_list_inline_adapter'});
1405
1419
  l.tag.attr('href', l.url);
1406
1420
  }
1407
1421
  l.set = this;
@@ -1422,9 +1436,13 @@
1422
1436
  insert: function(content) {
1423
1437
  this.close_previous_adapter();
1424
1438
 
1425
- if (this.position == 'replace') {
1439
+ if (this.position === 'replace') {
1426
1440
  this.position = 'after';
1427
1441
  this.hide_target = true;
1442
+ } else if (this.position === 'table') {
1443
+ this.hide_content = true;
1444
+ } else if (this.position === 'popup') {
1445
+ return ActiveScaffold.open_popup(content, this);
1428
1446
  }
1429
1447
 
1430
1448
  var colspan = this.target.children().length;
@@ -1432,15 +1450,17 @@
1432
1450
  content = jQuery(content);
1433
1451
  content.find('.inline-adapter-cell:first').attr('colspan', colspan);
1434
1452
  }
1435
- if (this.position == 'after') {
1453
+ if (this.position === 'after') {
1436
1454
  this.target.after(content);
1437
1455
  this.set_adapter(this.target.next());
1438
- }
1439
- else if (this.position == 'before') {
1456
+ } else if (this.position === 'before') {
1440
1457
  this.target.before(content);
1441
1458
  this.set_adapter(this.target.prev());
1442
- }
1443
- else {
1459
+ } else if (this.position === 'table') {
1460
+ var content_parent = this.target.closest('div.active-scaffold').find('tbody.before-header').first()
1461
+ content_parent.prepend(content);
1462
+ this.set_adapter(content_parent.children().first())
1463
+ } else {
1444
1464
  return false;
1445
1465
  }
1446
1466
  ActiveScaffold.highlight(this.adapter.find('td'));
@@ -1478,10 +1498,10 @@
1478
1498
  },
1479
1499
 
1480
1500
  set_opened: function() {
1481
- if (this.position == 'after') {
1501
+ if (this.position === 'after') {
1482
1502
  this.set_adapter(this.target.next());
1483
1503
  }
1484
- else if (this.position == 'before') {
1504
+ else if (this.position === 'before') {
1485
1505
  this.set_adapter(this.target.prev());
1486
1506
  }
1487
1507
  this.disable();
@@ -1507,13 +1527,14 @@
1507
1527
  if (this.position == 'replace') {
1508
1528
  this.position = 'top';
1509
1529
  this.hide_content = true;
1530
+ } else if (this.position == 'popup') {
1531
+ return ActiveScaffold.open_popup(content, this);
1510
1532
  }
1511
1533
 
1512
1534
  if (this.position == 'top') {
1513
1535
  this.target.prepend(content);
1514
1536
  this.set_adapter(this.target.children().first());
1515
- }
1516
- else {
1537
+ } else {
1517
1538
  throw 'Unknown position "' + this.position + '"'
1518
1539
  }
1519
1540
  ActiveScaffold.highlight(this.adapter.find('td').first().children().not('script'));
@@ -5,9 +5,10 @@
5
5
  ActiveScaffold is freely distributable under the terms of an MIT-style license.
6
6
 
7
7
  For details, see the ActiveScaffold web site: https://github.com/activescaffold/active_scaffold
8
+ *= require_self
9
+ *= require "active_scaffold_jquery_ui"
10
+ *= require "active_scaffold_extensions"
8
11
  */
9
- //= require "active_scaffold_jquery_ui"
10
- //= require "active_scaffold_extensions"
11
12
 
12
13
  @import 'active_scaffold_layout';
13
14
  @import 'active_scaffold_images';
@@ -497,6 +497,12 @@ padding: 4px;
497
497
  text-align: center;
498
498
  position: relative;
499
499
  }
500
+ .active-scaffold .filtered-message {
501
+ display: flex;
502
+ }
503
+ .active-scaffold .filtered-message > * {
504
+ flex-grow: 1;
505
+ }
500
506
 
501
507
  .active-scaffold .message, .active-scaffold-component .message {
502
508
  font-size: 11px;
@@ -512,10 +518,9 @@ display: inline;
512
518
  }
513
519
 
514
520
  .active-scaffold .filtered-message .reset {
515
- position: absolute;
516
- display: inline;
517
- right: 10px;
518
- top: 4px;
521
+ margin-right: 5px;
522
+ white-space: nowrap;
523
+ flex-grow: 0;
519
524
  padding: 0;
520
525
  }
521
526
 
@@ -19,7 +19,7 @@
19
19
  <%= render 'list_messages', columns: columns %>
20
20
  <tbody class="records" id="<%= active_scaffold_tbody_id %>" data-refresh-record="<%= url_for(params_for(action: :index, id: '--ID--')) %>">
21
21
  <% if !@page.empty? -%>
22
- <%= render partial: 'list_record', collection: @page.items, locals: {hidden: false, columns: columns, action_links: active_scaffold_config.action_links.member} %>
22
+ <%= render partial: list_record_view, collection: @page.items, locals: {hidden: false, columns: columns, action_links: active_scaffold_config.action_links.member} %>
23
23
  <% end -%>
24
24
  </tbody>
25
25
  <% if columns.any?(&:calculation?) -%>
@@ -1,5 +1,5 @@
1
1
  <%# nested_id, allows us to remove a nested scaffold programmatically %>
2
- <tr class="inline-adapter" id="<%= element_row_id action: :nested %>">
2
+ <tr class="inline-adapter" id="<%= nested_id = element_row_id action: :nested %>">
3
3
  <td class="inline-adapter-cell">
4
4
  <% if successful? %>
5
5
  <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view">
@@ -9,9 +9,9 @@
9
9
  <% end %>
10
10
  <%= javascript_tag do %>
11
11
  setTimeout(function() {
12
- var action_link = ActiveScaffold.ActionLink.get('<%= element_row_id(action: :nested) %>');
12
+ var action_link = ActiveScaffold.ActionLink.get('<%= nested_id %>');
13
13
  if (action_link) {
14
- action_link.update_flash_messages('<%= escape_javascript(render('messages').strip) %>');
14
+ action_link.update_flash_messages('<%= escape_javascript(render('messages')) %>');
15
15
  <% unless successful? %>
16
16
  action_link.close();
17
17
  ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
@@ -6,7 +6,7 @@
6
6
  <%= content_tag :div, class: 'filtered-message',
7
7
  style: ('display:none;' unless @filtered),
8
8
  data: ({search: search_params || ''} if active_scaffold_config.store_user_settings && respond_to?(:search_params)) do %>
9
- <%= @filtered.is_a?(Array) ? render('human_conditions', columns: @filtered) : as_(active_scaffold_config.list.filtered_message) %>
9
+ <div><%= @filtered.is_a?(Array) ? render('human_conditions', columns: @filtered) : as_(active_scaffold_config.list.filtered_message) %></div>
10
10
  <% if active_scaffold_config.list.show_search_reset && @filtered -%>
11
11
  <div class="reset">
12
12
  <%= loading_indicator_tag(action: :record, id: nil) %>
@@ -9,7 +9,7 @@
9
9
  <% elsif active_scaffold_config.create.refresh_list %>
10
10
  <%= render 'refresh_list', no_history: true %>
11
11
  <% elsif params[:parent_controller].nil? %>
12
- <% new_row = render 'list_record', record: @saved_record || @record %>
12
+ <% new_row = render list_record_view, record: @saved_record || @record %>
13
13
  ActiveScaffold.create_record_row(action_link ? action_link.scaffold() : '<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {insert_at: insert_at}.to_json.html_safe %>);
14
14
  <%= render 'update_calculations' %>
15
15
  <% end %>
@@ -0,0 +1,20 @@
1
+ <%# nested_id, allows us to remove a nested scaffold programmatically %>
2
+ <div class="active-scaffold" id="<%= nested_id = element_row_id action: :nested %>">
3
+ <% if successful? %>
4
+ <div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{nested? ? nested.name : id_from_controller(params[:controller])}-view" %> view">
5
+ <%= payload -%>
6
+ </div>
7
+ <% end %>
8
+ <%= javascript_tag do %>
9
+ setTimeout(function() {
10
+ var action_link = ActiveScaffold.ActionLink.get('<%= nested_id %>');
11
+ if (action_link) {
12
+ action_link.update_flash_messages('<%= escape_javascript(render('messages')) %>');
13
+ <% unless successful? %>
14
+ action_link.close();
15
+ ActiveScaffold.scroll_to(action_link.scaffold(), ActiveScaffold.config.scroll_on_close == "checkInViewport");
16
+ <% end %>
17
+ }
18
+ }, 10);
19
+ <% end %>
20
+ </div>
@@ -1,6 +1,6 @@
1
1
  <% if @auto_pagination -%>
2
2
  <% if @page.items.present? -%>
3
- ActiveScaffold.append('<%= active_scaffold_tbody_id %>', '<%= escape_javascript(render(partial: 'list_record', collection: @page.items, locals: {hidden: false, columns: list_columns, action_links: active_scaffold_config.action_links.member})) %>');
3
+ ActiveScaffold.append('<%= active_scaffold_tbody_id %>', '<%= escape_javascript(render(partial: list_record_view, collection: @page.items, locals: {hidden: false, columns: list_columns, action_links: active_scaffold_config.action_links.member})) %>');
4
4
 
5
5
  <% if @page.pager.infinite? || @page.number < @page.pager.number_of_pages -%>
6
6
  ActiveScaffold.auto_load_page('<%= url_for main_path_to_return %>', {auto_pagination: true, page: <%= @page.number + 1 %>});
@@ -1 +1 @@
1
- <%= render 'list_record', record: record %>
1
+ <%= render list_record_view, record: record %>
@@ -1,4 +1,4 @@
1
- <% new_row = render 'list_record', record: @record %>
1
+ <% new_row = render list_record_view, record: @record %>
2
2
  ActiveScaffold.create_record_row('<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {insert_at: :top}.to_json.html_safe %>);
3
3
 
4
4
  <%= render 'update_calculations' %>
@@ -5,7 +5,7 @@ link = ActiveScaffold.find_action_link('<%= element_form_id(action: action_name)
5
5
  <% if successful? %>
6
6
  <% if @record %>
7
7
  <%= render 'update_messages' %>
8
- <% row = escape_javascript(render('list_record', record: @record)) -%>
8
+ <% row = escape_javascript(render(list_record_view, record: @record)) -%>
9
9
  <% if @action_link&.position %>
10
10
  if (link) link.close('<%= row %>');
11
11
  <% else %>
@@ -5,7 +5,7 @@ if (action_link) action_link.update_flash_messages('<%= escape_javascript(render
5
5
  <% if successful? %>
6
6
  <% if params[:dont_close] %>
7
7
  <% row_selector = element_row_id(action: :list, id: @record.id) %>
8
- ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render('list_record', record: @record)) %>');
8
+ ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(list_record_view, record: @record)) %>');
9
9
  if (action_link) action_link.target = $('#<%= row_selector %>');
10
10
  <%= render 'update_calculations' %>
11
11
  <% if params[:iframe] == 'true' %>
@@ -22,7 +22,7 @@ if (action_link) action_link.update_flash_messages('<%= escape_javascript(render
22
22
  <%= render 'refresh_list', no_history: true %>
23
23
  <% else %>
24
24
  <% if @record %>
25
- if (action_link) action_link.close('<%= escape_javascript(render('list_record', record: @record)) %>');
25
+ if (action_link) action_link.close('<%= escape_javascript(render(list_record_view, record: @record)) %>');
26
26
  <% else %>
27
27
  if (action_link) action_link.close();
28
28
  ActiveScaffold.delete_record_row('<%= element_row_id(action: :list, id: params[:id]) %>');
@@ -1,2 +1,2 @@
1
- ActiveScaffold.update_row('<%= element_row_id(action: :list, id: @record&.id) %>', '<%= escape_javascript render('list_record', record: @record) %>');
1
+ ActiveScaffold.update_row('<%= element_row_id(action: :list, id: @record&.id) %>', '<%= escape_javascript render(list_record_view, record: @record) %>');
2
2
  <%= render 'update_calculations' %>
@@ -1 +1 @@
1
- ActiveScaffold.update_row('<%=element_row_id(action: 'list', id: @record.id)%>','<%=escape_javascript(render('list_record', record: @record))%>');
1
+ ActiveScaffold.update_row('<%=element_row_id(action: 'list', id: @record.id)%>','<%=escape_javascript(render(list_record_view, record: @record))%>');
@@ -195,6 +195,8 @@ module ActiveScaffold::Config
195
195
 
196
196
  # To be called before freezing
197
197
  def _cache_lazy_values
198
+ action_links.collection # ensure the collection group exist although it's empty
199
+ action_links.member # ensure the collection group exist although it's empty
198
200
  action_links.each(&:name_to_cache) if cache_action_link_urls
199
201
  columns.select(&:sortable?).each(&:sort)
200
202
  columns.select(&:searchable?).each(&:search_sql)
@@ -189,12 +189,15 @@ module ActiveScaffold::DataStructures
189
189
  # where the result of this action should insert in the display.
190
190
  # for type: :collection, supported values are:
191
191
  # :top
192
- # :replace (for updating the entire table)
192
+ # :replace (to hide the entire table)
193
+ # :popup (popup with JS library)
193
194
  # false (no attempt at positioning)
194
195
  # for type: :member, supported values are:
195
196
  # :before
196
- # :replace
197
+ # :replace (to hide the record row)
197
198
  # :after
199
+ # :table (to hide the entire table)
200
+ # :popup (popup with JS library)
198
201
  # false (no attempt at positioning)
199
202
  attr_writer :position
200
203
 
@@ -1,13 +1,15 @@
1
- class ActionLinkSeparator
2
- def initialize(weight)
3
- @weight = weight
4
- end
1
+ module ActiveScaffold::DataStructures
2
+ class ActionLinkSeparator
3
+ def initialize(weight)
4
+ @weight = weight
5
+ end
5
6
 
6
- attr_reader :weight
7
+ attr_reader :weight
7
8
 
8
- def ==(other)
9
- other == :separator
10
- end
9
+ def ==(other)
10
+ other == :separator
11
+ end
11
12
 
12
- def name_to_cache; end # :nodoc:
13
+ def name_to_cache; end # :nodoc:
14
+ end
13
15
  end
@@ -24,7 +24,7 @@ module ActiveScaffold
24
24
  end
25
25
 
26
26
  def format_human_condition(column, opt, from = nil, to = nil)
27
- attribute = column.active_record_class.human_attribute_name(column.name)
27
+ attribute = column.label
28
28
  opt ||= :between if from && to
29
29
  opt ||= from ? '>=' : '<='
30
30
  from = to = nil if opt&.in? %w[null not_null]
@@ -52,15 +52,15 @@ module ActiveScaffold
52
52
  range_type, range = value['range'].downcase.split('_')
53
53
  format = active_scaffold_human_condition_datetime_range_format(range_type, range)
54
54
  from, = controller.class.datetime_from_to(column, value)
55
- "#{column.active_record_class.human_attribute_name(column.name)} = #{as_(value['range'].downcase).downcase} (#{I18n.l(from, format: format)})"
56
- when 'PAST', 'FUTURE'
55
+ "#{column.label} = #{as_(value['range'].downcase).downcase} (#{I18n.l(from, format: format)})"
56
+ when 'PAST', 'FUTURE', 'BETWEEN'
57
57
  from, to = controller.class.datetime_from_to(column, value)
58
- "#{column.active_record_class.human_attribute_name(column.name)} #{as_('BETWEEN'.downcase).downcase} #{I18n.l(from)} - #{I18n.l(to)}"
58
+ "#{column.label} #{as_('between').downcase} #{I18n.l(from)} - #{I18n.l(to)}"
59
59
  when 'null', 'not_null'
60
- "#{column.active_record_class.human_attribute_name(column.name)} #{as_(value['opt'].downcase).downcase}"
60
+ "#{column.label} #{as_(value['opt'].downcase).downcase}"
61
61
  else
62
- from, to = controller.class.datetime_from_to(column, value)
63
- "#{column.active_record_class.human_attribute_name(column.name)} #{as_(value['opt'].downcase).downcase} #{I18n.l(from)} #{"- #{I18n.l(to)}" if value['opt'] == 'BETWEEN'}"
62
+ from, = controller.class.datetime_from_to(column, value)
63
+ "#{column.label} #{as_(value['opt'].downcase).downcase} #{I18n.l(from)}"
64
64
  end
65
65
  end
66
66
  alias active_scaffold_human_condition_time active_scaffold_human_condition_datetime
@@ -94,7 +94,7 @@ module ActiveScaffold
94
94
  # end
95
95
 
96
96
  def active_scaffold_human_condition_boolean(column, value)
97
- attribute = column.active_record_class.human_attribute_name(column.name)
97
+ attribute = column.label
98
98
  as_(:boolean, scope: :human_conditions, column: attribute, value: as_(value))
99
99
  end
100
100
  alias active_scaffold_human_condition_checkbox active_scaffold_human_condition_boolean
@@ -104,7 +104,7 @@ module ActiveScaffold
104
104
  end
105
105
 
106
106
  def active_scaffold_human_condition_select(column, associated)
107
- attribute = column.active_record_class.human_attribute_name(column.name)
107
+ attribute = column.label
108
108
  if associated.is_a?(Hash)
109
109
  return active_scaffold_human_condition_range(column, associated) unless associated['opt'] == '='
110
110
 
@@ -2,6 +2,10 @@ module ActiveScaffold
2
2
  module Helpers
3
3
  # Helpers that assist with the rendering of a List Column
4
4
  module ListColumnHelpers
5
+ def list_record_view
6
+ 'list_record'
7
+ end
8
+
5
9
  def get_column_value(record, column)
6
10
  record = record.send(column.delegated_association.name) if column.delegated_association
7
11
  if record
@@ -1,11 +1,4 @@
1
1
  class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
2
- class AssociationScope < ActiveRecord::Associations::AssociationScope
3
- INSTANCE = create
4
- def self.scope(association, connection)
5
- INSTANCE.scope association, connection
6
- end
7
- end
8
-
9
2
  class Connection < ActiveRecord::ConnectionAdapters::AbstractAdapter
10
3
  attr_reader :klass
11
4
 
@@ -150,8 +143,11 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
150
143
 
151
144
  class Relation < ::ActiveRecord::Relation
152
145
  include RelationExtension
146
+
147
+ delegate :connection_pool, to: :model
153
148
  end
154
149
  class << self
150
+ delegate :schema_cache, to: :connection
155
151
  def find(*ids)
156
152
  ids.length == 1 ? all.find(*ids[0]) : super # rubocop:disable Rails/RedundantActiveRecordAllMethod
157
153
  end
@@ -3,7 +3,7 @@ module ActiveScaffold
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
5
  PATCH = 0
6
- FIX = 'rc2'.freeze
6
+ FIX = 'rc3'.freeze
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, FIX].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc2
4
+ version: 4.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -136,6 +136,7 @@ files:
136
136
  - app/views/active_scaffold_overrides/_list_with_header.html.erb
137
137
  - app/views/active_scaffold_overrides/_messages.html.erb
138
138
  - app/views/active_scaffold_overrides/_new_record.js.erb
139
+ - app/views/active_scaffold_overrides/_popup_adapter.html.erb
139
140
  - app/views/active_scaffold_overrides/_refresh_create_form.js.erb
140
141
  - app/views/active_scaffold_overrides/_refresh_list.js.erb
141
142
  - app/views/active_scaffold_overrides/_render_field.js.erb