wice_grid 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/CHANGELOG +31 -7
- data/Gemfile +1 -0
- data/README.rdoc +20 -12
- data/Rakefile +4 -30
- data/lib/generators/wice_grid/templates/wice_grid.css.scss +41 -40
- data/lib/generators/wice_grid/templates/wice_grid.yml +48 -0
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +5 -0
- data/lib/{active_record_column_wrapper.rb → wice/active_record_column_wrapper.rb} +0 -0
- data/lib/{columns.rb → wice/columns.rb} +1 -1
- data/lib/{columns → wice/columns}/column_action.rb +0 -0
- data/lib/{columns → wice/columns}/column_boolean.rb +0 -0
- data/lib/{columns → wice/columns}/column_custom_dropdown.rb +0 -0
- data/lib/{columns → wice/columns}/column_date.rb +0 -0
- data/lib/{columns → wice/columns}/column_datetime.rb +22 -5
- data/lib/{columns → wice/columns}/column_float.rb +0 -0
- data/lib/{columns → wice/columns}/column_integer.rb +0 -0
- data/lib/{columns → wice/columns}/column_processor_index.rb +0 -0
- data/lib/{columns → wice/columns}/column_range.rb +0 -0
- data/lib/{columns → wice/columns}/column_string.rb +0 -0
- data/lib/{grid_output_buffer.rb → wice/grid_output_buffer.rb} +0 -0
- data/lib/{grid_renderer.rb → wice/grid_renderer.rb} +7 -0
- data/lib/wice/helpers/js_calendar_helpers.rb +81 -0
- data/lib/{helpers → wice/helpers}/wice_grid_misc_view_helpers.rb +24 -1
- data/lib/{helpers → wice/helpers}/wice_grid_serialized_queries_view_helpers.rb +0 -0
- data/lib/{helpers → wice/helpers}/wice_grid_view_helpers.rb +2 -0
- data/lib/{kaminari_monkey_patching.rb → wice/kaminari_monkey_patching.rb} +0 -0
- data/lib/{table_column_matrix.rb → wice/table_column_matrix.rb} +0 -0
- data/lib/{wice_grid_controller.rb → wice/wice_grid_controller.rb} +0 -0
- data/lib/{wice_grid_core_ext.rb → wice/wice_grid_core_ext.rb} +0 -0
- data/lib/{wice_grid_misc.rb → wice/wice_grid_misc.rb} +8 -1
- data/lib/{wice_grid_serialized_queries_controller.rb → wice/wice_grid_serialized_queries_controller.rb} +0 -0
- data/lib/{wice_grid_serialized_query.rb → wice/wice_grid_serialized_query.rb} +0 -0
- data/lib/{wice_grid_spreadsheet.rb → wice/wice_grid_spreadsheet.rb} +1 -1
- data/lib/wice_grid.rb +33 -25
- data/{RELEASE_NOTES_3.2.pre1.rdoc → release_notes/RELEASE_NOTES_3.2.pre1.rdoc} +0 -0
- data/{RELEASE_NOTES_3.2.pre2.rdoc → release_notes/RELEASE_NOTES_3.2.pre2.rdoc} +0 -0
- data/release_notes/RELEASE_NOTES_3.3.0.rdoc +21 -0
- data/vendor/assets/javascripts/wice_grid_init.js.coffee +43 -2
- data/vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee +2 -2
- data/wice_grid.gemspec +18 -89
- metadata +42 -37
- data/VERSION +0 -1
- data/lib/helpers/js_calendar_helpers.rb +0 -54
data/.gitignore
ADDED
data/CHANGELOG
CHANGED
@@ -1,11 +1,38 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.2
|
2
|
+
|
3
|
+
improvement of the javascript calendar control: if the FROM field is set to a value after TO, TO is set to the value of FROM.
|
4
|
+
Vice versa: if the TO field is set to a value before FROM, FROM is set to the value of TO
|
5
|
+
|
6
|
+
Wice::Defaults::DATEPICKER_YEAR_RANGE added to the config to define the default year range in Datepicker (https://github.com/leikind/wice_grid/issues/61)
|
7
|
+
|
8
|
+
support for Ruby 2.0
|
9
|
+
|
10
|
+
<caption> supported
|
11
|
+
|
12
|
+
2 js errors fixed in the Saved Queries UI ( https://github.com/leikind/wice_grid/issues/89
|
13
|
+
|
14
|
+
helpers filter_and_order_state_as_hash(grid) and filter_state_as_hash(grid)
|
15
|
+
|
16
|
+
the with_paginated_resultset callback receives an ActiveRelation object, not a lambda
|
17
|
+
|
18
|
+
3.2.1
|
19
|
+
|
20
|
+
action_column can now also take a block. If the block returns a falsy value, no checkbox will be rendered.
|
21
|
+
|
22
|
+
A fix: the css class submitted to column is also added to the <th> tags of the column.
|
23
|
+
|
24
|
+
Filter related code has been refactored: condition generators are unified together with view column processors into one module. Writing your own filters has been simplified.
|
25
|
+
|
26
|
+
The default filter for numeric columns has been replaced by a simple one field filter which checks the values for equality, not the inclusion in a range.
|
27
|
+
New column parameter :filter_type allows to load custom alternative filters.
|
28
|
+
The old numeric range filter can still be used by specifying filter_type: :range. See lib/columns/column_processor_index.rb for the list of available filters.
|
29
|
+
|
30
|
+
3.2.0
|
2
31
|
|
3
32
|
Fixes:
|
4
33
|
https://github.com/leikind/wice_grid/issues/83
|
5
34
|
https://github.com/leikind/wice_grid/issues/82
|
6
35
|
|
7
|
-
3.2.0pre1
|
8
|
-
|
9
36
|
action_column can now also take a block. If the block returns a falsy value, no checkbox will be rendered
|
10
37
|
|
11
38
|
A fix: the css class submitted to column is also added to <th> tags of the column
|
@@ -17,12 +44,9 @@ New column parameter :filter_type allows to load custom alternative filters. The
|
|
17
44
|
See lib/columns/column_processor_index.rb</tt> for the list of available filters.
|
18
45
|
|
19
46
|
|
20
|
-
3.2.0pre1
|
21
|
-
|
22
|
-
|
23
47
|
3.0.4
|
24
48
|
|
25
|
-
|
49
|
+
bugfixes
|
26
50
|
|
27
51
|
3.0.3
|
28
52
|
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/README.rdoc
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
= WiceGrid
|
2
2
|
|
3
|
-
Version:: 3.
|
3
|
+
Version:: 3.3.0
|
4
4
|
Author:: Yuri Leikind
|
5
5
|
Sources:: https://github.com/leikind/wice_grid/
|
6
|
-
Examples online:: http://
|
6
|
+
Examples online:: http://wicegrid.herokuapp.com
|
7
7
|
News:: http://leikind.org/pages/wicegrid/
|
8
8
|
Email:: "Yuri Leikind" <yuri.leikind at gmail dot com>
|
9
9
|
|
10
|
-
|
11
|
-
FOR RAILS 3.0.X AND 3.1.X USE VERSION 3.0.4.
|
10
|
+
FOR RAILS 3 USE VERSION 3.x
|
12
11
|
FOR RAILS 2 USE VERSION 0.6 (https://github.com/leikind/wice_grid/tree/master).
|
13
12
|
|
14
13
|
|
@@ -49,7 +48,7 @@ WiceGrid is known to work with MySQL and Postgres.
|
|
49
48
|
=== Examples
|
50
49
|
|
51
50
|
This tutorial is accompanied by a sample application with WiceGrid examples which you
|
52
|
-
can browse online ( http://
|
51
|
+
can browse online ( http://wicegrid.herokuapp.com ),
|
53
52
|
or just view the code ( https://github.com/leikind/wice_grid_testbed ).
|
54
53
|
|
55
54
|
|
@@ -75,7 +74,7 @@ Beginning from version 3.2 only jQuery is supported.
|
|
75
74
|
|
76
75
|
Add the following to your Gemfile:
|
77
76
|
|
78
|
-
gem "wice_grid", '3.2.
|
77
|
+
gem "wice_grid", '3.2.1'
|
79
78
|
|
80
79
|
and run the <tt>bundle</tt> command.
|
81
80
|
|
@@ -91,8 +90,10 @@ Require WiceGrid javascript in your js index file:
|
|
91
90
|
|
92
91
|
//= require wice_grid
|
93
92
|
|
94
|
-
Make sure that jQuery is
|
95
|
-
|
93
|
+
Make sure that jQuery is loaded.
|
94
|
+
If the application uses Date and DateTime filters, you have to install jQuery Datepicker by yourself.
|
95
|
+
|
96
|
+
Here is an example of application.js with everything WiceGrid needs:
|
96
97
|
|
97
98
|
//= require jquery
|
98
99
|
//= require jquery_ujs
|
@@ -101,7 +102,9 @@ to be required as well. Here is an example of application.js with everything Wic
|
|
101
102
|
//= require jquery.ui.datepicker
|
102
103
|
//= require_tree .
|
103
104
|
|
104
|
-
|
105
|
+
WiceGrid provides some very basic styles, not specifying exactly how the table should look like,
|
106
|
+
but if the application uses Twitter Bootstrap, the markup generated by WiceGrid will have correct classes and will fit nicely.
|
107
|
+
Generally it is advised to modify WiceGrid css to match the application style.
|
105
108
|
|
106
109
|
|
107
110
|
=== Basics
|
@@ -887,6 +890,11 @@ jQuery +datepicker+ uses a different format flavor, therefore there is an additi
|
|
887
890
|
for presenting initial date values in filters, so make sure that +DATE_FORMAT_JQUERY+ and +DATE_FORMAT+
|
888
891
|
result in an identical date representation.
|
889
892
|
|
893
|
+
Constant +DATEPICKER_YEAR_RANGE+ defined the range of years in the Datepicker year dropdown. Alternatively,
|
894
|
+
you can always change this range dynamically with the following javascript:
|
895
|
+
|
896
|
+
$( ".hasDatepicker" ).datepicker( "option", "yearRange", "2000:2042" );
|
897
|
+
|
890
898
|
|
891
899
|
=== Show All Records
|
892
900
|
|
@@ -1164,14 +1172,14 @@ There are two callbacks:
|
|
1164
1172
|
* <tt>:with_resultset</tt> - used to process all records browsable through all pages with the current filters
|
1165
1173
|
|
1166
1174
|
While the <tt>:with_paginated_resultset</tt> callback just receives the list of records, <tt>:with_resultset</tt>
|
1167
|
-
receives
|
1175
|
+
receives an ActiveRelation object which can be used to obtain the list of all records:
|
1168
1176
|
|
1169
1177
|
|
1170
1178
|
def index
|
1171
1179
|
@tasks_grid = initialize_grid(Task)
|
1172
1180
|
|
1173
|
-
@tasks_grid.with_resultset do |
|
1174
|
-
all_records =
|
1181
|
+
@tasks_grid.with_resultset do |active_relation|
|
1182
|
+
all_records = active_relation.find(:first)
|
1175
1183
|
...
|
1176
1184
|
end
|
1177
1185
|
end
|
data/Rakefile
CHANGED
@@ -1,16 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require 'rdoc/task'
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
4
3
|
|
5
|
-
|
6
|
-
task :default => :test
|
4
|
+
RSpec::Core::RakeTask.new
|
7
5
|
|
8
|
-
|
9
|
-
Rake::TestTask.new(:test) do |t|
|
10
|
-
t.libs << 'lib'
|
11
|
-
t.pattern = 'test/**/*_test.rb'
|
12
|
-
t.verbose = true
|
13
|
-
end
|
6
|
+
task :default => :rdoc
|
14
7
|
|
15
8
|
desc 'Generate documentation for the wice_grid plugin.'
|
16
9
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
@@ -23,22 +16,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
23
16
|
rdoc.rdoc_files.include('CHANGELOG')
|
24
17
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
18
|
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'git'
|
29
|
-
require 'jeweler'
|
30
|
-
Jeweler::Tasks.new do |gem|
|
31
|
-
gem.name = "wice_grid"
|
32
|
-
gem.summary = %Q{Rails Grid Plugin}
|
33
|
-
gem.description = %Q{A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters }
|
34
|
-
gem.email = "yuri.leikind@gmail.com"
|
35
|
-
gem.homepage = "http://github.com/leikind/wice_grid"
|
36
|
-
gem.authors = ["Yuri Leikind"]
|
37
|
-
gem.add_dependency "kaminari", ">= 0.13.0"
|
38
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
39
|
-
end
|
40
|
-
Jeweler::GemcutterTasks.new
|
41
|
-
rescue LoadError
|
42
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
43
|
-
end
|
44
|
-
|
@@ -3,12 +3,10 @@
|
|
3
3
|
height: 16px;
|
4
4
|
}
|
5
5
|
|
6
|
-
.wg-detached-filter{
|
6
|
+
.wg-detached-filter, .wice-grid{
|
7
|
+
|
7
8
|
a.date-label {text-decoration: none;}
|
8
9
|
a.date-label:hover {text-decoration: line-through;}
|
9
|
-
}
|
10
|
-
|
11
|
-
.wice-grid{
|
12
10
|
|
13
11
|
.clickable{
|
14
12
|
cursor: pointer;
|
@@ -16,14 +14,49 @@
|
|
16
14
|
margin-right: 2px;
|
17
15
|
}
|
18
16
|
|
19
|
-
|
20
|
-
a.date-label {text-decoration: none;}
|
21
|
-
a.date-label:hover {text-decoration: line-through;}
|
22
|
-
|
23
17
|
.ui-datepicker-trigger, .wg-detached-filter .ui-datepicker-trigger{
|
24
18
|
cursor: pointer;
|
25
19
|
}
|
26
20
|
|
21
|
+
.custom-dropdown-container {
|
22
|
+
position: relative;
|
23
|
+
padding-right: 18px;
|
24
|
+
|
25
|
+
|
26
|
+
.collapse-multi-select-icon, .expand-multi-select-icon{
|
27
|
+
width: 12px;
|
28
|
+
height: 12px;
|
29
|
+
position:absolute;
|
30
|
+
top:0;
|
31
|
+
right:0;
|
32
|
+
}
|
33
|
+
|
34
|
+
.collapse-multi-select-icon{
|
35
|
+
background: transparent url(/assets/icons/grid/collapse.gif) no-repeat;
|
36
|
+
}
|
37
|
+
|
38
|
+
.expand-multi-select-icon{
|
39
|
+
background: transparent url(/assets/icons/grid/expand.gif) no-repeat;
|
40
|
+
}
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
.text-filter-container {
|
45
|
+
position: relative; padding-right: 13px;
|
46
|
+
.negation-checkbox {
|
47
|
+
position:absolute;
|
48
|
+
top:0;
|
49
|
+
right:0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
.wice-grid{
|
58
|
+
|
59
|
+
|
27
60
|
.desc, .asc{
|
28
61
|
padding-right: 18px;
|
29
62
|
text-decoration:none;
|
@@ -71,38 +104,6 @@
|
|
71
104
|
float:left;
|
72
105
|
}
|
73
106
|
|
74
|
-
.custom-dropdown-container {
|
75
|
-
position: relative;
|
76
|
-
padding-right: 18px;
|
77
|
-
|
78
|
-
|
79
|
-
.collapse-multi-select-icon, .expand-multi-select-icon{
|
80
|
-
width: 12px;
|
81
|
-
height: 12px;
|
82
|
-
position:absolute;
|
83
|
-
top:0;
|
84
|
-
right:0;
|
85
|
-
}
|
86
|
-
|
87
|
-
.collapse-multi-select-icon{
|
88
|
-
background: transparent url(/assets/icons/grid/collapse.gif) no-repeat;
|
89
|
-
}
|
90
|
-
|
91
|
-
.expand-multi-select-icon{
|
92
|
-
background: transparent url(/assets/icons/grid/expand.gif) no-repeat;
|
93
|
-
}
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
.text-filter-container {
|
98
|
-
position: relative; padding-right: 13px;
|
99
|
-
.negation-checkbox {
|
100
|
-
position:absolute;
|
101
|
-
top:0;
|
102
|
-
right:0;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
107
|
|
107
108
|
/* in case of twitter bootstrap :) */
|
108
109
|
thead th select{
|
@@ -500,3 +500,51 @@ zh:
|
|
500
500
|
query_saved_message: 查询已储存
|
501
501
|
select_all: 全选
|
502
502
|
deselect_all: 全清
|
503
|
+
|
504
|
+
ja:
|
505
|
+
date:
|
506
|
+
order:
|
507
|
+
- :年
|
508
|
+
- :月
|
509
|
+
- :日
|
510
|
+
wice_grid:
|
511
|
+
show_filter_tooltip: フィルタ表示
|
512
|
+
hide_filter_tooltip: フィルタ非表示
|
513
|
+
csv_export_tooltip: CSVエクスポート
|
514
|
+
filter_tooltip: フィルタ
|
515
|
+
reset_filter_tooltip: リセット
|
516
|
+
boolean_filter_true_label: "yes"
|
517
|
+
boolean_filter_false_label: "no"
|
518
|
+
previous_label: «
|
519
|
+
next_label: »
|
520
|
+
# Title of the icon clicking on which will show the calendar to set the FROM date.
|
521
|
+
date_selector_tooltip_from: From
|
522
|
+
# Title of the icon clicking on which will show the calendar to set the TO date.
|
523
|
+
date_selector_tooltip_to: To
|
524
|
+
# The title of the checkox to turn on negation
|
525
|
+
negation_checkbox_title: 除外する
|
526
|
+
# link to switch to show all records
|
527
|
+
show_all_records_label: すべて表示
|
528
|
+
# tooltip for the link to switch to show all records
|
529
|
+
show_all_records_tooltip: 前レコード表示
|
530
|
+
# Warning message shown when the user wants to switch to all-records mode
|
531
|
+
all_queries_warning: 全てのレコードを表示しますか?
|
532
|
+
# link to paginated view
|
533
|
+
switch_back_to_paginated_mode_label: 戻る
|
534
|
+
# tooltip for the link to paginated view
|
535
|
+
switch_back_to_paginated_mode_tooltip: 戻る
|
536
|
+
# Title of the date string.
|
537
|
+
date_string_tooltip: 削除
|
538
|
+
saved_query_panel_title: クエリ保存
|
539
|
+
save_query_button_label: フィルタ保存
|
540
|
+
saved_query_deletion_confirmation: 本当によろしいですか?
|
541
|
+
saved_query_deletion_link_title: クエリ削除
|
542
|
+
saved_query_link_title: クエリのロード
|
543
|
+
validates_uniqueness_error: 同じ名前がすでに存在します
|
544
|
+
validates_presence_error: クエリ名を記入して下さい
|
545
|
+
query_deleted_message: クエリの削除が完了しました
|
546
|
+
query_saved_message: クエリを保存しました
|
547
|
+
select_all: 全てを選択
|
548
|
+
deselect_all: 選択を解除
|
549
|
+
expand: 開く
|
550
|
+
collapse: 閉じる
|
@@ -120,6 +120,11 @@ if defined?(Wice::Defaults)
|
|
120
120
|
end
|
121
121
|
}
|
122
122
|
|
123
|
+
# The range of years to display in jQuery Datepicker.
|
124
|
+
# It can always be changed dynamically with the following javascript:
|
125
|
+
# $( ".hasDatepicker" ).datepicker( "option", "yearRange", "2000:2042" );
|
126
|
+
Wice::Defaults::DATEPICKER_YEAR_RANGE = (from = Date.current.year - 10).to_s + ':' + (from + 15).to_s
|
127
|
+
|
123
128
|
|
124
129
|
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
125
130
|
# format defined by +DATETIME+ and must generate a Date object.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -49,11 +49,28 @@ module Wice
|
|
49
49
|
|
50
50
|
def render_calendar_filter_internal(params) #:nodoc:
|
51
51
|
|
52
|
-
|
53
|
-
params[:fr],
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
calendar_data_from = prepare_data_for_calendar(
|
53
|
+
:initial_date => params[:fr],
|
54
|
+
:title => NlMessage['date_selector_tooltip_from'],
|
55
|
+
:name => @name1,
|
56
|
+
:fire_event => auto_reload,
|
57
|
+
:grid_name => self.grid.name
|
58
|
+
)
|
59
|
+
|
60
|
+
calendar_data_to = prepare_data_for_calendar(
|
61
|
+
:initial_date => params[:to],
|
62
|
+
:title => NlMessage['date_selector_tooltip_to'],
|
63
|
+
:name => @name2,
|
64
|
+
:fire_event => auto_reload,
|
65
|
+
:grid_name => self.grid.name
|
66
|
+
)
|
67
|
+
|
68
|
+
calendar_data_from.the_other_datepicker_id_to = calendar_data_to.dom_id
|
69
|
+
calendar_data_to.the_other_datepicker_id_from = calendar_data_from.dom_id
|
70
|
+
|
71
|
+
html1 = date_calendar_jquery calendar_data_from
|
72
|
+
|
73
|
+
html2 = date_calendar_jquery calendar_data_to
|
57
74
|
|
58
75
|
%!<div class="date-filter">#{html1}<br/>#{html2}</div>!
|
59
76
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -14,6 +14,7 @@ module Wice
|
|
14
14
|
attr_reader :blank_slate_handler
|
15
15
|
attr_reader :last_row_handler
|
16
16
|
attr_reader :grid
|
17
|
+
attr_reader :kaption
|
17
18
|
|
18
19
|
@@order_parameter_name = "order"
|
19
20
|
@@order_direction_parameter_name = "order_direction"
|
@@ -115,6 +116,12 @@ module Wice
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
119
|
+
# Takes one argument and adds the <caption></caption> tag to the table with the argument value as
|
120
|
+
# the contents of <caption>.
|
121
|
+
def caption kaption
|
122
|
+
@kaption = kaption
|
123
|
+
end
|
124
|
+
|
118
125
|
# Adds a column with checkboxes for each record. Useful for actions with multiple records, for example, deleting
|
119
126
|
# selected records. Please note that +action_column+ only creates the checkboxes and the 'Select All' and
|
120
127
|
# 'Deselect All' buttons, and the form itelf as well as processing the parameters should be taken care of
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Wice #:nodoc:
|
2
|
+
module JsCalendarHelpers #:nodoc:
|
3
|
+
|
4
|
+
class CalendarData
|
5
|
+
attr_accessor :name,
|
6
|
+
:date_string,
|
7
|
+
:dom_id,
|
8
|
+
:datepicker_placeholder_id,
|
9
|
+
:date_span_id,
|
10
|
+
:close_calendar_event_name,
|
11
|
+
:title,
|
12
|
+
:fire_event,
|
13
|
+
:the_other_datepicker_id_to,
|
14
|
+
:the_other_datepicker_id_from
|
15
|
+
end
|
16
|
+
|
17
|
+
def date_calendar_jquery(calendar_data) #:nodoc:
|
18
|
+
|
19
|
+
hidden_field_tag_options = {
|
20
|
+
:id => calendar_data.dom_id,
|
21
|
+
'data-locale' => I18n.locale,
|
22
|
+
'data-date-format' => Wice::ConfigurationProvider.value_for(:DATE_FORMAT_JQUERY),
|
23
|
+
'data-button-image' => Wice::ConfigurationProvider.value_for(:CALENDAR_ICON),
|
24
|
+
'data-button-text' => calendar_data.title
|
25
|
+
}
|
26
|
+
|
27
|
+
if calendar_data.fire_event
|
28
|
+
hidden_field_tag_options['data-close-calendar-event-name'] = calendar_data.close_calendar_event_name
|
29
|
+
end
|
30
|
+
|
31
|
+
if Rails.env == 'development'
|
32
|
+
hidden_field_tag_options['class'] = 'check-for-datepicker'
|
33
|
+
end
|
34
|
+
|
35
|
+
if calendar_data.the_other_datepicker_id_to
|
36
|
+
hidden_field_tag_options['data-the-other-datepicker-id-to'] = calendar_data.the_other_datepicker_id_to
|
37
|
+
end
|
38
|
+
|
39
|
+
if calendar_data.the_other_datepicker_id_from
|
40
|
+
hidden_field_tag_options['data-the-other-datepicker-id-from'] = calendar_data.the_other_datepicker_id_from
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
if year_range = ConfigurationProvider.value_for(:DATEPICKER_YEAR_RANGE)
|
45
|
+
hidden_field_tag_options['data-date-year-range'] = year_range
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
date_picker = hidden_field_tag(calendar_data.name, calendar_data.date_string, hidden_field_tag_options) + ' ' +
|
50
|
+
|
51
|
+
link_to(calendar_data.date_string,
|
52
|
+
'#',
|
53
|
+
:id => calendar_data.date_span_id,
|
54
|
+
:class => 'date-label',
|
55
|
+
:title => ::Wice::NlMessage['date_string_tooltip'],
|
56
|
+
'data-dom-id' => calendar_data.dom_id
|
57
|
+
)
|
58
|
+
|
59
|
+
"<span id=\"#{calendar_data.datepicker_placeholder_id}\">#{date_picker}</span>"
|
60
|
+
end
|
61
|
+
|
62
|
+
def prepare_data_for_calendar(options) #:nodoc:
|
63
|
+
|
64
|
+
date_format = Wice::ConfigurationProvider.value_for(:DATE_FORMAT)
|
65
|
+
|
66
|
+
CalendarData.new.tap do |calendar_data|
|
67
|
+
|
68
|
+
calendar_data.name = options[:name]
|
69
|
+
calendar_data.date_string = options[:initial_date].nil? ? '' : options[:initial_date].strftime(date_format)
|
70
|
+
calendar_data.dom_id = options[:name].gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
|
71
|
+
calendar_data.datepicker_placeholder_id = calendar_data.dom_id + '_date_placeholder'
|
72
|
+
calendar_data.date_span_id = calendar_data.dom_id + '_date_view'
|
73
|
+
calendar_data.close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
|
74
|
+
calendar_data.title = options[:title]
|
75
|
+
calendar_data.fire_event = options[:fire_event]
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -15,11 +15,34 @@ module Wice
|
|
15
15
|
grid.get_state_as_parameter_value_pairs(true).collect{|param_name, value|
|
16
16
|
hidden_field_tag(param_name, value, :id => "hidden-#{param_name.gsub(/[\[\]]/, '-')}")
|
17
17
|
}.join("\n").html_safe
|
18
|
+
end
|
18
19
|
|
20
|
+
# This method dumps all HTTP parameters related to filtering of a certain grid in the form of a hash.
|
21
|
+
# This might be required if you want to keep the state of a grid while reloading the page using Rails routing helpers.
|
22
|
+
# Attention: this does not return parameters for ordering the grid, use +filter_and_order_state_as_hash+ if you
|
23
|
+
# need it.
|
24
|
+
#
|
25
|
+
# The only parameter is a grid object returned by +initialize_grid+ in the controller.
|
26
|
+
def filter_state_as_hash(grid)
|
27
|
+
{grid.name => {'f' => grid.status[:f]}}
|
28
|
+
end
|
29
|
+
|
30
|
+
# This method dumps all HTTP parameters related to filtering and ordering of a certain grid in the form of a hash.
|
31
|
+
# This might be required if you want to keep the state of a grid while reloading the page using Rails routing helpers.
|
32
|
+
#
|
33
|
+
# The only parameter is a grid object returned by +initialize_grid+ in the controller.
|
34
|
+
def filter_and_order_state_as_hash(grid)
|
35
|
+
{
|
36
|
+
grid.name => {
|
37
|
+
'f' => grid.status[:f],
|
38
|
+
'order' => grid.status[:order],
|
39
|
+
'order_direction' => grid.status[:order_direction]
|
40
|
+
}
|
41
|
+
}
|
19
42
|
end
|
20
43
|
|
21
44
|
def dump_state(grid) #:nodoc:
|
22
|
-
debug(grid.get_state_as_parameter_value_pairs)
|
45
|
+
debug(grid.get_state_as_parameter_value_pairs())
|
23
46
|
end
|
24
47
|
|
25
48
|
|
File without changes
|
@@ -195,6 +195,7 @@ module Wice
|
|
195
195
|
grid.output_buffer << %!<div class="wice-grid-container" id="#{grid.name}"><div id="#{grid.name}_title">!
|
196
196
|
grid.output_buffer << content_tag(:h3, grid.saved_query.name) if grid.saved_query
|
197
197
|
grid.output_buffer << "</div><table #{tag_options(table_html_attrs, true)}>"
|
198
|
+
grid.output_buffer << "<caption>#{rendering.kaption}</caption>" if rendering.kaption
|
198
199
|
grid.output_buffer << "<thead>"
|
199
200
|
|
200
201
|
no_filters_at_all = (options[:show_filters] == :no || rendering.no_filter_needed?) ? true: false
|
@@ -583,6 +584,7 @@ module Wice
|
|
583
584
|
paginate(grid.resultset,
|
584
585
|
:theme => 'wice_grid',
|
585
586
|
:param_name => "#{grid.name}[page]",
|
587
|
+
:params => extra_request_parameters,
|
586
588
|
:inner_window => 4,
|
587
589
|
:outer_window => 2
|
588
590
|
) +
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -88,7 +88,10 @@ module Wice
|
|
88
88
|
if Wice::Defaults.const_defined?(key)
|
89
89
|
Wice::Defaults.const_get(key)
|
90
90
|
else
|
91
|
-
raise
|
91
|
+
raise WiceGridMissingConfigurationConstantException.new("Could not find constant #{key} in the configuration file!" +
|
92
|
+
" It is possible that the version of WiceGrid you are using is newer than the installed configuration file in config/initializers. " +
|
93
|
+
"Constant Wice::Defaults::#{key} is missing and you need to add it manually to wice_grid_config.rb or run the generator task=:\n" +
|
94
|
+
" rails g wice_grid:install")
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
@@ -109,4 +112,8 @@ module Wice
|
|
109
112
|
class WiceGridException < Exception #:nodoc:
|
110
113
|
include ExceptionsMixin
|
111
114
|
end
|
115
|
+
class WiceGridMissingConfigurationConstantException < Exception #:nodoc:
|
116
|
+
include ExceptionsMixin
|
117
|
+
end
|
118
|
+
|
112
119
|
end
|
File without changes
|
File without changes
|
data/lib/wice_grid.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require 'wice_grid_misc.rb'
|
4
|
-
require 'wice_grid_core_ext.rb'
|
5
|
-
require 'grid_renderer.rb'
|
6
|
-
require 'table_column_matrix.rb'
|
7
|
-
require 'active_record_column_wrapper.rb'
|
8
|
-
require 'helpers/wice_grid_view_helpers.rb'
|
9
|
-
require 'helpers/wice_grid_misc_view_helpers.rb'
|
10
|
-
require 'helpers/wice_grid_serialized_queries_view_helpers.rb'
|
11
|
-
require 'helpers/wice_grid_view_helpers.rb'
|
12
|
-
require 'helpers/js_calendar_helpers.rb'
|
13
|
-
require 'grid_output_buffer.rb'
|
14
|
-
require 'wice_grid_controller.rb'
|
15
|
-
require 'wice_grid_spreadsheet.rb'
|
16
|
-
require 'wice_grid_serialized_queries_controller.rb'
|
17
|
-
require 'columns/column_processor_index.rb'
|
18
|
-
require 'columns.rb'
|
3
|
+
require 'wice/wice_grid_misc.rb'
|
4
|
+
require 'wice/wice_grid_core_ext.rb'
|
5
|
+
require 'wice/grid_renderer.rb'
|
6
|
+
require 'wice/table_column_matrix.rb'
|
7
|
+
require 'wice/active_record_column_wrapper.rb'
|
8
|
+
require 'wice/helpers/wice_grid_view_helpers.rb'
|
9
|
+
require 'wice/helpers/wice_grid_misc_view_helpers.rb'
|
10
|
+
require 'wice/helpers/wice_grid_serialized_queries_view_helpers.rb'
|
11
|
+
require 'wice/helpers/wice_grid_view_helpers.rb'
|
12
|
+
require 'wice/helpers/js_calendar_helpers.rb'
|
13
|
+
require 'wice/grid_output_buffer.rb'
|
14
|
+
require 'wice/wice_grid_controller.rb'
|
15
|
+
require 'wice/wice_grid_spreadsheet.rb'
|
16
|
+
require 'wice/wice_grid_serialized_queries_controller.rb'
|
17
|
+
require 'wice/columns/column_processor_index.rb'
|
18
|
+
require 'wice/columns.rb'
|
19
19
|
require 'kaminari.rb'
|
20
20
|
|
21
21
|
|
@@ -46,10 +46,10 @@ module Wice
|
|
46
46
|
end
|
47
47
|
|
48
48
|
Columns.load_column_processors
|
49
|
-
require 'wice_grid_serialized_query.rb'
|
49
|
+
require 'wice/wice_grid_serialized_query.rb'
|
50
50
|
|
51
51
|
# It is here only until this pull request is pulled: https://github.com/amatsuda/kaminari/pull/267
|
52
|
-
require 'kaminari_monkey_patching.rb'
|
52
|
+
require 'wice/kaminari_monkey_patching.rb'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -473,7 +473,7 @@ module Wice
|
|
473
473
|
|
474
474
|
def invoke_resultset_callbacks #:nodoc:
|
475
475
|
invoke_resultset_callback(@options[:with_paginated_resultset], @resultset)
|
476
|
-
invoke_resultset_callback(@options[:with_resultset],
|
476
|
+
invoke_resultset_callback(@options[:with_resultset], self.active_relation_for_resultset_without_paging_with_user_filters)
|
477
477
|
end
|
478
478
|
|
479
479
|
|
@@ -546,19 +546,27 @@ module Wice
|
|
546
546
|
# end
|
547
547
|
# end
|
548
548
|
|
549
|
-
|
550
549
|
def resultset_without_paging_with_user_filters #:nodoc:
|
550
|
+
@klass.unscoped do
|
551
|
+
active_relation_for_resultset_without_paging_with_user_filters.find(:all)
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
def active_relation_for_resultset_without_paging_with_user_filters #:nodoc:
|
551
556
|
form_ar_options
|
557
|
+
relation = nil
|
552
558
|
@klass.unscoped do
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
559
|
+
relation = @relation.
|
560
|
+
where(@ar_options[:conditions]).
|
561
|
+
joins(@ar_options[:joins]).
|
562
|
+
includes(@ar_options[:include]).
|
563
|
+
order(@ar_options[:order])
|
558
564
|
end
|
565
|
+
relation
|
559
566
|
end
|
560
567
|
|
561
568
|
|
569
|
+
|
562
570
|
def load_query(query_id) #:nodoc:
|
563
571
|
@query_store_model ||= Wice::get_query_store_model
|
564
572
|
query = @query_store_model.find_by_id_and_grid_name(query_id, self.name)
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
the with_paginated_resultset callback receives an ActiveRelation object, not a lambda
|
2
|
+
|
3
|
+
Wice::Defaults::DATEPICKER_YEAR_RANGE added to the config to define the default year range in Datepicker (https://github.com/leikind/wice_grid/issues/61)
|
4
|
+
|
5
|
+
improvement of the javascript calendar control: if the FROM field is set to a value after TO, TO is set to the value of FROM. Vice versa: if the TO field is set to a value before FROM, FROM is set to the value of TO
|
6
|
+
|
7
|
+
New view helpers filter_and_order_state_as_hash(grid) and filter_state_as_hash(grid)
|
8
|
+
|
9
|
+
<caption> supported
|
10
|
+
|
11
|
+
support for Ruby 2.0
|
12
|
+
|
13
|
+
2 errors fixed in the Saved Queries UI ( https://github.com/leikind/wice_grid/issues/89 )
|
14
|
+
|
15
|
+
bug fixed: extra_request_parameters not propagating to the pagination panel
|
16
|
+
|
17
|
+
README: made it clear that Datepicker has to be installed separately
|
18
|
+
|
19
|
+
README: made it clear that css is basis and that Twitter Bootstrap is supported
|
20
|
+
|
21
|
+
|
@@ -42,6 +42,22 @@ initWiceGrid = ->
|
|
42
42
|
setupExternalSubmitReset()
|
43
43
|
setupExternalCsvExport()
|
44
44
|
|
45
|
+
# for all grids on oage because it does not matter which grid it is
|
46
|
+
setupMultiSelectToggle $('.wg-detached-filter')
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
moveDateBoundIfInvalidPeriod = (dataFieldNameWithTheOtherDatepicker, datepickerHiddenField, selectedDate, dateFormat, predicate) ->
|
51
|
+
if (datepickerId = datepickerHiddenField.data(dataFieldNameWithTheOtherDatepicker)) &&
|
52
|
+
(theOtherDatepicker = $(_datepickerId = "#" + datepickerId)) &&
|
53
|
+
(theOtherDate = theOtherDatepicker.datepicker('getDate')) &&
|
54
|
+
|
55
|
+
predicate(theOtherDate, selectedDate)
|
56
|
+
theOtherDatepicker.datepicker("setDate", selectedDate)
|
57
|
+
theOtherDatepicker.next().next().html $.datepicker.formatDate(dateFormat, selectedDate)
|
58
|
+
|
59
|
+
|
60
|
+
|
45
61
|
# datepicker logic
|
46
62
|
setupDatepicker = ->
|
47
63
|
# check if datepicker is loaded
|
@@ -72,20 +88,45 @@ setupDatepicker = ->
|
|
72
88
|
false
|
73
89
|
that = this
|
74
90
|
|
91
|
+
dateFormat = datepickerHiddenField.data('date-format')
|
92
|
+
|
93
|
+
yearRange = datepickerHiddenField.data('date-year-range')
|
94
|
+
|
75
95
|
# datepicker constructor
|
76
96
|
datepickerHiddenField.datepicker
|
77
97
|
firstDay: 1
|
78
98
|
showOn: "button"
|
79
|
-
dateFormat:
|
99
|
+
dateFormat: dateFormat
|
80
100
|
buttonImage: datepickerHiddenField.data('button-image')
|
81
101
|
buttonImageOnly: true
|
82
102
|
buttonText: datepickerHiddenField.data('button-text')
|
83
103
|
changeMonth: true
|
84
104
|
changeYear: true
|
105
|
+
yearRange: yearRange
|
106
|
+
|
85
107
|
onSelect: (dateText, inst) ->
|
108
|
+
|
109
|
+
selectedDate = $(this).datepicker("getDate")
|
110
|
+
|
111
|
+
moveDateBoundIfInvalidPeriod(
|
112
|
+
'the-other-datepicker-id-to',
|
113
|
+
datepickerHiddenField,
|
114
|
+
selectedDate,
|
115
|
+
dateFormat,
|
116
|
+
(theOther, selected)-> theOther < selected
|
117
|
+
)
|
118
|
+
|
119
|
+
moveDateBoundIfInvalidPeriod(
|
120
|
+
'the-other-datepicker-id-from',
|
121
|
+
datepickerHiddenField,
|
122
|
+
selectedDate,
|
123
|
+
dateFormat,
|
124
|
+
(theOther, selected)-> theOther > selected
|
125
|
+
)
|
126
|
+
|
86
127
|
$(that).html(dateText)
|
87
128
|
if eventToTriggerOnChange
|
88
|
-
|
129
|
+
datepickerHiddenField.trigger(eventToTriggerOnChange)
|
89
130
|
|
90
131
|
|
91
132
|
|
@@ -88,13 +88,13 @@ onChangeToQueryList = (data, gridName, queryName, inputField) ->
|
|
88
88
|
queryListId = "##{gridName}_query_list"
|
89
89
|
inputField.val('') if queryName
|
90
90
|
if errorMessages = data['error_messages']
|
91
|
-
$(notificationMessagesDomId).text(
|
91
|
+
$(notificationMessagesDomId).text(errorMessages)
|
92
92
|
else
|
93
93
|
if notificationMessages = data['notification_messages']
|
94
94
|
$(notificationMessagesDomId).text(notificationMessages)
|
95
95
|
$(gridTitleId).html("<h3>#{queryName}</h3>") if queryName
|
96
96
|
$(queryListId).replaceWith(data['query_list'])
|
97
|
-
$(queryListId).effect('highlight')
|
97
|
+
$(queryListId).effect('highlight') if jQuery.ui
|
98
98
|
|
99
99
|
$(".wice-grid-delete-query", $(queryListId)).click (event) ->
|
100
100
|
deleteQuery(this, event)
|
data/wice_grid.gemspec
CHANGED
@@ -1,101 +1,30 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
1
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
2
|
+
s.name = 'wice_grid'
|
3
|
+
s.version = '3.3.0'
|
4
|
+
s.homepage = 'https://github.com/leikind/wice_grid'
|
5
|
+
s.date = '2013-08-04'
|
6
|
+
s.summary = 'A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters.'
|
7
|
+
s.description = 'One of the goals of this plugin was to allow the programmer to define the contents of the cell by himself, ' +
|
8
|
+
'just like one does when rendering a collection via a simple table (and this is what differentiates WiceGrid ' +
|
9
|
+
'from various scaffolding solutions), but automate implementation of filters, ordering, paginations, CSV ' +
|
10
|
+
'export, and so on. Ruby blocks provide an elegant means for this.'
|
11
|
+
s.authors = ['Yuri Leikind']
|
12
|
+
s.email = 'yuri.leikind@gmail.com'
|
13
|
+
s.files = `git ls-files`.split($/)
|
9
14
|
|
10
|
-
|
11
|
-
|
12
|
-
s.date = "2013-01-29"
|
13
|
-
s.description = "A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters "
|
14
|
-
s.email = "yuri.leikind@gmail.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"CHANGELOG",
|
20
|
-
"MIT-LICENSE",
|
21
|
-
"README.rdoc",
|
22
|
-
"RELEASE_NOTES_3.2.pre1.rdoc",
|
23
|
-
"RELEASE_NOTES_3.2.pre2.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"SAVED_QUERIES_HOWTO.rdoc",
|
26
|
-
"VERSION",
|
27
|
-
"app/views/kaminari/wice_grid/_gap.html.erb",
|
28
|
-
"app/views/kaminari/wice_grid/_next_page.html.erb",
|
29
|
-
"app/views/kaminari/wice_grid/_page.html.erb",
|
30
|
-
"app/views/kaminari/wice_grid/_paginator.html.erb",
|
31
|
-
"app/views/kaminari/wice_grid/_prev_page.html.erb",
|
32
|
-
"lib/active_record_column_wrapper.rb",
|
33
|
-
"lib/columns.rb",
|
34
|
-
"lib/columns/column_action.rb",
|
35
|
-
"lib/columns/column_boolean.rb",
|
36
|
-
"lib/columns/column_custom_dropdown.rb",
|
37
|
-
"lib/columns/column_date.rb",
|
38
|
-
"lib/columns/column_datetime.rb",
|
39
|
-
"lib/columns/column_float.rb",
|
40
|
-
"lib/columns/column_integer.rb",
|
41
|
-
"lib/columns/column_processor_index.rb",
|
42
|
-
"lib/columns/column_range.rb",
|
43
|
-
"lib/columns/column_string.rb",
|
44
|
-
"lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb",
|
45
|
-
"lib/generators/wice_grid/install_generator.rb",
|
46
|
-
"lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb",
|
47
|
-
"lib/generators/wice_grid/templates/wice_grid.css.scss",
|
48
|
-
"lib/generators/wice_grid/templates/wice_grid.yml",
|
49
|
-
"lib/generators/wice_grid/templates/wice_grid_config.rb",
|
50
|
-
"lib/grid_output_buffer.rb",
|
51
|
-
"lib/grid_renderer.rb",
|
52
|
-
"lib/helpers/js_calendar_helpers.rb",
|
53
|
-
"lib/helpers/wice_grid_misc_view_helpers.rb",
|
54
|
-
"lib/helpers/wice_grid_serialized_queries_view_helpers.rb",
|
55
|
-
"lib/helpers/wice_grid_view_helpers.rb",
|
56
|
-
"lib/kaminari_monkey_patching.rb",
|
57
|
-
"lib/table_column_matrix.rb",
|
58
|
-
"lib/wice_grid.rb",
|
59
|
-
"lib/wice_grid_controller.rb",
|
60
|
-
"lib/wice_grid_core_ext.rb",
|
61
|
-
"lib/wice_grid_misc.rb",
|
62
|
-
"lib/wice_grid_serialized_queries_controller.rb",
|
63
|
-
"lib/wice_grid_serialized_query.rb",
|
64
|
-
"lib/wice_grid_spreadsheet.rb",
|
65
|
-
"test/readme.txt",
|
66
|
-
"vendor/assets/images/icons/grid/arrow_down.gif",
|
67
|
-
"vendor/assets/images/icons/grid/arrow_up.gif",
|
68
|
-
"vendor/assets/images/icons/grid/calendar_view_month.png",
|
69
|
-
"vendor/assets/images/icons/grid/collapse.gif",
|
70
|
-
"vendor/assets/images/icons/grid/delete.png",
|
71
|
-
"vendor/assets/images/icons/grid/expand.gif",
|
72
|
-
"vendor/assets/images/icons/grid/page_white_excel.png",
|
73
|
-
"vendor/assets/images/icons/grid/page_white_find.png",
|
74
|
-
"vendor/assets/images/icons/grid/table.png",
|
75
|
-
"vendor/assets/images/icons/grid/table_refresh.png",
|
76
|
-
"vendor/assets/images/icons/grid/tick_all.png",
|
77
|
-
"vendor/assets/images/icons/grid/untick_all.png",
|
78
|
-
"vendor/assets/javascripts/wice_grid.js",
|
79
|
-
"vendor/assets/javascripts/wice_grid_init.js.coffee",
|
80
|
-
"vendor/assets/javascripts/wice_grid_processor.js.coffee",
|
81
|
-
"vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee",
|
82
|
-
"wice_grid.gemspec"
|
83
|
-
]
|
84
|
-
s.homepage = "http://github.com/leikind/wice_grid"
|
85
|
-
s.require_paths = ["lib"]
|
86
|
-
s.rubygems_version = "1.8.23"
|
87
|
-
s.summary = "Rails Grid Plugin"
|
15
|
+
kaminary = 'kaminari'
|
16
|
+
kaminary_version = '>= 0.13.0'
|
88
17
|
|
89
18
|
if s.respond_to? :specification_version then
|
90
19
|
s.specification_version = 3
|
91
20
|
|
92
21
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
93
|
-
s.add_runtime_dependency(
|
22
|
+
s.add_runtime_dependency(kaminary, [kaminary_version])
|
94
23
|
else
|
95
|
-
s.add_dependency(
|
24
|
+
s.add_dependency(kaminari, [kaminary_version])
|
96
25
|
end
|
97
26
|
else
|
98
|
-
s.add_dependency(
|
27
|
+
s.add_dependency(kaminari, [kaminary_version])
|
99
28
|
end
|
100
|
-
end
|
101
29
|
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wice_grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: kaminari
|
@@ -27,60 +27,64 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.13.0
|
30
|
-
description:
|
31
|
-
|
30
|
+
description: One of the goals of this plugin was to allow the programmer to define
|
31
|
+
the contents of the cell by himself, just like one does when rendering a collection
|
32
|
+
via a simple table (and this is what differentiates WiceGrid from various scaffolding
|
33
|
+
solutions), but automate implementation of filters, ordering, paginations, CSV export,
|
34
|
+
and so on. Ruby blocks provide an elegant means for this.
|
32
35
|
email: yuri.leikind@gmail.com
|
33
36
|
executables: []
|
34
37
|
extensions: []
|
35
|
-
extra_rdoc_files:
|
36
|
-
- README.rdoc
|
38
|
+
extra_rdoc_files: []
|
37
39
|
files:
|
40
|
+
- .gitignore
|
38
41
|
- CHANGELOG
|
42
|
+
- Gemfile
|
39
43
|
- MIT-LICENSE
|
40
44
|
- README.rdoc
|
41
|
-
- RELEASE_NOTES_3.2.pre1.rdoc
|
42
|
-
- RELEASE_NOTES_3.2.pre2.rdoc
|
43
45
|
- Rakefile
|
44
46
|
- SAVED_QUERIES_HOWTO.rdoc
|
45
|
-
- VERSION
|
46
47
|
- app/views/kaminari/wice_grid/_gap.html.erb
|
47
48
|
- app/views/kaminari/wice_grid/_next_page.html.erb
|
48
49
|
- app/views/kaminari/wice_grid/_page.html.erb
|
49
50
|
- app/views/kaminari/wice_grid/_paginator.html.erb
|
50
51
|
- app/views/kaminari/wice_grid/_prev_page.html.erb
|
51
|
-
- lib/active_record_column_wrapper.rb
|
52
|
-
- lib/columns.rb
|
53
|
-
- lib/columns/column_action.rb
|
54
|
-
- lib/columns/column_boolean.rb
|
55
|
-
- lib/columns/column_custom_dropdown.rb
|
56
|
-
- lib/columns/column_date.rb
|
57
|
-
- lib/columns/column_datetime.rb
|
58
|
-
- lib/columns/column_float.rb
|
59
|
-
- lib/columns/column_integer.rb
|
60
|
-
- lib/columns/column_processor_index.rb
|
61
|
-
- lib/columns/column_range.rb
|
62
|
-
- lib/columns/column_string.rb
|
63
52
|
- lib/generators/wice_grid/add_migration_for_serialized_queries_generator.rb
|
64
53
|
- lib/generators/wice_grid/install_generator.rb
|
65
54
|
- lib/generators/wice_grid/templates/create_wice_grid_serialized_queries.rb
|
66
55
|
- lib/generators/wice_grid/templates/wice_grid.css.scss
|
67
56
|
- lib/generators/wice_grid/templates/wice_grid.yml
|
68
57
|
- lib/generators/wice_grid/templates/wice_grid_config.rb
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/
|
58
|
+
- lib/wice/active_record_column_wrapper.rb
|
59
|
+
- lib/wice/columns.rb
|
60
|
+
- lib/wice/columns/column_action.rb
|
61
|
+
- lib/wice/columns/column_boolean.rb
|
62
|
+
- lib/wice/columns/column_custom_dropdown.rb
|
63
|
+
- lib/wice/columns/column_date.rb
|
64
|
+
- lib/wice/columns/column_datetime.rb
|
65
|
+
- lib/wice/columns/column_float.rb
|
66
|
+
- lib/wice/columns/column_integer.rb
|
67
|
+
- lib/wice/columns/column_processor_index.rb
|
68
|
+
- lib/wice/columns/column_range.rb
|
69
|
+
- lib/wice/columns/column_string.rb
|
70
|
+
- lib/wice/grid_output_buffer.rb
|
71
|
+
- lib/wice/grid_renderer.rb
|
72
|
+
- lib/wice/helpers/js_calendar_helpers.rb
|
73
|
+
- lib/wice/helpers/wice_grid_misc_view_helpers.rb
|
74
|
+
- lib/wice/helpers/wice_grid_serialized_queries_view_helpers.rb
|
75
|
+
- lib/wice/helpers/wice_grid_view_helpers.rb
|
76
|
+
- lib/wice/kaminari_monkey_patching.rb
|
77
|
+
- lib/wice/table_column_matrix.rb
|
78
|
+
- lib/wice/wice_grid_controller.rb
|
79
|
+
- lib/wice/wice_grid_core_ext.rb
|
80
|
+
- lib/wice/wice_grid_misc.rb
|
81
|
+
- lib/wice/wice_grid_serialized_queries_controller.rb
|
82
|
+
- lib/wice/wice_grid_serialized_query.rb
|
83
|
+
- lib/wice/wice_grid_spreadsheet.rb
|
77
84
|
- lib/wice_grid.rb
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
- lib/wice_grid_serialized_queries_controller.rb
|
82
|
-
- lib/wice_grid_serialized_query.rb
|
83
|
-
- lib/wice_grid_spreadsheet.rb
|
85
|
+
- release_notes/RELEASE_NOTES_3.2.pre1.rdoc
|
86
|
+
- release_notes/RELEASE_NOTES_3.2.pre2.rdoc
|
87
|
+
- release_notes/RELEASE_NOTES_3.3.0.rdoc
|
84
88
|
- test/readme.txt
|
85
89
|
- vendor/assets/images/icons/grid/arrow_down.gif
|
86
90
|
- vendor/assets/images/icons/grid/arrow_up.gif
|
@@ -99,7 +103,7 @@ files:
|
|
99
103
|
- vendor/assets/javascripts/wice_grid_processor.js.coffee
|
100
104
|
- vendor/assets/javascripts/wice_grid_saved_queries_init.js.coffee
|
101
105
|
- wice_grid.gemspec
|
102
|
-
homepage:
|
106
|
+
homepage: https://github.com/leikind/wice_grid
|
103
107
|
licenses: []
|
104
108
|
post_install_message:
|
105
109
|
rdoc_options: []
|
@@ -122,5 +126,6 @@ rubyforge_project:
|
|
122
126
|
rubygems_version: 1.8.23
|
123
127
|
signing_key:
|
124
128
|
specification_version: 3
|
125
|
-
summary: Rails
|
129
|
+
summary: A Rails grid plugin to create grids with sorting, pagination, and (automatically
|
130
|
+
generated) filters.
|
126
131
|
test_files: []
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.2.1
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Wice #:nodoc:
|
2
|
-
module JsCalendarHelpers #:nodoc:
|
3
|
-
|
4
|
-
def date_calendar_jquery(initial_date, title, opts = {}) #:nodoc:
|
5
|
-
date_format = Wice::ConfigurationProvider.value_for(:DATE_FORMAT)
|
6
|
-
|
7
|
-
name, date_string, dom_id, datepicker_placeholder_id, date_span_id, close_calendar_event_name =
|
8
|
-
prepare_data_for_calendar(opts, date_format, initial_date)
|
9
|
-
|
10
|
-
hidden_field_tag_options = {
|
11
|
-
:id => dom_id,
|
12
|
-
'data-locale' => I18n.locale,
|
13
|
-
'data-date-format' => Wice::ConfigurationProvider.value_for(:DATE_FORMAT_JQUERY),
|
14
|
-
'data-button-image' => Wice::ConfigurationProvider.value_for(:CALENDAR_ICON),
|
15
|
-
'data-button-text' => title,
|
16
|
-
}
|
17
|
-
|
18
|
-
if opts[:fire_event]
|
19
|
-
hidden_field_tag_options['data-close-calendar-event-name'] = close_calendar_event_name
|
20
|
-
end
|
21
|
-
|
22
|
-
if Rails.env == 'development'
|
23
|
-
hidden_field_tag_options['class'] = 'check-for-datepicker'
|
24
|
-
end
|
25
|
-
|
26
|
-
date_picker = hidden_field_tag(name, date_string, hidden_field_tag_options) + ' ' +
|
27
|
-
|
28
|
-
link_to(date_string,
|
29
|
-
'#',
|
30
|
-
:id => date_span_id,
|
31
|
-
:class => 'date-label',
|
32
|
-
:title => ::Wice::NlMessage['date_string_tooltip'],
|
33
|
-
'data-dom-id' => dom_id
|
34
|
-
)
|
35
|
-
|
36
|
-
"<span id=\"#{datepicker_placeholder_id}\">#{date_picker}</span>"
|
37
|
-
end
|
38
|
-
|
39
|
-
protected
|
40
|
-
|
41
|
-
def prepare_data_for_calendar(opts, date_format, initial_date) #:nodoc:
|
42
|
-
options = {:prefix => 'date'}
|
43
|
-
options.merge!(opts)
|
44
|
-
name = options[:prefix]
|
45
|
-
date_string = initial_date.nil? ? '' : initial_date.strftime(date_format)
|
46
|
-
dom_id = name.gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '').gsub(/\./, '_').gsub(/_+/, '_')
|
47
|
-
datepicker_placeholder_id = dom_id + '_date_placeholder'
|
48
|
-
date_span_id = dom_id + '_date_view'
|
49
|
-
close_calendar_event_name = "wg:calendarChanged_#{options[:grid_name]}"
|
50
|
-
return name, date_string, dom_id, datepicker_placeholder_id, date_span_id, close_calendar_event_name
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|