dry_crud 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/README.rdoc +32 -24
  2. data/Rakefile +73 -19
  3. data/VERSION +1 -1
  4. data/lib/generators/dry_crud/dry_crud_generator.rb +11 -2
  5. data/lib/generators/dry_crud/templates/app/assets/images/actions/delete.png +0 -0
  6. data/lib/generators/dry_crud/templates/app/assets/stylesheets/crud.scss +64 -0
  7. data/lib/generators/dry_crud/templates/app/assets/stylesheets/sample.scss +258 -0
  8. data/lib/generators/dry_crud/templates/app/controllers/crud_controller.rb +30 -24
  9. data/lib/generators/dry_crud/templates/app/controllers/list_controller.rb +93 -7
  10. data/lib/generators/dry_crud/templates/app/helpers/crud_helper.rb +70 -16
  11. data/lib/generators/dry_crud/templates/app/helpers/list_helper.rb +1 -0
  12. data/lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb +11 -3
  13. data/lib/generators/dry_crud/templates/app/helpers/standard_helper.rb +36 -45
  14. data/lib/generators/dry_crud/templates/app/helpers/standard_table_builder.rb +4 -3
  15. data/lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.erb +2 -2
  16. data/lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.haml +3 -0
  17. data/lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.haml +1 -0
  18. data/lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.erb +2 -2
  19. data/lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.haml +3 -0
  20. data/lib/generators/dry_crud/templates/app/views/crud/_attrs.html.erb +1 -1
  21. data/lib/generators/dry_crud/templates/app/views/crud/_attrs.html.haml +1 -0
  22. data/lib/generators/dry_crud/templates/app/views/crud/_form.html.haml +1 -0
  23. data/lib/generators/dry_crud/templates/app/views/crud/_list.html.haml +1 -0
  24. data/lib/generators/dry_crud/templates/app/views/crud/edit.html.erb +0 -2
  25. data/lib/generators/dry_crud/templates/app/views/crud/edit.html.haml +5 -0
  26. data/lib/generators/dry_crud/templates/app/views/crud/new.html.erb +0 -2
  27. data/lib/generators/dry_crud/templates/app/views/crud/new.html.haml +5 -0
  28. data/lib/generators/dry_crud/templates/app/views/crud/show.html.erb +0 -2
  29. data/lib/generators/dry_crud/templates/app/views/crud/show.html.haml +7 -0
  30. data/lib/generators/dry_crud/templates/app/views/layouts/_flash.html.erb +8 -0
  31. data/lib/generators/dry_crud/templates/app/views/layouts/_flash.html.haml +4 -0
  32. data/lib/generators/dry_crud/templates/app/views/layouts/_menu.html.erb +3 -0
  33. data/lib/generators/dry_crud/templates/app/views/layouts/_menu.html.haml +3 -0
  34. data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.erb +6 -0
  35. data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.haml +3 -0
  36. data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.erb +40 -21
  37. data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.haml +42 -0
  38. data/lib/generators/dry_crud/templates/app/views/list/_actions_index.html.haml +0 -0
  39. data/lib/generators/dry_crud/templates/app/views/list/_list.html.haml +1 -0
  40. data/lib/generators/dry_crud/templates/app/views/list/_search.html.erb +4 -3
  41. data/lib/generators/dry_crud/templates/app/views/list/_search.html.haml +5 -0
  42. data/lib/generators/dry_crud/templates/app/views/list/index.html.erb +2 -4
  43. data/lib/generators/dry_crud/templates/app/views/list/index.html.haml +7 -0
  44. data/lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.erb +1 -1
  45. data/lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.haml +6 -0
  46. data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.erb +1 -1
  47. data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.haml +3 -0
  48. data/lib/generators/dry_crud/templates/config/locales/en_crud.yml +6 -6
  49. data/lib/generators/dry_crud/templates/test/crud_test_model.rb +5 -1
  50. data/lib/generators/dry_crud/templates/test/custom_assertions.rb +4 -4
  51. data/lib/generators/dry_crud/templates/test/functional/crud_controller_test_helper.rb +40 -32
  52. data/lib/generators/dry_crud/templates/test/functional/crud_test_models_controller_test.rb +3 -5
  53. data/lib/generators/dry_crud/templates/test/unit/helpers/crud_helper_test.rb +5 -3
  54. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_form_builder_test.rb +4 -4
  55. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_helper_test.rb +11 -25
  56. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_table_builder_test.rb +9 -9
  57. data/test/templates/Gemfile +13 -6
  58. data/test/templates/app/controllers/admin/cities_controller.rb +14 -0
  59. data/test/templates/app/controllers/admin/countries_controller.rb +14 -0
  60. data/test/templates/app/controllers/people_controller.rb +1 -1
  61. data/test/templates/app/controllers/vips_controller.rb +2 -2
  62. data/test/templates/app/helpers/cities_helper.rb +9 -0
  63. data/test/templates/app/models/city.rb +4 -3
  64. data/test/templates/app/models/country.rb +14 -0
  65. data/test/templates/app/views/admin/cities/_actions_index.html.erb +2 -0
  66. data/test/templates/app/views/admin/cities/_actions_index.html.haml +2 -0
  67. data/test/templates/app/views/admin/cities/_form.html.erb +1 -0
  68. data/test/templates/app/views/admin/cities/_form.html.haml +1 -0
  69. data/test/templates/app/views/{cities → admin/cities}/_hello.html.erb +0 -0
  70. data/test/templates/app/views/admin/cities/_hello.html.haml +1 -0
  71. data/test/templates/app/views/admin/cities/_list.html.erb +6 -0
  72. data/test/templates/app/views/admin/cities/_list.html.haml +5 -0
  73. data/test/templates/app/views/admin/countries/_list.html.erb +5 -0
  74. data/test/templates/app/views/admin/countries/_list.html.haml +4 -0
  75. data/test/templates/app/views/ajax/_actions_index.html.haml +8 -0
  76. data/test/templates/app/views/ajax/_hello.html.haml +1 -0
  77. data/test/templates/app/views/ajax/ajax.js.haml +1 -0
  78. data/test/templates/app/views/layouts/_menu.html.erb +1 -1
  79. data/test/templates/app/views/layouts/_menu.html.haml +3 -0
  80. data/test/templates/app/views/people/_attrs.html.haml +4 -0
  81. data/test/templates/app/views/people/_list.html.haml +1 -0
  82. data/test/templates/config/database.yml +8 -9
  83. data/test/templates/config/locales/en_cities.yml +3 -3
  84. data/test/templates/config/routes.rb +16 -8
  85. data/test/templates/db/migrate/20100511174904_create_people_and_cities.rb +7 -7
  86. data/test/templates/db/seeds.rb +11 -5
  87. data/test/templates/test/fixtures/cities.yml +3 -3
  88. data/test/templates/test/fixtures/countries.yml +11 -0
  89. data/test/templates/test/functional/admin/cities_controller_test.rb +59 -0
  90. data/test/templates/test/functional/admin/countries_controller_test.rb +43 -0
  91. data/test/templates/test/functional/people_controller_test.rb +6 -1
  92. metadata +54 -15
  93. data/lib/generators/dry_crud/templates/app/assets/stylesheets/crud.css +0 -239
  94. data/test/templates/app/controllers/cities_controller.rb +0 -10
  95. data/test/templates/app/views/cities/_form.html.erb +0 -8
  96. data/test/templates/app/views/cities/_list.html.erb +0 -4
  97. data/test/templates/test/functional/cities_controller_test.rb +0 -45
@@ -0,0 +1,43 @@
1
+ require 'test_helper'
2
+ require File.join('functional', 'crud_controller_test_helper')
3
+
4
+ class Admin::CountriesControllerTest < ActionController::TestCase
5
+
6
+ include CrudControllerTestHelper
7
+
8
+ def test_setup
9
+ assert_equal 3, Country.count
10
+ assert_recognizes({:controller => 'admin/countries', :action => 'index'}, 'admin/countries')
11
+ assert_recognizes({:controller => 'admin/countries', :action => 'show', :id => '1'}, 'admin/countries/1')
12
+ end
13
+
14
+ def test_index
15
+ super
16
+ assert_equal Country.order('name').all, assigns(:entries)
17
+ assert_equal [:admin], @controller.send(:parents)
18
+ assert_nil @controller.send(:parent)
19
+ assert_equal Country.scoped, @controller.send(:model_scope)
20
+ assert_equal [:admin,2], @controller.send(:path_args, 2)
21
+ end
22
+
23
+ def test_show
24
+ get :show, test_params(:id => test_entry.id)
25
+ assert_redirected_to_index
26
+ end
27
+
28
+ def test_show_with_non_existing_id_raises_RecordNotFound #not
29
+ get :show, test_params(:id => 9999)
30
+ assert_redirected_to_index
31
+ end
32
+
33
+ protected
34
+
35
+ def test_entry
36
+ countries(:usa)
37
+ end
38
+
39
+ def test_entry_attrs
40
+ {:name => 'United States of America', :code => 'US'}
41
+ end
42
+
43
+ end
@@ -14,7 +14,12 @@ class PeopleControllerTest < ActionController::TestCase
14
14
  def test_index
15
15
  super
16
16
  assert_equal 2, assigns(:entries).size
17
- assert_equal Person.includes(:city).order('people.name, cities.country_code, cities.name').all, assigns(:entries)
17
+ assert_equal Person.includes(:city => :country).order('people.name, countries.code, cities.name').all, assigns(:entries)
18
+
19
+ assert_equal [], @controller.send(:parents)
20
+ assert_nil @controller.send(:parent)
21
+ assert_equal Person.scoped, @controller.send(:model_scope)
22
+ assert_equal [2], @controller.send(:path_args, 2)
18
23
  end
19
24
 
20
25
  def test_index_search
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry_crud
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 1.4.0
10
+ version: 1.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pascal Zumkehr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-05 00:00:00 +01:00
18
+ date: 2012-03-02 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,11 +26,11 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 7
29
+ hash: 3
30
30
  segments:
31
31
  - 3
32
- - 0
33
- version: "3.0"
32
+ - 2
33
+ version: "3.2"
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  description: |
@@ -52,7 +52,8 @@ files:
52
52
  - lib/generators/dry_crud/templates/app/assets/images/actions/edit.png
53
53
  - lib/generators/dry_crud/templates/app/assets/images/actions/list.png
54
54
  - lib/generators/dry_crud/templates/app/assets/images/actions/show.png
55
- - lib/generators/dry_crud/templates/app/assets/stylesheets/crud.css
55
+ - lib/generators/dry_crud/templates/app/assets/stylesheets/crud.scss
56
+ - lib/generators/dry_crud/templates/app/assets/stylesheets/sample.scss
56
57
  - lib/generators/dry_crud/templates/app/controllers/crud_controller.rb
57
58
  - lib/generators/dry_crud/templates/app/controllers/list_controller.rb
58
59
  - lib/generators/dry_crud/templates/app/helpers/crud_helper.rb
@@ -61,22 +62,43 @@ files:
61
62
  - lib/generators/dry_crud/templates/app/helpers/standard_helper.rb
62
63
  - lib/generators/dry_crud/templates/app/helpers/standard_table_builder.rb
63
64
  - lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.erb
65
+ - lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.haml
64
66
  - lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.erb
67
+ - lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.haml
65
68
  - lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.erb
69
+ - lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.haml
66
70
  - lib/generators/dry_crud/templates/app/views/crud/_attrs.html.erb
71
+ - lib/generators/dry_crud/templates/app/views/crud/_attrs.html.haml
67
72
  - lib/generators/dry_crud/templates/app/views/crud/_form.html.erb
73
+ - lib/generators/dry_crud/templates/app/views/crud/_form.html.haml
68
74
  - lib/generators/dry_crud/templates/app/views/crud/_list.html.erb
75
+ - lib/generators/dry_crud/templates/app/views/crud/_list.html.haml
69
76
  - lib/generators/dry_crud/templates/app/views/crud/edit.html.erb
77
+ - lib/generators/dry_crud/templates/app/views/crud/edit.html.haml
70
78
  - lib/generators/dry_crud/templates/app/views/crud/new.html.erb
79
+ - lib/generators/dry_crud/templates/app/views/crud/new.html.haml
71
80
  - lib/generators/dry_crud/templates/app/views/crud/show.html.erb
81
+ - lib/generators/dry_crud/templates/app/views/crud/show.html.haml
82
+ - lib/generators/dry_crud/templates/app/views/layouts/_flash.html.erb
83
+ - lib/generators/dry_crud/templates/app/views/layouts/_flash.html.haml
72
84
  - lib/generators/dry_crud/templates/app/views/layouts/_menu.html.erb
85
+ - lib/generators/dry_crud/templates/app/views/layouts/_menu.html.haml
86
+ - lib/generators/dry_crud/templates/app/views/layouts/_nav.html.erb
87
+ - lib/generators/dry_crud/templates/app/views/layouts/_nav.html.haml
73
88
  - lib/generators/dry_crud/templates/app/views/layouts/crud.html.erb
89
+ - lib/generators/dry_crud/templates/app/views/layouts/crud.html.haml
74
90
  - lib/generators/dry_crud/templates/app/views/list/_actions_index.html.erb
91
+ - lib/generators/dry_crud/templates/app/views/list/_actions_index.html.haml
75
92
  - lib/generators/dry_crud/templates/app/views/list/_list.html.erb
93
+ - lib/generators/dry_crud/templates/app/views/list/_list.html.haml
76
94
  - lib/generators/dry_crud/templates/app/views/list/_search.html.erb
95
+ - lib/generators/dry_crud/templates/app/views/list/_search.html.haml
77
96
  - lib/generators/dry_crud/templates/app/views/list/index.html.erb
97
+ - lib/generators/dry_crud/templates/app/views/list/index.html.haml
78
98
  - lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.erb
99
+ - lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.haml
79
100
  - lib/generators/dry_crud/templates/app/views/shared/_labeled.html.erb
101
+ - lib/generators/dry_crud/templates/app/views/shared/_labeled.html.haml
80
102
  - lib/generators/dry_crud/templates/config/locales/en_crud.yml
81
103
  - lib/generators/dry_crud/templates/INSTALL
82
104
  - lib/generators/dry_crud/templates/test/crud_test_model.rb
@@ -90,22 +112,38 @@ files:
90
112
  - lib/generators/dry_crud/templates/test/unit/helpers/standard_helper_test.rb
91
113
  - lib/generators/dry_crud/templates/test/unit/helpers/standard_table_builder_test.rb
92
114
  - lib/generators/dry_crud/USAGE
115
+ - test/templates/app/controllers/admin/cities_controller.rb
116
+ - test/templates/app/controllers/admin/countries_controller.rb
93
117
  - test/templates/app/controllers/ajax_controller.rb
94
- - test/templates/app/controllers/cities_controller.rb
95
118
  - test/templates/app/controllers/people_controller.rb
96
119
  - test/templates/app/controllers/vips_controller.rb
120
+ - test/templates/app/helpers/cities_helper.rb
97
121
  - test/templates/app/helpers/people_helper.rb
98
122
  - test/templates/app/models/city.rb
123
+ - test/templates/app/models/country.rb
99
124
  - test/templates/app/models/person.rb
125
+ - test/templates/app/views/admin/cities/_actions_index.html.erb
126
+ - test/templates/app/views/admin/cities/_actions_index.html.haml
127
+ - test/templates/app/views/admin/cities/_form.html.erb
128
+ - test/templates/app/views/admin/cities/_form.html.haml
129
+ - test/templates/app/views/admin/cities/_hello.html.erb
130
+ - test/templates/app/views/admin/cities/_hello.html.haml
131
+ - test/templates/app/views/admin/cities/_list.html.erb
132
+ - test/templates/app/views/admin/cities/_list.html.haml
133
+ - test/templates/app/views/admin/countries/_list.html.erb
134
+ - test/templates/app/views/admin/countries/_list.html.haml
100
135
  - test/templates/app/views/ajax/_actions_index.html.erb
136
+ - test/templates/app/views/ajax/_actions_index.html.haml
101
137
  - test/templates/app/views/ajax/_hello.html.erb
138
+ - test/templates/app/views/ajax/_hello.html.haml
102
139
  - test/templates/app/views/ajax/ajax.js.erb
103
- - test/templates/app/views/cities/_form.html.erb
104
- - test/templates/app/views/cities/_hello.html.erb
105
- - test/templates/app/views/cities/_list.html.erb
140
+ - test/templates/app/views/ajax/ajax.js.haml
106
141
  - test/templates/app/views/layouts/_menu.html.erb
142
+ - test/templates/app/views/layouts/_menu.html.haml
107
143
  - test/templates/app/views/people/_attrs.html.erb
144
+ - test/templates/app/views/people/_attrs.html.haml
108
145
  - test/templates/app/views/people/_list.html.erb
146
+ - test/templates/app/views/people/_list.html.haml
109
147
  - test/templates/config/database.yml
110
148
  - test/templates/config/locales/en_cities.yml
111
149
  - test/templates/config/routes.rb
@@ -113,8 +151,10 @@ files:
113
151
  - test/templates/db/seeds.rb
114
152
  - test/templates/Gemfile
115
153
  - test/templates/test/fixtures/cities.yml
154
+ - test/templates/test/fixtures/countries.yml
116
155
  - test/templates/test/fixtures/people.yml
117
- - test/templates/test/functional/cities_controller_test.rb
156
+ - test/templates/test/functional/admin/cities_controller_test.rb
157
+ - test/templates/test/functional/admin/countries_controller_test.rb
118
158
  - test/templates/test/functional/people_controller_test.rb
119
159
  - Rakefile
120
160
  - MIT-LICENSE
@@ -127,11 +167,10 @@ licenses: []
127
167
  post_install_message:
128
168
  rdoc_options:
129
169
  - --title
130
- - Dry Crud
170
+ - "\"Dry Crud\""
131
171
  - --main
132
172
  - README.rdoc
133
173
  - --line-numbers
134
- - --inline-source
135
174
  require_paths:
136
175
  - lib
137
176
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,239 +0,0 @@
1
- body, div, p, td, th {
2
- font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
3
- font-size: 11pt;
4
- }
5
-
6
- body {
7
- text-align: center;
8
- margin: 0pt;
9
- background-color: #ddf;
10
- }
11
-
12
- #container {
13
- padding: 20pt 20pt;
14
- margin: 0 auto;
15
- text-align: left;
16
- width: 600pt;
17
- height: 100%;
18
- background-color: #f6f6ff;
19
- -moz-box-shadow: 0px 0px 10px #2580a2;
20
- -webkit-box-shadow: 0px 0px 10px #2580a2;
21
- box-shadow: 0px 0px 10px #2580a2;
22
- }
23
-
24
- h1 {
25
- font-size: 150%;
26
- margin: 30px 0 15px 0;
27
- }
28
-
29
- tr.even {
30
- background-color: #F0F0F0;
31
- }
32
-
33
- tr.odd {
34
- background-color: #F8F8F8;
35
- }
36
-
37
- td {
38
- vertical-align: top;
39
- }
40
-
41
- td p {
42
- margin: 0;
43
- }
44
-
45
- a {
46
- color: #2580a2;
47
- text-decoration: none;
48
- }
49
-
50
- a:hover {
51
- text-decoration: underline;
52
- }
53
-
54
- a:visited {
55
- color: #2580a2;
56
- }
57
-
58
- a img {
59
- border: none;
60
- }
61
-
62
-
63
- .list {
64
- margin-top: 10pt;
65
- }
66
-
67
- table.list {
68
- border-collapse: collapse;
69
- width: 100%;
70
- padding: 0;
71
- }
72
-
73
- /* div rendered if no entries available for list */
74
- div.list {}
75
-
76
- table.list th {
77
- text-align: left;
78
- background-color: #2580a2;
79
- color: white;
80
- font-weight: bold;
81
- padding: 2px 4px;
82
- }
83
-
84
- table.list th a {
85
- color: white;
86
- text-decoration: none;
87
- }
88
-
89
- table.list td {
90
- padding: 2px 4px;
91
- }
92
-
93
-
94
- .clear {
95
- clear: both;
96
- height: 0;
97
- overflow: hidden;
98
- }
99
-
100
- .right {
101
- text-align: right;
102
- }
103
-
104
- .center {
105
- text-align: center;
106
- }
107
-
108
- .labeled {
109
- vertical-align: top;
110
- margin: 1pt;
111
- }
112
-
113
- .labeled .caption {
114
- font-style: italic;
115
- width: 120pt;
116
- padding-right: 5pt;
117
- float: left;
118
- }
119
-
120
- .labeled .value {
121
- margin-left: 125pt;
122
- }
123
-
124
- .labeled .value p {
125
- margin: 0px;
126
- }
127
-
128
- .actions {
129
- float: right;
130
- }
131
-
132
- a.action {
133
- margin-right: 10pt;
134
- }
135
-
136
- a.action img {
137
- vertical-align: text-top;
138
- }
139
-
140
- input, textarea {
141
- font-family: Verdana, Geneva, Helvetica, Arial, sans-serif;
142
- font-size: 10pt;
143
- }
144
-
145
- input[type=text], input[type=password] {
146
- width: 180pt;
147
- }
148
-
149
- input[type=number] {
150
- width: 80pt;
151
- }
152
-
153
- textarea {
154
- width: 180pt;
155
- height: 80pt;
156
- }
157
-
158
- .cancel {
159
- font-size: 80%;
160
- margin-left: 7pt;
161
- }
162
-
163
- .required {
164
- font-size: 80%;
165
- vertical-align: top;
166
- margin-left: 1pt;
167
- }
168
-
169
- #flash_notice, #flash_alert {
170
- margin: 15pt;
171
- padding: 5pt 10pt;
172
- }
173
-
174
- #flash_notice {
175
- border: solid 2px #6a6;
176
- background-color: #afa;
177
- }
178
-
179
- #flash_alert {
180
- border: solid 2px #da9;
181
- background-color: #fec;
182
- }
183
-
184
- #error_explanation {
185
- border: solid 2pt #da9;
186
- margin: 10pt;
187
- padding: 5pt 10pt;
188
- background-color: #fec;
189
- }
190
-
191
- #error_explanation h2 {
192
- font-size: 11pt;
193
- margin-top: 0pt;
194
- }
195
-
196
- #error_explanation ul {
197
- margin-bottom: 5pt;
198
- }
199
-
200
- .value div.field_with_errors {
201
- background-color: #da9;
202
- display: inline-block;
203
- padding: 1px 1px;
204
- }
205
-
206
- #menu {
207
- background: #333;
208
- -moz-box-shadow: 0px 3px 3px #2580a2;
209
- -webkit-box-shadow: 0px 3px 3px #2580a2;
210
- box-shadow: 0px 3px 3px #2580a2;
211
- float: left;
212
- list-style: none;
213
- margin: -20pt;
214
- padding: 0 20px;
215
- width: 610pt;
216
- }
217
-
218
- #menu li {
219
- float: left;
220
- font-size: 110%;
221
- margin: 0;
222
- padding: 0;
223
- }
224
-
225
- #menu a {
226
- background: #333 bottom right no-repeat;
227
- color: #ddd;
228
- display: block;
229
- float: left;
230
- margin: 0;
231
- padding: 4px 12px;
232
- text-decoration: none;
233
- }
234
-
235
- #menu a:hover {
236
- background: #2580a2 bottom center no-repeat;
237
- color: #fff;
238
- padding-bottom: 4px;
239
- }
@@ -1,10 +0,0 @@
1
- class CitiesController < AjaxController
2
-
3
- def show
4
- respond_to do |format|
5
- format.html { redirect_to_index flash.to_hash }
6
- format.json { render :json => @entry }
7
- end
8
- end
9
-
10
- end
@@ -1,8 +0,0 @@
1
- <%= crud_form do |f| -%>
2
- <%= f.labeled_input_field :name %>
3
- <%= f.labeled_collection_select(:country_code,
4
- ['BR', 'CH', 'DE', 'GB', 'JP', 'USA'],
5
- :to_s,
6
- :to_s,
7
- f.select_options(:country_code)) %>
8
- <% end -%>
@@ -1,4 +0,0 @@
1
- <%= crud_table *default_attrs do |t|
2
- action_col(t) { |e| link_table_action_edit(e) }
3
- action_col(t) { |e| link_table_action_destroy(e) }
4
- end %>
@@ -1,45 +0,0 @@
1
- require 'test_helper'
2
- require File.join('functional', 'crud_controller_test_helper')
3
-
4
- class CitiesControllerTest < ActionController::TestCase
5
-
6
- include CrudControllerTestHelper
7
-
8
- def test_setup
9
- assert_equal 3, City.count
10
- assert_recognizes({:controller => 'cities', :action => 'index'}, '/cities')
11
- assert_recognizes({:controller => 'cities', :action => 'show', :id => '1'}, '/cities/1')
12
- end
13
-
14
- def test_index
15
- super
16
- assert_equal 3, assigns(:entries).size
17
- assert_equal City.order('country_code, name').all, assigns(:entries)
18
- end
19
-
20
- def test_show
21
- get :show, :id => test_entry.id
22
- assert_redirected_to_index
23
- end
24
-
25
- def test_destroy_with_inhabitants
26
- ny = cities(:ny)
27
- assert_no_difference('City.count') do
28
- request.env["HTTP_REFERER"]
29
- delete :destroy, :id => ny.id
30
- end
31
- assert_redirected_to :action => 'show'
32
- assert flash.alert
33
- end
34
-
35
- protected
36
-
37
- def test_entry
38
- cities(:rj)
39
- end
40
-
41
- def test_entry_attrs
42
- {:name => 'Rejkiavik', :country_code => 'IS'}
43
- end
44
-
45
- end