it-logica-application-backbone 1.0.38 → 1.0.39

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.38
1
+ 1.0.39
@@ -18,8 +18,8 @@
18
18
  <!--</div>-->
19
19
 
20
20
  <!--<span title="Počet označených řádků na všech stránkách" id="<%#= settings[:form_id]+ "_active_checkboxes_count" %>">-->
21
- <!--<%#= !settings[:params]["checkbox_pool"].blank? ? settings[:params]["checkbox_pool"].split(",").count : 0 %>-->
22
- <!--</span>-->
21
+ <!--<%#= !settings[:params]["checkbox_pool"].blank? ? settings[:params]["checkbox_pool"].split(",").count : 0 %>-->
22
+ <!--</span>-->
23
23
  <!--<br/>-->
24
24
  <input type="checkbox" title="Označit/odznačit vše na stránce" onclick="CheckboxPool.check_or_uncheck_page(this, '<%= settings[:form_id] %>')" id=""/>
25
25
 
@@ -77,6 +77,12 @@
77
77
  <%= text_field_tag "find[#{col[:table]}.#{col[:name]}]", saved_param,
78
78
  {:class => "text first #{settings[:form_id] + '_column_find'}"} %>
79
79
  </div>
80
+ <% when :find_exact %>
81
+ <div class="inputs clearfix">
82
+ <% saved_param = (!settings[:params].blank? && !settings[:params]['find_exact'].blank? && !settings[:params]['find_exact']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['find_exact']["#{col[:table]}.#{col[:name]}"] : "" %>
83
+ <%= text_field_tag "find_exact[#{col[:table]}.#{col[:name]}]", saved_param,
84
+ {:class => "text first #{settings[:form_id] + '_column_find_exact'}"} %>
85
+ </div>
80
86
  <% when :multichoice %>
81
87
  <div class="inputs clearfix">
82
88
  <% saved_param = (!settings[:params].blank? && !settings[:params]['multichoice'].blank? && !settings[:params]['multichoice']["#{col[:table]}.#{col[:name]}"].blank?) ? settings[:params]['multichoice']["#{col[:table]}.#{col[:name]}"] : [] %>
@@ -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.0.38"
8
+ s.version = "1.0.39"
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-09-13"
12
+ s.date = "2012-09-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 = [
@@ -348,6 +348,30 @@ module ModelMixins
348
348
  end
349
349
  end
350
350
 
351
+ if !params.blank? && params['find_exact']
352
+ params['find'].each_pair do |i, v|
353
+ i = i.gsub(/___unknown___\./, "") #some cleaning job
354
+ unless v.blank?
355
+ if i.match(/^.*?non_existing_column___.*$/i)
356
+ puts "It has to be existing column for exact match"
357
+ else
358
+ if i.match(/^.*?___sql_expression___.*$/i)
359
+ i = i.gsub(/___sql_expression___\./, "") #some cleaning job
360
+
361
+ having_cond_str += " AND " unless having_cond_str.blank?
362
+ cond_id = "find_#{i.gsub(/\./, '_')}"
363
+ having_cond_str += "#{i} = :#{cond_id}" #OR guest_email LIKE :find"
364
+ having_cond_hash.merge!({cond_id.to_sym => "%#{v}%"})
365
+ else
366
+ cond_str += " AND " unless cond_str.blank?
367
+ cond_id = "find_#{i.gsub(/\./, '_')}"
368
+ cond_str += "#{i} = :#{cond_id}" #OR guest_email LIKE :find"
369
+ cond_hash.merge!({cond_id.to_sym => "%#{v}%"})
370
+ end
371
+ end
372
+ end
373
+ end
374
+ end
351
375
 
352
376
  # ToDo ladas add having condition to others
353
377
  if !params.blank? && params['multichoice']
@@ -379,7 +403,7 @@ module ModelMixins
379
403
  cond_str += " AND " unless cond_str.blank?
380
404
  cond_id = "date_from_#{i.gsub(/\./, '_')}"
381
405
  cond_str += "#{i} >= :#{cond_id}" #OR guest_email LIKE :find"
382
- v = Time.parse(v) # queries to database has to be in utc date
406
+ v = Time.parse(v) # queries to database has to be in utc date
383
407
  cond_hash.merge!({cond_id.to_sym => "#{v.utc}"})
384
408
  end
385
409
  end
@@ -402,7 +426,7 @@ module ModelMixins
402
426
  cond_str += " AND " unless cond_str.blank?
403
427
  cond_id = "date_to_#{i.gsub(/\./, '_')}"
404
428
  cond_str += "#{i} <= :#{cond_id}" #OR guest_email LIKE :find"
405
- v = Time.parse(v) # queries to database has to be in utc date
429
+ v = Time.parse(v) # queries to database has to be in utc date
406
430
  cond_hash.merge!({cond_id.to_sym => "#{v.utc}"})
407
431
  end
408
432
  end
@@ -50,7 +50,7 @@ class TableSettings
50
50
  end
51
51
 
52
52
  def global_format_method(col_name, fnc_name)
53
- @hash[:global_format_method][:col_name] = fnc_name
53
+ @hash[:global_format_method][col_name] = fnc_name
54
54
  self
55
55
  end
56
56
 
@@ -3,7 +3,7 @@ class TableSettings
3
3
  attr_accessor :table_settings
4
4
 
5
5
  class Column
6
- attr_accessor :column_hash, :index
6
+ attr_accessor :index
7
7
 
8
8
  def initialize(table_settings, index)
9
9
  @table_settings = table_settings
@@ -11,9 +11,12 @@ class TableSettings
11
11
  @index = index
12
12
  end
13
13
 
14
+ def column_hash
15
+ @column_hash
16
+ end
14
17
 
15
18
  def css_class(class_name)
16
- @column_hash[:class_name] = class_name
19
+ @column_hash[:class] = class_name
17
20
 
18
21
  self
19
22
  end
@@ -141,6 +144,28 @@ class TableSettings
141
144
  self
142
145
  end
143
146
 
147
+
148
+ def set_css_class_from_type(model)
149
+ column_params = model.columns_hash[@column_hash[:name]]
150
+ case column_params.type
151
+ when :boolean then css_class("boolean")
152
+ when :datetime then css_class("datetime")
153
+ when :string then css_class("string")
154
+ when :decimal then css_class("decimal")
155
+ else nil
156
+ end
157
+ end
158
+
159
+ #def column_hash
160
+ #
161
+ # unless @column_hash.include?(:class)
162
+ # model = @column_hash[:table].classify.constantize
163
+ # set_css_class_from_type(model) unless model.nil?
164
+ # end
165
+ #
166
+ # @column_hash
167
+ #end
168
+
144
169
  end
145
170
 
146
171
  end
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.0.38
4
+ version: 1.0.39
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-09-13 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: htmlentities
16
- requirement: &73113360 !ruby/object:Gem::Requirement
16
+ requirement: &73736130 !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: *73113360
24
+ version_requirements: *73736130
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &74374670 !ruby/object:Gem::Requirement
27
+ requirement: &74305840 !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: *74374670
35
+ version_requirements: *74305840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &74373650 !ruby/object:Gem::Requirement
38
+ requirement: &74304960 !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: *74373650
46
+ version_requirements: *74304960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &74372990 !ruby/object:Gem::Requirement
49
+ requirement: &74304340 !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: *74372990
57
+ version_requirements: *74304340
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &74372650 !ruby/object:Gem::Requirement
60
+ requirement: &74303970 !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: *74372650
68
+ version_requirements: *74303970
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &74372240 !ruby/object:Gem::Requirement
71
+ requirement: &74303500 !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: *74372240
79
+ version_requirements: *74303500
80
80
  description: longer description of your gem
81
81
  email: ladislav.smola@it-logica.cz
82
82
  executables: []
@@ -578,7 +578,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
578
578
  version: '0'
579
579
  segments:
580
580
  - 0
581
- hash: -147879135
581
+ hash: 484575119
582
582
  required_rubygems_version: !ruby/object:Gem::Requirement
583
583
  none: false
584
584
  requirements: