dry_crud 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/README.rdoc +24 -19
  2. data/Rakefile +12 -4
  3. data/VERSION +1 -1
  4. data/lib/generators/dry_crud/dry_crud_generator.rb +7 -7
  5. data/lib/generators/dry_crud/templates/app/assets/stylesheets/crud.scss +18 -7
  6. data/lib/generators/dry_crud/templates/app/assets/stylesheets/sample.scss +13 -18
  7. data/lib/generators/dry_crud/templates/app/controllers/crud_controller.rb +74 -87
  8. data/lib/generators/dry_crud/templates/app/controllers/list_controller.rb +95 -50
  9. data/lib/generators/dry_crud/templates/app/helpers/crud_helper.rb +11 -11
  10. data/lib/generators/dry_crud/templates/app/helpers/list_helper.rb +7 -7
  11. data/lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb +55 -27
  12. data/lib/generators/dry_crud/templates/app/helpers/standard_helper.rb +83 -30
  13. data/lib/generators/dry_crud/templates/app/helpers/standard_table_builder.rb +5 -13
  14. data/lib/generators/dry_crud/templates/app/views/layouts/_flash.html.erb +1 -4
  15. data/lib/generators/dry_crud/templates/app/views/layouts/_flash.html.haml +1 -3
  16. data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.erb +6 -6
  17. data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.haml +5 -3
  18. data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.erb +13 -11
  19. data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.haml +15 -15
  20. data/lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.erb +10 -10
  21. data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.erb +2 -2
  22. data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.haml +2 -2
  23. data/lib/generators/dry_crud/templates/config/initializers/field_error_proc.rb +1 -0
  24. data/lib/generators/dry_crud/templates/config/locales/en_crud.yml +1 -0
  25. data/lib/generators/dry_crud/templates/test/crud_test_model.rb +72 -17
  26. data/lib/generators/dry_crud/templates/test/custom_assertions.rb +1 -1
  27. data/lib/generators/dry_crud/templates/test/functional/crud_controller_test_helper.rb +42 -26
  28. data/lib/generators/dry_crud/templates/test/functional/crud_test_models_controller_test.rb +135 -29
  29. data/lib/generators/dry_crud/templates/test/unit/custom_assertions_test.rb +4 -4
  30. data/lib/generators/dry_crud/templates/test/unit/helpers/crud_helper_test.rb +4 -2
  31. data/lib/generators/dry_crud/templates/test/unit/helpers/list_helper_test.rb +2 -0
  32. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_form_builder_test.rb +94 -16
  33. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_helper_test.rb +58 -18
  34. data/lib/generators/dry_crud/templates/test/unit/helpers/standard_table_builder_test.rb +4 -4
  35. data/test/templates/Gemfile +1 -0
  36. data/test/templates/app/controllers/admin/cities_controller.rb +0 -7
  37. data/test/templates/app/controllers/admin/countries_controller.rb +2 -3
  38. data/test/templates/app/controllers/ajax_controller.rb +2 -0
  39. data/test/templates/app/controllers/people_controller.rb +1 -1
  40. data/test/templates/app/models/city.rb +2 -0
  41. data/test/templates/app/models/country.rb +2 -0
  42. data/test/templates/app/models/person.rb +2 -0
  43. data/test/templates/app/views/admin/cities/_attrs.html.erb +1 -0
  44. data/test/templates/app/views/admin/cities/_attrs.html.haml +1 -0
  45. data/test/templates/app/views/admin/cities/_form.html.erb +7 -1
  46. data/test/templates/app/views/admin/cities/_form.html.haml +5 -1
  47. data/test/templates/app/views/admin/cities/_list.html.erb +1 -4
  48. data/test/templates/app/views/admin/cities/_list.html.haml +1 -3
  49. data/test/templates/app/views/ajax/_actions_show.html.erb +4 -0
  50. data/test/templates/app/views/ajax/_actions_show.html.haml +4 -0
  51. data/test/templates/app/views/ajax/_form.html.erb +2 -0
  52. data/test/templates/app/views/ajax/_form.html.haml +2 -0
  53. data/test/templates/app/views/ajax/edit.js.erb +1 -0
  54. data/test/templates/app/views/ajax/edit.js.haml +1 -0
  55. data/test/templates/app/views/ajax/show.js.erb +1 -0
  56. data/test/templates/app/views/ajax/show.js.haml +1 -0
  57. data/test/templates/app/views/ajax/update.js.erb +5 -0
  58. data/test/templates/app/views/ajax/update.js.haml +5 -0
  59. data/test/templates/app/views/layouts/_nav.html.erb +6 -0
  60. data/test/templates/app/views/layouts/_nav.html.haml +5 -0
  61. data/test/templates/app/views/layouts/bootstrap.html.erb +68 -0
  62. data/test/templates/app/views/layouts/bootstrap.html.haml +49 -0
  63. data/test/templates/app/views/people/_attrs.html.erb +2 -2
  64. data/test/templates/app/views/people/_attrs.html.haml +2 -2
  65. data/test/templates/config/routes.rb +5 -5
  66. data/test/templates/db/migrate/20100511174904_create_people_and_cities.rb +1 -1
  67. data/test/templates/db/seeds.rb +52 -52
  68. data/test/templates/test/functional/admin/cities_controller_test.rb +15 -15
  69. data/test/templates/test/functional/admin/countries_controller_test.rb +4 -5
  70. data/test/templates/test/functional/people_controller_test.rb +32 -4
  71. metadata +22 -9
  72. data/lib/generators/dry_crud/templates/app/views/layouts/_menu.html.erb +0 -3
  73. data/lib/generators/dry_crud/templates/app/views/layouts/_menu.html.haml +0 -3
  74. data/test/templates/app/views/layouts/_menu.html.erb +0 -3
  75. data/test/templates/app/views/layouts/_menu.html.haml +0 -3
@@ -12,7 +12,7 @@ class StandardHelperTest < ActionView::TestCase
12
12
  def format_size(obj)
13
13
  "#{f(obj.size)} items"
14
14
  end
15
-
15
+
16
16
  def format_string_size(obj)
17
17
  "#{f(obj.size)} chars"
18
18
  end
@@ -79,7 +79,7 @@ class StandardHelperTest < ActionView::TestCase
79
79
  test "format attr with custom format_string_size method" do
80
80
  assert_equal "4 chars", format_attr("abcd", :size)
81
81
  end
82
-
82
+
83
83
  test "format attr with custom format_size method" do
84
84
  assert_equal "2 items", format_attr([1,2], :size)
85
85
  end
@@ -124,12 +124,12 @@ class StandardHelperTest < ActionView::TestCase
124
124
  m = crud_test_models(:AAAAA)
125
125
  assert_equal '1910-01-01', format_type(m, :birthdate)
126
126
  end
127
-
127
+
128
128
  test "format time column" do
129
129
  m = crud_test_models(:AAAAA)
130
130
  assert_equal '01:01', format_type(m, :gets_up_at)
131
131
  end
132
-
132
+
133
133
  test "format datetime column" do
134
134
  m = crud_test_models(:AAAAA)
135
135
  assert_equal "2010-01-01 11:21", format_type(m, :last_seen)
@@ -141,6 +141,46 @@ class StandardHelperTest < ActionView::TestCase
141
141
  assert format_type(m, :remarks).html_safe?
142
142
  end
143
143
 
144
+ test "format belongs to column without content" do
145
+ m = crud_test_models(:AAAAA)
146
+ assert_equal t(:'global.associations.no_entry'), format_attr(m, :companion)
147
+ end
148
+
149
+ test "format belongs to column with content" do
150
+ m = crud_test_models(:BBBBB)
151
+ assert_equal "AAAAA", format_attr(m, :companion)
152
+ end
153
+
154
+ test "format has_many column with content" do
155
+ m = crud_test_models(:CCCCC)
156
+ assert_equal "<ul><li>AAAAA</li><li>BBBBB</li></ul>", format_attr(m, :others)
157
+ end
158
+
159
+ test "content_tag_nested escapes safe correctly" do
160
+ html = content_tag_nested(:div, ['a', 'b']) { |e| content_tag(:span, e) }
161
+ assert_equal "<div><span>a</span><span>b</span></div>", html
162
+ end
163
+
164
+ test "content_tag_nested escapes unsafe correctly" do
165
+ html = content_tag_nested(:div, ['a', 'b']) { |e| "<#{e}>" }
166
+ assert_equal "<div>&lt;a&gt;&lt;b&gt;</div>", html
167
+ end
168
+
169
+ test "content_tag_nested without block" do
170
+ html = content_tag_nested(:div, ['a', 'b'])
171
+ assert_equal "<div>ab</div>", html
172
+ end
173
+
174
+ test "safe_join without block" do
175
+ html = safe_join(['<a>', '<b>'.html_safe])
176
+ assert_equal "&lt;a&gt;<b>", html
177
+ end
178
+
179
+ test "safe_join with block" do
180
+ html = safe_join(['a', 'b']) { |e| content_tag(:span, e) }
181
+ assert_equal "<span>a</span><span>b</span>", html
182
+ end
183
+
144
184
  test "empty table should render message" do
145
185
  result = table([]) { }
146
186
  assert result.html_safe?
@@ -212,7 +252,7 @@ class StandardHelperTest < ActionView::TestCase
212
252
  assert_match /form .*?action="\/crud_test_models\/#{e.id}" .*?method="post"/, f
213
253
  assert_match /input .*?name="_method" .*?type="hidden" .*?value="put"/, f
214
254
  assert_match /div[^>]* id='error_explanation'/, f
215
- assert_match /div class="field_with_errors"\>.*?\<input .*?name="crud_test_model\[name\]" .*?type="text"/, f
255
+ assert_match /div class="control-group error"\>.*?\<input .*?name="crud_test_model\[name\]" .*?type="text"/, f
216
256
  assert_match /select .*?name="crud_test_model\[birthdate\(1i\)\]"/, f
217
257
  assert_match /option selected="selected" value="1910">1910<\/option>/, f
218
258
  assert_match /option selected="selected" value="1">January<\/option>/, f
@@ -221,47 +261,47 @@ class StandardHelperTest < ActionView::TestCase
221
261
  assert_match /input .*?name="crud_test_model\[human\]" .*?type="checkbox"/, f
222
262
  assert_match /button .*?type="submit">Save<\/button>/, f
223
263
  end
224
-
264
+
225
265
  test "translate inheritable lookup" do
226
266
  # current controller is :crud_test_models, action is :index
227
267
  @controller = CrudTestModelsController.new
228
268
 
229
269
  I18n.backend.store_translations :en, :global => { :test_key => 'global' }
230
270
  assert_equal 'global', ti(:test_key)
231
-
271
+
232
272
  I18n.backend.store_translations :en, :list => { :global => {:test_key => 'list global'} }
233
273
  assert_equal 'list global', ti(:test_key)
234
-
274
+
235
275
  I18n.backend.store_translations :en, :list => { :index => {:test_key => 'list index'} }
236
276
  assert_equal 'list index', ti(:test_key)
237
-
277
+
238
278
  I18n.backend.store_translations :en, :crud => { :global => {:test_key => 'crud global'} }
239
279
  assert_equal 'crud global', ti(:test_key)
240
-
280
+
241
281
  I18n.backend.store_translations :en, :crud => { :index => {:test_key => 'crud index'} }
242
282
  assert_equal 'crud index', ti(:test_key)
243
-
283
+
244
284
  I18n.backend.store_translations :en, :crud_test_models => { :global => {:test_key => 'test global'} }
245
285
  assert_equal 'test global', ti(:test_key)
246
-
286
+
247
287
  I18n.backend.store_translations :en, :crud_test_models => { :index => {:test_key => 'test index'} }
248
288
  assert_equal 'test index', ti(:test_key)
249
289
  end
250
-
290
+
251
291
  test "translate association lookup" do
252
292
  assoc = CrudTestModel.reflect_on_association(:companion)
253
-
293
+
254
294
  I18n.backend.store_translations :en, :global => { :associations => {:test_key => 'global'} }
255
295
  assert_equal 'global', ta(:test_key, assoc)
256
-
296
+
257
297
  I18n.backend.store_translations :en, :activerecord => { :associations => { :crud_test_model => {:test_key => 'model'} } }
258
298
  assert_equal 'model', ta(:test_key, assoc)
259
-
299
+
260
300
  I18n.backend.store_translations :en, :activerecord => { :associations => { :models => {
261
301
  :crud_test_model => { :companion => {:test_key => 'companion'} } } } }
262
302
  assert_equal 'companion', ta(:test_key, assoc)
263
-
303
+
264
304
  assert_equal 'global', ta(:test_key)
265
305
  end
266
-
306
+
267
307
  end
@@ -61,7 +61,7 @@ class StandardTableBuilderTest < ActionView::TestCase
61
61
  <thead>
62
62
  <tr><th>Upcase</th><th>Size</th></tr>
63
63
  </thead>
64
- <tbody>
64
+ <tbody>
65
65
  <tr><td>FOO</td><td>3 chars</td></tr>
66
66
  <tr><td>BAHR</td><td>4 chars</td></tr>
67
67
  </tbody>
@@ -105,7 +105,7 @@ class StandardTableBuilderTest < ActionView::TestCase
105
105
 
106
106
  assert_dom_equal dom, table.to_html
107
107
  end
108
-
108
+
109
109
  test "empty entries collection renders empty table" do
110
110
  dom = <<-FIN
111
111
  <table class="table">
@@ -117,8 +117,8 @@ class StandardTableBuilderTest < ActionView::TestCase
117
117
  </table>
118
118
  FIN
119
119
  dom.gsub!(/[\n\t]/, "").gsub!(/\s{2,}/, "")
120
-
121
- table = StandardTableBuilder.new([], self)
120
+
121
+ table = StandardTableBuilder.new([], self)
122
122
  table.col('head', :class => 'left') { |e| link_to e, "/" }
123
123
  table.attrs :upcase, :size
124
124
  table.col { |e| "Never #{e}" }
@@ -25,6 +25,7 @@ group :assets do
25
25
  gem 'coffee-rails' #, '~> 3.2.1'
26
26
  gem 'uglifier' #, '>= 1.0.3'
27
27
  gem 'bootstrap-sass-rails'
28
+ #gem 'therubyracer'
28
29
  end
29
30
 
30
31
  gem 'jquery-rails'
@@ -3,12 +3,5 @@ class Admin::CitiesController < AjaxController
3
3
  self.nesting = :admin, Country
4
4
 
5
5
  self.search_columns = :name, 'countries.name'
6
-
7
- def show
8
- respond_to do |format|
9
- format.html { redirect_to_index flash.to_hash }
10
- format.json { render :json => entry }
11
- end
12
- end
13
6
 
14
7
  end
@@ -5,9 +5,8 @@ class Admin::CountriesController < AjaxController
5
5
  self.search_columns = :name, :code
6
6
 
7
7
  def show
8
- respond_to do |format|
9
- format.html { redirect_to_index flash.to_hash }
10
- format.json { render :json => entry }
8
+ super do |format|
9
+ format.html { redirect_to index_url, flash.to_hash }
11
10
  end
12
11
  end
13
12
 
@@ -1,5 +1,7 @@
1
1
  class AjaxController < CrudController
2
2
 
3
+ respond_to :html, :json, :js
4
+
3
5
  def ajax
4
6
 
5
7
  end
@@ -1,6 +1,6 @@
1
1
  class PeopleController < AjaxController
2
2
 
3
- self.search_columns = [:name, :children, :rating, :income, :birthdate, :remarks]
3
+ self.search_columns = [:name, :children, :rating, :income, :birthdate, :remarks, 'cities.name']
4
4
 
5
5
  self.sort_mappings = {:city_id => 'cities.name'}
6
6
 
@@ -1,5 +1,7 @@
1
1
  class City < ActiveRecord::Base
2
2
 
3
+ attr_protected nil
4
+
3
5
  belongs_to :country
4
6
  has_many :people
5
7
 
@@ -1,5 +1,7 @@
1
1
  class Country < ActiveRecord::Base
2
2
 
3
+ attr_protected nil
4
+
3
5
  has_many :cities, :dependent => :destroy
4
6
 
5
7
  validates :name, :presence => true
@@ -1,5 +1,7 @@
1
1
  class Person < ActiveRecord::Base
2
2
 
3
+ attr_protected nil
4
+
3
5
  belongs_to :city
4
6
 
5
7
  validates :name, :presence => true
@@ -0,0 +1 @@
1
+ <%= render_attrs @city, :people %>
@@ -0,0 +1 @@
1
+ = render_attrs entry, :people
@@ -1 +1,7 @@
1
- <%= crud_form :name %>
1
+ <% remote ||= false %>
2
+ <%= crud_form :remote => remote do |f| %>
3
+ <%= f.labeled(:name, 'Called') do %>
4
+ <%= f.input_field :name %>
5
+ <% end %>
6
+ <%= f.labeled_input_field :person_ids %>
7
+ <% end %>
@@ -1 +1,5 @@
1
- = crud_form :name
1
+ - remote ||= false
2
+ = crud_form :remote => remote do |f|
3
+ = f.labeled(:name, 'Called') do
4
+ = f.input_field :name
5
+ = f.labeled_input_field :person_ids
@@ -1,6 +1,3 @@
1
1
  <% @title = ti(:country_title, :country => @parents.last) -%>
2
2
 
3
- <%= crud_table *default_attrs do |t|
4
- action_col_edit(t)
5
- action_col_destroy(t)
6
- end %>
3
+ <%= render 'crud/list' %>
@@ -1,5 +1,3 @@
1
1
  - @title = ti(:country_title, :country => @parents.last)
2
2
 
3
- = crud_table *default_attrs do |t|
4
- - action_col_edit(t)
5
- - action_col_destroy(t)
3
+ = render 'crud/list'
@@ -0,0 +1,4 @@
1
+ <%= link_action_index %>
2
+ <%= link_action_edit %>
3
+ <%= link_action ti(:"link.edit") + ' AJAX', 'pencil', edit_polymorphic_path(path_args(entry), :format => :js), :remote => true %>
4
+ <%= link_action_destroy %>
@@ -0,0 +1,4 @@
1
+ = link_action_index
2
+ = link_action_edit
3
+ = link_action ti(:"link.edit") + ' AJAX', 'pencil', edit_polymorphic_path(path_args(entry), :format => :js), :remote => true
4
+ = link_action_destroy
@@ -0,0 +1,2 @@
1
+ <% remote ||= false %>
2
+ <%= crud_form :remote => remote %>
@@ -0,0 +1,2 @@
1
+ - remote ||= false
2
+ = crud_form :remote => remote
@@ -0,0 +1 @@
1
+ $('#content').html('<%= escape_javascript(render 'form', :remote => true) %>');
@@ -0,0 +1 @@
1
+ $('#content').html('#{escape_javascript(render 'form', :remote => true)}');
@@ -0,0 +1 @@
1
+ $('#content').html('<%= escape_javascript(render 'attrs') %>');
@@ -0,0 +1 @@
1
+ $('#content').html('#{escape_javascript(render 'attrs')}');
@@ -0,0 +1,5 @@
1
+ <% if entry.errors.present? %>
2
+ alert('<%= escape_javascript(entry.errors.full_messages.join("\n")) %>');
3
+ <% else %>
4
+ $('#content').html('<%= escape_javascript(render 'attrs') %>')
5
+ <% end %>
@@ -0,0 +1,5 @@
1
+ - if entry.errors.present?
2
+ alert('#{escape_javascript(entry.errors.full_messages.join("\n"))}');
3
+ - else
4
+ $('#content').html('#{escape_javascript(render 'attrs')}')
5
+
@@ -0,0 +1,6 @@
1
+ <%= link_to 'MyApp', root_path, :class => 'brand' %>
2
+ <ul class="nav">
3
+ <li><%= link_to t(:'global.menu.people'), people_path %></li>
4
+ <li><%= link_to t(:'global.menu.countries'), admin_countries_path %></li>
5
+ <li><%= link_to t(:'global.menu.vips'), vips_path %></li>
6
+ </ul>
@@ -0,0 +1,5 @@
1
+ = link_to 'MyApp', root_path, :class => 'brand'
2
+ %ul.nav
3
+ %li= link_to t(:'global.menu.people'), people_path
4
+ %li= link_to t(:'global.menu.countries'), admin_countries_path
5
+ %li= link_to t(:'global.menu.vips'), vips_path
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <title><%= strip_tags(@title) %></title>
7
+ <%= csrf_meta_tag %>
8
+
9
+ <!-- HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
12
+ <![endif]-->
13
+
14
+ <%= stylesheet_link_tag 'application', :media => 'all' %>
15
+ <style type="text/css">
16
+ body { padding-top: 70px; }
17
+ h1 { margin-bottom: 10px; }
18
+ </style>
19
+
20
+ <!-- fav and touch icons -->
21
+ <link href="images/favicon.ico" rel="shortcut icon">
22
+ <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
23
+ <link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
24
+ <link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
25
+
26
+ <%= yield :head %>
27
+ </head>
28
+ <body>
29
+
30
+ <div class="navbar navbar-fixed-top">
31
+ <div class="navbar-inner">
32
+ <div class="container">
33
+ <%= render 'layouts/nav' %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="container">
39
+
40
+ <h1><%= @title %></h1>
41
+
42
+ <%= render :partial => 'layouts/flash', :collection => [:notice, :alert], :as => :level %>
43
+
44
+ <div class="actions btn-toolbar">
45
+ <div class="pull-right">
46
+ <%= yield :actions %>
47
+ </div>
48
+ <div class="pull-left">
49
+ <%= yield :tools %>
50
+ </div>
51
+ </div>
52
+
53
+ <div id="content">
54
+ <%= yield %>
55
+ </div>
56
+
57
+ <footer>
58
+ <p>&copy; code!z <%= Time.zone.now.year %></p>
59
+ </footer>
60
+
61
+ </div>
62
+
63
+ <!-- Javascript placed at the end of the document so the pages load faster -->
64
+ <%= javascript_include_tag 'application' %>
65
+ <%= javascript_tag yield(:javascripts) if content_for?(:javascripts) %>
66
+
67
+ </body>
68
+ </html>
@@ -0,0 +1,49 @@
1
+ !!! 5
2
+
3
+ %html
4
+ %head
5
+ %meta{:charset => 'utf-8'}
6
+ %title= strip_tags(@title)
7
+ = csrf_meta_tag
8
+
9
+ <!-- HTML5 shim, for IE6-8 support of HTML elements -->
10
+ <!--[if lt IE 9]>
11
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
12
+ <![endif]-->
13
+
14
+ = stylesheet_link_tag 'application', :media => 'all'
15
+ %style{:type => "text/css"}
16
+ body { padding-top: 70px; }
17
+ h1 { margin-bottom: 10px; }
18
+
19
+ %link{:href => "images/favicon.ico", :rel => "shortcut icon"}
20
+ %link{:href => "images/apple-touch-icon.png", :rel => "apple-touch-icon"}
21
+ %link{:href => "images/apple-touch-icon-72x72.png", :rel => "apple-touch-icon", :sizes => "72x72"}
22
+ %link{:href => "images/apple-touch-icon-114x114.png", :rel => "apple-touch-icon", :sizes => "114x114"}
23
+
24
+ = yield :head
25
+
26
+ %body
27
+
28
+ .navbar.navbar-fixed-top
29
+ .navbar-inner
30
+ .container= render 'layouts/nav'
31
+
32
+ .container
33
+
34
+ %h1= @title
35
+
36
+ = render :partial => 'layouts/flash', :collection => [:notice, :alert], :as => :level
37
+
38
+ .actions.btn-toolbar
39
+ .pull-right= yield :actions
40
+ .pull-left= yield :tools
41
+
42
+ #content= yield
43
+
44
+ %footer
45
+ %p
46
+ &copy; code!z #{Time.zone.now.year}
47
+
48
+ = javascript_include_tag 'application'
49
+ = javascript_tag yield(:javascripts) if content_for?(:javascripts)
@@ -1,5 +1,5 @@
1
- <%= render_attrs @entry, *default_attrs %>
1
+ <%= render_attrs @person, *default_attrs %>
2
2
  <%= labeled(ti(:i_think_its), ti(:nice)) %>
3
3
  <%= labeled(ti(:check_google)) do %>
4
- <%= link_to ti(:"link.maps"), "http://map.google.com/?q=#{@entry.name}" %>
4
+ <%= link_to ti(:"link.maps"), "http://map.google.com/?q=#{@person.name}" %>
5
5
  <% end %>
@@ -1,4 +1,4 @@
1
- = render_attrs @entry, *default_attrs
1
+ = render_attrs entry, *default_attrs
2
2
  = labeled(ti(:i_think_its), ti(:nice))
3
3
  = labeled(ti(:check_google)) do
4
- = link_to ti(:"link.maps"), "http://map.google.com/?q=#{@entry.name}"
4
+ = link_to ti(:"link.maps"), "http://map.google.com/?q=#{entry.name}"
@@ -1,19 +1,19 @@
1
1
  TestApp::Application.routes.draw do
2
-
2
+
3
3
  resources :people do
4
- collection do
4
+ collection do
5
5
  get :ajax
6
6
  end
7
7
  end
8
8
 
9
9
  match 'vips' => 'vips#index', :as => :vips
10
-
10
+
11
11
  namespace :admin do
12
12
  resources :countries do
13
13
  collection do
14
14
  get :ajax
15
15
  end
16
-
16
+
17
17
  resources :cities do
18
18
  collection do
19
19
  get :ajax
@@ -23,7 +23,7 @@ TestApp::Application.routes.draw do
23
23
  end
24
24
 
25
25
  root :to => 'people#index'
26
-
26
+
27
27
  # Install the default routes as the lowest priority.
28
28
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
29
29
  # consider removing or commenting them out if you're using named routes and resources.
@@ -4,7 +4,7 @@ class CreatePeopleAndCities < ActiveRecord::Migration
4
4
  t.string :name, :null => false
5
5
  t.string :code, :null => :false, :limit => 3
6
6
  end
7
-
7
+
8
8
  create_table :cities do |t|
9
9
  t.string :name, :null => false
10
10
  t.integer :country_id, :null => false