Skip to content

Commit 5f90a04

Browse files
committed
#2 Convert views to HAML
1 parent d04fe44 commit 5f90a04

File tree

5 files changed

+46
-72
lines changed

5 files changed

+46
-72
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
<%= form_for(@static_page) do |f| %>
2-
<% if @static_page.errors.any? %>
3-
<div id="error_explanation">
4-
<h2><%= pluralize(@static_page.errors.count, "error") %> prohibited this static_page from being saved:</h2>
1+
= form_for @static_page do |f|
2+
.field
3+
= f.label :title
4+
%br
5+
= f.text_field :title
56

6-
<ul>
7-
<% @static_page.errors.full_messages.each do |msg| %>
8-
<li><%= msg %></li>
9-
<% end %>
10-
</ul>
11-
</div>
12-
<% end %>
7+
.field
8+
= f.label :content
9+
%br
10+
= f.text_field :content
1311

14-
<div class="field">
15-
<%= f.label :title %><br>
16-
<%= f.text_field :title %>
17-
</div>
18-
<div class="field">
19-
<%= f.label :content %><br>
20-
<%= f.text_area :content %>
21-
</div>
22-
<div class="actions">
23-
<%= f.submit %>
24-
</div>
25-
<% end %>
12+
.actions
13+
= f.submit
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
<h1>Editing static_page</h1>
1+
%h1 Editing static_page
22

3-
<%= render 'form' %>
4-
5-
<%= link_to 'Show', @static_page %> |
6-
<%= link_to 'Back', static_pages_path %>
3+
= render 'form', :static_page => @static_page
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,24 @@
1-
<h1>Listing static_pages</h1>
1+
%h1 Listing static_pages
2+
%table
3+
%thead
4+
%tr
5+
%th Title
6+
%th Content
7+
%th
8+
%th
9+
%th
10+
%tbody
11+
- @static_pages.each do |static_page|
12+
%tr
13+
%td
14+
= static_page.title
15+
%td
16+
= static_page.content
17+
%td
18+
= link_to 'Show', static_page
19+
%td
20+
= link_to 'Edit', edit_static_page_path(static_page)
21+
%td
22+
= link_to 'Destroy', static_page, method: :delete, data: { confirm: 'Are you sure?' }
223

3-
<table>
4-
<thead>
5-
<tr>
6-
<th>Title</th>
7-
<th>Content</th>
8-
<th></th>
9-
<th></th>
10-
<th></th>
11-
</tr>
12-
</thead>
13-
14-
<tbody>
15-
<% @static_pages.each do |static_page| %>
16-
<tr>
17-
<td><%= static_page.title %></td>
18-
<td><%= static_page.content %></td>
19-
<td><%= link_to 'Show', static_page %></td>
20-
<td><%= link_to 'Edit', edit_static_page_path(static_page) %></td>
21-
<td><%= link_to 'Destroy', static_page, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22-
</tr>
23-
<% end %>
24-
</tbody>
25-
</table>
26-
27-
<br>
28-
29-
<%= link_to 'New Static page', new_static_page_path %>
24+
= link_to 'New Static Page', new_static_page_path
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<h1>New static_page</h1>
1+
%h1 New static_page
22

3-
<%= render 'form' %>
4-
5-
<%= link_to 'Back', static_pages_path %>
3+
= render 'form', :static_page => @static_page
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
<p id="notice"><%= notice %></p>
1+
%p
2+
%strong Title:
3+
= @static_page.title
24

3-
<p>
4-
<strong>Title:</strong>
5-
<%= @static_page.title %>
6-
</p>
5+
%p
6+
%strong Content:
7+
= @static_page.content
78

8-
<p>
9-
<strong>Content:</strong>
10-
<%= @static_page.content %>
11-
</p>
12-
13-
<%= link_to 'Edit', edit_static_page_path(@static_page) %> |
14-
<%= link_to 'Back', static_pages_path %>
9+
= link_to 'Edit', edit_static_page_path(@static_page)
10+
= link_to 'Back', static_pages_path

0 commit comments

Comments
 (0)