it-logica-application-backbone 1.2.24 → 1.2.25

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.24
1
+ 1.2.25
@@ -9,22 +9,74 @@
9
9
  // }
10
10
  //
11
11
  //
12
- var submit_timestamp = {};
13
- function form_submit_watcher(watched_form_id) {
12
+ var submit_timestamp = {};
13
+ function form_submit_watcher(watched_form_id) {
14
14
  // console.log(watched_form_id);
15
15
  // console.log(submit_timestamp)
16
- //ladas_loading_show();
17
- //console.log("uaaa")
18
- FilterChangeMarker.mark_active_filters(watched_form_id);
16
+ //ladas_loading_show();
17
+ //console.log("uaaa")
18
+ FilterChangeMarker.mark_active_filters(watched_form_id);
19
19
 
20
- clearTimeout(submit_timestamp[watched_form_id]);
21
- submit_timestamp[watched_form_id] = setTimeout(function() { form_submit(watched_form_id) }, 1000);
20
+ clearTimeout(submit_timestamp[watched_form_id]);
21
+ submit_timestamp[watched_form_id] = setTimeout(function () {
22
+ form_submit(watched_form_id)
23
+ }, 1000);
22
24
 
23
- }
24
- function form_submit(watched_form_id) {
25
+ }
26
+ function form_submit(watched_form_id) {
25
27
  // console.log("submiting")
26
28
  // console.log(watched_form_id);
27
- $("#"+watched_form_id).submit();
28
- }
29
+ $("#" + watched_form_id).submit();
30
+ }
29
31
  //
30
- //})(jQuery);
32
+ //})(jQuery);
33
+
34
+
35
+ function submit_spec(form_id, spec_attr_name, spec_attr_value, options) {
36
+ // todo make all options by parameter
37
+ var form = $("#" + form_id);
38
+ // var form_original = $("#" + form_id);
39
+
40
+ // create new form by cloning without events
41
+ // var form = form_original.clone(false)
42
+ //
43
+ // // disabling ajax
44
+ // form.removeAttr("data-remote");
45
+ //
46
+ // form.attr("target", "_blank");
47
+ // form.attr("action", form_original.attr("action"));
48
+ // form.attr("style", "display: none;");
49
+ // form.attr("id", "");
50
+ //
51
+ // // need to append it to browser html, otherwise it wont send in many browsers (with clone it works only with chrome)
52
+ // form_original.after(form);
53
+
54
+ //Create an input type dynamically.
55
+ var element = document.createElement("input");
56
+
57
+ //Assign different attributes to the element.
58
+ element.setAttribute("type", "hidden");
59
+ element.setAttribute("value", spec_attr_value);
60
+ element.setAttribute("name", spec_attr_name);
61
+
62
+ //Append the element in form
63
+ form.append(element);
64
+
65
+ form.submit();
66
+ // form.remove();
67
+ }
68
+
69
+ function on_clear_table_fill_attrs(link, form_id) {
70
+
71
+ var checkbox_pool = $("#" + form_id + "_checkbox_pool").val();
72
+
73
+ // attrs I want to send when clearing form
74
+ var data = link.data("post");
75
+
76
+ data["clear"] = true;
77
+ data["checkbox_pool"] = checkbox_pool;
78
+
79
+ link.data("post", data);
80
+ }
81
+
82
+
@@ -1,5 +1,5 @@
1
1
  <div class="page">
2
- <%= render :partial => "/helpers/editable_table/build_table_text_description", :locals => {:settings => settings} %>
2
+ <%= render :partial => "/helpers/build_table_text_description", :locals => {:settings => settings} %>
3
3
  </div>
4
4
  <% if settings[:display_method]=="print_by_checkboxes" %>
5
5
  <div class="print-window-buttons" style="float:right">
@@ -22,21 +22,59 @@
22
22
  <% if settings[:checkboxes] %>
23
23
  <span>Vybráno: <strong>
24
24
  <span title="Počet označených řádků na všech stránkách" id="<%= settings[:form_id]+ "_active_checkboxes_count" %>">
25
- <%= !settings[:params]["checkbox_pool"].blank? ? settings[:params]["checkbox_pool"].split(",").count : 0 %>
25
+ <%= !settings[:params][:checkbox_pool].blank? ? settings[:params][:checkbox_pool].split(",").count : 0 %>
26
26
  </span>
27
27
  </strong>
28
28
  </span>
29
+ <% end %>
29
30
 
31
+ <% if settings[:display_method].blank? %>
32
+ <% if settings[:checkboxes] %>
33
+ <script type="text/javascript">
34
+ function submit_in_new_window(form_id, spec_attr_name, spec_attr_value) {
35
+ var form_original = $("#" + form_id);
30
36
 
31
- <% end %>
32
- <%= render :partial => "/helpers/editable_table/build_table_checkbox_functions", :locals => {:settings => settings} %>
37
+ // create new form by cloning without events
38
+ var form = form_original.clone(false)
39
+
40
+ // disabling ajax
41
+ form.removeAttr("data-remote");
42
+
43
+ form.attr("target", "_blank");
44
+ form.attr("action", form_original.attr("action"));
45
+ form.attr("style", "display: none;");
46
+ form.attr("id", "");
47
+
48
+ // need to append it to browser html, otherwise it wont send in many browsers (with clone it works only with chrome)
49
+ form_original.after(form);
50
+
51
+ //Create an input type dynamically.
52
+ var element = document.createElement("input");
53
+
54
+ //Assign different attributes to the element.
55
+ element.setAttribute("type", "hidden");
56
+ element.setAttribute("value", spec_attr_value);
57
+ element.setAttribute("name", spec_attr_name);
33
58
 
59
+ //Append the element in form
60
+ form.append(element);
61
+
62
+ form.submit();
63
+ form.remove();
64
+ }
65
+
66
+ </script>
67
+ <a href="#" class="btn print print_by_checkboxes" onclick="submit_in_new_window('<%= settings[:form_id] %>', '___display_method___', 'print_by_checkboxes'); return false;"><i class="icon-print"></i>&nbsp;
68
+ Tisknout výběr</a>
69
+
70
+ <a href="#" class="btn print print_by_filter" 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>&nbsp;
71
+ Tisknout vše dle filtrace</a>
72
+ <% end %>
73
+ <% end %>
34
74
  </div>
35
75
  </div>
36
76
  <% end %>
37
-
38
- <%= yield :table_form_tabs_above_form %>
39
- <%= form_tag settings[:filter_path], :html => {:'data-type' => 'html'}, :method => 'POST', :class => 'well dataGrid no_hover editable_table', :remote => true, :id => settings[:form_id] do |f| %>
77
+ <%= form_tag settings[:filter_path], :html => {:'data-type' => 'html'}, :method => 'POST', :class => 'well dataGrid', :remote => true, :id => settings[:form_id] do |f| %>
40
78
  <% if settings[:display_method].blank? %>
41
79
  <% if content_for?(:table_form) %>
42
80
  <%= yield :table_form %>
@@ -44,52 +82,28 @@
44
82
  <% end %>
45
83
 
46
84
  <fieldset>
47
- <%= render :partial => "/helpers/editable_table/build_table_filter", :locals => {:settings => settings} %>
85
+ <%= render :partial => "/helpers/build_table_filter", :locals => {:settings => settings} %>
48
86
 
49
87
  <% if settings[:display_method].blank? %>
50
88
  <% unless settings[:per_page].blank? %>
51
- <span class="select_for_per_page" style="float: right">Zobrazit na stránku: <%= select_tag("per_page_chosen", options_for_select(settings[:per_page], settings[:params]['per_page'].to_i),
52
- :onchange => "form_submit_watcher('#{settings[:form_id]}')",
53
- :class => "") %></span>
89
+ <span class="select_for_per_page" style="float: right">Zobrazit na stránku: <%= select_tag("per_page_chosen", options_for_select(settings[:per_page], settings[:params]['per_page'].to_i),
90
+ :onchange => "form_submit_watcher('#{settings[:form_id]}')",
91
+ :class => "") %></span>
54
92
  <% end %>
55
93
 
94
+
95
+
56
96
  <div class="<%= settings[:form_id] + '_ajax_pager' %>">
57
- <%= render :partial => 'helpers/editable_table/build_table_pager', :locals => {:settings => settings, :placement => "placement-up"} %>
97
+ <%= render :partial => 'helpers/build_table_pager', :locals => {:settings => settings, :placement => "placement-up"} %>
58
98
  </div>
59
-
60
99
  <% end %>
61
100
 
62
- <%= render :partial => "/helpers/editable_table/build_table_wrapper", :locals => {:settings => settings} %>
101
+ <%= render :partial => "/helpers/build_table_wrapper", :locals => {:settings => settings} %>
63
102
 
64
103
  <% if settings[:display_method].blank? %>
65
- <div class="<%= settings[:form_id] + '_ajax_pager' %>">
66
- <%= render :partial => 'helpers/editable_table/build_table_pager', :locals => {:settings => settings, :placement => "placement-down"} %>
104
+ <div class="<%= settings[:form_id] + '_ajax_pager' %> parent-filter-paging placement-down">
105
+ <%= render :partial => 'helpers/build_table_pager', :locals => {:settings => settings, :placement => "placement-down"} %>
67
106
  </div>
68
107
  <% end %>
69
108
  </fieldset>
70
- <% end %>
71
-
72
-
73
-
74
- <div id="modal_cell_editing" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
75
- <!--<div class="modal-header">-->
76
- <!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>-->
77
- <!--<h3 id="myModalLabel">Modal header</h3>-->
78
- <!--</div>-->
79
- <!--<div class="modal-body">-->
80
- <!--<p>One fine body…</p>-->
81
- <!--</div>-->
82
- <!--<div class="modal-footer">-->
83
- <!--<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>-->
84
- <!--<button class="btn btn-primary">Save changes</button>-->
85
- <!--</div>-->
86
- </div>
87
- <script type="text/javascript">
88
- EditableTableModalDialog.init('modal_cell_editing')
89
- </script>
90
-
91
- <%# moved here, document ready removed, it has been called when printed etc, ready is called event when form is send to target _blank %>
92
- <%= render :partial => "/helpers/editable_table/build_table_ajax_callback_code", :locals => {:settings => settings} %>
93
-
94
-
95
-
109
+ <% end %>
@@ -1,9 +1,16 @@
1
1
  <div class="filter-paging clearfix <%= placement if defined? placement %>">
2
2
  <div class="reset">
3
- <%= ajax_post_link_to "Smazat filtr", settings[:filter_path],
4
- "data-content_id" => settings[:content_id].blank? ? "" : settings[:content_id],
5
- :class => "btn",
6
- "data-post" => {:clear => true}.to_json %>
3
+ <%= link_to "Smazat filtr", settings[:filter_path],
4
+ "data-content_id" => settings[:content_id].blank? ? "" : settings[:content_id],
5
+ :class => "btn",
6
+ "data-post" => {:clear => true}.to_json,
7
+ "onclick" => "on_clear_table_fill_attrs($(this), '#{settings[:form_id]}'); parse_link_and_post($(this)); return false;"
8
+ %>
9
+ <%#= link_to "Smazat filtr", "#",
10
+ "data-content_id" => settings[:content_id].blank? ? "" : settings[:content_id],
11
+ :remote => true,
12
+ :class => "btn",
13
+ :onclick => "submit_spec('#{settings[:form_id]}', 'clear', 'true'); return false;" %>
7
14
  </div>
8
15
 
9
16
  <% if settings[:data_paginate].total_pages > 1 %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "it-logica-application-backbone"
8
- s.version = "1.2.24"
8
+ s.version = "1.2.25"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ladas"]
12
- s.date = "2012-11-26"
12
+ s.date = "2012-12-03"
13
13
  s.description = "longer description of your gem"
14
14
  s.email = "ladislav.smola@it-logica.cz"
15
15
  s.extra_rdoc_files = [
@@ -92,7 +92,7 @@ module ControllerMixins
92
92
  else
93
93
  case export_method
94
94
  when "csv"
95
- @settings = class_obj.prepare_settings(logged_user, data, @settings, default_params ,nil, 50000)
95
+ @settings = class_obj.prepare_settings(logged_user, data, @settings, default_params, nil, 50000)
96
96
  generate_and_return_csv(get_data_for_csv_from_settings(@settings))
97
97
  when "csv_by_checkboxes"
98
98
  settings[:filter_method] = "only_by_checkboxes"
@@ -131,6 +131,7 @@ module ControllerMixins
131
131
 
132
132
  def render_table_on_clear_filter(settings, show_table_method)
133
133
  session["#{settings[:form_id]}_params"] = ""
134
+
134
135
  render :layout => false, :action => (show_table_method.blank? ? :index : show_table_method)
135
136
  end
136
137
 
@@ -164,6 +165,11 @@ module ControllerMixins
164
165
  default_params = settings[:default].dup
165
166
  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?
166
167
  default_params[:order_by] = settings[:default][:order] if !settings[:default][:order].blank?
168
+
169
+ if defined?(ModelMixins::TableBuilderClassMethods::ON_CLEAR_FILTER_CLEAR_CHECKBOXES) && !ModelMixins::TableBuilderClassMethods::ON_CLEAR_FILTER_CLEAR_CHECKBOXES
170
+ default_params[:checkbox_pool] = params["checkbox_pool"]
171
+ end
172
+
167
173
  default_params
168
174
  end
169
175
 
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.24
4
+ version: 1.2.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-26 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: htmlentities
16
- requirement: &72441200 !ruby/object:Gem::Requirement
16
+ requirement: &85304670 !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: *72441200
24
+ version_requirements: *85304670
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &72440740 !ruby/object:Gem::Requirement
27
+ requirement: &85304210 !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: *72440740
35
+ version_requirements: *85304210
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &72440300 !ruby/object:Gem::Requirement
38
+ requirement: &85303750 !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: *72440300
46
+ version_requirements: *85303750
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &72439720 !ruby/object:Gem::Requirement
49
+ requirement: &85303180 !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: *72439720
57
+ version_requirements: *85303180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &72439190 !ruby/object:Gem::Requirement
60
+ requirement: &85302650 !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: *72439190
68
+ version_requirements: *85302650
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &72438820 !ruby/object:Gem::Requirement
71
+ requirement: &85302290 !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: *72438820
79
+ version_requirements: *85302290
80
80
  description: longer description of your gem
81
81
  email: ladislav.smola@it-logica.cz
82
82
  executables: []
@@ -618,7 +618,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
618
618
  version: '0'
619
619
  segments:
620
620
  - 0
621
- hash: -230153933
621
+ hash: -605749421
622
622
  required_rubygems_version: !ruby/object:Gem::Requirement
623
623
  none: false
624
624
  requirements: