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
11 changed files
with
213 additions
and
25 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pyc |
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,8 +1,17 @@ | ||
application: helloworld | ||
application: lyricswelove | ||
version: 1 | ||
runtime: python | ||
api_version: 1 | ||
|
||
handlers: | ||
- url: /stylesheets | ||
static_dir: stylesheets | ||
|
||
- url: /images | ||
static_dir: images | ||
|
||
- url: /javascripts | ||
static_dir: javascripts | ||
|
||
- url: /.* | ||
script: lyricswelove.py | ||
script: lyrics.py |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
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,43 @@ | ||
from google.appengine.ext import webapp | ||
from google.appengine.ext import db | ||
from google.appengine.api import users | ||
from google.appengine.ext.webapp import template | ||
import models | ||
import os | ||
import wsgiref.handlers | ||
|
||
class BetterHandler(webapp.RequestHandler): | ||
def template_path(self, filename): | ||
return os.path.join(os.path.dirname(__file__), 'templates', filename) | ||
|
||
def template_values(self, extra_dict=None): | ||
standard_values = { | ||
'user': users.get_current_user(), | ||
'login_url': users.create_login_url('/'), | ||
'logout_url': users.create_logout_url('/'), | ||
} | ||
|
||
if extra_dict: | ||
standard_values.update(extra_dict) | ||
|
||
return standard_values | ||
|
||
|
||
class MainPage(BetterHandler): | ||
def get(self): | ||
self.response.out.write(template.render(self.template_path('index.html'), self.template_values())) | ||
|
||
|
||
class NewLyric(BetterHandler): | ||
def get(self): | ||
self.response.out.write(template.render(self.template_path('new_lyric.html'), self.template_values())) | ||
|
||
|
||
def main(): | ||
application = webapp.WSGIApplication([('/', MainPage), | ||
('/lyric/new', NewLyric)], | ||
debug=True) | ||
wsgiref.handlers.CGIHandler().run(application) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
from google.appengine.ext import db | ||
from google.appengine.api import users | ||
|
||
class Lyric(db.Model): | ||
body = db.TextProperty() | ||
owner = db.UserProperty(required=True) |
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,64 @@ | ||
/* elements */ | ||
body { | ||
background-color: #fff; | ||
color: #191919; | ||
font-family: Georgia, Times, serif; | ||
margin: 2em 15% 0 15%; | ||
} | ||
|
||
a { | ||
color: #0080ff; | ||
text-decoration: none; | ||
} | ||
a:active, a:hover { text-decoration: underline; } | ||
|
||
h1 { font-size: 3em; } | ||
h1 a:hover { text-decoration: none; } | ||
h2 { font-size: 2em; } | ||
|
||
/* classes */ | ||
.lyricform br { | ||
clear: left; | ||
} | ||
|
||
.lyricform label, .lyricform input[type=text] { | ||
display: block; | ||
width: 60%; | ||
float: left; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.lyricform label { | ||
text-align: right; | ||
width: 150px; | ||
padding-right: 20px; | ||
} | ||
|
||
.lyricform textarea { | ||
width: 60%; | ||
height: 200px; | ||
} | ||
|
||
.optional { | ||
color: #666; | ||
} | ||
|
||
|
||
/* ids */ | ||
|
||
#content { | ||
font-size: 1em; | ||
} | ||
|
||
#nav { | ||
float: right; | ||
font-family: Helvetica, sans-serif; | ||
font-size: .9em; | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
|
||
#nav li { | ||
display: inline; | ||
margin-right: 1em; | ||
} |
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,25 @@ | ||
<html> | ||
<head> | ||
<title>Lyrics We Love</title> | ||
<link type="text/css" rel="stylesheet" href="/stylesheets/screen.css" /> | ||
<script type="text/javascript" src="/javascripts/jquery-1.2.3.min.js"></script> | ||
<script type="text/javascript" src="/javascripts/app.js"></script> | ||
</head> | ||
<body> | ||
<ul id="nav"> | ||
{% if user %} | ||
<li>{{ user }}</li> | ||
<li><a href="/lyric/new">add a lyric</a></li> | ||
<li><a href="{{ logout_url }}">logout</a></li> | ||
{% else %} | ||
<a href="{{ login_url }}">login</a> | ||
{% endif %} | ||
</ul> | ||
|
||
<h1><a href="/">Lyrics We Love</a></h1> | ||
|
||
<div id="content"> | ||
{% block content %}{% endblock %} | ||
</div> | ||
</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,5 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h2>Recent Lyrics</h2> | ||
{% endblock %} |
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 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h2>Share A Lyric</h2> | ||
|
||
<form action="/lyric/new" method="post" name="new_lyric_form" class="lyricform"> | ||
<label for="lyric">Lyric</label> | ||
<textarea name="body"></textarea> | ||
<br /> | ||
|
||
<label for="artist">Artist</label> | ||
<input type="text" name="artist" /> | ||
<br /> | ||
|
||
<label for="album" class="optional">Album</label> | ||
<input type="text" name="album" /> | ||
<br /> | ||
|
||
<label for="song">Song</label> | ||
<input type="text" name="song" /> | ||
<br /> | ||
|
||
<label for="submit"></label> | ||
<input type="submit" value="La lala la" /> | ||
</form> | ||
{% endblock %} |