Skip to content

Commit

Permalink
Updated link styles and fixed its form.
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Feb 8, 2009
1 parent 70100b1 commit 094d529
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 14 deletions.
2 changes: 2 additions & 0 deletions app/controllers/admin/links_controller.rb
@@ -0,0 +1,2 @@
class Admin::LinksController < Admin::PostsController
end
3 changes: 2 additions & 1 deletion app/controllers/admin/posts_controller.rb
Expand Up @@ -34,14 +34,15 @@ def new
@post = Post.new

respond_to do |format|
format.html # new.html.erb
format.html { render :template => 'admin/posts/new.html.erb' }
format.xml { render :xml => @post }
end
end

# GET /posts/1/edit
def edit
@post = Post.find_by_permalink(params[:id]) || Post.find(params[:id])
render :template => 'admin/posts/edit.html.erb'
end

# POST /posts
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/links_controller.rb
@@ -0,0 +1,2 @@
class LinksController < PostsController
end
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
@@ -1,5 +1,9 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
# Extracted a method here to open the door to custom formatters.
def markup_for(str)
RedCloth.new(str).to_html
end

def spanned_link(*args)
text = '<span>' + args.shift + '</span>'
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/posts/forms/_link.html.erb
Expand Up @@ -13,13 +13,13 @@

<label for="cite">
About (optional)<br>
<%= f.text_field :cite %>
<%= f.text_area :content %>
</label>

<%= f.hidden_field :type, :value => 'Link' %>

<p>
<%= @post.new_record? ? f.submit("Create") : f.submit("Update") %>
<%= @post.new_record? ? f.submit("Create Link") : f.submit("Update Link") %>
</p>
<% end %>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/posts/index.html.erb
Expand Up @@ -5,7 +5,7 @@
<% end -%>

<div id="posts">
<%= render :partial => "post", :collection => @posts %>
<%= render :partial => "posts/post", :collection => @posts %>
</div>

<%= '<p>There were no posts found.</p>' if @posts.empty? %>
Expand Down
14 changes: 11 additions & 3 deletions app/views/admin/posts/types/_link.html.erb
Expand Up @@ -2,10 +2,18 @@
<span class="month"><%= post.created_at.strftime('%b') -%></span>
<span class="day"><%= post.created_at.strftime('%e') -%></span>
</div>
<blockquote>

<div class="entry">
<%= spanned_link h(post.link_text), post.permalink -%>
<%= content_tag :p, post.content unless post.content.blank? %>
</blockquote>
<% if post.content? %>
<div class="article">
<div class="entry">
<%= markup_for(post.content) %>
</div>
</div>
<% end %>
</div>

<cite>
<%- if post.feed -%>
Expand Down
13 changes: 10 additions & 3 deletions app/views/posts/types/_link.html.erb
Expand Up @@ -2,10 +2,17 @@
<span class="month"><%= post.created_at.strftime('%b') -%></span>
<span class="day"><%= post.created_at.strftime('%e') -%></span>
</div>
<blockquote>
<div class="entry">
<%= spanned_link h(post.link_text), post.permalink -%>
<%= content_tag :p, post.content unless post.content.blank? %>
</blockquote>
<% if post.content? %>
<div class="article">
<div class="entry">
<%= markup_for(post.content) %>
</div>
</div>
<% end %>
</div>

<cite>
<%- if post.feed -%>
Expand Down
8 changes: 4 additions & 4 deletions app/views/sessions/new.html.erb
Expand Up @@ -5,10 +5,10 @@
<label for="password">Password<br/>
<%= password_field_tag 'password' %></label>

<!-- Uncomment this if you want this functionality
<p><label for="remember_me">Remember me:</label>
<%= check_box_tag 'remember_me' %></p>
-->
<label for="remember_me">
<%= check_box_tag 'remember_me' %> Remember me
</label>


<p><%= submit_tag 'Log in', :title => "Logging in..." %></p>
<% end -%>

0 comments on commit 094d529

Please sign in to comment.