Skip to content

Commit

Permalink
Woah! Gotta ignore /blogs and not blogs..
Browse files Browse the repository at this point in the history
  • Loading branch information
bernerdschaefer committed Oct 7, 2009
1 parent 8d9cb24 commit ff3f544
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blogs
pkg
log
*.db
public/assets
/blogs
/public/assets
/log
/pkg
34 changes: 34 additions & 0 deletions lib/captains_blog/views/admin/blogs/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<%
if @blog.new_record?
resource_path = "/admin/blogs"
form_method = :post
offer_delete = false
else
resource_path = "/admin/blogs/#{@blog.id}"
form_method = :put
offer_delete = true
end
%>
<% form resource_path, :method => form_method do %>
<fieldset>
<%= error_messages_for(@blog) %>

<label for="blog_title">Title</label>
<input type="text" id="blog_title" name="blog[title]" value="<%=h @blog.title %>">

<label for="blog_tagline">Tagline</label>
<input type="text" id="blog_tagline" name="blog[tagline]" value="<%=h @blog.tagline %>">

<label for="blog_slug">Slug</label>
<input type="text" id="blog_slug" name="blog[slug]" value="<%=h @blog.slug %>">

</fieldset>
<input type="submit" value="Save">
<% end %>
<% if offer_delete %>
<% form(resource_path, :method => :delete) do %>
<input type="submit" value="Delete">
<% end %>
<% end %>
2 changes: 2 additions & 0 deletions lib/captains_blog/views/admin/blogs/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= render "admin/blogs/_form" %>
7 changes: 7 additions & 0 deletions lib/captains_blog/views/admin/blogs/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<a href="/admin/blogs/new">New</a>

<ul>
<% @blogs.each do |blog| %>
<li><a href="/admin/blogs/<%= blog.id %>"><%= blog.title %></a> (<a href="<%= blog_root(blog) %>/admin">admin</a>)</li>
<% end %>
</ul>
2 changes: 2 additions & 0 deletions lib/captains_blog/views/admin/blogs/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= render "admin/blogs/_form" %>

0 comments on commit ff3f544

Please sign in to comment.