active_scaffold 3.3.0.rc → 3.3.0.rc2
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.
- data/CHANGELOG +19 -2
- data/app/assets/javascripts/jquery/active_scaffold.js +26 -27
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +19 -21
- data/app/assets/javascripts/jquery/draggable_lists.js +1 -2
- data/app/assets/javascripts/jquery/jquery.editinplace.js +4 -0
- data/app/assets/javascripts/prototype/active_scaffold.js +8 -3
- data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_form_attribute.html.erb +5 -1
- data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +6 -1
- data/app/views/active_scaffold_overrides/_list_record.html.erb +0 -1
- data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +0 -2
- data/app/views/active_scaffold_overrides/destroy.js.erb +1 -1
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +1 -1
- data/app/views/active_scaffold_overrides/on_update.js.erb +7 -1
- data/app/views/active_scaffold_overrides/render_field_inplace.html.erb +1 -0
- data/app/views/active_scaffold_overrides/row.js.erb +1 -1
- data/lib/active_scaffold/actions/core.rb +10 -13
- data/lib/active_scaffold/actions/update.rb +2 -1
- data/lib/active_scaffold/attribute_params.rb +16 -1
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
- data/lib/active_scaffold/bridges/chosen/helpers.rb +1 -1
- data/lib/active_scaffold/bridges/date_picker/ext.rb +12 -0
- data/lib/active_scaffold/bridges/date_picker/helper.rb +2 -2
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +3 -3
- data/lib/active_scaffold/config/list.rb +4 -0
- data/lib/active_scaffold/data_structures/action_links.rb +1 -1
- data/lib/active_scaffold/data_structures/sorting.rb +4 -0
- data/lib/active_scaffold/extensions/action_view_rendering.rb +8 -3
- data/lib/active_scaffold/finder.rb +35 -8
- data/lib/active_scaffold/helpers/form_column_helpers.rb +6 -2
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +3 -3
- data/lib/active_scaffold/helpers/list_column_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/search_column_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/view_helpers.rb +3 -0
- data/lib/active_scaffold/tableless.rb +2 -3
- data/lib/active_scaffold/version.rb +1 -1
- data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +4 -4
- metadata +6 -4
data/CHANGELOG
CHANGED
@@ -15,8 +15,25 @@
|
|
15
15
|
- Fix calculations using field_search with has_many includes
|
16
16
|
- Add support to ActiveScaffold.create_record_row to insert after or before of an element
|
17
17
|
- Add support for dynamic action group
|
18
|
-
|
19
|
-
|
18
|
+
- Improve parsing of datetimes
|
19
|
+
- Add support for lists filtered by id (one-item lists)
|
20
|
+
- Fix update_columns with sending whole big forms
|
21
|
+
- Improve update_columns on subforms
|
22
|
+
- Support to override ActiveScaffold.remove so effects can be added on page elements deletion
|
23
|
+
- Add support for conversion methods in controller, so form_uis can define how to convert params to values
|
24
|
+
- Avoid sorting by contraint columns
|
25
|
+
- Cosmetic fixes and improvements
|
26
|
+
- Fix multipart persistent update form
|
27
|
+
- Support jquery 1.9 (jquery-rails 2.2.0 gem)
|
28
|
+
|
29
|
+
= 3.2.19 (not released yet)
|
30
|
+
- Avoid crashing when between is chosen and from or to is not filled
|
31
|
+
|
32
|
+
= 3.2.18
|
33
|
+
- Fix add existing record with record_select
|
34
|
+
- Disable link for polymorphic associations in 3.2.x, it doesn't work
|
35
|
+
|
36
|
+
= 3.2.17
|
20
37
|
- fix constraints for columns with multiple columns in search_sql
|
21
38
|
- remove unauthorized collection links
|
22
39
|
- copy parameters and html_options on cloning action link
|
@@ -1,4 +1,10 @@
|
|
1
1
|
jQuery(document).ready(function($) {
|
2
|
+
if (jQuery().jquery < '1.8.0') {
|
3
|
+
var error = 'ActiveScaffold requires jquery 1.8.0 or greater, please use jquery-rails 2.1.x gem or greater';
|
4
|
+
if (typeof console != 'undefined') console.error(error);
|
5
|
+
else alert(error);
|
6
|
+
}
|
7
|
+
|
2
8
|
jQuery(document).click(function(event) {
|
3
9
|
jQuery('.action_group.dyn ul').remove();
|
4
10
|
});
|
@@ -24,7 +30,7 @@ jQuery(document).ready(function($) {
|
|
24
30
|
jQuery(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
|
25
31
|
var as_div = jQuery(this).closest("div.active-scaffold");
|
26
32
|
if (as_div.length) {
|
27
|
-
ActiveScaffold.report_500_response(as_div);
|
33
|
+
ActiveScaffold.report_500_response(as_div, xhr);
|
28
34
|
}
|
29
35
|
});
|
30
36
|
jQuery(document).on('submit', 'form.as_form:not([data-remote])', function(event) {
|
@@ -69,7 +75,7 @@ jQuery(document).ready(function($) {
|
|
69
75
|
jQuery(document).on('ajax:error', 'a.as_action', function(event, xhr, status, error) {
|
70
76
|
var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
|
71
77
|
if (action_link) {
|
72
|
-
ActiveScaffold.report_500_response(action_link.scaffold_id());
|
78
|
+
ActiveScaffold.report_500_response(action_link.scaffold_id(), xhr);
|
73
79
|
action_link.enable();
|
74
80
|
}
|
75
81
|
return true;
|
@@ -103,7 +109,7 @@ jQuery(document).ready(function($) {
|
|
103
109
|
jQuery(document).on('ajax:error', 'a.as_cancel', function(event, xhr, status, error) {
|
104
110
|
var action_link = ActiveScaffold.find_action_link(jQuery(this));
|
105
111
|
if (action_link) {
|
106
|
-
ActiveScaffold.report_500_response(action_link.scaffold_id());
|
112
|
+
ActiveScaffold.report_500_response(action_link.scaffold_id(), xhr);
|
107
113
|
}
|
108
114
|
return true;
|
109
115
|
});
|
@@ -116,10 +122,10 @@ jQuery(document).ready(function($) {
|
|
116
122
|
});
|
117
123
|
jQuery(document).on('ajax:error', 'a.as_sort', function(event, xhr, status, error) {
|
118
124
|
var as_scaffold = jQuery(this).closest('.active-scaffold');
|
119
|
-
ActiveScaffold.report_500_response(as_scaffold);
|
125
|
+
ActiveScaffold.report_500_response(as_scaffold, xhr);
|
120
126
|
return true;
|
121
127
|
});
|
122
|
-
jQuery(document).on('
|
128
|
+
jQuery(document).on('mouseenter mouseleave', 'td.in_place_editor_field', function(event) {
|
123
129
|
var td = jQuery(this), span = td.find('span.in_place_editor_field');
|
124
130
|
if (event.type == 'mouseenter') {
|
125
131
|
if (td.hasClass('empty') || typeof(span.data('editInPlace')) === 'undefined') td.find('span').addClass("hover");
|
@@ -145,7 +151,7 @@ jQuery(document).ready(function($) {
|
|
145
151
|
});
|
146
152
|
jQuery(document).on('ajax:error', 'a.as_paginate', function(event, xhr, status, error) {
|
147
153
|
var as_scaffold = jQuery(this).closest('.active-scaffold');
|
148
|
-
ActiveScaffold.report_500_response(as_scaffold);
|
154
|
+
ActiveScaffold.report_500_response(as_scaffold, xhr);
|
149
155
|
return true;
|
150
156
|
});
|
151
157
|
jQuery(document).on('ajax:complete', 'a.as_paginate', function(event) {
|
@@ -153,7 +159,9 @@ jQuery(document).ready(function($) {
|
|
153
159
|
return true;
|
154
160
|
});
|
155
161
|
jQuery(document).on('ajax:before', 'a.as_add_existing, a.as_replace_existing', function(event) {
|
156
|
-
var
|
162
|
+
var prev = jQuery(this).prev();
|
163
|
+
if (!prev.is(':input')) prev = prev.find(':input');
|
164
|
+
var id = prev.val();
|
157
165
|
if (id) {
|
158
166
|
if (!jQuery(this).data('href')) jQuery(this).data('href', jQuery(this).attr('href'));
|
159
167
|
jQuery(this).attr('href', jQuery(this).data('href').replace('--ID--', id));
|
@@ -428,7 +436,8 @@ var ActiveScaffold = {
|
|
428
436
|
replace: function(element, html) {
|
429
437
|
if (typeof(element) == 'string') element = '#' + element;
|
430
438
|
element = jQuery(element);
|
431
|
-
var new_element = jQuery(html);
|
439
|
+
var new_element = typeof(html) == 'string' ? jQuery.parseHTML(html.trim()) : html;
|
440
|
+
new_element = jQuery(new_element);
|
432
441
|
element.replaceWith(new_element);
|
433
442
|
new_element.trigger('as:element_updated');
|
434
443
|
return new_element;
|
@@ -650,7 +659,8 @@ var ActiveScaffold = {
|
|
650
659
|
var initial_label = (options.default_visible === true) ? options.hide_label : options.show_label;
|
651
660
|
|
652
661
|
toggler.append(' (<a class="visibility-toggle" href="#">' + initial_label + '</a>)');
|
653
|
-
toggler.children('a').click(function() {
|
662
|
+
toggler.children('a').click(function(e) {
|
663
|
+
e.preventDefault();
|
654
664
|
toggable.toggle();
|
655
665
|
jQuery(this).html((toggable.is(':hidden')) ? options.show_label : options.hide_label);
|
656
666
|
return false;
|
@@ -682,7 +692,7 @@ var ActiveScaffold = {
|
|
682
692
|
render_form_field: function(source, content, options) {
|
683
693
|
if (typeof(source) == 'string') source = '#' + source;
|
684
694
|
var source = jQuery(source);
|
685
|
-
var element = source.closest('.association-record').nextUntil('.association-record').
|
695
|
+
var element = source.closest('.association-record').nextUntil('.association-record').addBack();
|
686
696
|
if (element.length == 0) {
|
687
697
|
element = source.closest('form > ol.form');
|
688
698
|
}
|
@@ -701,7 +711,7 @@ var ActiveScaffold = {
|
|
701
711
|
jQuery.ajax({
|
702
712
|
url: edit_associated_url.split('--ID--').join(id),
|
703
713
|
error: function(xhr, textStatus, errorThrown){
|
704
|
-
ActiveScaffold.report_500_response(active_scaffold_id)
|
714
|
+
ActiveScaffold.report_500_response(active_scaffold_id, xhr)
|
705
715
|
}
|
706
716
|
});
|
707
717
|
},
|
@@ -712,24 +722,13 @@ var ActiveScaffold = {
|
|
712
722
|
var element = jQuery(element);
|
713
723
|
if (options.include_checkboxes) {
|
714
724
|
var mark_checkboxes = jQuery('#' + element.attr('id') + ' > tr.record td.as_marked-column input[type="checkbox"]');
|
715
|
-
mark_checkboxes.
|
716
|
-
|
717
|
-
if(options.checked) {
|
718
|
-
item.attr('checked', 'checked');
|
719
|
-
} else {
|
720
|
-
item.removeAttr('checked');
|
721
|
-
}
|
722
|
-
item.attr('value', ('' + !options.checked));
|
723
|
-
});
|
725
|
+
mark_checkboxes.prop('checked', !!options.checked);
|
726
|
+
mark_checkboxes.val('' + !options.checked);
|
724
727
|
}
|
725
728
|
if(options.include_mark_all) {
|
726
729
|
var mark_all_checkbox = element.prevAll('thead').find('th.as_marked-column_heading span input[type="checkbox"]');
|
727
|
-
|
728
|
-
|
729
|
-
} else {
|
730
|
-
mark_all_checkbox.removeAttr('checked');
|
731
|
-
}
|
732
|
-
mark_all_checkbox.attr('value', ('' + !options.checked));
|
730
|
+
mark_all_checkbox.prop('checked', !!options.checked);
|
731
|
+
mark_all_checkbox.val('' + !options.checked);
|
733
732
|
}
|
734
733
|
},
|
735
734
|
|
@@ -860,7 +859,7 @@ var ActiveScaffold = {
|
|
860
859
|
error: function (xhr, status, error) {
|
861
860
|
var as_div = element.closest("div.active-scaffold");
|
862
861
|
if (as_div) {
|
863
|
-
ActiveScaffold.report_500_response(as_div);
|
862
|
+
ActiveScaffold.report_500_response(as_div, xhr);
|
864
863
|
}
|
865
864
|
}
|
866
865
|
});
|
@@ -1,24 +1,22 @@
|
|
1
1
|
<%= ActiveScaffold::Bridges[:date_picker].localization %>
|
2
|
-
|
3
|
-
jQuery(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
date_picker.datepicker();
|
9
|
-
date_picker.trigger('focus');
|
10
|
-
}
|
11
|
-
}
|
12
|
-
return true;
|
13
|
-
});
|
14
|
-
jQuery('input.datetime_picker').live('focus', function(event) {
|
15
|
-
var date_picker = jQuery(this);
|
16
|
-
if (typeof(date_picker.datetimepicker) == 'function') {
|
17
|
-
if (!date_picker.hasClass('hasDatepicker')) {
|
18
|
-
date_picker.datetimepicker();
|
19
|
-
date_picker.trigger('focus');
|
20
|
-
}
|
2
|
+
jQuery(document).on("focus", "input.date_picker", function(){
|
3
|
+
var date_picker = jQuery(this);
|
4
|
+
if (typeof(date_picker.datepicker) == 'function') {
|
5
|
+
if (!date_picker.hasClass('hasDatepicker')) {
|
6
|
+
date_picker.datepicker();
|
7
|
+
date_picker.trigger('focus');
|
21
8
|
}
|
22
|
-
|
23
|
-
|
9
|
+
}
|
10
|
+
return true;
|
24
11
|
});
|
12
|
+
|
13
|
+
jQuery(document).on("focus", "input.datetime_picker", function(){
|
14
|
+
var date_picker = jQuery(this);
|
15
|
+
if (typeof(date_picker.datetimepicker) == 'function') {
|
16
|
+
if (!date_picker.hasClass('hasDatepicker')) {
|
17
|
+
date_picker.datetimepicker();
|
18
|
+
date_picker.trigger('focus');
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return true;
|
22
|
+
});
|
@@ -18,8 +18,7 @@ jQuery.fn.draggable_lists = function() {
|
|
18
18
|
drop: function(event, ui) {
|
19
19
|
jQuery(this).append(ui.draggable);
|
20
20
|
var input = jQuery('input:checkbox', ui.draggable);
|
21
|
-
|
22
|
-
else input.removeAttr('checked');
|
21
|
+
input.prop('checked', jQuery(this).hasClass('selected'));
|
23
22
|
ui.draggable.css({left: '0px', top: '0px'});
|
24
23
|
}
|
25
24
|
});
|
@@ -420,8 +420,10 @@ $.extend(InlineEditor.prototype, {
|
|
420
420
|
form.find(".inplace_field").blur(cancelEditorAction);
|
421
421
|
|
422
422
|
// workaround for msie & firefox bug where it won't submit on enter if no button is shown
|
423
|
+
/* TODO find a way to restore it without $.browser if it doesn't work
|
423
424
|
if ($.browser.mozilla || $.browser.msie)
|
424
425
|
this.bindSubmitOnEnterInInput();
|
426
|
+
*/
|
425
427
|
}
|
426
428
|
|
427
429
|
form.keyup(function(anEvent) {
|
@@ -433,8 +435,10 @@ $.extend(InlineEditor.prototype, {
|
|
433
435
|
|
434
436
|
// workaround for webkit nightlies where they won't submit at all on enter
|
435
437
|
// REFACT: find a way to just target the nightlies
|
438
|
+
/* TODO find a way to restore it without $.browser if it doesn't work
|
436
439
|
if ($.browser.safari)
|
437
440
|
this.bindSubmitOnEnterInInput();
|
441
|
+
*/
|
438
442
|
|
439
443
|
|
440
444
|
form.submit(saveEditorAction);
|
@@ -244,9 +244,13 @@ document.observe("dom:loaded", function() {
|
|
244
244
|
});
|
245
245
|
document.on('ajax:before', 'a.as_add_existing, a.as_replace_existing', function(event) {
|
246
246
|
var button = event.findElement();
|
247
|
-
var
|
248
|
-
|
249
|
-
|
247
|
+
var prev = button.previous();
|
248
|
+
if (!prev.match('input,select')) prev = prev.down('input,select');
|
249
|
+
var id = prev.getValue();
|
250
|
+
if (id) {
|
251
|
+
event.memo.url = button.readAttribute('href').sub('--ID--', id);
|
252
|
+
return true;
|
253
|
+
} else return false;
|
250
254
|
});
|
251
255
|
document.on('change', 'input.update_form, textarea.update_form, select.update_form', function(event) {
|
252
256
|
var element = event.findElement();
|
@@ -599,6 +603,7 @@ var ActiveScaffold = {
|
|
599
603
|
toggler.insert(' (<a class="visibility-toggle" href="#">' + initial_label + '</a>)');
|
600
604
|
toggler.firstDescendant().observe('click', function(event) {
|
601
605
|
var element = event.element();
|
606
|
+
event.stop();
|
602
607
|
toggable.toggle();
|
603
608
|
element.innerHTML = (toggable.style.display == 'none') ? options.show_label : options.hide_label;
|
604
609
|
return false;
|
@@ -6,8 +6,8 @@
|
|
6
6
|
<ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
|
7
7
|
<% columns.each :for => @record, :crud_type => (:read if show_unauthorized_columns) do |column| %>
|
8
8
|
<% column_css_class = column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>
|
9
|
-
<% authorized = show_unauthorized_columns ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
|
10
9
|
<% renders_as = column_renders_as(column) %>
|
10
|
+
<% authorized = show_unauthorized_columns ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true unless renders_as == :subsection %>
|
11
11
|
<% if renders_as == :subsection -%>
|
12
12
|
<% subsection_id = sub_section_id(:sub_section => column.label) %>
|
13
13
|
<li class="sub-section <%= column_css_class %>">
|
@@ -34,7 +34,7 @@ add_new_url = params_for(:action => 'edit_associated', :child_association => col
|
|
34
34
|
|
35
35
|
<% if show_add_existing -%>
|
36
36
|
<% if remote_controller and remote_controller.respond_to? :uses_record_select? and remote_controller.uses_record_select? -%>
|
37
|
-
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "ActiveScaffold.record_select_onselect(#{edit_associated_url.to_json}, #{active_scaffold_id.to_json}, id);" -%>
|
37
|
+
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "ActiveScaffold.record_select_onselect(#{url_for(edit_associated_url).to_json}, #{active_scaffold_id.to_json}, id);" -%>
|
38
38
|
<% else -%>
|
39
39
|
<% select_options = options_from_collection_for_select(sorted_association_options_find(column.association), :id, :to_label)
|
40
40
|
add_existing_id = "#{sub_form_id(:association => column.name)}-add-existing"
|
@@ -1,8 +1,12 @@
|
|
1
1
|
<%
|
2
2
|
scope ||= nil
|
3
3
|
column_options = active_scaffold_input_options(column, scope)
|
4
|
+
attributes = field_attributes(column, @record)
|
5
|
+
if local_assigns[:col_class].present?
|
6
|
+
attributes[:class] = "#{attributes[:class]} #{col_class}"
|
7
|
+
end
|
4
8
|
%>
|
5
|
-
|
9
|
+
<%= tag :dl, attributes, true %>
|
6
10
|
<dt>
|
7
11
|
<label for="<%= column_options[:id] %>"><%= column.label %></label>
|
8
12
|
</dt>
|
@@ -6,7 +6,12 @@
|
|
6
6
|
next unless in_subform?(column, parent_record)
|
7
7
|
hidden = column_renders_as(column) == :hidden
|
8
8
|
-%>
|
9
|
-
<th class="<%= "#{column.name}-column #{'required' if column.required?} #{'hidden' if hidden}" %>"
|
9
|
+
<th class="<%= "#{column.name}-column #{'required' if column.required?} #{'hidden' if hidden}" %>">
|
10
|
+
<label><%= column.label unless hidden %></label>
|
11
|
+
<% if column.description.present? -%>
|
12
|
+
<span class="description"><%= column.description %></span>
|
13
|
+
<% end -%>
|
14
|
+
</th>
|
10
15
|
<% end -%>
|
11
16
|
</tr>
|
12
17
|
</thead>
|
@@ -5,7 +5,6 @@ tr_class = cycle("", "even-record") + ' ' + list_row_class(record)
|
|
5
5
|
action_links ||= active_scaffold_config.action_links.member
|
6
6
|
data_refresh ||= url_for(params_for(:action => :row, :id => '--ID--', :_method => :get))
|
7
7
|
-%>
|
8
|
-
|
9
8
|
<tr class="record <%= tr_class %>" id="<%= element_row_id(:action => :list, :id => record.id) %>" data-refresh="<%= data_refresh.sub('--ID--', record.id.to_s).html_safe %>">
|
10
9
|
<% columns.each do |column| %>
|
11
10
|
<% authorized = record.authorized_for?(:crud_type => :read, :column => column.name) -%>
|
@@ -1,8 +1,6 @@
|
|
1
1
|
<div id="<%= sub_form_list_id(:association => column.name) %>">
|
2
2
|
<% associated.each_index do |index| %>
|
3
|
-
<div class="sub-form-record">
|
4
3
|
<% @record = associated[index] -%>
|
5
4
|
<%= render :partial => 'form_association_record', :locals => {:scope => column_scope(column, scope), :parent_record => parent_record, :column => column, :locked => show_blank_record && @record.new_record? && @record == associated.last, :index => index} %>
|
6
|
-
</div>
|
7
5
|
<% end -%>
|
8
6
|
</div>
|
@@ -21,6 +21,6 @@
|
|
21
21
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
22
22
|
<% end %>
|
23
23
|
<% else %>
|
24
|
-
<% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) %>
|
24
|
+
<% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record.errors.present? %>
|
25
25
|
<% end %>
|
26
26
|
<%= render :partial => 'update_messages', :locals => {:messages_id => messages_id} %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%= render :partial => 'refresh_list' %>
|
17
17
|
<% end %>
|
18
18
|
<% else %>
|
19
|
-
<% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) %>
|
19
|
+
<% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record.errors.present? %>
|
20
20
|
ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>','<%= escape_javascript(render(:partial => 'messages')) %>');
|
21
21
|
ActiveScaffold.scroll_to('<%= active_scaffold_messages_id %>', true);
|
22
22
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
try {
|
2
|
-
<% form_selector = "#{element_form_id(:action => :update, :id => @record.id)}" %>
|
2
|
+
<% form_selector = "#{element_form_id(:action => :update, :id => @record.try(:id) || params[:id])}" %>
|
3
3
|
var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
|
4
4
|
action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
|
5
5
|
<% if controller.send :successful? %>
|
@@ -8,6 +8,7 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
|
|
8
8
|
ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
9
9
|
action_link.target = $('#<%= row_selector %>');
|
10
10
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
11
|
+
<%= "ActiveScaffold.enable_form('#{form_selector}');" if params[:iframe] == 'true' %>
|
11
12
|
<% else %>
|
12
13
|
<% if render_parent? %>
|
13
14
|
<% if nested_singular_association? || render_parent_action == :row %>
|
@@ -18,7 +19,12 @@ action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'mes
|
|
18
19
|
<% elsif update_refresh_list? %>
|
19
20
|
<%= render :partial => 'refresh_list' %>
|
20
21
|
<% else %>
|
22
|
+
<% if @record %>
|
21
23
|
action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
|
24
|
+
<% else %>
|
25
|
+
action_link.close();
|
26
|
+
ActiveScaffold.delete_record_row('<%= element_row_id(:action => :list, :id => params[:id]) %>');
|
27
|
+
<% end %>
|
22
28
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
23
29
|
<% end %>
|
24
30
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= active_scaffold_input_for(active_scaffold_config.columns[@column.name]) %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
ActiveScaffold.update_row('<%= element_row_id(:action => :list) %>', '<%= escape_javascript render('
|
1
|
+
ActiveScaffold.update_row('<%= element_row_id(:action => :list) %>', '<%= escape_javascript render('list_record', :record => @record) %>');
|
2
2
|
<%= render :partial => 'update_calculations', :formats => [:js] %>
|
@@ -28,19 +28,20 @@ module ActiveScaffold::Actions
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def render_field_for_inplace_editing
|
31
|
+
@column = active_scaffold_config.columns[params[:update_column]]
|
31
32
|
@record = find_if_allowed(params[:id], :crud_type => :update, :column => params[:update_column])
|
32
|
-
render :
|
33
|
+
render :action => 'render_field_inplace', :layout => false
|
33
34
|
end
|
34
35
|
|
35
36
|
def render_field_for_update_columns
|
36
|
-
column = active_scaffold_config.columns[params.delete(:column)]
|
37
|
-
unless column.nil?
|
37
|
+
@column = active_scaffold_config.columns[params.delete(:column)]
|
38
|
+
unless @column.nil?
|
38
39
|
@source_id = params.delete(:source_id)
|
39
|
-
@columns = column.update_columns
|
40
|
+
@columns = @column.update_columns
|
40
41
|
@scope = params.delete(:scope)
|
41
42
|
@main_columns = active_scaffold_config.send(@scope ? :subform : (params[:id] ? :update : :create)).columns
|
42
43
|
|
43
|
-
if column.send_form_on_update_column
|
44
|
+
if @column.send_form_on_update_column
|
44
45
|
if @scope
|
45
46
|
hash = @scope.gsub('[','').split(']').inject(params[:record]) do |hash, index|
|
46
47
|
hash[index]
|
@@ -54,11 +55,11 @@ module ActiveScaffold::Actions
|
|
54
55
|
@record = update_record_from_params(@record, @main_columns, hash)
|
55
56
|
else
|
56
57
|
@record = new_model
|
57
|
-
value = column_value_from_param_value(@record, column, params.delete(:value))
|
58
|
-
@record.send "#{column.name}=", value
|
58
|
+
value = column_value_from_param_value(@record, @column, params.delete(:value))
|
59
|
+
@record.send "#{@column.name}=", value
|
59
60
|
end
|
60
61
|
|
61
|
-
after_render_field(@record, column)
|
62
|
+
after_render_field(@record, @column)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -70,11 +71,7 @@ module ActiveScaffold::Actions
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def clear_flashes
|
73
|
-
if request.xhr?
|
74
|
-
flash.keys.each do |flash_key|
|
75
|
-
flash[flash_key] = nil
|
76
|
-
end
|
77
|
-
end
|
74
|
+
flash.clear if request.xhr?
|
78
75
|
end
|
79
76
|
|
80
77
|
def each_marked_record(&block)
|
@@ -52,7 +52,8 @@ module ActiveScaffold::Actions
|
|
52
52
|
if update_refresh_list?
|
53
53
|
do_refresh_list
|
54
54
|
else
|
55
|
-
get_row
|
55
|
+
# get_row so associations are cached like in list action
|
56
|
+
@record = get_row rescue nil # if record doesn't fullfil current conditions remove it from list
|
56
57
|
end
|
57
58
|
end
|
58
59
|
flash.now[:info] = as_(:updated_model, :model => @record.to_label) if active_scaffold_config.update.persistent
|
@@ -91,12 +91,27 @@ module ActiveScaffold
|
|
91
91
|
|
92
92
|
def column_value_from_param_value(parent_record, column, value)
|
93
93
|
# convert the value, possibly by instantiating associated objects
|
94
|
-
|
94
|
+
form_ui = column.form_ui || column.column.try(:type)
|
95
|
+
if form_ui && self.respond_to?("column_value_for_#{form_ui}_type")
|
96
|
+
self.send("column_value_for_#{form_ui}_type", parent_record, column, value)
|
97
|
+
elsif value.is_a?(Hash)
|
95
98
|
column_value_from_param_hash_value(parent_record, column, value)
|
96
99
|
else
|
97
100
|
column_value_from_param_simple_value(parent_record, column, value)
|
98
101
|
end
|
99
102
|
end
|
103
|
+
|
104
|
+
def datetime_conversion_for_value(column)
|
105
|
+
if column.column
|
106
|
+
column.column.type == :date ? :to_date : :to_time
|
107
|
+
else
|
108
|
+
:to_time
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def column_value_for_datetime_type(parent_record, column, value)
|
113
|
+
self.class.condition_value_for_datetime(column, value, self.class.datetime_conversion_for_condition(column))
|
114
|
+
end
|
100
115
|
|
101
116
|
def column_value_from_param_simple_value(parent_record, column, value)
|
102
117
|
if column.singular_association?
|
@@ -34,7 +34,7 @@ module ActiveScaffold
|
|
34
34
|
module SearchColumnHelpers
|
35
35
|
def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
|
36
36
|
if current_search.is_a? Hash
|
37
|
-
value = controller.class.condition_value_for_datetime(current_search[name], column.column.type == :date ? :to_date : :to_time)
|
37
|
+
value = controller.class.condition_value_for_datetime(column, current_search[name], column.column.type == :date ? :to_date : :to_time)
|
38
38
|
else
|
39
39
|
value = current_search
|
40
40
|
end
|
@@ -20,7 +20,7 @@ class ActiveScaffold::Bridges::Chosen
|
|
20
20
|
html_options[:name] = "#{html_options[:name]}[]" if html_options[:multiple] == true && !html_options[:name].to_s.ends_with?("[]")
|
21
21
|
|
22
22
|
if optgroup = options.delete(:optgroup)
|
23
|
-
select(:record, column.name,
|
23
|
+
select(:record, column.name, active_scaffold_grouped_options(column, select_options, optgroup), options, html_options)
|
24
24
|
else
|
25
25
|
collection_select(:record, column.name, select_options, :id, :to_label, options, html_options)
|
26
26
|
end
|
@@ -61,3 +61,15 @@ ActiveScaffold::Finder::ClassMethods.module_eval do
|
|
61
61
|
alias_method :condition_for_date_picker_type, :condition_for_date_bridge_type
|
62
62
|
alias_method :condition_for_datetime_picker_type, :condition_for_date_picker_type
|
63
63
|
end
|
64
|
+
ActiveScaffold::AttributeParams.module_eval do
|
65
|
+
def datetime_conversion_for_value_with_datepicker(column)
|
66
|
+
if column.form_ui == :date_picker
|
67
|
+
:to_date
|
68
|
+
else
|
69
|
+
datetime_conversion_for_value_without_datepicker(column)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
alias_method_chain :datetime_conversion_for_value, :datepicker
|
73
|
+
alias_method :column_value_for_date_picker_type, :column_value_for_datetime_type
|
74
|
+
alias_method :column_value_for_datetime_picker_type, :column_value_for_datetime_type
|
75
|
+
end
|
@@ -151,7 +151,7 @@ module ActiveScaffold::Bridges
|
|
151
151
|
module SearchColumnHelpers
|
152
152
|
def active_scaffold_search_date_bridge_calendar_control(column, options, current_search, name)
|
153
153
|
if current_search.is_a? Hash
|
154
|
-
value = controller.class.condition_value_for_datetime(current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
|
154
|
+
value = controller.class.condition_value_for_datetime(column, current_search[name], column.search_ui == :date_picker ? :to_date : :to_time)
|
155
155
|
else
|
156
156
|
value = current_search
|
157
157
|
end
|
@@ -169,7 +169,7 @@ module ActiveScaffold::Bridges
|
|
169
169
|
def active_scaffold_input_date_picker(column, options)
|
170
170
|
options = active_scaffold_input_text_options(options.merge(column.options))
|
171
171
|
options[:class] << " #{column.form_ui.to_s}"
|
172
|
-
value = controller.class.condition_value_for_datetime(@record.send(column.name), column.form_ui == :date_picker ? :to_date : :to_time)
|
172
|
+
value = controller.class.condition_value_for_datetime(column, @record.send(column.name), column.form_ui == :date_picker ? :to_date : :to_time)
|
173
173
|
format = options.delete(:format) || (column.form_ui == :date_picker ? :default : :picker)
|
174
174
|
datepicker_format_options(column, format, options)
|
175
175
|
options[:value] = (value ? l(value, :format => format) : nil)
|
@@ -114,7 +114,7 @@ module ActiveScaffold
|
|
114
114
|
unless operator.nil?
|
115
115
|
["%{search_sql} #{value[:opt]} ?", from_value.to_s(:db)] unless from_value.nil?
|
116
116
|
else
|
117
|
-
["%{search_sql} BETWEEN ? AND ?", from_value.to_s(:db), to_value.to_s(:db)] unless from_value.nil?
|
117
|
+
["%{search_sql} BETWEEN ? AND ?", from_value.to_s(:db), to_value.to_s(:db)] unless from_value.nil? || to_value.nil?
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -127,7 +127,7 @@ module ActiveScaffold
|
|
127
127
|
when 'PAST', 'FUTURE'
|
128
128
|
date_bridge_from_to_for_trend(column, value).collect(&conversion)
|
129
129
|
else
|
130
|
-
['from', 'to'].collect { |field| condition_value_for_datetime(value[field], conversion)}
|
130
|
+
['from', 'to'].collect { |field| condition_value_for_datetime(column, value[field], conversion)}
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -206,4 +206,4 @@ ActiveScaffold::Finder.const_set('TimeUnits', ["SECONDS", "MINUTES", "HOURS"])
|
|
206
206
|
ActiveScaffold::Finder.const_set('DateRanges', ["TODAY", "YESTERDAY", "TOMORROW",
|
207
207
|
"THIS_WEEK", "PREV_WEEK", "NEXT_WEEK",
|
208
208
|
"THIS_MONTH", "PREV_MONTH", "NEXT_MONTH",
|
209
|
-
"THIS_YEAR", "PREV_YEAR", "NEXT_YEAR"])
|
209
|
+
"THIS_YEAR", "PREV_YEAR", "NEXT_YEAR"])
|
@@ -230,6 +230,10 @@ module ActiveScaffold::Config
|
|
230
230
|
@sorting = sorting
|
231
231
|
else
|
232
232
|
@sorting = default_sorting
|
233
|
+
if @conf.columns.constraint_columns.present?
|
234
|
+
@sorting = @sorting.clone
|
235
|
+
@sorting.constraint_columns = @conf.columns.constraint_columns
|
236
|
+
end
|
233
237
|
end
|
234
238
|
end
|
235
239
|
@sorting
|
@@ -3,9 +3,12 @@ module ActiveScaffold::DataStructures
|
|
3
3
|
class Sorting
|
4
4
|
include Enumerable
|
5
5
|
|
6
|
+
attr_accessor :constraint_columns
|
7
|
+
|
6
8
|
def initialize(columns)
|
7
9
|
@columns = columns
|
8
10
|
@clauses = []
|
11
|
+
@constraint_columns = []
|
9
12
|
end
|
10
13
|
|
11
14
|
def set_default_sorting(model)
|
@@ -91,6 +94,7 @@ module ActiveScaffold::DataStructures
|
|
91
94
|
# unless the sorting is by method, create the sql string
|
92
95
|
order = []
|
93
96
|
each do |sort_column, sort_direction|
|
97
|
+
next if constraint_columns.include? sort_column.name
|
94
98
|
sql = sort_column.sort[:sql]
|
95
99
|
next if sql.nil? or sql.empty?
|
96
100
|
|
@@ -70,7 +70,11 @@ module ActionView::Helpers #:nodoc:
|
|
70
70
|
end
|
71
71
|
|
72
72
|
elsif args.first == :super
|
73
|
-
|
73
|
+
@_view_paths ||= lookup_context.view_paths.clone
|
74
|
+
parts = @virtual_path.split('/')
|
75
|
+
template = parts.pop
|
76
|
+
prefix = parts.join('/')
|
77
|
+
|
74
78
|
options = args[1] || {}
|
75
79
|
options[:locals] ||= {}
|
76
80
|
options[:locals] = view_stack.last[:locals].merge!(options[:locals]) if view_stack.last && view_stack.last[:locals]
|
@@ -80,19 +84,20 @@ module ActionView::Helpers #:nodoc:
|
|
80
84
|
options[:prefixes] = lookup_context.prefixes.drop((lookup_context.prefixes.find_index(prefix) || -1) + 1)
|
81
85
|
else
|
82
86
|
options[:prefixes] = ['active_scaffold_overrides']
|
83
|
-
view_paths = lookup_context.view_paths
|
84
87
|
last_view_path = File.expand_path(File.dirname(File.dirname(lookup_context.last_template.inspect)), Rails.root)
|
85
88
|
lookup_context.view_paths = view_paths.drop(view_paths.find_index {|path| path.to_s == last_view_path} + 1)
|
86
89
|
end
|
87
90
|
result = render_without_active_scaffold options
|
88
|
-
lookup_context.view_paths =
|
91
|
+
lookup_context.view_paths = @_view_paths if @_view_paths
|
89
92
|
result
|
90
93
|
else
|
94
|
+
@_view_paths ||= lookup_context.view_paths.clone
|
91
95
|
last_template = lookup_context.last_template
|
92
96
|
if args.first.is_a?(Hash)
|
93
97
|
current_view = {:locals => args.first[:locals]}
|
94
98
|
view_stack << current_view
|
95
99
|
end
|
100
|
+
lookup_context.view_paths = @_view_paths # reset view_paths in case a view render :super, and then render :partial
|
96
101
|
result = render_without_active_scaffold(*args, &block)
|
97
102
|
view_stack.pop if current_view.present?
|
98
103
|
lookup_context.last_template = last_template
|
@@ -116,8 +116,24 @@ module ActiveScaffold
|
|
116
116
|
nil
|
117
117
|
end
|
118
118
|
end
|
119
|
+
|
120
|
+
def translate_days_and_months(value, format)
|
121
|
+
keys = {
|
122
|
+
'%A' => 'date.day_names',
|
123
|
+
'%a' => 'date.abbr_day_names',
|
124
|
+
'%B' => 'date.month_names',
|
125
|
+
'%b' => 'date.abbr_month_names'
|
126
|
+
}
|
127
|
+
keys.each do |f, k|
|
128
|
+
if format.include? f
|
129
|
+
table = Hash[I18n.t(k).compact.zip(I18n.t(k, :locale => :en).compact)]
|
130
|
+
value.gsub!(Regexp.union(table.keys)) { |s| table[s] }
|
131
|
+
end
|
132
|
+
end
|
133
|
+
value
|
134
|
+
end
|
119
135
|
|
120
|
-
def condition_value_for_datetime(value, conversion = :to_time)
|
136
|
+
def condition_value_for_datetime(column, value, conversion = :to_time)
|
121
137
|
if value.is_a? Hash
|
122
138
|
Time.zone.local(*[:year, :month, :day, :hour, :minute, :second].collect {|part| value[part].to_i}) rescue nil
|
123
139
|
elsif value.respond_to?(:strftime)
|
@@ -129,19 +145,30 @@ module ActiveScaffold
|
|
129
145
|
value.send(conversion)
|
130
146
|
end
|
131
147
|
elsif conversion == :to_date
|
132
|
-
Date.strptime(value, I18n.t(
|
148
|
+
Date.strptime(value, I18n.t("date.formats.#{column.options[:format] || :default}")) rescue nil
|
133
149
|
else
|
134
150
|
parts = Date._parse(value)
|
135
|
-
format = I18n.translate
|
151
|
+
format = I18n.translate "time.formats.#{column.options[:format] || :picker}", :default => '' if ActiveScaffold.js_framework == :jquery
|
136
152
|
if format.blank?
|
137
153
|
time_parts = [[:hour, '%H'], [:min, '%M'], [:sec, '%S']].collect {|part, format_part| format_part if parts[part].present?}.compact
|
138
154
|
format = "#{I18n.t('date.formats.default')} #{time_parts.join(':')} #{'%z' if parts[:offset].present?}"
|
139
155
|
else
|
156
|
+
if parts[:hour]
|
157
|
+
[[:min, '%M'], [:sec, '%S']].each {|part, f| format.gsub!(":#{f}", '') unless parts[part].present?}
|
158
|
+
else
|
159
|
+
value += ' 00:00:00'
|
160
|
+
end
|
140
161
|
format += ' %z' if parts[:offset].present? && format !~ /%z/i
|
141
162
|
end
|
142
|
-
|
143
|
-
|
144
|
-
|
163
|
+
if !parts[:year] && !parts[:month] && !parts[:mday]
|
164
|
+
value = "#{Date.today.strftime(format.gsub(/%[HI].*/, ''))} #{value}"
|
165
|
+
end
|
166
|
+
value = translate_days_and_months(value, format) if I18n.locale != :en
|
167
|
+
time = DateTime.strptime(value, format) rescue nil
|
168
|
+
if time
|
169
|
+
time = Time.zone.local_to_utc(time).in_time_zone unless parts[:offset]
|
170
|
+
time = time.send(conversion) unless conversion == :to_time
|
171
|
+
end
|
145
172
|
time
|
146
173
|
end unless value.nil? || value.blank?
|
147
174
|
end
|
@@ -180,8 +207,8 @@ module ActiveScaffold
|
|
180
207
|
|
181
208
|
def condition_for_datetime(column, value, like_pattern = nil)
|
182
209
|
conversion = datetime_conversion_for_condition(column)
|
183
|
-
from_value = condition_value_for_datetime(value[:from], conversion)
|
184
|
-
to_value = condition_value_for_datetime(value[:to], conversion)
|
210
|
+
from_value = condition_value_for_datetime(column, value[:from], conversion)
|
211
|
+
to_value = condition_value_for_datetime(column, value[:to], conversion)
|
185
212
|
|
186
213
|
if from_value.nil? and to_value.nil?
|
187
214
|
nil
|
@@ -128,11 +128,15 @@ module ActiveScaffold
|
|
128
128
|
options
|
129
129
|
end
|
130
130
|
|
131
|
+
def field_attributes(column, record)
|
132
|
+
{}
|
133
|
+
end
|
134
|
+
|
131
135
|
##
|
132
136
|
## Form input methods
|
133
137
|
##
|
134
138
|
|
135
|
-
def
|
139
|
+
def active_scaffold_grouped_options(column, select_options, optgroup)
|
136
140
|
group_label = active_scaffold_config_for(column.association.klass).columns[optgroup].try(:association) ? :to_label : :to_s
|
137
141
|
select_options.group_by(&optgroup.to_sym).collect do |group, options|
|
138
142
|
[group.send(group_label), options.collect {|r| [r.to_label, r.id]}]
|
@@ -160,7 +164,7 @@ module ActiveScaffold
|
|
160
164
|
active_scaffold_translate_select_options(options)
|
161
165
|
|
162
166
|
if optgroup = options.delete(:optgroup)
|
163
|
-
select(:record, method,
|
167
|
+
select(:record, method, active_scaffold_grouped_options(column, select_options, optgroup), options, html_options)
|
164
168
|
else
|
165
169
|
collection_select(:record, method, select_options, :id, :to_label, options, html_options)
|
166
170
|
end
|
@@ -20,8 +20,8 @@ module ActiveScaffold
|
|
20
20
|
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(opt).downcase} '#{value[:from]}' #{opt == 'BETWEEN' ? '- ' + value[:to].to_s : ''}"
|
21
21
|
when :date, :time, :datetime, :timestamp
|
22
22
|
conversion = column.column.type == :date ? :to_date : :to_time
|
23
|
-
from = controller.condition_value_for_datetime(value[:from], conversion)
|
24
|
-
to = controller.condition_value_for_datetime(value[:to], conversion)
|
23
|
+
from = controller.condition_value_for_datetime(column, value[:from], conversion)
|
24
|
+
to = controller.condition_value_for_datetime(column, value[:to], conversion)
|
25
25
|
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(value[:opt])} #{I18n.l(from)} #{value[:opt] == 'BETWEEN' ? '- ' + I18n.l(to) : ''}"
|
26
26
|
when :select, :multi_select, :record_select
|
27
27
|
associated = value
|
@@ -61,4 +61,4 @@ module ActiveScaffold
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
@@ -278,7 +278,7 @@ module ActiveScaffold
|
|
278
278
|
end
|
279
279
|
|
280
280
|
def render_column_heading(column, sorting, sort_direction)
|
281
|
-
tag_options = {:id => active_scaffold_column_header_id(column), :class => column_heading_class(column, sorting), :title => column.description}
|
281
|
+
tag_options = {:id => active_scaffold_column_header_id(column), :class => column_heading_class(column, sorting), :title => strip_tags(column.description)}
|
282
282
|
if column.name == :as_marked
|
283
283
|
tag_options[:data] = {
|
284
284
|
:ie_mode => :inline_checkbox,
|
@@ -94,7 +94,7 @@ module ActiveScaffold
|
|
94
94
|
end
|
95
95
|
|
96
96
|
if optgroup = options.delete(:optgroup)
|
97
|
-
select(:record, method,
|
97
|
+
select(:record, method, active_scaffold_grouped_options(column, select_options, optgroup), options, html_options)
|
98
98
|
elsif column.association
|
99
99
|
collection_select(:record, method, select_options, :id, :to_label, options, html_options)
|
100
100
|
else
|
@@ -479,7 +479,10 @@ module ActiveScaffold
|
|
479
479
|
calculation = column_calculation(column)
|
480
480
|
override_formatter = "render_#{column.name}_#{column.calculate.is_a?(Proc) ? :calculate : column.calculate}"
|
481
481
|
calculation = send(override_formatter, calculation) if respond_to? override_formatter
|
482
|
+
format_column_calculation(column, calculation)
|
483
|
+
end
|
482
484
|
|
485
|
+
def format_column_calculation(column, calculation)
|
483
486
|
"#{"#{as_(column.calculate)}: " unless column.calculate.is_a? Proc}#{format_column_value nil, column, calculation}"
|
484
487
|
end
|
485
488
|
|
@@ -36,7 +36,7 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_one(id)
|
39
|
-
@klass.find_one(id, self)
|
39
|
+
@klass.find_one(id, self) or raise ActiveRecord::RecordNotFound
|
40
40
|
end
|
41
41
|
|
42
42
|
def execute_simple_calculation(operation, column_name, distinct)
|
@@ -51,8 +51,7 @@ class ActiveScaffold::Tableless < ActiveRecord::Base
|
|
51
51
|
class << self
|
52
52
|
private
|
53
53
|
def relation
|
54
|
-
|
55
|
-
super
|
54
|
+
ActiveScaffold::Tableless::Relation.new(self, arel_table)
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
@@ -621,19 +621,19 @@
|
|
621
621
|
|
622
622
|
if (this.hour_slider) {
|
623
623
|
this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
|
624
|
-
this.control.value(this, this.hour_slider, 'hour', this.hour);
|
624
|
+
this.control.value(this, this.hour_slider, 'hour', this.hour - this.hour % this._defaults.stepHour);
|
625
625
|
}
|
626
626
|
if (this.minute_slider) {
|
627
627
|
this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
|
628
|
-
this.control.value(this, this.minute_slider, 'minute', this.minute);
|
628
|
+
this.control.value(this, this.minute_slider, 'minute', this.minute - this.minute % this._defaults.stepMinute);
|
629
629
|
}
|
630
630
|
if (this.second_slider) {
|
631
631
|
this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
|
632
|
-
this.control.value(this, this.second_slider, 'second', this.second);
|
632
|
+
this.control.value(this, this.second_slider, 'second', this.second - this.second % this._defaults.stepSecond);
|
633
633
|
}
|
634
634
|
if (this.millisec_slider) {
|
635
635
|
this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
|
636
|
-
this.control.value(this, this.millisec_slider, 'millisec', this.millisec);
|
636
|
+
this.control.value(this, this.millisec_slider, 'millisec', this.millisec - this.millisec % this._defaults.stepMillisec);
|
637
637
|
}
|
638
638
|
}
|
639
639
|
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1415994350
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
|
11
|
+
- 2
|
12
|
+
version: 3.3.0.rc2
|
12
13
|
platform: ruby
|
13
14
|
authors:
|
14
15
|
- Many, see README
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date:
|
20
|
+
date: 2013-02-12 00:00:00 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
type: :development
|
@@ -173,6 +174,7 @@ files:
|
|
173
174
|
- app/views/active_scaffold_overrides/on_mark.js.erb
|
174
175
|
- app/views/active_scaffold_overrides/on_update.js.erb
|
175
176
|
- app/views/active_scaffold_overrides/render_field.js.erb
|
177
|
+
- app/views/active_scaffold_overrides/render_field_inplace.html.erb
|
176
178
|
- app/views/active_scaffold_overrides/row.js.erb
|
177
179
|
- app/views/active_scaffold_overrides/search.html.erb
|
178
180
|
- app/views/active_scaffold_overrides/show.html.erb
|
@@ -441,7 +443,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
443
|
requirements: []
|
442
444
|
|
443
445
|
rubyforge_project:
|
444
|
-
rubygems_version: 1.8.
|
446
|
+
rubygems_version: 1.8.24
|
445
447
|
signing_key:
|
446
448
|
specification_version: 3
|
447
449
|
summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
|