wice_grid_mongoid 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/.gitignore +8 -0
  2. data/CHANGELOG +409 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +1172 -0
  5. data/Rakefile +42 -0
  6. data/SAVED_QUERIES_HOWTO.rdoc +123 -0
  7. data/VERSION +1 -0
  8. data/generators/common_templates/icons/arrow_down.gif +0 -0
  9. data/generators/common_templates/icons/arrow_up.gif +0 -0
  10. data/generators/common_templates/icons/calendar_view_month.png +0 -0
  11. data/generators/common_templates/icons/delete.png +0 -0
  12. data/generators/common_templates/icons/expand.png +0 -0
  13. data/generators/common_templates/icons/page_white_excel.png +0 -0
  14. data/generators/common_templates/icons/page_white_find.png +0 -0
  15. data/generators/common_templates/icons/table.png +0 -0
  16. data/generators/common_templates/icons/table_refresh.png +0 -0
  17. data/generators/common_templates/icons/tick_all.png +0 -0
  18. data/generators/common_templates/icons/untick_all.png +0 -0
  19. data/generators/common_templates/initializers/wice_grid_config.rb +215 -0
  20. data/generators/common_templates/locales/wice_grid.yml +269 -0
  21. data/generators/common_templates/stylesheets/wice_grid.css +173 -0
  22. data/generators/wice_grid_assets_jquery/templates/USAGE +6 -0
  23. data/generators/wice_grid_assets_jquery/templates/javascripts/wice_grid_jquery.js +161 -0
  24. data/generators/wice_grid_assets_jquery/wice_grid_assets_jquery_generator.rb +35 -0
  25. data/generators/wice_grid_assets_prototype/USAGE +8 -0
  26. data/generators/wice_grid_assets_prototype/templates/javascripts/calendarview.js +1168 -0
  27. data/generators/wice_grid_assets_prototype/templates/javascripts/wice_grid_prototype.js +153 -0
  28. data/generators/wice_grid_assets_prototype/templates/stylesheets/calendarview.css +107 -0
  29. data/generators/wice_grid_assets_prototype/wice_grid_assets_prototype_generator.rb +37 -0
  30. data/init.rb +1 -0
  31. data/install.rb +1 -0
  32. data/lib/grid_output_buffer.rb +52 -0
  33. data/lib/grid_renderer.rb +531 -0
  34. data/lib/helpers/js_calendar_helpers.rb +188 -0
  35. data/lib/helpers/wice_grid_misc_view_helpers.rb +113 -0
  36. data/lib/helpers/wice_grid_serialized_queries_view_helpers.rb +82 -0
  37. data/lib/helpers/wice_grid_view_helpers.rb +781 -0
  38. data/lib/js_adaptors/jquery_adaptor.rb +145 -0
  39. data/lib/js_adaptors/js_adaptor.rb +12 -0
  40. data/lib/js_adaptors/prototype_adaptor.rb +168 -0
  41. data/lib/table_column_matrix.rb +51 -0
  42. data/lib/view_columns.rb +469 -0
  43. data/lib/views/create.rjs +13 -0
  44. data/lib/views/delete.rjs +12 -0
  45. data/lib/wice_grid.rb +809 -0
  46. data/lib/wice_grid_controller.rb +165 -0
  47. data/lib/wice_grid_core_ext.rb +179 -0
  48. data/lib/wice_grid_misc.rb +99 -0
  49. data/lib/wice_grid_serialized_queries_controller.rb +77 -0
  50. data/lib/wice_grid_serialized_query.rb +14 -0
  51. data/lib/wice_grid_spreadsheet.rb +33 -0
  52. data/tasks/wice_grid_tasks.rake +28 -0
  53. data/test/.gitignore +2 -0
  54. data/test/database.yml +21 -0
  55. data/test/schema.rb +33 -0
  56. data/test/test_helper.rb +89 -0
  57. data/test/views/projects_and_people_grid.html.erb +12 -0
  58. data/test/views/projects_and_people_grid_invalid.html.erb +12 -0
  59. data/test/views/simple_projects_grid.html.erb +9 -0
  60. data/test/wice_grid_core_ext_test.rb +183 -0
  61. data/test/wice_grid_functional_test.rb +68 -0
  62. data/test/wice_grid_misc_test.rb +41 -0
  63. data/test/wice_grid_test.rb +42 -0
  64. data/test/wice_grid_view_helper_test.rb +12 -0
  65. data/uninstall.rb +1 -0
  66. data/wice_grid_mongoid.gemspec +111 -0
  67. metadata +141 -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,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
+
@@ -0,0 +1,12 @@
1
+
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+
4
+ include Wice::GridViewHelper
5
+
6
+ class WiceGridViewHelperTest < Test::Unit::TestCase
7
+
8
+ def test_truth
9
+ #flunk
10
+ end
11
+
12
+ end
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
@@ -0,0 +1,111 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{wice_grid_mongoid}
8
+ s.version = "0.5.6"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Yuri Leikind", "Aleksandr Furmanov"]
12
+ s.date = %q{2010-11-30}
13
+ s.description = %q{A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters }
14
+ s.email = ["yuri.leikind@gmail.com", "aleksandr.furmanov@gmail.com"]
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG",
21
+ "MIT-LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "SAVED_QUERIES_HOWTO.rdoc",
25
+ "VERSION",
26
+ "generators/common_templates/icons/arrow_down.gif",
27
+ "generators/common_templates/icons/arrow_up.gif",
28
+ "generators/common_templates/icons/calendar_view_month.png",
29
+ "generators/common_templates/icons/delete.png",
30
+ "generators/common_templates/icons/expand.png",
31
+ "generators/common_templates/icons/page_white_excel.png",
32
+ "generators/common_templates/icons/page_white_find.png",
33
+ "generators/common_templates/icons/table.png",
34
+ "generators/common_templates/icons/table_refresh.png",
35
+ "generators/common_templates/icons/tick_all.png",
36
+ "generators/common_templates/icons/untick_all.png",
37
+ "generators/common_templates/initializers/wice_grid_config.rb",
38
+ "generators/common_templates/locales/wice_grid.yml",
39
+ "generators/common_templates/stylesheets/wice_grid.css",
40
+ "generators/wice_grid_assets_jquery/templates/USAGE",
41
+ "generators/wice_grid_assets_jquery/templates/javascripts/wice_grid_jquery.js",
42
+ "generators/wice_grid_assets_jquery/wice_grid_assets_jquery_generator.rb",
43
+ "generators/wice_grid_assets_prototype/USAGE",
44
+ "generators/wice_grid_assets_prototype/templates/javascripts/calendarview.js",
45
+ "generators/wice_grid_assets_prototype/templates/javascripts/wice_grid_prototype.js",
46
+ "generators/wice_grid_assets_prototype/templates/stylesheets/calendarview.css",
47
+ "generators/wice_grid_assets_prototype/wice_grid_assets_prototype_generator.rb",
48
+ "init.rb",
49
+ "install.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/js_adaptors/jquery_adaptor.rb",
57
+ "lib/js_adaptors/js_adaptor.rb",
58
+ "lib/js_adaptors/prototype_adaptor.rb",
59
+ "lib/table_column_matrix.rb",
60
+ "lib/view_columns.rb",
61
+ "lib/views/create.rjs",
62
+ "lib/views/delete.rjs",
63
+ "lib/wice_grid.rb",
64
+ "lib/wice_grid_controller.rb",
65
+ "lib/wice_grid_core_ext.rb",
66
+ "lib/wice_grid_misc.rb",
67
+ "lib/wice_grid_serialized_queries_controller.rb",
68
+ "lib/wice_grid_serialized_query.rb",
69
+ "lib/wice_grid_spreadsheet.rb",
70
+ "tasks/wice_grid_tasks.rake",
71
+ "test/.gitignore",
72
+ "test/database.yml",
73
+ "test/schema.rb",
74
+ "test/test_helper.rb",
75
+ "test/views/projects_and_people_grid.html.erb",
76
+ "test/views/projects_and_people_grid_invalid.html.erb",
77
+ "test/views/simple_projects_grid.html.erb",
78
+ "test/wice_grid_core_ext_test.rb",
79
+ "test/wice_grid_functional_test.rb",
80
+ "test/wice_grid_misc_test.rb",
81
+ "test/wice_grid_test.rb",
82
+ "test/wice_grid_view_helper_test.rb",
83
+ "uninstall.rb",
84
+ "wice_grid_mongoid.gemspec"
85
+ ]
86
+ s.homepage = %q{http://github.com/afurmanov/wice_grid}
87
+ s.rdoc_options = ["--charset=UTF-8"]
88
+ s.require_paths = ["lib"]
89
+ s.rubygems_version = %q{1.3.7}
90
+ s.summary = %q{Rails Grid Plugin}
91
+ s.test_files = [
92
+ "test/schema.rb",
93
+ "test/test_helper.rb",
94
+ "test/wice_grid_core_ext_test.rb",
95
+ "test/wice_grid_functional_test.rb",
96
+ "test/wice_grid_misc_test.rb",
97
+ "test/wice_grid_test.rb",
98
+ "test/wice_grid_view_helper_test.rb"
99
+ ]
100
+
101
+ if s.respond_to? :specification_version then
102
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
103
+ s.specification_version = 3
104
+
105
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
106
+ else
107
+ end
108
+ else
109
+ end
110
+ end
111
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wice_grid_mongoid
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 6
10
+ version: 0.5.6
11
+ platform: ruby
12
+ authors:
13
+ - Yuri Leikind
14
+ - Aleksandr Furmanov
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-11-30 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:
25
+ - yuri.leikind@gmail.com
26
+ - aleksandr.furmanov@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ files:
34
+ - .gitignore
35
+ - CHANGELOG
36
+ - MIT-LICENSE
37
+ - README.rdoc
38
+ - Rakefile
39
+ - SAVED_QUERIES_HOWTO.rdoc
40
+ - VERSION
41
+ - generators/common_templates/icons/arrow_down.gif
42
+ - generators/common_templates/icons/arrow_up.gif
43
+ - generators/common_templates/icons/calendar_view_month.png
44
+ - generators/common_templates/icons/delete.png
45
+ - generators/common_templates/icons/expand.png
46
+ - generators/common_templates/icons/page_white_excel.png
47
+ - generators/common_templates/icons/page_white_find.png
48
+ - generators/common_templates/icons/table.png
49
+ - generators/common_templates/icons/table_refresh.png
50
+ - generators/common_templates/icons/tick_all.png
51
+ - generators/common_templates/icons/untick_all.png
52
+ - generators/common_templates/initializers/wice_grid_config.rb
53
+ - generators/common_templates/locales/wice_grid.yml
54
+ - generators/common_templates/stylesheets/wice_grid.css
55
+ - generators/wice_grid_assets_jquery/templates/USAGE
56
+ - generators/wice_grid_assets_jquery/templates/javascripts/wice_grid_jquery.js
57
+ - generators/wice_grid_assets_jquery/wice_grid_assets_jquery_generator.rb
58
+ - generators/wice_grid_assets_prototype/USAGE
59
+ - generators/wice_grid_assets_prototype/templates/javascripts/calendarview.js
60
+ - generators/wice_grid_assets_prototype/templates/javascripts/wice_grid_prototype.js
61
+ - generators/wice_grid_assets_prototype/templates/stylesheets/calendarview.css
62
+ - generators/wice_grid_assets_prototype/wice_grid_assets_prototype_generator.rb
63
+ - init.rb
64
+ - install.rb
65
+ - lib/grid_output_buffer.rb
66
+ - lib/grid_renderer.rb
67
+ - lib/helpers/js_calendar_helpers.rb
68
+ - lib/helpers/wice_grid_misc_view_helpers.rb
69
+ - lib/helpers/wice_grid_serialized_queries_view_helpers.rb
70
+ - lib/helpers/wice_grid_view_helpers.rb
71
+ - lib/js_adaptors/jquery_adaptor.rb
72
+ - lib/js_adaptors/js_adaptor.rb
73
+ - lib/js_adaptors/prototype_adaptor.rb
74
+ - lib/table_column_matrix.rb
75
+ - lib/view_columns.rb
76
+ - lib/views/create.rjs
77
+ - lib/views/delete.rjs
78
+ - lib/wice_grid.rb
79
+ - lib/wice_grid_controller.rb
80
+ - lib/wice_grid_core_ext.rb
81
+ - lib/wice_grid_misc.rb
82
+ - lib/wice_grid_serialized_queries_controller.rb
83
+ - lib/wice_grid_serialized_query.rb
84
+ - lib/wice_grid_spreadsheet.rb
85
+ - tasks/wice_grid_tasks.rake
86
+ - test/.gitignore
87
+ - test/database.yml
88
+ - test/schema.rb
89
+ - test/test_helper.rb
90
+ - test/views/projects_and_people_grid.html.erb
91
+ - test/views/projects_and_people_grid_invalid.html.erb
92
+ - test/views/simple_projects_grid.html.erb
93
+ - test/wice_grid_core_ext_test.rb
94
+ - test/wice_grid_functional_test.rb
95
+ - test/wice_grid_misc_test.rb
96
+ - test/wice_grid_test.rb
97
+ - test/wice_grid_view_helper_test.rb
98
+ - uninstall.rb
99
+ - wice_grid_mongoid.gemspec
100
+ has_rdoc: true
101
+ homepage: http://github.com/afurmanov/wice_grid
102
+ licenses: []
103
+
104
+ post_install_message:
105
+ rdoc_options:
106
+ - --charset=UTF-8
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirements: []
128
+
129
+ rubyforge_project:
130
+ rubygems_version: 1.3.7
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: Rails Grid Plugin
134
+ test_files:
135
+ - test/schema.rb
136
+ - test/test_helper.rb
137
+ - test/wice_grid_core_ext_test.rb
138
+ - test/wice_grid_functional_test.rb
139
+ - test/wice_grid_misc_test.rb
140
+ - test/wice_grid_test.rb
141
+ - test/wice_grid_view_helper_test.rb