-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with getting persistence project on Heroku #3
Open
daniez
wants to merge
3
commits into
cuny-nytech:master
Choose a base branch
from
DAloiciusFilesFromCUNY-NYTechClass:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
*{ | ||
font-family: Garamond; | ||
color: black; | ||
} | ||
body{ | ||
background-color: #EEEEEE; | ||
|
||
} | ||
div { | ||
background-color:white; | ||
border-radius: 5px; | ||
border-style: solid; | ||
|
||
} | ||
|
||
|
||
#header { | ||
display: inline-block; | ||
border-color: #0000ff; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
#post { | ||
display: inline-block; | ||
border-color: #CC00CC; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
|
||
#name{ | ||
display: inline-block; | ||
height: 50px; | ||
width: 300px; | ||
margin: 0px 30px 10px 30px; | ||
text-align: center; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#box_title{ | ||
display: inline-block; | ||
height: 50px; | ||
width: 300px; | ||
margin: 0px 30px 10px 30px; | ||
text-align: center; | ||
} | ||
|
||
#box{ | ||
/*display: inline-block;*/ | ||
float: left; | ||
height: 300px; | ||
width: 350px; | ||
box-shadow: 10px 10px 5px #888888; | ||
background-color: black; | ||
|
||
margin: 20px 30px 20px 30px; | ||
|
||
|
||
|
||
} | ||
|
||
tr:nth-child(3) td div{ | ||
/*display: inline-block;*/ | ||
height: 100px; | ||
|
||
|
||
/*background-color: black;*/ | ||
margin: 20px 30px 10px 30px; | ||
padding: 5px; | ||
} | ||
|
||
|
||
table{ | ||
margin: auto; | ||
width: 100%; | ||
margin-top: 50px; | ||
} | ||
|
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 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rubocop' | ||
gem 'sinatra' | ||
gem 'data_mapper' |
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,25 +1,17 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
ast (2.0.0) | ||
astrolabe (1.3.0) | ||
parser (>= 2.2.0.pre.3, < 3.0) | ||
parser (2.2.0.pre.5) | ||
ast (>= 1.1, < 3.0) | ||
slop (~> 3.4, >= 3.4.5) | ||
powerpack (0.0.9) | ||
rainbow (2.0.0) | ||
rubocop (0.26.1) | ||
astrolabe (~> 1.3) | ||
parser (>= 2.2.0.pre.4, < 3.0) | ||
powerpack (~> 0.0.6) | ||
rainbow (>= 1.99.1, < 3.0) | ||
ruby-progressbar (~> 1.4) | ||
ruby-progressbar (1.6.0) | ||
slop (3.6.0) | ||
rack (1.5.2) | ||
rack-protection (1.5.3) | ||
rack | ||
sinatra (1.4.5) | ||
rack (~> 1.4) | ||
rack-protection (~> 1.4) | ||
tilt (~> 1.3, >= 1.3.4) | ||
tilt (1.4.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rubocop | ||
sinatra |
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 @@ | ||
web: bundle exec ruby blog.rb -p $PORT | ||
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,18 +1,5 @@ | ||
# Persistence assignment | ||
|
||
Create a site in Sinatra that saves information from a form to a database, then displays that information on the page. Examples: | ||
This is a blog which is editable online. To add a blog entry, type the title and content in a field provided, then click on the submit button. | ||
|
||
* A single-user Twitter clone | ||
* A blog that can be edited online | ||
* A note-taking app | ||
* A recipe site | ||
* *etc.* | ||
|
||
Using a SQL database is recommended, specifically PostgreSQL (a.k.a. "Postgres") via the [pg](https://bitbucket.org/ged/ruby-pg/wiki/Home) gem. The app doesn't need a lot of bells & whistles, e.g. user authentication, unless you get that first part done early. | ||
|
||
**Deploy the application to Heroku**, and **submit a pull request** to this repository. Include: | ||
|
||
* All the necessary files | ||
* In the README: | ||
* Setup instructions | ||
* A link to the live app on Heroku | ||
To edit an entry, click on the ID number of the entry. |
Binary file not shown.
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,47 @@ | ||
require 'sinatra' | ||
require 'data_mapper' | ||
|
||
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/blog.db") | ||
|
||
class Post | ||
include DataMapper::Resource | ||
property :id, Serial | ||
property :post_title, Text, required: true | ||
property :content, Text, required: true | ||
property :created_at, DateTime | ||
property :updated_at, DateTime | ||
end | ||
|
||
DataMapper.auto_upgrade! | ||
|
||
get '/' do | ||
@posts = Post.all order: :id.desc | ||
erb :home | ||
end | ||
|
||
post '/' do | ||
p = Post.new | ||
p.post_title = params[:post_title] | ||
p.content = params[:content] | ||
p.created_at = Time.now | ||
p.updated_at = Time.now | ||
p.save | ||
redirect '/' | ||
end | ||
|
||
get '/:id/' do | ||
# retreive post from database | ||
@post = Post.get params[:id] | ||
@title = 'Edit blog post' | ||
erb :edit | ||
end | ||
|
||
put '/:id' do | ||
|
||
p = Post.get params[:id] | ||
p.post_title = params[:post_title] | ||
p.content = params[:content] | ||
p.updated_at = Time.now | ||
p.save | ||
redirect '/' | ||
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 @@ | ||
require './blog.rb' | ||
run Sinatra::Application |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,121 @@ | ||
*{ | ||
font-family: Arial, Helvetica, Sans-Serif; | ||
color: #151B54; | ||
/*font-size:medium;*/ | ||
} | ||
body{ | ||
background-color: #EEEEEE; | ||
|
||
} | ||
div { | ||
background-color:white; | ||
border-radius: 5px; | ||
border-style: solid; | ||
|
||
} | ||
|
||
|
||
#header { | ||
display: inline-block; | ||
border-color: #0000ff; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
|
||
|
||
#post_left { | ||
display: float: left; | ||
border-color: #CC00CC; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
#post_right { | ||
display: float: left; | ||
/*display: inline-block;*/ | ||
border-color: #CC00CC; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
|
||
#new_post { | ||
/*display: inline-block;*/ | ||
border-color: orange; | ||
width: 95%; | ||
/*height: 60px;*/ | ||
|
||
margin-bottom: 10px; | ||
padding-left: 40px; | ||
padding-top: 10px; | ||
padding-botton: 10px; | ||
} | ||
|
||
|
||
#name{ | ||
display: inline-block; | ||
height: 50px; | ||
width: 300px; | ||
margin: 0px 30px 10px 30px; | ||
text-align: center; | ||
} | ||
|
||
|
||
|
||
#image{ | ||
height="100" | ||
width="120" | ||
border-style: 1px solid #DDD; | ||
border-radius: 50% | ||
} | ||
|
||
|
||
|
||
|
||
#box_title{ | ||
display: inline-block; | ||
height: 50px; | ||
width: 300px; | ||
margin: 0px 30px 10px 30px; | ||
text-align: center; | ||
} | ||
|
||
#box{ | ||
/*display: inline-block;*/ | ||
float: left; | ||
height: 300px; | ||
width: 350px; | ||
box-shadow: 10px 10px 5px #888888; | ||
background-color: black; | ||
|
||
margin: 20px 30px 20px 30px; | ||
|
||
} | ||
|
||
#post_title{ | ||
height:20px; | ||
width: 50%; | ||
} | ||
|
||
#post_content{ | ||
height:100px; | ||
width: 95%; | ||
} | ||
|
||
|
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,18 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf8"> | ||
<link type="text/css" rel="stylesheet" href="stylesheet.css"/> | ||
<title>Danielle--Blog</title> | ||
</head> | ||
<body> | ||
<!--change from div?--> | ||
|
||
<div id="header"><h1>Danielle Zoe Aloicius</h1><br> | ||
<img src="/Snapshot_20080828_1.jpg" alt="DZA" height="100" width="120"> | ||
</div> | ||
|
||
|
||
<%= yield %> | ||
</body> | ||
</html> |
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 @@ | ||
<% if @post %> | ||
<form action="/<%= @post.id %>" method="post" id="edit"> | ||
<input type="hidden" name="_method" value="put"> | ||
<textarea id="post_title" name="post_title" ><%= @post.post_title %></textarea> | ||
<textarea id="post_content" name="content" ><%= @post.content %></textarea> | ||
|
||
<input type="submit"> | ||
</form> | ||
<% 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,26 @@ | ||
<div id="new_post"> | ||
<form action="/" method="post"> | ||
<textarea id="post_title" name="post_title" placeholder="Add Post Title" ></textarea> | ||
<textarea id="post_content" name="content" placeholder="Add Post Contents"></textarea> | ||
<input type="submit" value="Add Post"> | ||
</form> | ||
</div> | ||
|
||
<% @posts.each_with_index do |post, i| %> | ||
|
||
<div <%='id="post_left"' if i % 2==0%> | ||
<%='id="post_right"'if i % 2==1%> | ||
|
||
|
||
<p class="links"> | ||
<a href="/<%= post.id %>/"><%=post.id %></a> | ||
</p> | ||
<%= post.post_title %><br> | ||
<%= post.content %> | ||
|
||
<p class="meta">Created: <%= post.created_at %></p> | ||
|
||
</div> | ||
|
||
|
||
<% end %> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this command working for you locally? I'm getting
cannot load such file -- dm-sqlite-adapter
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...which means what?