Skip to content

Commit

Permalink
Merge branch '3-7-stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Oct 19, 2024
2 parents d70e295 + 832a0ba commit 9685233
Show file tree
Hide file tree
Showing 21 changed files with 330 additions and 110 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- Add tabbed_by to group of columns in forms. The columns in the group must be collection associations, with a common column or association, used to partition them in different tabs.

= 3.7.8
- Rollback previous behaviour when submitting empty values, broken when default_value was added. Default value set in column is not used when trying to save empty value, DB default is used in that case, and save NULL when string is empty, as before.
- Support operators =, null and not null for :select search_ui, so it's possible to search for NULL with :select search UI.

Expand Down
130 changes: 65 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
active_scaffold (3.7.7)
active_scaffold (3.7.8)
cow_proxy (~> 0.3)
ice_nine (~> 0.11)
rails (>= 5.2.0)
Expand All @@ -16,65 +16,65 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.8)
actionpack (= 6.1.7.8)
activesupport (= 6.1.7.8)
actioncable (6.1.7.9)
actionpack (= 6.1.7.9)
activesupport (= 6.1.7.9)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.8)
actionpack (= 6.1.7.8)
activejob (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
actionmailbox (6.1.7.9)
actionpack (= 6.1.7.9)
activejob (= 6.1.7.9)
activerecord (= 6.1.7.9)
activestorage (= 6.1.7.9)
activesupport (= 6.1.7.9)
mail (>= 2.7.1)
actionmailer (6.1.7.8)
actionpack (= 6.1.7.8)
actionview (= 6.1.7.8)
activejob (= 6.1.7.8)
activesupport (= 6.1.7.8)
actionmailer (6.1.7.9)
actionpack (= 6.1.7.9)
actionview (= 6.1.7.9)
activejob (= 6.1.7.9)
activesupport (= 6.1.7.9)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.7.8)
actionview (= 6.1.7.8)
activesupport (= 6.1.7.8)
actionpack (6.1.7.9)
actionview (= 6.1.7.9)
activesupport (= 6.1.7.9)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.8)
actionpack (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
actiontext (6.1.7.9)
actionpack (= 6.1.7.9)
activerecord (= 6.1.7.9)
activestorage (= 6.1.7.9)
activesupport (= 6.1.7.9)
nokogiri (>= 1.8.5)
actionview (6.1.7.8)
activesupport (= 6.1.7.8)
actionview (6.1.7.9)
activesupport (= 6.1.7.9)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.8)
activesupport (= 6.1.7.8)
activejob (6.1.7.9)
activesupport (= 6.1.7.9)
globalid (>= 0.3.6)
activemodel (6.1.7.8)
activesupport (= 6.1.7.8)
activerecord (6.1.7.8)
activemodel (= 6.1.7.8)
activesupport (= 6.1.7.8)
activemodel (6.1.7.9)
activesupport (= 6.1.7.9)
activerecord (6.1.7.9)
activemodel (= 6.1.7.9)
activesupport (= 6.1.7.9)
activerecord-jdbc-adapter (61.2-java)
activerecord (~> 6.1.0)
activerecord-jdbcsqlite3-adapter (61.2-java)
activerecord-jdbc-adapter (= 61.2)
jdbc-sqlite3 (~> 3.8, < 3.30)
activestorage (6.1.7.8)
actionpack (= 6.1.7.8)
activejob (= 6.1.7.8)
activerecord (= 6.1.7.8)
activesupport (= 6.1.7.8)
activestorage (6.1.7.9)
actionpack (= 6.1.7.9)
activejob (= 6.1.7.9)
activerecord (= 6.1.7.9)
activesupport (= 6.1.7.9)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.8)
activesupport (6.1.7.9)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -83,27 +83,27 @@ GEM
ansi (1.5.0)
ast (2.4.2)
brakeman (5.4.1)
builder (3.2.4)
builder (3.3.0)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
concurrent-ruby (1.3.1)
concurrent-ruby (1.3.4)
cow_proxy (0.3.3)
crass (1.0.6)
date (3.3.4)
date (3.3.4-java)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubi (1.12.0)
erubi (1.13.0)
gli (2.21.0)
globalid (1.2.1)
activesupport (>= 6.1)
highline (2.0.3)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.36)
activesupport (>= 4.0.2)
Expand Down Expand Up @@ -140,7 +140,7 @@ GEM
mime-types-data (3.2022.0105)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.23.1)
minitest (5.25.1)
minitest-reporters (1.6.0)
ansi
builder
Expand Down Expand Up @@ -173,25 +173,25 @@ GEM
stringio
psych (5.1.2-java)
jar-dependencies (>= 0.1.7)
racc (1.8.0)
racc (1.8.0-java)
rack (2.2.9)
racc (1.8.1)
racc (1.8.1-java)
rack (2.2.10)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.8)
actioncable (= 6.1.7.8)
actionmailbox (= 6.1.7.8)
actionmailer (= 6.1.7.8)
actionpack (= 6.1.7.8)
actiontext (= 6.1.7.8)
actionview (= 6.1.7.8)
activejob (= 6.1.7.8)
activemodel (= 6.1.7.8)
activerecord (= 6.1.7.8)
activestorage (= 6.1.7.8)
activesupport (= 6.1.7.8)
rails (6.1.7.9)
actioncable (= 6.1.7.9)
actionmailbox (= 6.1.7.9)
actionmailer (= 6.1.7.9)
actionpack (= 6.1.7.9)
actiontext (= 6.1.7.9)
actionview (= 6.1.7.9)
activejob (= 6.1.7.9)
activemodel (= 6.1.7.9)
activerecord (= 6.1.7.9)
activestorage (= 6.1.7.9)
activesupport (= 6.1.7.9)
bundler (>= 1.15.0)
railties (= 6.1.7.8)
railties (= 6.1.7.9)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
Expand All @@ -202,9 +202,9 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.1.7.8)
actionpack (= 6.1.7.8)
activesupport (= 6.1.7.8)
railties (6.1.7.9)
actionpack (= 6.1.7.9)
activesupport (= 6.1.7.9)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -244,15 +244,15 @@ GEM
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.0)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (1.4.4)
stringio (3.0.6)
terminal-table (3.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (1.3.1)
thor (1.3.2)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand All @@ -266,7 +266,7 @@ GEM
websocket-driver (0.7.6-java)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.15)
zeitwerk (2.6.18)

PLATFORMS
java
Expand Down
10 changes: 10 additions & 0 deletions app/assets/javascripts/jquery/active_scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,16 @@
form.find('select.as_search_date_time_option').val('BETWEEN');
});

jQuery(document).on('click', '.active-scaffold .tabbed .nav-tabs a', function(e) {
if (typeof $().tab == 'function') return; // bootstrap tab plugin is loaded and will handle tabs
e.preventDefault();
var tab_ctrl = jQuery(this), tabbed = tab_ctrl.closest('.tabbed')
tabbed.find('.nav-tabs .active').removeClass('active');
tabbed.find('.tab-content .active').removeClass('in active');
tab_ctrl.closest('li').addClass('active');
jQuery(tab_ctrl.attr('href')).addClass('in active');
});

jQuery(document).on('turbolinks:before-visit turbo:before-visit', function() {
if (history.state.active_scaffold) {
history.replaceState({turbolinks: true, url: document.location.href}, '', document.location.href);
Expand Down
54 changes: 54 additions & 0 deletions app/assets/stylesheets/active_scaffold_layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,60 @@ font-size: 100%;
float:left;
}

.active-scaffold .tabbed .nav-tabs {
border-bottom: 1px solid #ddd;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}

.active-scaffold .tabbed .nav-tabs:before,
.active-scaffold .tabbed .nav-tabs:after {
display: table;
content: ' ';
}
.active-scaffold .tabbed .nav-tabs:after {
clear: both;
}

.active-scaffold .tabbed .nav-tabs > li {
float: left;
margin-bottom: -1px;
position: relative;
display: block;
}

.active-scaffold .tabbed .nav-tabs > li > a {
margin-right: 2px;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
position: relative;
display: block;
padding: 10px 15px;
}
.active-scaffold .tabbed .nav-tabs > li > a:focus,
.active-scaffold .tabbed .nav-tabs > li > a:hover {
border-color: #eee #eee #ddd;
text-decoration: none;
background-color: #eee;
}
.active-scaffold .tabbed .nav-tabs > li.active > a,
.active-scaffold .tabbed .nav-tabs > li.active > a:focus,
.active-scaffold .tabbed .nav-tabs > li.active > a:hover {
border-color: #ddd;
border-bottom-color: transparent;
cursor: default;
background-color: #fff;
}

.active-scaffold .tabbed .tab-content > .tab-pane {
display: none;
}
.active-scaffold .tabbed .tab-content > .active {
display: block;
}


.as_touch a.inline-adapter-close {
width: 25px;
height: 27px;
Expand Down
23 changes: 10 additions & 13 deletions app/views/active_scaffold_overrides/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
<%
scope ||= nil
subsection_id ||= nil
tab_value ||= nil
tabbed_by ||= nil
tab_id ||= nil
show_unauthorized_columns = active_scaffold_config.send(form_action).show_unauthorized_columns if active_scaffold_config.actions.include? form_action
%>
<ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
<% columns.each_column(for: @record, crud_type: (:read if show_unauthorized_columns)) do |column| %>
<% column_css_class = column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>
<% renders_as = column_renders_as(column) %>
<% authorized = show_unauthorized_columns || renders_as == :subsection ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
<% if renders_as == :subsection -%>
<% if authorized %>
<% subsection_id = sub_section_id(:sub_section => column.label) %>
<% authorized = show_unauthorized_columns || renders_as == :subsection ? @record.authorized_for?(crud_type: form_action, column: column.name) : true %>
<% if renders_as == :subsection || renders_as == :tabbed -%>
<% next unless authorized %>
<li class="sub-section <%= column_css_class %>">
<h5>
<%= column.label %>
<%= link_to_visibility_toggle(subsection_id, {:default_visible => !column.collapsed}) -%>
</h5>
<%= render :partial => 'form', :locals => { :columns => column, :subsection_id => subsection_id, :form_action => form_action, :scope => scope } %>
<%= render_subsection(column, @record, scope, form_action) %>
</li>
<% end %>
<% elsif renders_as == :subform and authorized -%>
<%= content_tag :li, active_scaffold_subform_attributes(column, column_css_class) do %>
<%= render_column(column, @record, renders_as, scope) %>
<%= content_tag :li, active_scaffold_subform_attributes(column, column_css_class, tab_id: tab_id) do %>
<%= render_column(column, @record, renders_as, scope, tabbed_by: (column.options[:tabbed_by] || tabbed_by if tabbed_by), tab_value: tab_value, tab_id: tab_id) %>
<% end %>
<% else -%>
<li class="form-element <%= 'required' if column.required?(action_for_validation?(@record)) %> <%= column.form_ui %> <%= column_css_class %>">
<%= render_column(column, @record, renders_as, scope, !authorized) %>
<%= render_column(column, @record, renders_as, scope, only_value: !authorized) %>
</li>
<% end -%>
<% end -%>
Expand Down
Loading

0 comments on commit 9685233

Please sign in to comment.