Skip to content

Commit

Permalink
allow anyone to submit, try different style for form
Browse files Browse the repository at this point in the history
  • Loading branch information
Evaw committed Oct 18, 2012
1 parent 8db526a commit c54ba28
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 91 deletions.
32 changes: 17 additions & 15 deletions main.py
@@ -1,8 +1,8 @@
#TODO: resize images
#TODO: test worthiness of submission with challenge problem (factoring?)
#TODO: pagination
#TODO: make a way to activate/deactivate the voting without re-deploying app.
#add user management, at least at the cookie level to allow them to take their stuff down if they want
#improve user management, use memcache
#
#--address="1.1.1.1"

import webapp2
Expand Down Expand Up @@ -225,7 +225,6 @@ def get(self):
'user': user,
'loginURL':users.create_login_url("/"),
'logoutURL':users.create_logout_url("/"),

}
if user:
userManagement['nickname'] = user.nickname()
Expand Down Expand Up @@ -262,16 +261,16 @@ def post(self):
pic = self.request.get("pic")
user = users.get_current_user();

if not user:
self.redirect('/')
return


artist = getOrCreateArtistKeyFromUser(user)

if not artist:
logging.log('had some problem, could not ger artist')
self.redirect('/')
#if not user:
# self.redirect('/')
# return
artistKey = None
if user:
artistKey = getOrCreateArtistKeyFromUser(user)
artistKey = str(artistKey)
#if not artist: letting anyone submit
# logging.log('had some problem, could not ger artist')
# self.redirect('/')

keys = memcache.get(MEMCACHE_TOP_ART_KEY)
if keys and len(keys) >= MAX_POSTS:
Expand All @@ -280,7 +279,7 @@ def post(self):


#canVote = not check_secure_val(self.request.cookies.get('voted%s' % VOTING_EVENT))
artistKey = str(artist)

error =""
if len(title) > 500:
error = "title should be less than 500 characters"
Expand All @@ -291,7 +290,10 @@ def post(self):
try:
resizedPic = images.resize(pic, 500, 300)
picBlob = db.Blob(resizedPic)
a = Art(title = title, pic=picBlob, artist=artistKey)
if artistKey:
a = Art(title = title, pic=picBlob, artist=artistKey)
else:
a= Art(title = title, pic=picBlob)
a.put()
topArts(True)
title= "";#clear title for redirect
Expand Down
Binary file added main.pyc
Binary file not shown.
72 changes: 67 additions & 5 deletions static/css/votingPage.css
@@ -1,3 +1,15 @@
::-webkit-selection,
::selection {
color: black;
background: red; }

body {
margin: 0;
padding: 0; }

.main-body {
margin: 8px; }

.button, .submit-art, .voting-button {
background: transparent;
border: 1px whiteSmoke;
Expand All @@ -9,13 +21,28 @@
cursor: pointer; }

.file-upload {
border: 0px;
/*
opacity: 0;
Filter: alpha(opacity = 50);
*/ }

.submit-art {
clear: left;
display: block;
height: 3em;
display: inline-block;
font-weight: bold;
color: black;
box-shadow: #222 0px 0px 3px 1px, inset #333 0px 0px 3px 0px; }

input[name="title"] {
background: green; }
background: #333;
border: black;
color: #D1D1D1;
font-weight: bold;
line-height: 1.4em;
border-radius: 3px; }

body {
background: #333333;
Expand Down Expand Up @@ -58,21 +85,56 @@ body {
box-shadow: red 0px 0px 3px 3px;
border: red solid 10px; }

.heading {
display: inline-block;
height: 3em;
margin: 5px;
position: relative; }

.picture-submission {
float: right;
display: inline-block; }

.footer {
display: block;
height: 10em; }

.error {
color: red; }

.picture-submission {
/*position: fixed;
bottom: 0;*/ }

.submit-art-form > * {
float: left; }

.picture-submission {
display: inline-block;
background: #D1D1D1;
border: solid 3px;
background: #CE1B1B;
border: none;
border-radius: 3px;
color: black;
bottom: 0px;
padding: 0 15px 15px 15px; }
bottom: 0px; }

.art-title {
font-weight: bolder;
font-size: 1.4em; }

.picture-submission-container {
display: inline-block;
-webkit-transition: height 1s;
margin-top: 5px; }

.no-height {
display: none;
height: 0; }

.picture-submission > * {
padding: 5px; }

.user-login-container {
border-bottom: 1px solid; }

.submit-art-form > * {
margin-right: 3px; }
68 changes: 62 additions & 6 deletions static/css/votingPage.scss
Expand Up @@ -2,7 +2,19 @@ $dark: #333;
$orange: #FFA500;
$green: #008000;
$background: $dark;
::-webkit-selection,
::selection {
color: black;
background: red;
}

body{
margin: 0;
padding: 0;
}
.main-body{
margin: 8px;
}
.button {
background: transparent;
border: 1px whiteSmoke;
Expand All @@ -17,21 +29,34 @@ $background: $dark;

}
.file-upload{
border: 0px;
/*
opacity: 0;
Filter: alpha(opacity = 50);
*/
}
.submit-art{
@extend .button;
clear: left;
display: block;
height: 3em;
display: inline-block;
font-weight: bold;
color: black;
box-shadow: #222 0px 0px 3px 1px, inset #333 0px 0px 3px 0px;
}
.voting-button{
@extend .button;

}

input[name="title"]{
background: $green;
background: #333;
border: black;
color: #D1D1D1;
font-weight: bold;
line-height: 1.4em;
border-radius: 3px;
}

input[name="pic"]{
Expand Down Expand Up @@ -88,7 +113,14 @@ screen and (min-width: 500px){
border: red solid 10px;
}
.heading{

display: inline-block;
height: 3em;
margin: 5px;
position: relative;
}
.picture-submission{
float: right;
display: inline-block;
}
.footer{
display: block;
Expand All @@ -98,26 +130,28 @@ screen and (min-width: 500px){
color: red;
}
.picture-submission{
/*position: fixed;
bottom: 0;*/
}
.submit-art-form > *{
float: left;
}
.picture-submission{
display: inline-block;
background: #D1D1D1;
border: solid 3px;
background: #CE1B1B;
border:none;
border-radius: 3px;
color: black;
bottom: 0px;
padding: 0 15px 15px 15px;
}

.art-showcase{

}

.art-title{

font-weight: bolder;
font-size: 1.4em;
}

.votes{
Expand All @@ -129,3 +163,25 @@ screen and (min-width: 500px){
}


.picture-submission-container{
display: inline-block;
-webkit-transition: height 1s;
margin-top: 5px;
}

.no-height{
display: none;
height: 0;

}

.picture-submission > *{
padding: 5px;
}
.user-login-container{
border-bottom: 1px solid;
}

.submit-art-form > *{
margin-right: 3px;
}
15 changes: 15 additions & 0 deletions static/js/page.js
@@ -0,0 +1,15 @@
$(document).ready(
function(){
"use strict";
var togglePicSubmission = function(){
if($('.picture-submission-container').hasClass('no-height')){
$('.picture-submission-container').removeClass('no-height');
} else {
$('.picture-submission-container').addClass('no-height')
}

};
$('#pic-submission-toggle-btn').bind('click', togglePicSubmission);

}
);

0 comments on commit c54ba28

Please sign in to comment.