it-logica-application-backbone 1.3.12 → 1.3.13

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.12
1
+ 1.3.13
@@ -46,8 +46,23 @@
46
46
  <%= text_field_tag "number_to[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text #{settings[:form_id] + '_column_find'}",
47
47
  :onchange => "form_submit_watcher('#{settings[:form_id]}')",
48
48
  :placeholder => "max.",
49
- :title => t('itl-gem.value_has_to_be_bigger_or_equal')} %>
49
+ :title => t('itl-gem.value_has_to_be_lesser_or_equal')} %>
50
50
  </div>
51
+ <% when :number_exact %>
52
+ <div class="inputs range clearfix small_padding">
53
+ <% saved_param = (!settings[:params].blank? && !settings[:params]['number_exact_from'].blank? && !settings[:params]['number_exact_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_exact_from']["#{col[:table]}.#{col[:name]}"] : "" %>
54
+
55
+ <%= text_field_tag "number_exact_from[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text first #{settings[:form_id] + '_column_find'}",
56
+ :onchange => "form_submit_watcher('#{settings[:form_id]}')",
57
+ :placeholder => "min.",
58
+ :title => t('itl-gem.value_has_to_be_bigger_or_equal_or_exact')} %>
59
+ <% saved_param = (!settings[:params].blank? && !settings[:params]['number_exact_to'].blank? && !settings[:params]['number_exact_to']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_exact_to']["#{col[:table]}.#{col[:name]}"] : "" %>
60
+ <%#= label_tag "date_to[#{col[:table]}.#{col[:name]}]", "Do", :class => "datetime_class_label" %>
61
+ <%= text_field_tag "number_exact_to[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text #{settings[:form_id] + '_column_find'}",
62
+ :onchange => "form_submit_watcher('#{settings[:form_id]}')",
63
+ :placeholder => "max.",
64
+ :title => t('itl-gem.value_has_to_be_lesser_or_equal_or_exact')} %>
65
+ </div>
51
66
  <% when :date %>
52
67
  <div class="inputs range clearfix small_padding">
53
68
  <% saved_param = (!settings[:params].blank? && !settings[:params]['date_from'].blank? && !settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"] : "" %>
@@ -56,6 +56,21 @@
56
56
  :placeholder => "max.",
57
57
  :title => "Hodnota musí být menší nebo rovna zadané hodnotě"} %>
58
58
  </div>
59
+ <% when :number_exact %>
60
+ <div class="inputs range clearfix small_padding">
61
+ <% saved_param = (!settings[:params].blank? && !settings[:params]['number_exact_from'].blank? && !settings[:params]['number_exact_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_exact_from']["#{col[:table]}.#{col[:name]}"] : "" %>
62
+
63
+ <%= text_field_tag "number_exact_from[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text first #{settings[:form_id] + '_column_find'}",
64
+ :onchange => "form_submit_watcher('#{settings[:form_id]}')",
65
+ :placeholder => "min.",
66
+ :title => t('itl-gem.value_has_to_be_bigger_or_equal_or_exact')} %>
67
+ <% saved_param = (!settings[:params].blank? && !settings[:params]['number_exact_to'].blank? && !settings[:params]['number_exact_to']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['number_exact_to']["#{col[:table]}.#{col[:name]}"] : "" %>
68
+ <%#= label_tag "date_to[#{col[:table]}.#{col[:name]}]", "Do", :class => "datetime_class_label" %>
69
+ <%= text_field_tag "number_exact_to[#{col[:table]}.#{col[:name]}]", saved_param, {:class => "text #{settings[:form_id] + '_column_find'}",
70
+ :onchange => "form_submit_watcher('#{settings[:form_id]}')",
71
+ :placeholder => "max.",
72
+ :title => t('itl-gem.value_has_to_be_lesser_or_equal_or_exact')} %>
73
+ </div>
59
74
  <% when :date %>
60
75
  <div class="inputs range clearfix small_padding">
61
76
  <% saved_param = (!settings[:params].blank? && !settings[:params]['date_from'].blank? && !settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['date_from']["#{col[:table]}.#{col[:name]}"] : "" %>
@@ -14,6 +14,9 @@ cs:
14
14
  edit_description: Editovat popisek
15
15
  value_has_to_be_bigger_or_equal: Hodnota musí být vetší nebo rovna zadané hodnotě
16
16
  value_has_to_be_lesser_or_equal: Hodnota musí být menší nebo rovna zadané hodnotě
17
+ value_has_to_be_bigger_or_equal_or_exact: Hodnota musí být rovna zadané hodnotě nebo v intervalu <min,max> pokud jsou zadány obě hodnoty min a max.
18
+ value_has_to_be_lesser_or_equal_or_exact: Hodnota musí být rovna zadané hodnotě nebo v intervalu <min,max> pokud jsou zadány obě hodnoty min a max.
19
+
17
20
  date_from: Datum od
18
21
  date_to: Datum do
19
22
  mark_unmark_all_checkboxes: Označit/odznačit vše na stránce
@@ -14,6 +14,9 @@ sk:
14
14
  edit_description: Editovať popis
15
15
  value_has_to_be_bigger_or_equal: Hodnota musí byť väčšia alebo rovná zadanej hodnote
16
16
  value_has_to_be_lesser_or_equal: Hodnota musí byť menšia nebo rovná zadanej hodnote
17
+ value_has_to_be_bigger_or_equal_or_exact: Hodnota sa musí rovnať zadanej hodnote, alebo byť v intervale <min,max>, ak sú hodnoty min a max zadané
18
+ value_has_to_be_lesser_or_equal_or_exact: Hodnota sa musí rovnať zadanej hodnote, alebo byť v intervale <min,max>, ak sú hodnoty min a max zadané
19
+
17
20
  date_from: Dátum od
18
21
  date_to: Dátum do
19
22
  mark_unmark_all_checkboxes: Označiť/odznačit všetko na stránke
@@ -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.3.12"
8
+ s.version = "1.3.13"
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 = "2013-02-19"
12
+ s.date = "2013-03-14"
13
13
  s.description = "longer description of your gem"
14
14
  s.email = "ladislav.smola@it-logica.cz"
15
15
  s.extra_rdoc_files = [
@@ -383,6 +383,49 @@ module ModelMixins
383
383
  select(select_string)
384
384
  end
385
385
 
386
+ def process_number_exact_filter(params)
387
+ # this will divide :number_exact filter into find_exact and number_from - number_to filter
388
+ # the condition is look for interval if there is an interval(2 values given) otherwise look for the exact match
389
+
390
+ if !params.blank?
391
+ number_exact_from = params['number_exact_from'].blank? ? nil : params['number_exact_from'].dup
392
+ number_exact_to = params['number_exact_to'].blank? ? nil : params['number_exact_to'].dup
393
+
394
+ if (!number_exact_from.blank? && !number_exact_to.blank?)
395
+ # if they have whole interval, it will go to number_filter
396
+ number_keys = number_exact_from.keys.delete_if { |x| number_exact_from[x].blank? } &
397
+ number_exact_to.keys.delete_if { |x| number_exact_to[x].blank? }
398
+ number_keys.each do |number_key|
399
+ # move it to number filter
400
+ params['number_from'] ||= {}
401
+ params['number_from'][number_key] = number_exact_from[number_key]
402
+ params['number_to'] ||= {}
403
+ params['number_to'][number_key] = number_exact_to[number_key]
404
+
405
+ # and delete it
406
+ number_exact_from.delete(number_key)
407
+ number_exact_to.delete(number_key)
408
+ end
409
+ end
410
+
411
+ # the ones with whole interval were removed, I will put the rest in find exact
412
+ if (!number_exact_from.blank?)
413
+ params['find_exact'] ||= {}
414
+ number_exact_from.each_pair do |index, value|
415
+ params['find_exact'][index] = value unless value.blank?
416
+ end
417
+ end
418
+
419
+ if (!number_exact_to.blank?)
420
+ params['find_exact'] ||= {}
421
+ number_exact_to.each_pair do |index, value|
422
+ params['find_exact'][index] = value unless value.blank?
423
+ end
424
+ end
425
+ end
426
+ params
427
+ end
428
+
386
429
  def filter(object, settings, params, per_page = 10, total_count = nil)
387
430
  order_by = params[:real_order_by]
388
431
 
@@ -398,6 +441,9 @@ module ModelMixins
398
441
  cond_hash = {:checkboxes => params["checkbox_pool"].split(",")}
399
442
  per_page = nil # no paginate for checkbox filter
400
443
  else
444
+ params = process_number_exact_filter(params)
445
+
446
+
401
447
  # filtering by table filters
402
448
  if !params.blank? && params['find']
403
449
  params['find'].each_pair do |i, v|
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.3.12
4
+ version: 1.3.13
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: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: htmlentities
16
- requirement: &82222620 !ruby/object:Gem::Requirement
16
+ requirement: &69897050 !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: *82222620
24
+ version_requirements: *69897050
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jquery-rails
27
- requirement: &82221660 !ruby/object:Gem::Requirement
27
+ requirement: &69895340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.1.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *82221660
35
+ version_requirements: *69895340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &82219800 !ruby/object:Gem::Requirement
38
+ requirement: &69894290 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *82219800
46
+ version_requirements: *69894290
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &85197770 !ruby/object:Gem::Requirement
49
+ requirement: &72767730 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.12'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *85197770
57
+ version_requirements: *72767730
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &85196770 !ruby/object:Gem::Requirement
60
+ requirement: &72766790 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *85196770
68
+ version_requirements: *72766790
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &85195850 !ruby/object:Gem::Requirement
71
+ requirement: &72765950 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.8.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *85195850
79
+ version_requirements: *72765950
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov
82
- requirement: &85194910 !ruby/object:Gem::Requirement
82
+ requirement: &72764980 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *85194910
90
+ version_requirements: *72764980
91
91
  description: longer description of your gem
92
92
  email: ladislav.smola@it-logica.cz
93
93
  executables: []
@@ -633,7 +633,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
633
633
  version: '0'
634
634
  segments:
635
635
  - 0
636
- hash: -217816723
636
+ hash: -158069183
637
637
  required_rubygems_version: !ruby/object:Gem::Requirement
638
638
  none: false
639
639
  requirements: