Skip to content
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

Gabriela Voll's WORKING persistance assignment #1

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
11149df
added empty files to be filled for this assignment
gabrielavoll Oct 22, 2014
b3fc4e9
initial website, has running version and has none functioning persist…
gabrielavoll Oct 30, 2014
bde1a4a
forgotten fils
gabrielavoll Oct 30, 2014
36ee4f5
Create README.md
gabrielavoll Oct 30, 2014
128ece2
working version
gabrielavoll Oct 30, 2014
402a349
left some stuff behind
gabrielavoll Oct 30, 2014
dff0a22
all good to deploy ex
gabrielavoll Oct 30, 2014
52dc66c
fix reference to file index.erb
gabrielavoll Oct 31, 2014
ec2cb05
changed title name
gabrielavoll Oct 31, 2014
b2fb0f7
Update README.md
gabrielavoll Oct 31, 2014
6d07dcc
small cahnges
gabrielavoll Oct 31, 2014
4bb6dc4
added readme
gabrielavoll Oct 31, 2014
75c1965
took out the need for the net/http gem, still havin problems with the…
gabrielavoll Nov 1, 2014
fc1df70
Update README.md
gabrielavoll Nov 1, 2014
9dadeb4
everything working and running, pagination, about, and contact page
gabrielavoll Nov 3, 2014
4a371d9
readme update
gabrielavoll Nov 3, 2014
12b89a5
changes to pg conncection variable to connect to heroku db, hopefully…
gabrielavoll Nov 3, 2014
d6804f0
took out use of user, since dont know pwd, hopefully connects now
gabrielavoll Nov 3, 2014
0ef2825
put user and pwd in , hopefully connects now
gabrielavoll Nov 3, 2014
43b19c7
added pg connection close
gabrielavoll Nov 3, 2014
3197b4c
fixed inital number of table to 0
gabrielavoll Nov 3, 2014
16734c7
pagination problem, so outputting some nums on webpage for test in bo…
gabrielavoll Nov 3, 2014
c482488
false alarm, all is a go, everything is working
gabrielavoll Nov 3, 2014
225d749
not false alarm, was missing the case of where there are 16 elements,…
gabrielavoll Nov 3, 2014
bb1dea5
coppied working persist into this repo
gabrielavoll Nov 3, 2014
d88dac4
thing
gabrielavoll Nov 3, 2014
a96ccc6
coppied working persist into this repo
gabrielavoll Nov 3, 2014
e878c64
Update README.md
gabrielavoll Nov 3, 2014
4c210d7
changed form to have action to post to form, and then send form to re…
gabrielavoll Nov 3, 2014
322bb88
deleting last two elements
gabrielavoll Nov 3, 2014
20563d0
moved them into index
gabrielavoll Nov 3, 2014
ef11028
dafe
gabrielavoll Nov 3, 2014
16aa1ac
dafe
gabrielavoll Nov 3, 2014
a769a77
dafe
gabrielavoll Nov 3, 2014
a92f513
dafe
gabrielavoll Nov 3, 2014
d9af955
allfixed
gabrielavoll Nov 3, 2014
adb303f
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
b9c6fc3
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
4b5f675
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
c0b67bb
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
c52d8a0
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
fcd381b
tryin to fix refresh issue
gabrielavoll Nov 3, 2014
9b80114
pagig problem
gabrielavoll Nov 3, 2014
18d67f4
pagig problem
gabrielavoll Nov 3, 2014
d18fa6b
pagig problem
gabrielavoll Nov 3, 2014
601281f
no problems
gabrielavoll Nov 3, 2014
5ee7532
Update README.md
gabrielavoll Nov 3, 2014
9fa38c7
edited readme to have correct website
gabrielavoll Nov 3, 2014
e76d1cc
deleting elemetn
gabrielavoll Nov 3, 2014
1a44806
perfect perfect now
gabrielavoll Nov 3, 2014
1b5583e
added style.css file and updated the other files
gabrielavoll Nov 3, 2014
1f242c0
added style.css file and updated the other files
gabrielavoll Nov 3, 2014
39c901c
fixed the break
gabrielavoll Nov 3, 2014
c17133e
small typo
gabrielavoll Nov 4, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source 'https://rubygems.org'

gem 'rubocop'
source "https://rubygems.org"
ruby "2.1.2"
gem 'sinatra', '1.1.0'
gem 'pg', :group => :production
25 changes: 8 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
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)
pg (0.17.1)
rack (1.5.2)
sinatra (1.1.0)
rack (~> 1.1)
tilt (~> 1.1)
tilt (1.4.1)

PLATFORMS
ruby

DEPENDENCIES
rubocop
pg
sinatra (= 1.1.0)
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec ruby basics.rb -p $PORT
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
# Persistence assignment
persist-ass
===========

Create a site in Sinatra that saves information from a form to a database, then displays that information on the page. Examples:
This repository creates a small web app that makes a small message board, like web app.
That will take in posts from anyone.
It is supposed to be a pretend watergate website for any famous person.
IE you can pretend to be Obama, Whitney Houston's Ghost, Eisnten, a Kardashien, or etc and say whatever you want.

* A single-user Twitter clone
* A blog that can be edited online
* A note-taking app
* A recipe site
* *etc.*
Working version here at (https://sleepy-atoll-6973.herokuapp.com/)

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
only small problems, with refresh
50 changes: 50 additions & 0 deletions basics.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

require 'rubygems'
require 'sinatra'
require 'pg'


get '/about' do
erb :about
end

get '/contact' do
erb :contact
end

get '/:page' do
erb :index
end

get '/' do
erb :index
end

post '/form' do
if(params[:name]!="" && params[:avatarimg] !="" && params[:post]!="" && params[:name]!="...person your impersonating here......" && params[:avatarimg] !="....(copy url address of image here....." )
conn= PG::Connection.new(host:'ec2-54-225-102-235.compute-1.amazonaws.com',user: 'blqijevewuznsa', password: '4ciDikAsPFofqZGfcBGFzSppe2', dbname:'d8df2nk7lqp4f9',port:'5432')
t=Time.now
t.getlocal("-04:00")
lastid=0
conn.exec_params("SELECT * FROM post ORDER BY id DESC LIMIT 1") do |result|
result.each do |row|
lastid=row['id'].to_i
lastid+=1
end
end
conn.exec_params("INSERT INTO post (id, posttime, username, avatar, userpost) VALUES ('#{lastid}', '#{t}', '#{params[:name]}', '#{params[:avatarimg]}', '#{params[:post]}')")
conn.close()
end
params[:name]=""
params[:avatarimg] =""
params[:post]=""

redirect '/'
end

not_found do
status 404
'not found'
end


171 changes: 171 additions & 0 deletions public/stylesheets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@

body {
font-family: Courier New;
background: url("https://31.media.tumblr.com/49050472baa0c80d0e28ca08daf6fa97/tumblr_ne6gabqNip1s7jjavo1_500.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: 100% 100%;
height: 100%;
width:100%;
}
#main {
opacity: 0.8;
top:-30px;
overflow: auto;
left:-10px;
position: relative;
background-color: #FFFFFF;
margin:0px auto 0px auto;
padding-top:0px;
padding-bottom:10px;
padding: 0px 10px 10px 0px;
width: 690px;
}
#header {
top:-30px;
left:-10px;
opacity: 1;
position: relative;
background-color: #c75143;
margin:0px auto 0px auto;
width:700px;
height:100px;
border-top-right-radius: 20px;
border-top-left-radius:20px;
text-align: center;
}
#header img {
height:50px;
}
#title {
font-size: 2em;
}
#info {
width: 660px;
height:100px;
font-size: .9em;
margin:0px 5px 10px 10px;
text-align: center;
}
#info img{
width:100px;
margin-top: -10px;
margin-bottom: -10px;
}
#nameget {
width: 200px;
}
#imageget{
width:300px;
}
#newpost{
line-height: 140%;
margin-top: -10px;
}

#submit {
float: right;
margin:-5px 10px 5px 0px;
}
.post {
float:left;
padding:5px 5px 0px 10px;
background-color: #EEEEEE;
width: 670px;
margin:5px 5px 0px 7px ;
border-radius: 10px;

}
.post img{
border-radius: 60px;
margin-top:5px;
width:100px;
float:left;
margin-bottom: 5px;
}
#bottomfill li{
position: relative;
display:inline-block;
margin: 0px 30px 0px 20px;
}
#bottomfill {
text-align: center;
margin-left: -10px;
margin-top: -30px;
}


.ptext {
float:left;
padding:0px 0px 0px 10px;
width:550px;
}
#time{
margin-top:-10px;
margin-bottom:5px;
text-align: right;
line-height: 100%;
}
#name {
margin-top:5px;
line-height: 100%;
}
#text {
margin-top: -5px;
}

#paginate {
float:left;
width: 685px;
margin:5px 5px 0px 7px ;
border-radius: 10px;

}
.pagebutton {
border-radius:30px;
padding:5px;
display: inline-block;
}
#right {
float:right;
}
#left {
float:left;
}

#homerefresh {
text-decoration: none;
color: #000000;
}

#link:hover {
color: #c75143;
}

#rightbottom {
left:-30px;
}

#link {
text-decoration: none;
color: #000000;
}

#infoEx{
width: 660px;
font-size: 1.2em;
margin:0px 5px 10px 5px;
padding:0px 10px 0px 10px;
text-align: left;

}
#rickroll {
color:#000000;
text-align: center;
}

#disclaimer {
font-size: .8em;
color:#c75143;;
}
31 changes: 31 additions & 0 deletions views/about.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>Famous Watergate</title>
<link href="./stylesheets/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<a href="/" id="homerefresh">
<div id="header">
<p id="title">True Words from the Famous <br> ...
<img src="https://33.media.tumblr.com/2ccd5c63af9acc3ad6ec563b2659c841/tumblr_ne6iuieIig1s7jjavo1_400.gif"> ...</p>
</div>
</a>
<div id="main">
<div id="info">
<p> <img src="https://38.media.tumblr.com/b78e9000be7b15d9b6934381763d486a/tumblr_ne6ierAUsF1s7jjavo1_400.gif"> Watergate! <br> They said some outrageous shit! <br> What exactly did the say? <br><br> Well you have the power to make it be whatever you want it to be. Post some shit below.
</div>
<hr width="90%">
<div id="infoEx">
<p> This is the <b>True Words from the Famous .... </b> website. On this website you will find the 100% legitimate and shocking quotes from the most influential and famous people on this planet, living or dead. You can even submit your own favorite quotes from these people, that you may or may not have overheard in real life.</p>
<p id="disclaimer"> DISCLAIMER: None of the things writen on this website are true, this is a joke website that is open for the use of anyone, to write whatever they want. All content will be moderated by Gato, the creator of this website. </p>
</div>
</div> <!-- end of main-->
<div id="bottomfill">
<ul>
<a href="/about" id="link"><li id="rightbottom">About</li></a> <a href="/contact" id="link"><li>Contact Us</li> </a>
</ul>
</div>

</body>
</html>
33 changes: 33 additions & 0 deletions views/contact.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Famous Watergate</title>

<link href="./stylesheets/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<a href="/" id="homerefresh">
<div id="header">
<p id="title">True Words from the Famous <br> ...
<img src="https://33.media.tumblr.com/2ccd5c63af9acc3ad6ec563b2659c841/tumblr_ne6iuieIig1s7jjavo1_400.gif"> ...</p>
</div>
</a>
<div id="main">
<div id="info">
<p> <img src="https://38.media.tumblr.com/b78e9000be7b15d9b6934381763d486a/tumblr_ne6ierAUsF1s7jjavo1_400.gif"> Watergate! <br> They said some outrageous shit! <br> What exactly did the say? <br><br> Well you have the power to make it be whatever you want it to be. Post some shit below.
</div>
<hr width="90%">
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" id="link">
<div id="infoEx">
<p id="rickroll"> <br><br> jk, not accepting messages at this time <br> <br> <br> <br> </p>
</div>
</a>
</div> <!-- end of main-->
<div id="bottomfill">
<ul>
<a href="/about" id="link"><li id="rightbottom">About</li></a> <a href="/contact" id="link"><li>Contact Us</li> </a>
</ul>
</div>

</body>
</html>
Binary file added views/famousPeople.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added views/famouspeoplered.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading