it-logica-application-backbone 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/views/helpers/_build_table.html.erb +8 -4
- data/app/views/helpers/editable_table/_build_table.html.erb +4 -39
- data/app/views/helpers/editable_table/_build_table_ajax_callback_code.html.erb +54 -0
- data/app/views/helpers/editable_table/_build_table_checkbox_functions.html.erb +48 -0
- data/app/views/helpers/editable_table/_build_table_filter.html.erb +0 -53
- data/it-logica-application-backbone.gemspec +3 -1
- data/lib/controller_mixins/csv_instance_methods.rb +37 -0
- data/lib/controller_mixins/renderer_instance_methods.rb +58 -31
- data/lib/model_mixins/table_builder_class_methods.rb +8 -3
- metadata +16 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.2
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<% if settings[:display_method].blank? %>
|
32
32
|
<% if settings[:checkboxes] %>
|
33
33
|
<script type="text/javascript">
|
34
|
-
function submit_in_new_window(form_id) {
|
34
|
+
function submit_in_new_window(form_id, spec_attr_name, spec_attr_value) {
|
35
35
|
var form_original = $("#" + form_id);
|
36
36
|
|
37
37
|
// create new form by cloning without events
|
@@ -43,6 +43,7 @@
|
|
43
43
|
form.attr("target", "_blank");
|
44
44
|
form.attr("action", form_original.attr("action"));
|
45
45
|
form.attr("style", "display: none;");
|
46
|
+
form.attr("id", "");
|
46
47
|
|
47
48
|
// need to append it to browser html, otherwise it wont send in many browsers (with clone it works only with chrome)
|
48
49
|
form_original.after(form);
|
@@ -52,8 +53,8 @@
|
|
52
53
|
|
53
54
|
//Assign different attributes to the element.
|
54
55
|
element.setAttribute("type", "hidden");
|
55
|
-
element.setAttribute("value",
|
56
|
-
element.setAttribute("name",
|
56
|
+
element.setAttribute("value", spec_attr_value);
|
57
|
+
element.setAttribute("name", spec_attr_name);
|
57
58
|
|
58
59
|
//Append the element in form
|
59
60
|
form.append(element);
|
@@ -63,8 +64,11 @@
|
|
63
64
|
}
|
64
65
|
|
65
66
|
</script>
|
66
|
-
<a href="#" class="btn" onclick="submit_in_new_window('<%= settings[:form_id] %>'); return false;"><i class="icon-print"></i>
|
67
|
+
<a href="#" class="btn" onclick="submit_in_new_window('<%= settings[:form_id] %>', '___display_method___', 'print_by_checkboxes'); return false;"><i class="icon-print"></i>
|
67
68
|
Tisknout výběr</a>
|
69
|
+
|
70
|
+
<a href="#" class="btn" onclick="if (confirm('Tato operace může trvat několik minut v této době prosím neobnovujte stránku. Maximální počet řádků pro tisk je 10000. Chcete pokračovat?')){submit_in_new_window('<%= settings[:form_id] %>', '___display_method___', 'print');} return false;"><i class="icon-print"></i>
|
71
|
+
Tisknout vše dle filtrace</a>
|
68
72
|
<% end %>
|
69
73
|
<% end %>
|
70
74
|
</div>
|
@@ -29,46 +29,8 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
<% end %>
|
32
|
+
<%= render :partial => "/helpers/editable_table/build_table_checkbox_functions", :locals => {:settings => settings} %>
|
32
33
|
|
33
|
-
<% if settings[:display_method].blank? %>
|
34
|
-
<% if settings[:checkboxes] %>
|
35
|
-
<script type="text/javascript">
|
36
|
-
function submit_in_new_window(form_id) {
|
37
|
-
var form_original = $("#" + form_id);
|
38
|
-
|
39
|
-
// create new form by cloning without events
|
40
|
-
var form = form_original.clone(false)
|
41
|
-
|
42
|
-
// disabling ajax
|
43
|
-
form.removeAttr("data-remote");
|
44
|
-
|
45
|
-
form.attr("target", "_blank");
|
46
|
-
form.attr("action", form_original.attr("action"));
|
47
|
-
form.attr("style", "display: none;");
|
48
|
-
|
49
|
-
// need to append it to browser html, otherwise it wont send in many browsers (with clone it works only with chrome)
|
50
|
-
form_original.after(form);
|
51
|
-
|
52
|
-
//Create an input type dynamically.
|
53
|
-
var element = document.createElement("input");
|
54
|
-
|
55
|
-
//Assign different attributes to the element.
|
56
|
-
element.setAttribute("type", "hidden");
|
57
|
-
element.setAttribute("value", "print_by_checkboxes");
|
58
|
-
element.setAttribute("name", "___display_method___");
|
59
|
-
|
60
|
-
//Append the element in form
|
61
|
-
form.append(element);
|
62
|
-
|
63
|
-
form.submit();
|
64
|
-
form.remove();
|
65
|
-
}
|
66
|
-
|
67
|
-
</script>
|
68
|
-
<a href="#" class="btn" onclick="submit_in_new_window('<%= settings[:form_id] %>'); return false;"><i class="icon-print"></i>
|
69
|
-
Tisknout výběr</a>
|
70
|
-
<% end %>
|
71
|
-
<% end %>
|
72
34
|
</div>
|
73
35
|
</div>
|
74
36
|
<% end %>
|
@@ -124,5 +86,8 @@
|
|
124
86
|
EditableTableModalDialog.init('modal_cell_editing')
|
125
87
|
</script>
|
126
88
|
|
89
|
+
<%# moved here, document ready removed, it has been called when printed etc, ready is called event when form is send to target _blank %>
|
90
|
+
<%= render :partial => "/helpers/editable_table/build_table_ajax_callback_code", :locals => {:settings => settings} %>
|
91
|
+
|
127
92
|
|
128
93
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
|
3
|
+
<% if settings[:template].blank? %>
|
4
|
+
ladas_loading_show();
|
5
|
+
var initial_parsed_data = jQuery.parseJSON('<%= j settings.to_json.html_safe %>');
|
6
|
+
|
7
|
+
var html_from_json = EditableTableBuilder.render_tbody(initial_parsed_data);
|
8
|
+
TableSummaries.refresh(initial_parsed_data);
|
9
|
+
|
10
|
+
$("#<%= settings[:form_id] %>_ajax_content").html(html_from_json);
|
11
|
+
apply_modifiers_of_the_table($("#<%= settings[:form_id] %>_ajax_content"));
|
12
|
+
EditableTableAligner.align_table(initial_parsed_data, false);
|
13
|
+
ladas_loading_hide();
|
14
|
+
<% end %>
|
15
|
+
formatLinkForPaginationURL('<%= settings[:form_id] %>');
|
16
|
+
FilterChangeMarker.mark_active_filters('<%= settings[:form_id] %>');
|
17
|
+
|
18
|
+
|
19
|
+
$("#<%= settings[:form_id] %>")
|
20
|
+
.live("ajax:beforeSend", function (evt, xhr, settings) {
|
21
|
+
ladas_loading_show();
|
22
|
+
})
|
23
|
+
.live("ajax:complete", function (evt, xhr, status) {
|
24
|
+
var parsed_response = jQuery.parseJSON(xhr.responseText);
|
25
|
+
|
26
|
+
|
27
|
+
//console.log(parsed_response);
|
28
|
+
//console.log(parsed_response['settings']);
|
29
|
+
$(".<%= settings[:form_id] %>_ajax_pager").html(parsed_response['paginate']);
|
30
|
+
|
31
|
+
//console.log(ladas_build_table('template-ajax-table', parsed_response));
|
32
|
+
<% if settings[:template].blank? %>
|
33
|
+
var parsed_settings = jQuery.parseJSON(parsed_response['settings'])
|
34
|
+
var html_from_json = EditableTableBuilder.render_tbody(parsed_settings);
|
35
|
+
console.log("created")
|
36
|
+
TableSummaries.refresh(parsed_settings);
|
37
|
+
console.log("summaries")
|
38
|
+
|
39
|
+
$("#<%= settings[:form_id] %>_ajax_content").html(html_from_json);
|
40
|
+
apply_modifiers_of_the_table($("#<%= settings[:form_id] %>_ajax_content"));
|
41
|
+
EditableTableAligner.align_table(parsed_settings, true);
|
42
|
+
console.log("aligned")
|
43
|
+
|
44
|
+
<% else %>
|
45
|
+
var raw_html = parsed_response['settings']
|
46
|
+
$("#<%= settings[:form_id] %>_ajax_content").html(raw_html);
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
ladas_loading_hide();
|
50
|
+
formatLinkForPaginationURL('<%= settings[:form_id] %>');
|
51
|
+
})
|
52
|
+
|
53
|
+
</script>
|
54
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<% if settings[:display_method].blank? %>
|
2
|
+
<% if settings[:checkboxes] %>
|
3
|
+
<script type="text/javascript">
|
4
|
+
function submit_form_in_new_window(form_id, spec_attr_name, spec_attr_value) {
|
5
|
+
var form_original = $("#" + form_id);
|
6
|
+
|
7
|
+
// create new form by cloning without events
|
8
|
+
var form = form_original.clone(false)
|
9
|
+
|
10
|
+
// disabling ajax
|
11
|
+
form.removeAttr("data-remote");
|
12
|
+
|
13
|
+
form.attr("target", "_blank");
|
14
|
+
form.attr("action", form_original.attr("action"));
|
15
|
+
form.attr("style", "display: none;");
|
16
|
+
form.attr("id", "");
|
17
|
+
|
18
|
+
// need to append it to browser html, otherwise it wont send in many browsers (with clone it works only with chrome)
|
19
|
+
form_original.after(form);
|
20
|
+
|
21
|
+
//Create an input type dynamically.
|
22
|
+
var element = document.createElement("input");
|
23
|
+
|
24
|
+
//Assign different attributes to the element.
|
25
|
+
element.setAttribute("type", "hidden");
|
26
|
+
element.setAttribute("value", spec_attr_value);
|
27
|
+
element.setAttribute("name", spec_attr_name);
|
28
|
+
|
29
|
+
//Append the element in form
|
30
|
+
form.append(element);
|
31
|
+
|
32
|
+
form.submit();
|
33
|
+
form.remove();
|
34
|
+
}
|
35
|
+
|
36
|
+
</script>
|
37
|
+
<a href="#" class="btn" onclick="submit_form_in_new_window('<%= settings[:form_id] %>', '___display_method___', 'print_by_checkboxes'); return false;"><i class="icon-print"></i>
|
38
|
+
Tisknout výběr</a>
|
39
|
+
|
40
|
+
<a href="#" class="btn" onclick="submit_form_in_new_window('<%= settings[:form_id] %>', '___export_method___', 'csv_by_checkboxes'); return false;"><i class="icon-download-alt"></i>
|
41
|
+
Exportovat výběr do CSV</a>
|
42
|
+
|
43
|
+
<a href="#" class="btn" onclick="if (confirm('Tato operace může trvat několik minut v této době prosím neobnovujte stránku. Maximální počet řádků pro tisk je 10000. Chcete pokračovat?')){submit_form_in_new_window('<%= settings[:form_id] %>', '___display_method___', 'print');} return false;"><i class="icon-print"></i>
|
44
|
+
Tisknout vše dle filtrace</a>
|
45
|
+
<a href="#" class="btn" onclick="if (confirm('Tato operace může trvat několik minut v této době prosím neobnovujte stránku. Maximální počet řádků pro export je 50000. Chcete pokračovat?')){submit_form_in_new_window('<%= settings[:form_id] %>', '___export_method___', 'csv');} return false;"><i class="icon-download-alt"></i>
|
46
|
+
Exportovat vše do CSV dle filtrace</a>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
@@ -14,57 +14,4 @@
|
|
14
14
|
|
15
15
|
<%# end %>
|
16
16
|
|
17
|
-
<%#= javascript_include_tag '/assets/backbone_js/tmpl.min.js' %>
|
18
|
-
<script type="text/javascript">
|
19
|
-
$(document).ready(function () {
|
20
|
-
<% if settings[:template].blank? %>
|
21
|
-
ladas_loading_show();
|
22
|
-
var initial_parsed_data = jQuery.parseJSON('<%= j settings.to_json.html_safe %>');
|
23
|
-
var html_from_json = EditableTableBuilder.render_tbody(initial_parsed_data);
|
24
|
-
TableSummaries.refresh(initial_parsed_data);
|
25
|
-
|
26
|
-
$("#<%= settings[:form_id] %>_ajax_content").html(html_from_json);
|
27
|
-
apply_modifiers_of_the_table($("#<%= settings[:form_id] %>_ajax_content"));
|
28
|
-
EditableTableAligner.align_table(initial_parsed_data, false);
|
29
|
-
ladas_loading_hide();
|
30
|
-
<% end %>
|
31
|
-
formatLinkForPaginationURL('<%= settings[:form_id] %>');
|
32
|
-
FilterChangeMarker.mark_active_filters('<%= settings[:form_id] %>');
|
33
|
-
|
34
|
-
|
35
|
-
$("#<%= settings[:form_id] %>")
|
36
|
-
.live("ajax:beforeSend", function (evt, xhr, settings) {
|
37
|
-
ladas_loading_show();
|
38
|
-
})
|
39
|
-
.live("ajax:complete", function (evt, xhr, status) {
|
40
|
-
var parsed_response = jQuery.parseJSON(xhr.responseText);
|
41
|
-
|
42
|
-
//console.log(xhr.responseText)
|
43
|
-
//console.log(parsed_response);
|
44
|
-
//console.log(parsed_response['settings']);
|
45
|
-
$(".<%= settings[:form_id] %>_ajax_pager").html(parsed_response['paginate']);
|
46
|
-
|
47
|
-
//console.log(ladas_build_table('template-ajax-table', parsed_response));
|
48
|
-
<% if settings[:template].blank? %>
|
49
|
-
var parsed_settings = jQuery.parseJSON(parsed_response['settings'])
|
50
|
-
var html_from_json = EditableTableBuilder.render_tbody(parsed_settings);
|
51
|
-
console.log("created")
|
52
|
-
TableSummaries.refresh(parsed_settings);
|
53
|
-
console.log("summaries")
|
54
|
-
|
55
|
-
$("#<%= settings[:form_id] %>_ajax_content").html(html_from_json);
|
56
|
-
apply_modifiers_of_the_table($("#<%= settings[:form_id] %>_ajax_content"));
|
57
|
-
EditableTableAligner.align_table(parsed_settings, true);
|
58
|
-
console.log("aligned")
|
59
|
-
|
60
|
-
<% else %>
|
61
|
-
var raw_html = parsed_response['settings']
|
62
|
-
$("#<%= settings[:form_id] %>_ajax_content").html(raw_html);
|
63
|
-
<% end %>
|
64
|
-
|
65
|
-
ladas_loading_hide();
|
66
|
-
formatLinkForPaginationURL('<%= settings[:form_id] %>');
|
67
|
-
})
|
68
|
-
});
|
69
|
-
</script>
|
70
17
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "it-logica-application-backbone"
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ladas"]
|
@@ -499,6 +499,8 @@ Gem::Specification.new do |s|
|
|
499
499
|
"app/views/helpers/_build_table_wrapper.html.erb",
|
500
500
|
"app/views/helpers/editable_table/_build_ajax_callback_code.html.erb",
|
501
501
|
"app/views/helpers/editable_table/_build_table.html.erb",
|
502
|
+
"app/views/helpers/editable_table/_build_table_ajax_callback_code.html.erb",
|
503
|
+
"app/views/helpers/editable_table/_build_table_checkbox_functions.html.erb",
|
502
504
|
"app/views/helpers/editable_table/_build_table_data.html.erb",
|
503
505
|
"app/views/helpers/editable_table/_build_table_filter.html.erb",
|
504
506
|
"app/views/helpers/editable_table/_build_table_header.html.erb",
|
@@ -13,5 +13,42 @@ module ControllerMixins
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
def generate_and_return_csv(csv_array, name = "export.csv", encoding = "UTF-8", delimiter = ";")
|
18
|
+
csv = CSV.generate(encoding: encoding, col_sep: delimiter, force_quotes: true) do |csv|
|
19
|
+
csv_array.each do |row|
|
20
|
+
csv << row
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
#Then spit out the csv with BOM as the response:
|
25
|
+
csv = "\xEF\xBB\xBF".force_encoding("UTF-8") + csv if ["UTF-8"].include?(encoding)
|
26
|
+
|
27
|
+
csv = "\xFF\xFE".force_encoding("UTF-16LE") + csv if ["UTF-16LE"].include?(encoding)
|
28
|
+
|
29
|
+
|
30
|
+
send_data csv, :type => 'text/csv', :filename => name #,:disposition => 'attachment'
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_data_for_csv_from_settings(settings, encoding = "UTF-8")
|
34
|
+
data_for_csv = []
|
35
|
+
header_of_names = []
|
36
|
+
header_of_labels = []
|
37
|
+
settings[:columns].each do |c|
|
38
|
+
header_of_names << c[:name].to_s.encode(encoding, "UTF-8")
|
39
|
+
header_of_labels << c[:label].to_s.encode(encoding, "UTF-8")
|
40
|
+
end
|
41
|
+
data_for_csv << header_of_names
|
42
|
+
data_for_csv << header_of_labels
|
43
|
+
|
44
|
+
settings[:data].each do |c|
|
45
|
+
row = []
|
46
|
+
c.each_pair do |name, value|
|
47
|
+
row << value.to_s.encode(encoding, "UTF-8")
|
48
|
+
end
|
49
|
+
data_for_csv << row
|
50
|
+
end
|
51
|
+
data_for_csv
|
52
|
+
end
|
16
53
|
end
|
17
54
|
end
|
@@ -13,30 +13,35 @@ module ControllerMixins
|
|
13
13
|
|
14
14
|
render :layout => "print", :action => :index
|
15
15
|
else
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
default_params = @settings[:default].dup
|
20
|
-
default_params[:order_by] = @settings[:default][:order_by] + " " + @settings[:default][:order_by_direction] if !@settings[:default][:order_by].blank? && !@settings[:default][:order_by_direction].blank?
|
21
|
-
default_params[:order_by] = @settings[:default][:order] if !@settings[:default][:order].blank?
|
22
|
-
end
|
23
|
-
|
24
|
-
@settings = class_obj.prepare_settings(logged_user, data, @settings, default_params)
|
25
|
-
if !params.blank? && params["clear"]
|
26
|
-
session["#{@settings[:form_id]}_params"] = ""
|
27
|
-
render :layout => false, :action => :index
|
28
|
-
else
|
29
|
-
@paginate = render_to_string(:partial => "/helpers/build_table_pager", :locals => {:settings => @settings})
|
30
|
-
session["#{@settings[:form_id]}_params"] = params
|
31
|
-
if @settings[:template].blank?
|
32
|
-
# if there is no template a will return json and tbody renders in javascript template
|
33
|
-
returned_t_body = @settings.to_json
|
16
|
+
case params["___export_method___"]
|
17
|
+
when "csv"
|
18
|
+
@settings = class_obj.prepare_settings(logged_user, data, @settings, default_params)
|
34
19
|
else
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
20
|
+
# default print of table
|
21
|
+
default_params = params
|
22
|
+
if !params.blank? && params["clear"]
|
23
|
+
default_params = @settings[:default].dup
|
24
|
+
default_params[:order_by] = @settings[:default][:order_by] + " " + @settings[:default][:order_by_direction] if !@settings[:default][:order_by].blank? && !@settings[:default][:order_by_direction].blank?
|
25
|
+
default_params[:order_by] = @settings[:default][:order] if !@settings[:default][:order].blank?
|
26
|
+
end
|
27
|
+
|
28
|
+
@settings = class_obj.prepare_settings(logged_user, data, @settings, default_params)
|
29
|
+
if !params.blank? && params["clear"]
|
30
|
+
session["#{@settings[:form_id]}_params"] = ""
|
31
|
+
render :layout => false, :action => :index
|
32
|
+
else
|
33
|
+
@paginate = render_to_string(:partial => "/helpers/build_table_pager", :locals => {:settings => @settings})
|
34
|
+
session["#{@settings[:form_id]}_params"] = params
|
35
|
+
if @settings[:template].blank?
|
36
|
+
# if there is no template a will return json and tbody renders in javascript template
|
37
|
+
returned_t_body = @settings.to_json
|
38
|
+
else
|
39
|
+
# or there is template so i will return template rendered here in ruby
|
40
|
+
returned_t_body = render_to_string(:partial => @settings[:template], :locals => {:settings => @settings})
|
41
|
+
end
|
42
|
+
|
43
|
+
render :layout => false, :json => {:settings => returned_t_body, :paginate => @paginate}.to_json
|
44
|
+
end
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
@@ -69,6 +74,13 @@ module ControllerMixins
|
|
69
74
|
default_params = set_default_params(filter_method, show_table_method, settings)
|
70
75
|
|
71
76
|
case display_method
|
77
|
+
when "print"
|
78
|
+
# vyjímka pro tisk tabulek
|
79
|
+
# printing page, it should be opened in new window
|
80
|
+
settings[:display_method] = display_method
|
81
|
+
settings = class_obj.prepare_settings(logged_user, data, settings, default_params, nil, 10000)
|
82
|
+
|
83
|
+
render_table_for_printing(settings, show_table_method)
|
72
84
|
when "print_by_checkboxes"
|
73
85
|
# vyjímka pro tisk tabulek
|
74
86
|
# printing page, it should be opened in new window
|
@@ -78,17 +90,28 @@ module ControllerMixins
|
|
78
90
|
|
79
91
|
render_table_for_printing(settings, show_table_method)
|
80
92
|
else
|
81
|
-
|
93
|
+
case export_method
|
94
|
+
when "csv"
|
95
|
+
@settings = class_obj.prepare_settings(logged_user, data, @settings, default_params ,nil, 50000)
|
96
|
+
generate_and_return_csv(get_data_for_csv_from_settings(@settings))
|
97
|
+
when "csv_by_checkboxes"
|
98
|
+
settings[:filter_method] = "only_by_checkboxes"
|
99
|
+
@settings = class_obj.prepare_settings(logged_user, data, @settings, default_params)
|
100
|
+
generate_and_return_csv(get_data_for_csv_from_settings(@settings))
|
101
|
+
else
|
82
102
|
|
83
|
-
|
84
|
-
if is_filtering?(filter_method)
|
103
|
+
settings = class_obj.prepare_settings(logged_user, data, settings, default_params)
|
85
104
|
|
86
|
-
|
87
|
-
|
88
|
-
else # Ostatni filtry
|
89
|
-
render_tbody_on_filter(settings)
|
90
|
-
end
|
105
|
+
# Filtrovani se renderuje zde
|
106
|
+
if is_filtering?(filter_method)
|
91
107
|
|
108
|
+
if clear_filter? # Tlacitko Smazat filtr
|
109
|
+
render_table_on_clear_filter(settings, show_table_method)
|
110
|
+
else # Ostatni filtry
|
111
|
+
render_tbody_on_filter(settings)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
92
115
|
end
|
93
116
|
end
|
94
117
|
|
@@ -133,6 +156,10 @@ module ControllerMixins
|
|
133
156
|
params["___display_method___"]
|
134
157
|
end
|
135
158
|
|
159
|
+
def export_method
|
160
|
+
params["___export_method___"]
|
161
|
+
end
|
162
|
+
|
136
163
|
def default_params_for_clear_filter(settings)
|
137
164
|
default_params = settings[:default].dup
|
138
165
|
default_params[:order_by] = settings[:default][:order_by] + " " + settings[:default][:order_by_direction] if !settings[:default][:order_by].blank? && !settings[:default][:order_by_direction].blank?
|
@@ -6,7 +6,7 @@ module ModelMixins
|
|
6
6
|
end
|
7
7
|
|
8
8
|
|
9
|
-
def prepare_settings(logged_user, object, settings, params, per_page = 10)
|
9
|
+
def prepare_settings(logged_user, object, settings, params, per_page = 10, forced_per_page = nil)
|
10
10
|
params[:page] = 1 if params[:page].blank?
|
11
11
|
params[:order_by] = settings[:default][:order_by] + " " + settings[:default][:order_by_direction] if params[:order_by].blank? && !settings[:default][:order_by].blank? && !settings[:default][:order_by_direction].blank?
|
12
12
|
|
@@ -27,6 +27,8 @@ module ModelMixins
|
|
27
27
|
params[:per_page] = settings[:default][:per_page] if params[:per_page].blank? && !settings[:default][:per_page].blank?
|
28
28
|
end
|
29
29
|
params[:per_page] = per_page if params[:per_page].blank?
|
30
|
+
# forcing per page for print, export of all, etc., there will be maximum, later I can add ___unlimited___
|
31
|
+
params[:per_page] = forced_per_page unless forced_per_page.blank?
|
30
32
|
per_page = params[:per_page]
|
31
33
|
|
32
34
|
|
@@ -57,7 +59,10 @@ module ModelMixins
|
|
57
59
|
if !col[:summarize_page].blank? && col[:summarize_page]
|
58
60
|
# mysql SUM of the collumn on the page
|
59
61
|
# passing all_items.total_entries because I don't want it to count again
|
60
|
-
|
62
|
+
if all_items.class.kind_of?(WillPaginate::Collection)
|
63
|
+
# if this is not will paginate collection, it means there is no pagination, so there wont be summary of page
|
64
|
+
col[:summarize_page_value] = sumarize(object, col, object.filter(object, settings, params, per_page, all_items.total_entries).selection(settings))
|
65
|
+
end
|
61
66
|
end
|
62
67
|
|
63
68
|
if !col[:summarize_all].blank? && col[:summarize_all]
|
@@ -574,7 +579,7 @@ module ModelMixins
|
|
574
579
|
end
|
575
580
|
|
576
581
|
# if model has cell colors
|
577
|
-
|
582
|
+
|
578
583
|
if (object_class.new.respond_to?(:editable_table_cell_colors))
|
579
584
|
cell_colors = EditableTableCellColor.where(:owner_type => object_class.to_s, :owner_id => all_items_row_ids).all
|
580
585
|
cell_colors_for_settings = {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: it-logica-application-backbone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-11-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: htmlentities
|
16
|
-
requirement: &
|
16
|
+
requirement: &78669540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *78669540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &78669200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *78669200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &78668900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.12'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *78668900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &78668580 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *78668580
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &78668130 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.8.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *78668130
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &78667730 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *78667730
|
80
80
|
description: longer description of your gem
|
81
81
|
email: ladislav.smola@it-logica.cz
|
82
82
|
executables: []
|
@@ -567,6 +567,8 @@ files:
|
|
567
567
|
- app/views/helpers/_build_table_wrapper.html.erb
|
568
568
|
- app/views/helpers/editable_table/_build_ajax_callback_code.html.erb
|
569
569
|
- app/views/helpers/editable_table/_build_table.html.erb
|
570
|
+
- app/views/helpers/editable_table/_build_table_ajax_callback_code.html.erb
|
571
|
+
- app/views/helpers/editable_table/_build_table_checkbox_functions.html.erb
|
570
572
|
- app/views/helpers/editable_table/_build_table_data.html.erb
|
571
573
|
- app/views/helpers/editable_table/_build_table_filter.html.erb
|
572
574
|
- app/views/helpers/editable_table/_build_table_header.html.erb
|
@@ -615,7 +617,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
615
617
|
version: '0'
|
616
618
|
segments:
|
617
619
|
- 0
|
618
|
-
hash: -
|
620
|
+
hash: -911255711
|
619
621
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
620
622
|
none: false
|
621
623
|
requirements:
|