This repository has been archived by the owner on Apr 24, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
252 additions
and
0 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
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,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
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,3 @@ | ||
// Place all the styles related to the posts controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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,38 @@ | ||
class PostsController < ApplicationController | ||
|
||
def index | ||
@posts = Post.all | ||
@posts = @posts.page params[:page] unless @posts.count == 0 | ||
respond_to do |format| | ||
format.html | ||
format.any(:json) { render request.format.to_sym => @posts } | ||
end | ||
end | ||
|
||
def show | ||
@post = Post.find(params[:id]) | ||
respond_to do |format| | ||
format.html | ||
format.any(:json) { render request.format.to_sym => @post } | ||
end | ||
end | ||
|
||
def create | ||
@post = Post.new(params[:post]) | ||
@post.save | ||
redirect_to post_path(@post) | ||
end | ||
|
||
def update | ||
end | ||
|
||
def destroy | ||
end | ||
|
||
def new | ||
@post = Post.new | ||
end | ||
|
||
def edit | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module PostsHelper | ||
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,6 @@ | ||
class Post | ||
include Mongoid::Document | ||
field :title, :type => String | ||
field :body, :type => String | ||
field :published, :type => Boolean | ||
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,24 @@ | ||
.first.grid1 | ||
= form_for @post, :html => {:class => 'grid10 main_form'} do |f| | ||
.first.grid10.box | ||
.first.grid10.subhead | ||
.first.grid2.label | ||
%h3 Post | ||
.first.grid2.label | ||
= f.label :title, "Title" | ||
.grid8.field | ||
= f.text_field :title | ||
|
||
.first.grid2.label | ||
= f.label :body, "Body" | ||
.grid8.field | ||
= f.text_area :body | ||
|
||
.first.grid2.label | ||
= f.label :published, "Published" | ||
.grid8.field | ||
= f.check_box :published | ||
|
||
.first.grid10.submit | ||
= f.submit :class => 'button save' | ||
|
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,2 @@ | ||
%h1 Posts#create | ||
%p Find me in app/views/posts/create.html.haml |
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,2 @@ | ||
%h1 Posts#destroy | ||
%p Find me in app/views/posts/destroy.html.haml |
Empty file.
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,20 @@ | ||
.grid1.first | ||
|
||
.grid10.box | ||
.first.grid10.subhead | ||
.first.grid2.label | ||
%h3 Posts | ||
- for post in @posts | ||
.first.grid10.article_row | ||
.first.grid2 | ||
= post.title | ||
.grid6 | ||
.first.grid6 | ||
= post.body | ||
|
||
.first.grid10 | ||
-#= paginate @posts | ||
.grid1.first | ||
.grid10 | ||
= link_to('new post', new_post_url, :class => "button add") |
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 @@ | ||
= render :partial => 'form' |
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 @@ | ||
.first.grid1 | ||
.grid10.box | ||
.first.grid10.subhead | ||
.first.grid2.label | ||
%h3 | ||
= @post.title | ||
.first.grid10.article_attribute | ||
= simple_format(@post.body) | ||
.first.grid10.article_attribute |
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,2 @@ | ||
%h1 Posts#update | ||
%p Find me in app/views/posts/update.html.haml |
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 @@ | ||
Kaminari.configure do |config| | ||
# config.default_per_page = 25 | ||
# config.window = 4 | ||
# config.outer_window = 0 | ||
# config.left = 0 | ||
# config.right = 0 | ||
# config.param_name = :page | ||
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require 'spec_helper' | ||
|
||
describe PostsController do | ||
|
||
describe "GET 'index'" do | ||
it "returns http success" do | ||
get 'index' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'show'" do | ||
it "returns http success" do | ||
get 'show' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'create'" do | ||
it "returns http success" do | ||
get 'create' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'update'" do | ||
it "returns http success" do | ||
get 'update' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'destroy'" do | ||
it "returns http success" do | ||
get 'destroy' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'edit'" do | ||
it "returns http success" do | ||
get 'edit' | ||
response.should be_success | ||
end | ||
end | ||
|
||
describe "GET 'new'" do | ||
it "returns http success" do | ||
get 'new' | ||
response.should be_success | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Read about factories at http://github.com/thoughtbot/factory_girl | ||
|
||
FactoryGirl.define do | ||
factory :post do | ||
title "MyString" | ||
body "MyText" | ||
published false | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the PostHelper. For example: | ||
# | ||
# describe PostHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# helper.concat_strings("this","that").should == "this that" | ||
# end | ||
# end | ||
# end | ||
describe PostHelper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,15 @@ | ||
require 'spec_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the PostsHelper. For example: | ||
# | ||
# describe PostsHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# helper.concat_strings("this","that").should == "this that" | ||
# end | ||
# end | ||
# end | ||
describe PostsHelper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe Post do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe "posts/create.html.haml" do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe "posts/destroy.html.haml" do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe "posts/index.html.haml" do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe "posts/show.html.haml" do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
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,5 @@ | ||
require 'spec_helper' | ||
|
||
describe "posts/update.html.haml" do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |