amrita2 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. data/README +5 -5
  2. data/Rakefile +85 -0
  3. data/lib/amrita2/gettext.rb +9 -4
  4. data/lib/amrita2/template.rb +20 -9
  5. data/lib/amrita2/testsupport.rb +25 -0
  6. data/lib/amrita2/version.rb +1 -1
  7. data/sample/depot/README +160 -0
  8. data/sample/depot/Rakefile +10 -0
  9. data/sample/depot/app/views/admin/_form.html.a2 +23 -0
  10. data/sample/depot/app/views/admin/_form.html.erb +14 -0
  11. data/sample/depot/app/views/admin/edit.html.a2 +22 -0
  12. data/sample/depot/app/views/admin/edit.html.erb +10 -0
  13. data/sample/depot/app/views/admin/list.html.a2 +34 -0
  14. data/sample/depot/app/views/admin/list.html.erb +37 -0
  15. data/sample/depot/app/views/admin/new.html.a2 +21 -0
  16. data/sample/depot/app/views/admin/new.html.erb +9 -0
  17. data/sample/depot/app/views/admin/show.html.a2 +12 -0
  18. data/sample/depot/app/views/admin/show.html.erb +13 -0
  19. data/sample/depot/app/views/info/who_bought.rhtml +14 -0
  20. data/sample/depot/app/views/info/who_bought.rxml +8 -0
  21. data/sample/depot/app/views/layouts/admin.a2html +32 -0
  22. data/sample/depot/app/views/layouts/admin.rhtml +40 -0
  23. data/sample/depot/app/views/layouts/store.a2html +37 -0
  24. data/sample/depot/app/views/layouts/store.rhtml +43 -0
  25. data/sample/depot/app/views/login/add_user.rhtml +33 -0
  26. data/sample/depot/app/views/login/index.rhtml +9 -0
  27. data/sample/depot/app/views/login/list_users.rhtml +20 -0
  28. data/sample/depot/app/views/login/login.rhtml +26 -0
  29. data/sample/depot/app/views/store/_cart.html.a2 +18 -0
  30. data/sample/depot/app/views/store/_cart.html.erb +17 -0
  31. data/sample/depot/app/views/store/_cart_item.html.a2 +16 -0
  32. data/sample/depot/app/views/store/_cart_item.html.erb +14 -0
  33. data/sample/depot/app/views/store/add_to_cart.rjs +11 -0
  34. data/sample/depot/app/views/store/checkout.html.a2 +45 -0
  35. data/sample/depot/app/views/store/checkout.html.a2.using_macro +32 -0
  36. data/sample/depot/app/views/store/checkout.html.a2.without_label +37 -0
  37. data/sample/depot/app/views/store/checkout.html.erb +41 -0
  38. data/sample/depot/app/views/store/index.html.a2 +19 -0
  39. data/sample/depot/app/views/store/index.html.erb +22 -0
  40. data/sample/depot/config/database.yml +24 -0
  41. data/sample/depot/db/create_database.sql +14 -0
  42. data/sample/depot/doc/README_FOR_APP +35 -0
  43. data/sample/depot/lib/tasks/db_schema_version.rake +6 -0
  44. data/sample/depot/log/development.log +116 -0
  45. data/sample/depot/log/test.log +347 -0
  46. data/sample/depot/public/404.html +13 -0
  47. data/sample/depot/public/500.html +13 -0
  48. data/sample/depot/public/dispatch.cgi +10 -0
  49. data/sample/depot/public/dispatch.fcgi +24 -0
  50. data/sample/depot/public/favicon.ico +0 -0
  51. data/sample/depot/public/images/auto.jpg +0 -0
  52. data/sample/depot/public/images/logo.png +0 -0
  53. data/sample/depot/public/images/rails.png +0 -0
  54. data/sample/depot/public/images/svn.jpg +0 -0
  55. data/sample/depot/public/images/utc.jpg +0 -0
  56. data/sample/depot/public/index.html +282 -0
  57. data/sample/depot/public/javascripts/application.js +2 -0
  58. data/sample/depot/public/javascripts/controls.js +832 -0
  59. data/sample/depot/public/javascripts/dragdrop.js +942 -0
  60. data/sample/depot/public/javascripts/effects.js +954 -0
  61. data/sample/depot/public/javascripts/prototype.js +2347 -0
  62. data/sample/depot/public/robots.txt +1 -0
  63. data/sample/depot/public/stylesheets/depot.css +227 -0
  64. data/sample/depot/public/stylesheets/scaffold.css +74 -0
  65. data/sample/depot/script/about +3 -0
  66. data/sample/depot/script/breakpointer +3 -0
  67. data/sample/depot/script/console +3 -0
  68. data/sample/depot/script/destroy +3 -0
  69. data/sample/depot/script/generate +3 -0
  70. data/sample/depot/script/performance/benchmarker +3 -0
  71. data/sample/depot/script/performance/profiler +3 -0
  72. data/sample/depot/script/plugin +3 -0
  73. data/sample/depot/script/process/inspector +3 -0
  74. data/sample/depot/script/process/reaper +3 -0
  75. data/sample/depot/script/process/spawner +3 -0
  76. data/sample/depot/script/runner +3 -0
  77. data/sample/depot/script/server +3 -0
  78. data/sample/depot/test/fixtures/line_items.yml +16 -0
  79. data/sample/depot/test/fixtures/orders.yml +4 -0
  80. data/sample/depot/test/fixtures/performance/products.yml +8 -0
  81. data/sample/depot/test/fixtures/products.yml +16 -0
  82. data/sample/depot/test/fixtures/users.yml +7 -0
  83. data/sample/depot/vendor/plugins/will_paginate/LICENSE +18 -0
  84. data/sample/depot/vendor/plugins/will_paginate/README +171 -0
  85. data/sample/depot/vendor/plugins/will_paginate/Rakefile +27 -0
  86. data/sample/depot/vendor/plugins/will_paginate/test/console +9 -0
  87. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/companies.yml +24 -0
  88. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
  89. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/projects.yml +7 -0
  90. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/replies.yml +34 -0
  91. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/schema.sql +44 -0
  92. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
  93. data/sample/depot/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
  94. data/sample/login_engine/README +182 -0
  95. data/sample/login_engine/Rakefile +27 -0
  96. data/sample/login_engine/app/views/layouts/user.a2html +20 -0
  97. data/sample/login_engine/app/views/layouts/user.rhtml +16 -0
  98. data/sample/login_engine/app/views/user/_edit.a2html +16 -0
  99. data/sample/login_engine/app/views/user/_edit.rhtml +11 -0
  100. data/sample/login_engine/app/views/user/_password.a2html +18 -0
  101. data/sample/login_engine/app/views/user/_password.rhtml +9 -0
  102. data/sample/login_engine/app/views/user/change_password.a2html +17 -0
  103. data/sample/login_engine/app/views/user/change_password.rhtml +17 -0
  104. data/sample/login_engine/app/views/user/edit.a2html +22 -0
  105. data/sample/login_engine/app/views/user/edit.rhtml +23 -0
  106. data/sample/login_engine/app/views/user/forgot_password.rhtml +18 -0
  107. data/sample/login_engine/app/views/user/home.a2html +12 -0
  108. data/sample/login_engine/app/views/user/home.rhtml +7 -0
  109. data/sample/login_engine/app/views/user/login.a2html +16 -0
  110. data/sample/login_engine/app/views/user/login.rhtml +17 -0
  111. data/sample/login_engine/app/views/user/logout.rhtml +8 -0
  112. data/sample/login_engine/app/views/user/signup.a2html +14 -0
  113. data/sample/login_engine/app/views/user/signup.rhtml +17 -0
  114. data/sample/login_engine/app/views/user_notify/change_password.rhtml +10 -0
  115. data/sample/login_engine/app/views/user_notify/delete.rhtml +5 -0
  116. data/sample/login_engine/app/views/user_notify/forgot_password.rhtml +11 -0
  117. data/sample/login_engine/app/views/user_notify/pending_delete.rhtml +9 -0
  118. data/sample/login_engine/app/views/user_notify/signup.rhtml +12 -0
  119. data/sample/login_engine/config/database.yml +18 -0
  120. data/sample/login_engine/db/create_database.sql +14 -0
  121. data/sample/login_engine/db/dev.sqlite3 +0 -0
  122. data/sample/login_engine/db/test.sqlite3 +0 -0
  123. data/sample/login_engine/doc/README_FOR_APP +2 -0
  124. data/sample/login_engine/locale/ja/LC_MESSAGES/login_engine.mo +0 -0
  125. data/sample/login_engine/log/development.log +330 -0
  126. data/sample/login_engine/log/test.log +19026 -0
  127. data/sample/login_engine/po/ja/login_engine.po +248 -0
  128. data/sample/login_engine/po/login_engine.pot +245 -0
  129. data/sample/login_engine/public/404.html +30 -0
  130. data/sample/login_engine/public/500.html +30 -0
  131. data/sample/login_engine/public/dispatch.cgi +10 -0
  132. data/sample/login_engine/public/dispatch.fcgi +24 -0
  133. data/sample/login_engine/public/favicon.ico +0 -0
  134. data/sample/login_engine/public/images/rails.png +0 -0
  135. data/sample/login_engine/public/index.html +277 -0
  136. data/sample/login_engine/public/javascripts/application.js +2 -0
  137. data/sample/login_engine/public/javascripts/controls.js +833 -0
  138. data/sample/login_engine/public/javascripts/dragdrop.js +942 -0
  139. data/sample/login_engine/public/javascripts/effects.js +1088 -0
  140. data/sample/login_engine/public/javascripts/prototype.js +2385 -0
  141. data/sample/login_engine/public/robots.txt +1 -0
  142. data/sample/login_engine/public/stylesheets/login_engine.css +81 -0
  143. data/sample/login_engine/script/about +3 -0
  144. data/sample/login_engine/script/breakpointer +3 -0
  145. data/sample/login_engine/script/console +3 -0
  146. data/sample/login_engine/script/destroy +3 -0
  147. data/sample/login_engine/script/generate +3 -0
  148. data/sample/login_engine/script/performance/benchmarker +3 -0
  149. data/sample/login_engine/script/performance/profiler +3 -0
  150. data/sample/login_engine/script/plugin +3 -0
  151. data/sample/login_engine/script/process/inspector +3 -0
  152. data/sample/login_engine/script/process/reaper +3 -0
  153. data/sample/login_engine/script/process/spawner +3 -0
  154. data/sample/login_engine/script/runner +3 -0
  155. data/sample/login_engine/script/server +3 -0
  156. data/sample/login_engine/test/fixtures/users.yml +41 -0
  157. data/specs/erb_cdata.rb +11 -0
  158. data/specs/filters.rb +5 -4
  159. data/specs/gettext/static_text.rb +30 -13
  160. data/specs/impl/preprocess.rb +58 -54
  161. metadata +375 -120
  162. data/sample/hello/test1.rb +0 -23
@@ -0,0 +1,23 @@
1
+
2
+ %= error_messages_for 'product'
3
+
4
+ << :form <
5
+ <<p<
6
+ <label for="product_title">Title</label><br/>
7
+ <<:title>>
8
+
9
+ <<p<
10
+ <label for="product_description">Description</label><br/>
11
+ <<:description>>
12
+
13
+ <<p<
14
+ <label for="product_image_url">Image url</label><br/>
15
+ <<:image_url>>
16
+
17
+ <<p<
18
+ <label for="product_price">Price</label><br/>
19
+ <<:price>>
20
+
21
+ <<:submit>>
22
+
23
+
@@ -0,0 +1,14 @@
1
+ <%= error_messages_for 'product' %>
2
+
3
+ <p><label for="product_title">Title</label><br/>
4
+ <%= f.text_field 'title' %></p>
5
+
6
+ <p><label for="product_description">Description</label><br/>
7
+ <%= f.text_area 'description' %></p>
8
+
9
+ <p><label for="product_image_url">Image url</label><br/>
10
+ <%= f.text_field 'image_url' %></p>
11
+
12
+ <p><label for="product_price">Price</label><br/>
13
+ <%= f.text_field 'price' %></p>
14
+
@@ -0,0 +1,22 @@
1
+
2
+ <h1>Editing product</h1>
3
+
4
+ <%
5
+ form = amrita_define_form(
6
+ :product,
7
+ @product,
8
+ :url=>{:action=>:update, :id=>@product}
9
+ ) do |f|
10
+ f.text_field :title
11
+ f.text_area :description
12
+ f.text_field :image_url
13
+ f.text_field :price
14
+ f.add_field_element :submit, submit_tag("Update")
15
+ end
16
+ %>
17
+
18
+ << :form | AcceptData[:hook] <
19
+ %= render :partial => 'form', :object=>$_
20
+
21
+ <%= link_to 'Show', :action => 'show', :id => @product %> |
22
+ <%= link_to 'Back', :action => 'list' %>
@@ -0,0 +1,10 @@
1
+
2
+ <h1>Editing product</h1>
3
+
4
+ <% form_for :product, @product, :url => { :action => 'update', :id => @product } do |f| %>
5
+ <%= render :partial => 'form.html.erb', :locals=>{ :f=>f } %>
6
+ <%= submit_tag 'Update' %>
7
+ <% end %>
8
+
9
+ <%= link_to 'Show', :action => 'show', :id => @product %> |
10
+ <%= link_to 'Back', :action => 'list' %>
@@ -0,0 +1,34 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <<div id="product-list"<
7
+ <h1>Product Listing</h1>
8
+
9
+ <<table cellpadding="5" cellspacing="0"<
10
+ <<:products
11
+ {
12
+ :tr_class => cycle('list-line-odd', 'list-line-even'),
13
+ :product_id => $_.id
14
+ } <
15
+ <<tr valign="top" :| Attr[:class => :tr_class] <
16
+ <<td<
17
+ <<img class="list-image" :| Attr[:src=>:image_url]>>
18
+
19
+ <<td width="60%"<
20
+ <<span class="list-title":title>> <br/>
21
+ <<:description | :truncate >>
22
+
23
+ <<td class="list-actions"<
24
+ %= link_to 'Show', :action => 'show', :id => $_.product_id
25
+ <br/>
26
+ %= link_to 'Edit', :action => 'edit', :id => $_.product_id
27
+ <br/>
28
+ %= link_to 'Destroy', { :action => 'destroy', :id => $_.product_id }, :confirm => "Are you sure?", :method => :post
29
+
30
+ %= will_paginate(@products)
31
+
32
+ <br />
33
+
34
+ %= link_to 'New product', :action => 'new'
@@ -0,0 +1,37 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <div id="product-list">
7
+ <h1>Product Listing</h1>
8
+
9
+ <table cellpadding="5" cellspacing="0">
10
+ <% for product in @products %>
11
+ <tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">
12
+
13
+ <td>
14
+ <img class="list-image" src="<%= product.image_url %>"/>
15
+ </td>
16
+
17
+ <td width="60%">
18
+ <span class="list-title"><%= h(product.title) %></span><br />
19
+ <%= h(truncate(product.description, 80)) %>
20
+ </td>
21
+
22
+ <td class="list-actions">
23
+ <%= link_to 'Show', :action => 'show', :id => product %><br/>
24
+ <%= link_to 'Edit', :action => 'edit', :id => product %><br/>
25
+ <%= link_to 'Destroy', { :action => 'destroy', :id => product },
26
+ :confirm => "Are you sure?",
27
+ :method => :post %>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </table>
32
+ </div>
33
+
34
+
35
+ <br />
36
+
37
+ <%= link_to 'New product', :action => 'new' %>
@@ -0,0 +1,21 @@
1
+
2
+ <h1>New product</h1>
3
+
4
+ <%
5
+ form = amrita_define_form(
6
+ :product,
7
+ @product,
8
+ :url=>{:action=>:create }
9
+ ) do |f|
10
+ f.text_field :title
11
+ f.text_area :description
12
+ f.text_field :image_url
13
+ f.text_field :price
14
+ f.add_field_element :submit, submit_tag("Create")
15
+ end
16
+ %>
17
+
18
+ << :form | AcceptData[:hook] <
19
+ %= render :partial => 'form', :object=>$_
20
+
21
+ %= link_to 'Back', :action => 'list'
@@ -0,0 +1,9 @@
1
+
2
+ <h1>New product</h1>
3
+
4
+ <% form_for :product, @product, :url=>{:action=>:create} do |f| %>
5
+ <%= render :partial => 'form.html.erb', :locals => { :f => f } %>
6
+ <%= submit_tag "Create" %>
7
+ <% end %>
8
+
9
+ <%= link_to 'Back', :action => 'list' %>
@@ -0,0 +1,12 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <<p : [Product.content_columns] <
7
+ <b><<:human_name>>:</b>
8
+ %= h @product.send($_.name)
9
+
10
+ %= link_to 'Edit', :action => 'edit', :id => @product
11
+ |
12
+ %= link_to 'Back', :action => 'list'
@@ -0,0 +1,13 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <% for column in Product.content_columns %>
7
+ <p>
8
+ <b><%= column.human_name %>:</b> <%=h @product.send(column.name) %>
9
+ </p>
10
+ <% end %>
11
+
12
+ <%= link_to 'Edit', :action => 'edit', :id => @product %> |
13
+ <%= link_to 'Back', :action => 'list' %>
@@ -0,0 +1,14 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <h3>People Who Bought <%= @product.title %></h3>
7
+
8
+ <ul>
9
+ <% for order in @orders -%>
10
+ <li>
11
+ <%= mail_to order.email, order.name %>
12
+ </li>
13
+ <% end -%>
14
+ </ul>
@@ -0,0 +1,8 @@
1
+ xml.order_list(:for_product => @product.title) do
2
+ for o in @orders
3
+ xml.order do
4
+ xml.name(o.name)
5
+ xml.email(o.email)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,32 @@
1
+ <%(BeforeCompile) opt[:process_xhtml]=true %>
2
+
3
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <!--
6
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
7
+ ! We make no guarantees that this code is fit for any purpose.
8
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
9
+ -->
10
+ <<html<
11
+ <<head<
12
+ <title>Administer the Bookstore</title>
13
+ %= stylesheet_link_tag "scaffold", "depot", :media => "all"
14
+ <<body#admin<
15
+ <<div#banner<
16
+ %= image_tag("logo.png")
17
+ %= @page_title || "Pragmatic Bookshelf"
18
+
19
+ <<div#columns<
20
+ <<div#side<
21
+ <<p<
22
+ %= link_to "Products", :controller => 'admin', :action => 'list'
23
+ <<p<
24
+ %= link_to "List users", :controller => 'login', :action => 'list_users'
25
+ <br/>
26
+ %= link_to "Add user", :controller => 'login', :action => 'add_user'
27
+ <<p<
28
+ %= link_to "Logout", :controller => 'login', :action => 'logout'
29
+ <<div#main<
30
+ <<div#notice ?[flash[:notice]] <
31
+ %= flash[:notice]
32
+ << :content_for_layout | NoSanitize >>
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!--
4
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
5
+ ! We make no guarantees that this code is fit for any purpose.
6
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
7
+ -->
8
+ <html>
9
+ <head>
10
+ <title>Administer the Bookstore</title>
11
+ <%= stylesheet_link_tag "scaffold", "depot", :media => "all" %>
12
+ </head>
13
+ <body id="admin">
14
+ <div id="banner">
15
+ <%= image_tag("logo.png") %>
16
+ <%= @page_title || "Pragmatic Bookshelf" %>
17
+ </div>
18
+ <div id="columns">
19
+ <div id="side">
20
+ <p>
21
+ <%= link_to "Products", :controller => 'admin', :action => 'list' %>
22
+ </p>
23
+ <p>
24
+ <%= link_to "List users", :controller => 'login', :action => 'list_users' %>
25
+ <br/>
26
+ <%= link_to "Add user", :controller => 'login', :action => 'add_user' %>
27
+ </p>
28
+ <p>
29
+ <%= link_to "Logout", :controller => 'login', :action => 'logout' %>
30
+ </p>
31
+ </div>
32
+ <div id="main">
33
+ <% if flash[:notice] -%>
34
+ <div id="notice"><%= flash[:notice] %></div>
35
+ <% end -%>
36
+ <%= yield :layout %>
37
+ </div>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,37 @@
1
+ <%(BeforeCompile) opt[:process_xhtml]=true %>
2
+
3
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <!--
6
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
7
+ ! We make no guarantees that this code is fit for any purpose.
8
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
9
+ -->
10
+ <<html<
11
+ <<head<
12
+ <title>Pragprog Books Online Store</title>
13
+
14
+ %= stylesheet_link_tag "depot", :media => "all"
15
+ %= javascript_include_tag :defaults
16
+
17
+ <<body#store<
18
+ <<div#banner<
19
+ %= image_tag("logo.png")
20
+ %= @page_title || "Pragmatic Bookshelf"
21
+
22
+ <<div#columns<
23
+ <<div#side<
24
+ % style = @cart.items.empty? ? "display: none" : false
25
+ <<div#cart : | Attr[:style] <
26
+ %= render(:partial => "cart", :object => @cart)
27
+
28
+ <a href="http://www....">Home</a><br />
29
+ <a href="http://www..../faq">Questions</a><br />
30
+ <a href="http://www..../news">News</a><br />
31
+ <a href="http://www..../contact">Contact</a><br />
32
+
33
+ <<div#main<
34
+ <<div#notice ?[flash[:notice]]<
35
+ %= flash[:notice]
36
+
37
+ << :content_for_layout | NoSanitize >>
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <!--
4
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
5
+ ! We make no guarantees that this code is fit for any purpose.
6
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
7
+ -->
8
+ <html>
9
+ <head>
10
+ <title>Pragprog Books Online Store</title>
11
+
12
+ <%= stylesheet_link_tag "depot", :media => "all" %>
13
+
14
+ <%= javascript_include_tag :defaults %>
15
+ </head>
16
+
17
+ <body id="store">
18
+ <div id="banner">
19
+ <%= image_tag("logo.png") %>
20
+ <%= @page_title || "Pragmatic Bookshelf" %>
21
+ </div>
22
+ <div id="columns">
23
+ <div id="side">
24
+
25
+
26
+ <% hidden_div_if(@cart.items.empty?, :id => "cart") do %>
27
+ <%= render(:partial => "cart.html.erb", :object => @cart) %>
28
+ <% end %>
29
+
30
+ <a href="http://www....">Home</a><br />
31
+ <a href="http://www..../faq">Questions</a><br />
32
+ <a href="http://www..../news">News</a><br />
33
+ <a href="http://www..../contact">Contact</a><br />
34
+ </div>
35
+ <div id="main">
36
+ <% if flash[:notice] -%>
37
+ <div id="notice"><%= flash[:notice] %></div>
38
+ <% end -%>
39
+ <%= yield :layout %>
40
+ </div>
41
+ </div>
42
+ </body>
43
+ </html>
@@ -0,0 +1,33 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <div class="depot-form">
7
+
8
+ <%= error_messages_for 'user' %>
9
+
10
+ <fieldset>
11
+ <legend>Enter User Details</legend>
12
+
13
+ <% form_for :user do |form| %>
14
+ <p>
15
+ <label for="user_name">Name:</label>
16
+ <%= form.text_field :name, :size => 40 %>
17
+ </p>
18
+
19
+ <p>
20
+ <label for="user_password">Password:</label>
21
+ <%= form.password_field :password, :size => 40 %>
22
+ </p>
23
+
24
+ <p>
25
+ <label for="user_password_confirmation">Confirm:</label>
26
+ <%= form.password_field :password_confirmation, :size => 40 %>
27
+ </p>
28
+
29
+ <%= submit_tag "Add User", :class => "submit" %>
30
+
31
+ <% end %>
32
+ </fieldset>
33
+ </div>
@@ -0,0 +1,9 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <h1>Welcome</h1>
7
+
8
+ It's <%= Time.now %>.
9
+ We have <%= pluralize(@total_orders, "order") %>.
@@ -0,0 +1,20 @@
1
+ <!--
2
+ ! Excerpted from "Agile Web Development with Rails, 2nd Ed."
3
+ ! We make no guarantees that this code is fit for any purpose.
4
+ ! Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book information.
5
+ -->
6
+ <h1>Administrators</h1>
7
+ <ul>
8
+ <% for user in @all_users %>
9
+ <li><%= link_to "[X]", { # link_to options
10
+ :controller => 'login',
11
+ :action => 'delete_user',
12
+ :id => user},
13
+ { # html options
14
+ :method => :post,
15
+ :confirm => "Really delete #{user.name}?"
16
+ } %>
17
+ <%= h(user.name) %>
18
+ </li>
19
+ <% end %>
20
+ </ul>