Permalink
Browse files

Refactor and clean up views

  • Loading branch information...
1 parent 5a045bd commit c4d976ba23307f728a4089886b9547760cd02952 @joneslee85 joneslee85 committed Aug 25, 2012
@@ -1,4 +1,7 @@
-<% content_for(:page_title) do %><%= archives_title %><% end -%>
+<% content_for(:page_title) do -%>
+ <%= archives_title %>
+<% end -%>
+
<h2>Archives</h2>
<% if @months.empty? -%>
@@ -1,4 +1,4 @@
<cite><%= author_link(comment) %></cite> says:
- <br>
+ <br/>
<small class="commentmetadata"><a href="#comment-<%= comment.id %>" title=""><%= format_comment_date(comment.created_at) %></a></small>
- <p><%=raw comment.body_html %></p>
+ <p><%== comment.body_html %></p>
@@ -13,11 +13,11 @@
<%= yield(:head) %>
<% if flash[:notice] -%>
- <script>
- jQuery(document).ready(function() {
- humanMsg.displayMsg('<%= escape_javascript(flash[:notice]) %>');
- })
- </script>
+ <%= javascript_tag do -%>
+ $(function() {
+ humanMsg.displayMsg('<%= escape_javascript(flash[:notice]) %>');
+ })
+ <% end -%>
<% end -%>
</head>
@@ -2,9 +2,7 @@
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
-
<title><%= enki_config[:title] %> - Admin Login</title>
-
<%= stylesheet_link_tag 'login' %>
</head>
<body>
@@ -14,7 +12,7 @@
</div>
<div id="nav">
<ul>
- <li><%= link_to("View Site", '/', :title => 'View Site') %></li>
+ <li><%= link_to 'View Site', root_path, :title => 'View Site' %></li>
</ul>
</div>
</div>
@@ -1 +1 @@
-<%=raw page.body_html %>
+<%== page.body_html %>
@@ -1,4 +1,5 @@
<% content_for(:page_title) do -%>
-<%= page_title(@page) -%>
+ <%= page_title(@page) -%>
<% end -%>
-<%= render :partial => 'pages/page', :locals => {:page => @page} %>
+
+<%= render @page %>
@@ -1,13 +1,13 @@
<h2><%= link_to(post.title, post_path(post)) %></h2>
-<div class="entrybody">
- <%=raw post.body_html %>
+<div class="entry-body">
+ <%== post.body_html %>
</div>
<div class="meta">
<ul>
<li class="date">Posted on <%= format_post_date(post.published_at) %></li>
- <li class="comments"><%= link_to(pluralize(post.approved_comments.size, "comment"), post_path(post, :anchor => 'comments')) %></li>
+ <li class="comments"><%= link_to pluralize(post.approved_comments.size, "comment"), post_path(post, :anchor => 'comments') %></li>
<% unless post.tags.empty? -%>
- <li class="tags">Tagged <%= linked_tag_list(post.tags) %></li>
+ <li class="tags">Tagged <%= linked_tag_list(post.tags) %></li>
<% end -%>
</ul>
</div>
@@ -1,15 +1,20 @@
-<% content_for(:page_title) do %><%= posts_title(@tag) %><% end -%>
-<% content_for(:head) do %><%= auto_discovery_link_tag(:atom, @tag.nil? ? formatted_posts_path(:format => 'atom') : posts_path(:tag => @tag, :format => 'atom')) %><% end -%>
+<% content_for :page_title do -%>
+ <%= posts_title(@tag) %>
+<% end -%>
+
+<% content_for :head do -%>
+ <%= auto_discovery_link_tag(:atom, @tag.nil? ? formatted_posts_path(:format => 'atom') : posts_path(:tag => @tag, :format => 'atom')) %>
+<% end -%>
<% if @posts.empty? -%>
<p>There are no posts yet.</p>
<% else -%>
<% @posts.each do |post| -%>
- <div class="post post-<%= post.id %>">
- <%= render :partial => 'post', :locals => {:post => post} %>
+ <div class="post" id="<%= dom_id(post) %>">
+ <%= render post %>
</div>
<% end -%>
<% if more_content? -%>
- <div class="related">Looking for more? Head on over to the <%= link_to("archives", archives_path) %>.</div>
+ <div class="related">Looking for more? Head on over to the <%= link_to 'archives', archives_path %>.</div>
<% end -%>
<% end -%>
@@ -1,30 +1,42 @@
-<% content_for(:page_title) do -%>
-<%= post_title(@post) -%>
+<% content_for :page_title do -%>
+ <%= post_title @post -%>
<% end -%>
-<%= render :partial => 'posts/post', :locals => {:post => @post} %>
+
+<%= render @post %>
+
<ol class="commentlist">
<% @post.approved_comments.each do |comment| -%>
- <li<%=raw cycle(' class="alt"', '') %> id="comment-<%= comment.id %>">
- <%= render :partial => 'comments/comment', :locals => {:comment => comment} %>
- </li>
+ <li<%=raw cycle(' class="alt"', '') %> id="comment-<%= comment.id %>">
+ <%= render comment %>
+ </li>
<% end -%>
</ol>
-<div class="related">Looking for more? Head on over to the <%= link_to("archives", archives_path) %>.</div>
+
+<div class="related">Looking for more? Head on over to the <%= link_to 'archives', archives_path %>.</div>
+
<h2>Post a comment</h2>
- <% unless @comment.errors.empty? -%>
- <div class="errors">
- <h3>Comment not added!</h3>
- <ul>
- <% @comment.errors.sort_by(&:first).each do |error| -%>
- <li><%= format_comment_error(error) %></li>
- <% end -%>
- </ul>
- </div>
- <% end -%>
-<%= form_for([@post, @comment]) do |form| -%>
- <div>
- <p><%= form.text_field 'author' %><label for="comment_author"><small>Name or <a href="http://openidexplained.com/">OpenID</a> (required)</small></label></p>
- <p><%= form.text_area 'body' %><br><small>(<a href="http://lesstile.rubyforge.org">lesstile enabled</a> - surround code blocks with ---)</small></p>
- <p><%= submit_tag "Add Comment" %></p>
- </div>
+<% unless @comment.errors.empty? -%>
+<div class="errors">
+ <h3>Comment not added!</h3>
+ <ul>
+ <% @comment.errors.sort_by(&:first).each do |error| -%>
+ <li><%= format_comment_error(error) %></li>
+ <% end -%>
+ </ul>
+</div>
<% end -%>
+
+<div>
+ <%= form_for [@post, @comment] do |form| -%>
+ <p>
+ <%= form.text_field 'author' %>
+ <%= form.label :author %>
+ <small>Name or <%= link_to 'OpenID', 'http://openidexplained.com/' %> (required)</small>
+ </p>
+ <p>
+ <%= form.text_area 'body' %><br/>
+ <small>(<%= link_to 'lesstile enabled', 'http://lesstile.rubyforge.org' %> - surround code blocks with ---)</small>
+ </p>
+ <p><%= form.submit 'Add Comment' %></p>
+ <% end -%>
+</div>

0 comments on commit c4d976b

Please sign in to comment.