it-logica-application-backbone 1.2.5 → 1.2.6
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.6
|
@@ -253,8 +253,8 @@ class EditableTableAligner
|
|
253
253
|
|
254
254
|
@align_table_size: ->
|
255
255
|
|
256
|
-
#
|
257
|
-
#
|
256
|
+
#console.log $(window).width()
|
257
|
+
#console.log $(window).height()
|
258
258
|
# console.log $(document).width()
|
259
259
|
# console.log $(document).height()
|
260
260
|
scroller_size = 16
|
@@ -266,14 +266,14 @@ class EditableTableAligner
|
|
266
266
|
center_width = $(window).width() - left_column_width - scroller_size - width_border
|
267
267
|
table_height = $(window).height() - upper_panel_size
|
268
268
|
|
269
|
-
console.log left_column_width
|
269
|
+
#console.log left_column_width
|
270
270
|
# console.log center_width
|
271
271
|
|
272
272
|
|
273
|
-
$(".tableContainer").css({'width': (left_column_width + center_width + scroller_size + width_border)})
|
273
|
+
$(".tableContainer").css({'width': (left_column_width + center_width + scroller_size + width_border/2)})
|
274
274
|
|
275
|
-
$(".centerContainer .detachedTableContainer").css({'width': (center_width + scroller_size), 'height': (table_height + scroller_size)})
|
276
|
-
$(".centerContainer .scrollTargetContainter").css({'width': center_width })
|
275
|
+
$(".centerContainer .detachedTableContainer").css({'width': (center_width + scroller_size + width_border/4), 'height': (table_height + scroller_size)})
|
276
|
+
$(".centerContainer .scrollTargetContainter").css({'width': (center_width + width_border/4) })
|
277
277
|
|
278
278
|
$(".fixedLeftColumn .detachedTableContainer").css({'height': table_height})
|
279
279
|
$(".fixedLeftColumn table").css({'width': left_column_width})
|
@@ -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.
|
8
|
+
s.version = "1.2.6"
|
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-
|
12
|
+
s.date = "2012-11-07"
|
13
13
|
s.description = "longer description of your gem"
|
14
14
|
s.email = "ladislav.smola@it-logica.cz"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -49,6 +49,9 @@ module ModelMixins
|
|
49
49
|
all_items = items.all # maybe can be done more optimal
|
50
50
|
all_items_row_ids = all_items.collect { |x| x.row_id }.uniq
|
51
51
|
|
52
|
+
# summarization will be in one query, otherwise it takes a lot of time to do it in many
|
53
|
+
summarized_paged_cols = []
|
54
|
+
summarized_all_cols = []
|
52
55
|
|
53
56
|
if settings[:template].blank?
|
54
57
|
# initialize another_global_formats,another_formats and column_methods
|
@@ -61,13 +64,15 @@ module ModelMixins
|
|
61
64
|
# passing all_items.total_entries because I don't want it to count again
|
62
65
|
if all_items.kind_of?(WillPaginate::Collection)
|
63
66
|
# 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))
|
67
|
+
#col[:summarize_page_value] = sumarize(object, col, object.filter(object, settings, params, per_page, all_items.total_entries).selection(settings))
|
68
|
+
summarized_paged_cols << col
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
72
|
if !col[:summarize_all].blank? && col[:summarize_all]
|
69
73
|
# mysql SUM of the collumn off all data
|
70
|
-
col[:summarize_all_value] = sumarize(object, col, object.filter(object, settings, params, false).selection(settings))
|
74
|
+
#col[:summarize_all_value] = sumarize(object, col, object.filter(object, settings, params, false).selection(settings))
|
75
|
+
summarized_all_cols << col
|
71
76
|
end
|
72
77
|
|
73
78
|
|
@@ -96,6 +101,14 @@ module ModelMixins
|
|
96
101
|
end
|
97
102
|
end
|
98
103
|
|
104
|
+
# making all summarizations in 2 queries
|
105
|
+
summarized_paged_cols_arel = nil
|
106
|
+
summarized_all_cols_arel = nil
|
107
|
+
|
108
|
+
summarized_paged_cols_arel = object.filter(object, settings, params, per_page, all_items.total_entries).selection(settings) unless summarized_paged_cols.blank?
|
109
|
+
summarized_all_cols_arel = object.filter(object, settings, params, false).selection(settings) unless summarized_all_cols.blank?
|
110
|
+
make_sumarizations!(object, summarized_paged_cols, summarized_paged_cols_arel, summarized_all_cols, summarized_all_cols_arel)
|
111
|
+
|
99
112
|
|
100
113
|
# same as template_items below, loads objects so column method are better to use
|
101
114
|
# todo think about, but I dont need object, because it's making the same query twice, I just need class and with one outer join it return filtered data, and i include includes to it
|
@@ -223,6 +236,68 @@ module ModelMixins
|
|
223
236
|
settings
|
224
237
|
end
|
225
238
|
|
239
|
+
def make_sumarizations!(object, summarized_paged_cols, paged_cols_arel, summarized_all_cols, all_cols_arel)
|
240
|
+
# make summarizations, will set it in the given cols
|
241
|
+
unless summarized_paged_cols.blank?
|
242
|
+
sumarize_collection!(object, summarized_paged_cols, paged_cols_arel, :page)
|
243
|
+
end
|
244
|
+
unless summarized_all_cols.blank?
|
245
|
+
sumarize_collection!(object, summarized_all_cols, all_cols_arel, :all)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def sumarize_collection!(object, cols, items_arel, type)
|
250
|
+
# make the col_name aliases and the query
|
251
|
+
col_names = {}
|
252
|
+
sum_query = ""
|
253
|
+
cols.each do |col|
|
254
|
+
col_name = col[:name]
|
255
|
+
col_name_alias = col_name + "_sum"
|
256
|
+
|
257
|
+
sum_query += ", " unless sum_query.blank?
|
258
|
+
sum_query += "SUM(#{col_name}) AS #{col_name_alias}"
|
259
|
+
end
|
260
|
+
|
261
|
+
#make the query
|
262
|
+
if object.respond_to?(:klass)
|
263
|
+
mysql_sums = object.klass.find_by_sql("SELECT #{sum_query} FROM (" + items_arel.to_sql + ") counts")
|
264
|
+
else
|
265
|
+
mysql_sums = object.find_by_sql("SELECT #{sum_query} FROM (" + items_arel.to_sql + ") counts")
|
266
|
+
end
|
267
|
+
sums = mysql_sums.first
|
268
|
+
|
269
|
+
# set the summarization results back to cols
|
270
|
+
cols.each do |col|
|
271
|
+
col_name = col[:name]
|
272
|
+
col_name_alias = col_name + "_sum"
|
273
|
+
|
274
|
+
# getting summarization value
|
275
|
+
sum_value = sums[col_name_alias]
|
276
|
+
|
277
|
+
# formating sum_value, if there is formating method
|
278
|
+
format_method = nil
|
279
|
+
format_method = col[:format_method] unless col[:format_method].blank?
|
280
|
+
format_method = col[:global_format_method] unless col[:global_format_method].blank?
|
281
|
+
|
282
|
+
unless format_method.blank?
|
283
|
+
if object.respond_to?(:klass)
|
284
|
+
sum_value = object.klass.new.send(format_method.to_sym, sum_value)
|
285
|
+
else
|
286
|
+
sum_value = object.new.send(format_method.to_sym, sum_value)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
|
291
|
+
# assigning back to col by type
|
292
|
+
case type
|
293
|
+
when :all
|
294
|
+
col[:summarize_all_value] = sum_value
|
295
|
+
when :page
|
296
|
+
col[:summarize_page_value] = sum_value
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
226
301
|
def sumarize(object, col, items)
|
227
302
|
#method for sumarizing values in column
|
228
303
|
|
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.6
|
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-
|
12
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: htmlentities
|
16
|
-
requirement: &
|
16
|
+
requirement: &81859830 !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: *81859830
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &81859490 !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: *81859490
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &81859190 !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: *81859190
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &81858880 !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: *81858880
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &81858450 !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: *81858450
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &81858010 !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: *81858010
|
80
80
|
description: longer description of your gem
|
81
81
|
email: ladislav.smola@it-logica.cz
|
82
82
|
executables: []
|
@@ -617,7 +617,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
617
617
|
version: '0'
|
618
618
|
segments:
|
619
619
|
- 0
|
620
|
-
hash:
|
620
|
+
hash: 674166125
|
621
621
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
622
622
|
none: false
|
623
623
|
requirements:
|