mongoid_wice_grid 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/CHANGELOG +409 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +140 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +1188 -0
- data/Rakefile +40 -0
- data/SAVED_QUERIES_HOWTO.rdoc +123 -0
- data/VERSION +1 -0
- data/lib/filter_conditions_generators.rb +126 -0
- data/lib/generators/wice_grid/templates/calendarview.css +107 -0
- data/lib/generators/wice_grid/templates/calendarview.js +1168 -0
- data/lib/generators/wice_grid/templates/icons/arrow_down.gif +0 -0
- data/lib/generators/wice_grid/templates/icons/arrow_up.gif +0 -0
- data/lib/generators/wice_grid/templates/icons/calendar_view_month.png +0 -0
- data/lib/generators/wice_grid/templates/icons/delete.png +0 -0
- data/lib/generators/wice_grid/templates/icons/expand.png +0 -0
- data/lib/generators/wice_grid/templates/icons/page_white_excel.png +0 -0
- data/lib/generators/wice_grid/templates/icons/page_white_find.png +0 -0
- data/lib/generators/wice_grid/templates/icons/table.png +0 -0
- data/lib/generators/wice_grid/templates/icons/table_refresh.png +0 -0
- data/lib/generators/wice_grid/templates/icons/tick_all.png +0 -0
- data/lib/generators/wice_grid/templates/icons/untick_all.png +0 -0
- data/lib/generators/wice_grid/templates/wice_grid.css +173 -0
- data/lib/generators/wice_grid/templates/wice_grid.yml +269 -0
- data/lib/generators/wice_grid/templates/wice_grid_config.rb +215 -0
- data/lib/generators/wice_grid/templates/wice_grid_jquery.js +161 -0
- data/lib/generators/wice_grid/templates/wice_grid_prototype.js +153 -0
- data/lib/generators/wice_grid/wice_grid_assets_jquery_generator.rb +32 -0
- data/lib/generators/wice_grid/wice_grid_assets_prototype_generator.rb +34 -0
- data/lib/grid_output_buffer.rb +52 -0
- data/lib/grid_renderer.rb +547 -0
- data/lib/helpers/js_calendar_helpers.rb +183 -0
- data/lib/helpers/wice_grid_misc_view_helpers.rb +113 -0
- data/lib/helpers/wice_grid_serialized_queries_view_helpers.rb +82 -0
- data/lib/helpers/wice_grid_view_helpers.rb +761 -0
- data/lib/js_adaptors/jquery_adaptor.rb +145 -0
- data/lib/js_adaptors/js_adaptor.rb +12 -0
- data/lib/js_adaptors/prototype_adaptor.rb +168 -0
- data/lib/mongoid_field.rb +50 -0
- data/lib/tasks/wice_grid_tasks.rake +28 -0
- data/lib/view_columns.rb +464 -0
- data/lib/views/create.rjs +13 -0
- data/lib/views/delete.rjs +12 -0
- data/lib/wice_grid.rb +521 -0
- data/lib/wice_grid_controller.rb +165 -0
- data/lib/wice_grid_core_ext.rb +179 -0
- data/lib/wice_grid_misc.rb +99 -0
- data/lib/wice_grid_serialized_queries_controller.rb +77 -0
- data/lib/wice_grid_serialized_query.rb +14 -0
- data/lib/wice_grid_spreadsheet.rb +33 -0
- data/test/.gitignore +2 -0
- data/test/blueprint.rb +17 -0
- data/test/database.yml +21 -0
- data/test/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/test/public/javascripts/wice_grid.js +163 -0
- data/test/rails_mongoid_test.rb +104 -0
- data/test/rails_test_app.rb +71 -0
- data/test/require_gems.rb +19 -0
- data/test/schema.rb +33 -0
- data/test/spec_helper.rb +22 -0
- data/test/test_helper.rb +89 -0
- data/test/views/projects_and_people_grid.html.erb +12 -0
- data/test/views/projects_and_people_grid_invalid.html.erb +12 -0
- data/test/views/simple_projects_grid.html.erb +9 -0
- data/test/wice_grid_core_ext_test.rb +183 -0
- data/test/wice_grid_functional_test.rb +68 -0
- data/test/wice_grid_initializer.rb +215 -0
- data/test/wice_grid_misc_test.rb +41 -0
- data/test/wice_grid_test.rb +42 -0
- data/test/wice_grid_view_helper_test.rb +12 -0
- metadata +150 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
|
4
|
+
require 'action_controller/test_process'
|
5
|
+
|
6
|
+
class TestControllerBase < ActionController::Base
|
7
|
+
|
8
|
+
def render_wice_grid_view(name)
|
9
|
+
render :file => File.join(File.dirname(__FILE__), "views/#{name}.html.erb")
|
10
|
+
end
|
11
|
+
|
12
|
+
def rescue_action(e)
|
13
|
+
raise e
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class ProjectsController < TestControllerBase
|
19
|
+
|
20
|
+
def index
|
21
|
+
@grid = initialize_grid(Project, :order => 'created_at', :order_direction => 'DESC')
|
22
|
+
render_wice_grid_view('simple_projects_grid')
|
23
|
+
end
|
24
|
+
|
25
|
+
def index2
|
26
|
+
@grid = initialize_grid(Project, :include => :person, :order => 'created_at', :order_direction => 'DESC')
|
27
|
+
render_wice_grid_view('projects_and_people_grid')
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# class TasksController < TestControllerBase
|
33
|
+
#
|
34
|
+
# def index
|
35
|
+
# @grid = initialize_grid(Task, :include => [{:project => :person}, :person])
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# end
|
39
|
+
|
40
|
+
class WiceGridFunctionalTest < ActionController::TestCase
|
41
|
+
|
42
|
+
def setup
|
43
|
+
|
44
|
+
@controller = ProjectsController.new
|
45
|
+
@request = ActionController::TestRequest.new
|
46
|
+
@response = ActionController::TestResponse.new
|
47
|
+
|
48
|
+
ActionController::Routing::Routes.draw do |map|
|
49
|
+
map.resources :projects
|
50
|
+
map.resources :tasks
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_index_without_parameters
|
56
|
+
get :index
|
57
|
+
assert_response :success
|
58
|
+
assert css_select("table")
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_index2_without_parameters
|
62
|
+
#
|
63
|
+
# get :index2
|
64
|
+
# assert_response :success
|
65
|
+
#assert css_select("table")
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
if defined?(Wice::Defaults)
|
2
|
+
|
3
|
+
Wice::Defaults::JS_FRAMEWORK = :jquery
|
4
|
+
# Wice::Defaults::JS_FRAMEWORK = :prototype
|
5
|
+
|
6
|
+
# Style of the view helper.
|
7
|
+
# +false+ is a usual view helper.
|
8
|
+
# +true+ will allow to embed erb content in column (cell) definitions.
|
9
|
+
Wice::Defaults::ERB_MODE = false
|
10
|
+
|
11
|
+
# Default number of rows to show per page.
|
12
|
+
Wice::Defaults::PER_PAGE = 20
|
13
|
+
|
14
|
+
# Default order direction
|
15
|
+
Wice::Defaults::ORDER_DIRECTION = 'asc'
|
16
|
+
|
17
|
+
# Default name for a grid. A grid name is the basis for a lot of
|
18
|
+
# names including parameter names, DOM IDs, etc
|
19
|
+
# The shorter the name is the shorter the request URI will be.
|
20
|
+
Wice::Defaults::GRID_NAME = 'grid'
|
21
|
+
|
22
|
+
# If REUSE_LAST_COLUMN_FOR_FILTER_ICONS is true and the last column doesn't have any filter and column name, it will be used
|
23
|
+
# for filter related icons (filter icon, reset icon, show/hide icon), otherwise an additional table column is added.
|
24
|
+
Wice::Defaults::REUSE_LAST_COLUMN_FOR_FILTER_ICONS = true
|
25
|
+
|
26
|
+
Wice::Defaults::SHOW_HIDE_FILTER_ICON = 'icons/grid/page_white_find.png'
|
27
|
+
|
28
|
+
|
29
|
+
# Icon to trigger filtering.
|
30
|
+
Wice::Defaults::FILTER_ICON = 'icons/grid/table_refresh.png'
|
31
|
+
|
32
|
+
# Icon to reset the filter.
|
33
|
+
Wice::Defaults::RESET_ICON = "icons/grid/table.png"
|
34
|
+
|
35
|
+
# Icon to reset the filter.
|
36
|
+
Wice::Defaults::TOGGLE_MULTI_SELECT_ICON = "/images/icons/grid/expand.png"
|
37
|
+
|
38
|
+
# CSV Export icon.
|
39
|
+
Wice::Defaults::CSV_EXPORT_ICON = "/images/icons/grid/page_white_excel.png"
|
40
|
+
|
41
|
+
# Tick-All icon for the action column.
|
42
|
+
Wice::Defaults::TICK_ALL_ICON = "/images/icons/grid/tick_all.png"
|
43
|
+
|
44
|
+
# Untick-All icon for the action column.
|
45
|
+
Wice::Defaults::UNTICK_ALL_ICON = "/images/icons/grid/untick_all.png"
|
46
|
+
|
47
|
+
# The label of the first option of a custom dropdown list meaning 'All items'
|
48
|
+
Wice::Defaults::CUSTOM_FILTER_ALL_LABEL = '--'
|
49
|
+
|
50
|
+
|
51
|
+
# Allow switching between a single and multiple selection modes in custom filters (dropdown boxes)
|
52
|
+
Wice::Defaults::ALLOW_MULTIPLE_SELECTION = true
|
53
|
+
|
54
|
+
# Show the upper pagination panel by default or not
|
55
|
+
Wice::Defaults::SHOW_UPPER_PAGINATION_PANEL = false
|
56
|
+
|
57
|
+
# Enabling CSV export by default
|
58
|
+
Wice::Defaults::ENABLE_EXPORT_TO_CSV = false
|
59
|
+
|
60
|
+
|
61
|
+
# The strategy when to show the filter.
|
62
|
+
# * <tt>:when_filtered</tt> - when the table is the result of filtering
|
63
|
+
# * <tt>:always</tt> - show the filter always
|
64
|
+
# * <tt>:no</tt> - never show the filter
|
65
|
+
Wice::Defaults::SHOW_FILTER = :always
|
66
|
+
|
67
|
+
# A boolean value specifying if a change in a filter triggers reloading of the grid.
|
68
|
+
Wice::Defaults::AUTO_RELOAD = false
|
69
|
+
|
70
|
+
|
71
|
+
# SQL operator used for matching strings in string filters.
|
72
|
+
Wice::Defaults::STRING_MATCHING_OPERATOR = 'LIKE'
|
73
|
+
# STRING_MATCHING_OPERATOR = 'ILIKE' # Use this for Postgresql case-insensitive matching.
|
74
|
+
|
75
|
+
|
76
|
+
# Defining one string matching operator globally for the whole application turns is not enough
|
77
|
+
# when you connect to two databases one of which is MySQL and the other is Postgresql.
|
78
|
+
# If the key for an adapter is missing it will fall back to Wice::Defaults::STRING_MATCHING_OPERATOR
|
79
|
+
Wice::Defaults::STRING_MATCHING_OPERATORS = {
|
80
|
+
'ActiveRecord::ConnectionAdapters::MysqlAdapter' => 'LIKE',
|
81
|
+
'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => 'ILIKE'
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
87
|
+
# Advanced Filters #
|
88
|
+
|
89
|
+
# Switch of the negation checkbox in all text filters
|
90
|
+
Wice::Defaults::NEGATION_IN_STRING_FILTERS = false
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
95
|
+
# Showing All Queries #
|
96
|
+
|
97
|
+
# Enable or disable showing all queries (non-paginated table)
|
98
|
+
Wice::Defaults::ALLOW_SHOWING_ALL_QUERIES = true
|
99
|
+
|
100
|
+
# If number of all queries is more than this value, the user will be given a warning message
|
101
|
+
Wice::Defaults::START_SHOWING_WARNING_FROM = 100
|
102
|
+
|
103
|
+
|
104
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
105
|
+
# Saving Queries #
|
106
|
+
|
107
|
+
# Icon to delete a saved query
|
108
|
+
Wice::Defaults::DELETE_QUERY_ICON = 'icons/grid/delete.png'
|
109
|
+
|
110
|
+
# ActiveRecord model to store queries. Read the documentation for details
|
111
|
+
# QUERY_STORE_MODEL = 'WiceGridSerializedQuery'
|
112
|
+
Wice::Defaults::QUERY_STORE_MODEL = 'WiceGridSerializedQuery'
|
113
|
+
|
114
|
+
|
115
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
116
|
+
# Here go settings related to the calendar helpers #
|
117
|
+
|
118
|
+
# The default style of the date and datetime helper
|
119
|
+
# * <tt>:calendar</tt> - JS calendar
|
120
|
+
# * <tt>:standard</tt> - standard Rails date and datetime helpers
|
121
|
+
Wice::Defaults::HELPER_STYLE = :calendar
|
122
|
+
|
123
|
+
# Format of the datetime displayed.
|
124
|
+
# If you change the format, make sure to check if +DATETIME_PARSER+ can still parse this string.
|
125
|
+
Wice::Defaults::DATETIME_FORMAT = "%Y-%m-%d %H:%M"
|
126
|
+
|
127
|
+
# Format of the date displayed.
|
128
|
+
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
129
|
+
Wice::Defaults::DATE_FORMAT = "%Y-%m-%d"
|
130
|
+
|
131
|
+
# Format of the date displayed in jQuery's Datepicker
|
132
|
+
# If you change the format, make sure to check if +DATE_PARSER+ can still parse this string.
|
133
|
+
Wice::Defaults::DATE_FORMAT_JQUERY = "yy-mm-dd"
|
134
|
+
|
135
|
+
|
136
|
+
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
137
|
+
# format defined by +DATETIME_FORMAT+ and must generate a DateTime object.
|
138
|
+
# In many cases <tt>Time.zone.parse</tt> is enough, for instance, <tt>%Y-%m-%d</tt>. If you change the format, make sure to check this code
|
139
|
+
# and modify it if needed.
|
140
|
+
Wice::Defaults::DATETIME_PARSER = lambda{|datetime_string| Time.zone.parse(datetime_string) }
|
141
|
+
|
142
|
+
# With Calendar helpers enabled the parameter sent is the string displayed. This lambda will be given a date string in the
|
143
|
+
# format defined by +DATETIME+ and must generate a Date object.
|
144
|
+
# In many cases <tt>Date.parse</tt> is enough, for instance, <tt>%Y-%m-%d</tt>. If you change the format, make sure to check this code
|
145
|
+
# and modify it if needed.
|
146
|
+
Wice::Defaults::DATE_PARSER = lambda{|date_string| Date.parse(date_string) }
|
147
|
+
|
148
|
+
# Icon to popup the calendar.
|
149
|
+
Wice::Defaults::CALENDAR_ICON = "/images/icons/grid/calendar_view_month.png"
|
150
|
+
|
151
|
+
# popup calendar will be shown relative to the popup trigger element or to the mouse pointer
|
152
|
+
Wice::Defaults::POPUP_PLACEMENT_STRATEGY = :trigger # :pointer
|
153
|
+
|
154
|
+
######## Messages ########
|
155
|
+
|
156
|
+
Wice::Defaults::SHOW_FILTER_TOOLTIP = 'Show filter'
|
157
|
+
Wice::Defaults::HIDE_FILTER_TOOLTIP = 'Hide filter'
|
158
|
+
Wice::Defaults::CSV_EXPORT_TOOLTIP = 'Export to CSV'
|
159
|
+
|
160
|
+
Wice::Defaults::FILTER_TOOLTIP = "Filter"
|
161
|
+
Wice::Defaults::RESET_FILTER_TOOLTIP = "Reset"
|
162
|
+
|
163
|
+
Wice::Defaults::BOOLEAN_FILTER_TRUE_LABEL = 'yes'
|
164
|
+
Wice::Defaults::BOOLEAN_FILTER_FALSE_LABEL = 'no'
|
165
|
+
|
166
|
+
Wice::Defaults::PREVIOUS_LABEL = '« Previous'
|
167
|
+
Wice::Defaults::NEXT_LABEL = 'Next »'
|
168
|
+
|
169
|
+
# Title of the icon clicking on which will show the calendar to set the FROM date.
|
170
|
+
Wice::Defaults::DATE_SELECTOR_TOOLTIP_FROM = 'From'
|
171
|
+
# Title of the icon clicking on which will show the calendar to set the TO date.
|
172
|
+
Wice::Defaults::DATE_SELECTOR_TOOLTIP_TO = 'To'
|
173
|
+
|
174
|
+
# The title of the checkox to turn on negation
|
175
|
+
Wice::Defaults::NEGATION_CHECKBOX_TITLE = 'Exclude'
|
176
|
+
|
177
|
+
# link to switch to "show all records"
|
178
|
+
Wice::Defaults::SHOW_ALL_RECORDS_LABEL = 'show all'
|
179
|
+
|
180
|
+
# tooltip for the link to switch to "show all records"
|
181
|
+
Wice::Defaults::SHOW_ALL_RECORDS_TOOLTIP = 'Show all records'
|
182
|
+
|
183
|
+
# Warning message shown when the user wants to switch to all-records mode
|
184
|
+
Wice::Defaults::ALL_QUERIES_WARNING = 'Are you sure you want to display all records?'
|
185
|
+
|
186
|
+
# link to paginated view
|
187
|
+
Wice::Defaults::SWITCH_BACK_TO_PAGINATED_MODE_LABEL = "back to paginated view"
|
188
|
+
|
189
|
+
# tooltip for the link to paginated view
|
190
|
+
Wice::Defaults::SWITCH_BACK_TO_PAGINATED_MODE_TOOLTIP = "Switch back to the view with pages"
|
191
|
+
|
192
|
+
# Title of the date string.
|
193
|
+
Wice::Defaults::DATE_STRING_TOOLTIP = 'Click to delete'
|
194
|
+
|
195
|
+
|
196
|
+
Wice::Defaults::SAVED_QUERY_PANEL_TITLE = 'Saved Queries'
|
197
|
+
Wice::Defaults::SAVE_QUERY_BUTTON_LABEL = 'Save the state of filters'
|
198
|
+
|
199
|
+
Wice::Defaults::SAVED_QUERY_DELETION_CONFIRMATION = 'Are you sure?'
|
200
|
+
Wice::Defaults::SAVED_QUERY_DELETION_LINK_TITLE = 'Delete query'
|
201
|
+
Wice::Defaults::SAVED_QUERY_LINK_TITLE = 'Load query'
|
202
|
+
|
203
|
+
Wice::Defaults::VALIDATES_UNIQUENESS_ERROR = "A query with this name already exists"
|
204
|
+
Wice::Defaults::VALIDATES_PRESENCE_ERROR = "Please sumbit the name of the custom query"
|
205
|
+
|
206
|
+
Wice::Defaults::QUERY_DELETED_MESSAGE = "Saved query deleted."
|
207
|
+
Wice::Defaults::QUERY_SAVED_MESSAGE = "Query saved."
|
208
|
+
|
209
|
+
Wice::Defaults::SELECT_ALL = "Select all"
|
210
|
+
Wice::Defaults::DESELECT_ALL = "Remove selection"
|
211
|
+
|
212
|
+
######## Messages END ########
|
213
|
+
|
214
|
+
end
|
215
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# More or less complete
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
4
|
+
require 'action_controller/test_process'
|
5
|
+
|
6
|
+
class WiceGridMiscTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
|
9
|
+
def test_get_query_store_model
|
10
|
+
assert_equal(SavedQuery, Wice.get_query_store_model)
|
11
|
+
end
|
12
|
+
|
13
|
+
class InvalidQueryStorageModel
|
14
|
+
end
|
15
|
+
class InvalidQueryStorageModel2
|
16
|
+
def self.list
|
17
|
+
end
|
18
|
+
end
|
19
|
+
class InvalidQueryStorageModel3
|
20
|
+
def self.list(a,b,c)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
class ValidQueryStorageModel
|
24
|
+
def self.list(a,b)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_validate_query_model
|
29
|
+
assert_raise(Wice::WiceGridArgumentError){Wice.validate_query_model(InvalidQueryStorageModel)}
|
30
|
+
assert_raise(Wice::WiceGridArgumentError){Wice.validate_query_model(InvalidQueryStorageModel2)}
|
31
|
+
assert_raise(Wice::WiceGridArgumentError){Wice.validate_query_model(InvalidQueryStorageModel3)}
|
32
|
+
assert_nothing_raised{Wice.validate_query_model(ValidQueryStorageModel)}
|
33
|
+
assert_equal(true, Wice.validate_query_model(ValidQueryStorageModel))
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_deprecated_call
|
37
|
+
opts = {:foo => :baz, :old_name => 23}
|
38
|
+
Wice.deprecated_call(:old_name, :new_name, opts)
|
39
|
+
assert_equal({:foo => :baz, :new_name => 23} , opts)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'action_controller/test_process'
|
4
|
+
|
5
|
+
class ObjectWithoutStringRepresentation
|
6
|
+
undef_method :to_s
|
7
|
+
end
|
8
|
+
|
9
|
+
class WiceGridTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
#
|
12
|
+
def setup
|
13
|
+
@controller = ActionController::Base.new
|
14
|
+
@controller.params = {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_grid_parameter_must_be_a_grid
|
18
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(nil, @controller) }
|
19
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new("MyModel", @controller) }
|
20
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(String, @controller) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_after_parameter_validation
|
24
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(Person, @controller, :after => "do something") }
|
25
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(Person, @controller, :after => 12) }
|
26
|
+
assert_nothing_raised { Wice::WiceGrid.new(Person, @controller, :after => lambda { } ) }
|
27
|
+
assert_nothing_raised { Wice::WiceGrid.new(Person, @controller, :after => :symbol) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_grid_name_parameter_validation
|
31
|
+
object_without_to_s = ObjectWithoutStringRepresentation.new
|
32
|
+
assert !object_without_to_s.respond_to?(:to_s)
|
33
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(Person, @controller, :name => object_without_to_s) }
|
34
|
+
assert_nothing_raised { Wice::WiceGrid.new(Person, @controller, :name => "1nvalid") }
|
35
|
+
# we are strict about grid names
|
36
|
+
assert_raise(Wice::WiceGridArgumentError) { Wice::WiceGrid.new(Person, @controller, :name => "céhec") }
|
37
|
+
assert_nothing_raised { Wice::WiceGrid.new(Person, @controller, :name => "valid") }
|
38
|
+
assert_nothing_raised { Wice::WiceGrid.new(Person, @controller, :name => :valid) }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mongoid_wice_grid
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 4.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Yuri Leikind
|
14
|
+
- Aleksandr Furmanov
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-11-24 00:00:00 -08:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: "A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters "
|
24
|
+
email: aleksandr.furmanov@gmail.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files:
|
30
|
+
- README.rdoc
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- CHANGELOG
|
34
|
+
- Gemfile
|
35
|
+
- Gemfile.lock
|
36
|
+
- MIT-LICENSE
|
37
|
+
- README.rdoc
|
38
|
+
- Rakefile
|
39
|
+
- SAVED_QUERIES_HOWTO.rdoc
|
40
|
+
- VERSION
|
41
|
+
- lib/filter_conditions_generators.rb
|
42
|
+
- lib/generators/wice_grid/templates/calendarview.css
|
43
|
+
- lib/generators/wice_grid/templates/calendarview.js
|
44
|
+
- lib/generators/wice_grid/templates/icons/arrow_down.gif
|
45
|
+
- lib/generators/wice_grid/templates/icons/arrow_up.gif
|
46
|
+
- lib/generators/wice_grid/templates/icons/calendar_view_month.png
|
47
|
+
- lib/generators/wice_grid/templates/icons/delete.png
|
48
|
+
- lib/generators/wice_grid/templates/icons/expand.png
|
49
|
+
- lib/generators/wice_grid/templates/icons/page_white_excel.png
|
50
|
+
- lib/generators/wice_grid/templates/icons/page_white_find.png
|
51
|
+
- lib/generators/wice_grid/templates/icons/table.png
|
52
|
+
- lib/generators/wice_grid/templates/icons/table_refresh.png
|
53
|
+
- lib/generators/wice_grid/templates/icons/tick_all.png
|
54
|
+
- lib/generators/wice_grid/templates/icons/untick_all.png
|
55
|
+
- lib/generators/wice_grid/templates/wice_grid.css
|
56
|
+
- lib/generators/wice_grid/templates/wice_grid.yml
|
57
|
+
- lib/generators/wice_grid/templates/wice_grid_config.rb
|
58
|
+
- lib/generators/wice_grid/templates/wice_grid_jquery.js
|
59
|
+
- lib/generators/wice_grid/templates/wice_grid_prototype.js
|
60
|
+
- lib/generators/wice_grid/wice_grid_assets_jquery_generator.rb
|
61
|
+
- lib/generators/wice_grid/wice_grid_assets_prototype_generator.rb
|
62
|
+
- lib/grid_output_buffer.rb
|
63
|
+
- lib/grid_renderer.rb
|
64
|
+
- lib/helpers/js_calendar_helpers.rb
|
65
|
+
- lib/helpers/wice_grid_misc_view_helpers.rb
|
66
|
+
- lib/helpers/wice_grid_serialized_queries_view_helpers.rb
|
67
|
+
- lib/helpers/wice_grid_view_helpers.rb
|
68
|
+
- lib/js_adaptors/jquery_adaptor.rb
|
69
|
+
- lib/js_adaptors/js_adaptor.rb
|
70
|
+
- lib/js_adaptors/prototype_adaptor.rb
|
71
|
+
- lib/mongoid_field.rb
|
72
|
+
- lib/tasks/wice_grid_tasks.rake
|
73
|
+
- lib/view_columns.rb
|
74
|
+
- lib/views/create.rjs
|
75
|
+
- lib/views/delete.rjs
|
76
|
+
- lib/wice_grid.rb
|
77
|
+
- lib/wice_grid_controller.rb
|
78
|
+
- lib/wice_grid_core_ext.rb
|
79
|
+
- lib/wice_grid_misc.rb
|
80
|
+
- lib/wice_grid_serialized_queries_controller.rb
|
81
|
+
- lib/wice_grid_serialized_query.rb
|
82
|
+
- lib/wice_grid_spreadsheet.rb
|
83
|
+
- test/.gitignore
|
84
|
+
- test/blueprint.rb
|
85
|
+
- test/database.yml
|
86
|
+
- test/public/javascripts/jquery-1.4.2.min.js
|
87
|
+
- test/public/javascripts/wice_grid.js
|
88
|
+
- test/rails_mongoid_test.rb
|
89
|
+
- test/rails_test_app.rb
|
90
|
+
- test/require_gems.rb
|
91
|
+
- test/schema.rb
|
92
|
+
- test/spec_helper.rb
|
93
|
+
- test/test_helper.rb
|
94
|
+
- test/views/projects_and_people_grid.html.erb
|
95
|
+
- test/views/projects_and_people_grid_invalid.html.erb
|
96
|
+
- test/views/simple_projects_grid.html.erb
|
97
|
+
- test/wice_grid_core_ext_test.rb
|
98
|
+
- test/wice_grid_functional_test.rb
|
99
|
+
- test/wice_grid_initializer.rb
|
100
|
+
- test/wice_grid_misc_test.rb
|
101
|
+
- test/wice_grid_test.rb
|
102
|
+
- test/wice_grid_view_helper_test.rb
|
103
|
+
has_rdoc: true
|
104
|
+
homepage: https://github.com/afurmanov/wice_grid
|
105
|
+
licenses: []
|
106
|
+
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options:
|
109
|
+
- --charset=UTF-8
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
120
|
+
version: "0"
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
130
|
+
requirements: []
|
131
|
+
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 1.3.7
|
134
|
+
signing_key:
|
135
|
+
specification_version: 3
|
136
|
+
summary: Rails Grid Plugin
|
137
|
+
test_files:
|
138
|
+
- test/blueprint.rb
|
139
|
+
- test/rails_mongoid_test.rb
|
140
|
+
- test/rails_test_app.rb
|
141
|
+
- test/require_gems.rb
|
142
|
+
- test/schema.rb
|
143
|
+
- test/spec_helper.rb
|
144
|
+
- test/test_helper.rb
|
145
|
+
- test/wice_grid_core_ext_test.rb
|
146
|
+
- test/wice_grid_functional_test.rb
|
147
|
+
- test/wice_grid_initializer.rb
|
148
|
+
- test/wice_grid_misc_test.rb
|
149
|
+
- test/wice_grid_test.rb
|
150
|
+
- test/wice_grid_view_helper_test.rb
|