-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the rest of the functionality, and some cleanup
- Loading branch information
Showing
18 changed files
with
187 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
- Create a framework for interacting with DataStore | ||
- Create a small framework for interacting with UserService | ||
CSS on stuff | ||
Fix pooling for Rack | ||
Check times | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,53 @@ | ||
class BlogsController < ApplicationController | ||
layout 'blog' | ||
require_admin :new, :create, :remove | ||
require_admin :new_post, :create_post, :create, :remove, :remove_post | ||
|
||
def start | ||
@posts = Post.all({}, :limit => 15, :iorder => :created_at) | ||
end | ||
|
||
def index | ||
@blogs = Blog.all | ||
end | ||
|
||
def blog | ||
@blog = Blog.get(params[:id].to_i) | ||
@blog = Blog.get(params[:id]) | ||
@posts = @blog.posts | ||
end | ||
|
||
def post | ||
@post = Post.get(params[:post_id]) | ||
@blog = @post.blog | ||
end | ||
|
||
def remove | ||
Blog.delete(params[:id].to_i) | ||
Blog.delete(params[:id]) | ||
redirect_to blogs_url | ||
end | ||
|
||
def create | ||
name = params[:name] | ||
|
||
blog = Blog.new | ||
blog.name = name | ||
blog.owner = @person | ||
blog.save! | ||
blog = Blog.create :name => name, :owner => @person, :created_at => Time.now | ||
|
||
redirect_to blogs_url | ||
end | ||
|
||
def new_post | ||
@blog = Blog.get(params[:id]) | ||
end | ||
|
||
def create_post | ||
@blog = Blog.get(params[:id]) | ||
Post.create :title => params[:title], :content => params[:content], :blog => @blog, :created_at => Time.now | ||
|
||
redirect_to blog_url(@blog) | ||
end | ||
|
||
def remove_post | ||
post = Post.get(params[:id]) | ||
blog = post.blog | ||
post.delete! | ||
|
||
redirect_to blog_url(blog) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ class Person | |
include Bumble | ||
|
||
ds :given_name, :sur_name, :email | ||
# has_many :blogs, Blog | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h1>New post</h1> | ||
<p><i>In <%=link_to @blog.name, blog_url(@blog)%></i></p> | ||
|
||
<% form_tag create_post_url(@blog) do -%> | ||
<p><%=text_field_tag :title, nil, :size => 50 %></p> | ||
<p><%=text_area_tag :content, nil, :rows => 40, :cols => 70 %></p> | ||
<p><%=submit_tag "Publish post"%></p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
<h1><%=@post.title%></h1> | ||
<p><i>In <%=link_to @blog.name, blog_url(@blog)%></i></p> | ||
<% if @admin %> | ||
<p><i><%=link_to("Remove post", remove_post_url(@post), {:method => :post})%></i></p> | ||
<% end %> | ||
<pre> | ||
<%=@post.content%> | ||
</pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1>Latest posts</h1> | ||
|
||
<% @posts.each do |p| %> | ||
<hr/> | ||
<h3><%=link_to p.title, post_url(p.blog, p)%><%= @admin ? " - <i>#{link_to("Remove post", remove_post_url(p), {:method => :post})}</i>" : ""%></h3> | ||
<p><i>In <%=link_to p.blog.name, blog_url(p.blog)%></i></p> | ||
<pre> | ||
<%=p.content%> | ||
</pre> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<datastore-indexes autoGenerate="true"> | ||
<datastore-index kind="Post" ancestor="false"> | ||
<property name="blog_id" direction="asc"/> | ||
<property name="created_at" direction="desc"/> | ||
</datastore-index> | ||
</datastore-indexes> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
jruby -S warble | ||
cd ../tmp/yarbl_web | ||
rm -rf * | ||
jar xf ../../yarbl/yarbl.war | ||
~/Desktop/Secrets/appengine-java-sdk/bin/appcfg.sh update . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.