started work on donate pages
This commit is contained in:
parent
c101b17f37
commit
445bcd4943
|
@ -11,11 +11,12 @@ RUN \
|
|||
apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y software-properties-common python-software-properties && \
|
||||
apt-get install -y python-requests python-lxml python-flask python-flask-login python-misaka python-tz python-mysqldb python-psycopg2 python-requests-oauthlib
|
||||
apt-get install -y python-pip python-requests python-lxml python-flask python-flask-login python-misaka python-tz python-mysqldb python-psycopg2 python-requests-oauthlib
|
||||
|
||||
RUN add-apt-repository -y ppa:oly/ppa
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y python-scaffold
|
||||
RUN pip install gocardless
|
||||
|
||||
ADD site /var/www/
|
||||
|
||||
|
|
|
@ -108,8 +108,17 @@ def auth_required():
|
|||
def register_form():
|
||||
header('Register for access')
|
||||
web.page.create('Register for access')
|
||||
web.page.section(web.register_form.create().render())
|
||||
#~ web.page.section(web.register_form.create().render())
|
||||
|
||||
web.form.create('Register new user account', '/register')
|
||||
web.form.append(name='name', label='Your full name', placeholder='Ralf Green', value='')
|
||||
web.form.append(name='email', label='Valid Email', placeholder='ralf@maidstone-hackspace.org.uk', value='')
|
||||
web.form.append(input_type='password', name='password', label='Password', placeholder='quick brown fox jumped over', value='')
|
||||
web.form.append(input_type='password', name='password_confirm', label='Password Confirm', placeholder='quick brown fox jumped over', value='')
|
||||
|
||||
web.page.section(web.form.render())
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
return make_response(footer())
|
||||
|
||||
@authorize_pages.route("/register", methods=['POST'])
|
||||
|
@ -155,6 +164,7 @@ def oauth(provider=None):
|
|||
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
|
||||
|
||||
print session
|
||||
print provider
|
||||
if provider:
|
||||
oauth_session = OAuth2Session(
|
||||
oauth_provider.get('client_id'),
|
||||
|
@ -168,9 +178,10 @@ def oauth(provider=None):
|
|||
oauth_provider.get('auth_uri'),
|
||||
access_type=oauth_access_type,
|
||||
approval_prompt=oauth_approval_prompt)
|
||||
|
||||
print state
|
||||
# State is used to prevent CSRF, keep this for later, make sure oauth returns to the same url.
|
||||
session['oauth_state'] = state
|
||||
session.modified = True
|
||||
return redirect(authorization_url)
|
||||
|
||||
print session
|
||||
|
@ -365,7 +376,6 @@ def login_screen_submit():
|
|||
|
||||
|
||||
@authorize_pages.route("/logout")
|
||||
@login_required
|
||||
def logout():
|
||||
logout_user()
|
||||
return redirect('/')
|
||||
|
|
|
@ -32,6 +32,7 @@ oauth_conf = {
|
|||
|
||||
|
||||
gocardless_enviroment = 'sandbox'
|
||||
gocardless_redirect_uri = 'https://test.maidstone-hackspace.org.uk'
|
||||
gocardless_credentials = {
|
||||
'app_id': '',
|
||||
'app_secret': '',
|
||||
|
|
|
@ -3,6 +3,7 @@ page_menu = [
|
|||
('Home', '/'),
|
||||
#('Competition', '/competition'),
|
||||
('Chat', '/chat'),
|
||||
('Donate', '/donate'),
|
||||
('Contact', '#mailing-list-signup')]
|
||||
|
||||
banner_images = [
|
||||
|
|
|
@ -6,7 +6,8 @@ import argparse
|
|||
sys.path.append(os.path.abspath('../../../scaffold/'))
|
||||
sys.path.insert(0,os.path.abspath('../../../scaffold/'))
|
||||
|
||||
from scaffold import www
|
||||
from scaffold import web
|
||||
web.load_widgets('widgets')
|
||||
|
||||
from libs.rss_fetcher import feed_reader
|
||||
|
||||
|
@ -16,6 +17,9 @@ from pages import web
|
|||
from pages import header, footer
|
||||
from pages import blog
|
||||
from pages import competition
|
||||
from pages import donate
|
||||
|
||||
from config.settings import *
|
||||
|
||||
|
||||
def examples():
|
||||
|
@ -41,6 +45,7 @@ if __name__ == "__main__":
|
|||
('pages.homepage', 'index', 'index.html'),
|
||||
('pages.blog', 'index', 'blog.html'),
|
||||
('pages.chat', 'index', 'chat.html'),
|
||||
('pages.donate', 'index', 'donate.html'),
|
||||
('pages.competition', 'index', 'competition.html'))
|
||||
|
||||
args = parser.parse_args()
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,9 @@
|
|||
<head>
|
||||
<link rel="stylesheet" id="navigationCss" href="/static/css/default.css" media="" type="text/css" />
|
||||
<link rel="stylesheet" id="navigationCss" href="/static/js/jquery-ui/themes/base/jquery-ui.css" media="" type="text/css" />
|
||||
<link rel="stylesheet" id="navigationCss" href="/static/css/sprite-navigation-white.css" media="" type="text/css" />
|
||||
<link rel="stylesheet" id="navigationCss" href="/static/css/sprite-action-white.css" media="" type="text/css" />
|
||||
<link rel="stylesheet" id="navigationCss" href="/static/css/sprite-content-white.css" media="" type="text/css" />
|
||||
<script type="text/javascript" src="/static/js/jquery-2.1.4.min.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.js"></script>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-animate.js"></script>
|
||||
|
@ -13,13 +16,14 @@
|
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="headerstrip"><nav class="navstrip"><div class="left"><a id="mini_logo" href="/login"><img src="/static/images/hackspace.png" class="mini-logo"></a><span class="mini-logo-text">Maidstone Hackspace</span></div><div class="social"><div class="btn"><a href="https://twitter.com/share" class="twitter-share-button" data-via="MHackspace">Tweet</a></div><div class="btn"><div class="fb-share-button" data-href="http://maidstone-hackspace.org.uk/" data-layout="button_count"></div></div><div class="btn"><script type="IN/Share" data-url="http://maidstone-hackspace.org.uk/" data-counter="right"></script></div><div class="btn"><div size="standard" class="g-plusone" data-href="http://maidstone-hackspace.org.uk/" data-size="medium" data-annotation="bubble" count="true"></div></div></div></nav></div>
|
||||
<div id="headerstrip"><nav class="navstrip"><div class="left"><a id="mini_logo" href="/login"><img src="//127.0.0.1:5000/static/images/hackspace.png" class="mini-logo"></a><span class="mini-logo-text">Maidstone Hackspace</span></div><div class="social"><div class="btn"><a href="https://twitter.com/share" class="twitter-share-button" data-via="MHackspace">Tweet</a></div><div class="btn"><div class="fb-share-button" data-href="http://maidstone-hackspace.org.uk/" data-layout="button_count"></div></div><div class="btn"><script type="IN/Share" data-url="http://maidstone-hackspace.org.uk/" data-counter="right"></script></div><div class="btn"><div size="standard" class="g-plusone" data-href="http://maidstone-hackspace.org.uk/" data-size="medium" data-annotation="bubble" count="true"></div></div></div></nav></div>
|
||||
<nav id="leftNav" class="menu" >
|
||||
<ul>
|
||||
<li class="active mi0"><a href="/" >Home</a></li>
|
||||
<li class="mi1"><a href="/chat" >Chat</a></li>
|
||||
<li class="mi2"><a href="#mailing-list-signup" >Contact</a></li>
|
||||
<li class="mi3"><a href="/login" >login</a></li>
|
||||
<li class="mi2"><a href="/donate" >Donate</a></li>
|
||||
<li class="mi3"><a href="#mailing-list-signup" >Contact</a></li>
|
||||
<li class="mi4"><a href="/login" >login</a></li>
|
||||
</ul>
|
||||
<div style="clear:both;"></div>
|
||||
</nav>
|
||||
|
@ -85,9 +89,8 @@ This kit comes with an arduino board and various sensors and components, list be
|
|||
</footer>
|
||||
</div>
|
||||
|
||||
<div id="footer"><div id="footertop"></div><div id="footerbottom"><div class="container"><div class="copyright">©2015 Maidstone Hackspace</div><div id="mailing-list-signup" class="google-groups-signup"><h3>Signup and make yourself known</h3><form class="block" name="signup" method="get" action="http://groups.google.com/group/maidstone-hackspace/boxsubscribe"><label for="groups-email">Email Address</label><input id="groups-email" name="email" class="required"/><button type="submit" />Subscribe</button><a href="http://groups.google.com/group/maidstone-hackspace">Browse Archives</a></form><div style="clear:both;"></div><div></div></div><div>
|
||||
|
||||
<div id="ajaxPopup" class="hide" ></div><script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<div id="footer"><div id="footertop"></div><div id="footerbottom"><div class="container"><div class="copyright">©2015 Maidstone Hackspace</div><div mailing-list-signup class="google-groups-signup"><h3>Signup and make yourself known</h3><form class="block" name="signup" method="get" action="http://groups.google.com/group/maidstone-hackspace/boxsubscribe"><label for="groups-email">Email Address</label><input id="groups-email" name="email" class="required"/><button type="submit" />Subscribe</button><a href="http://groups.google.com/group/maidstone-hackspace">Browse Archives</a></form><div style="clear:both;"></div><div></div></div><div>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
|
||||
<script><!--//--><![CDATA[//><!--!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
|
||||
//]]></script>
|
||||
|
@ -99,6 +102,15 @@ This kit comes with an arduino board and various sensors and components, list be
|
|||
(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.3";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));
|
||||
//]]></script><script type="text/javascript" ><!--//--><![CDATA[//><!--
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#mini_logo').on("click", function(e){
|
||||
e.preventDefault();
|
||||
$('#member_navigation').toggle();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
|
@ -112,15 +124,6 @@ ga('create', 'UA-63373181-1', 'maidstone-hackspace.org.uk');
|
|||
|
||||
ga('send', 'pageview');
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#mini_logo').on("click", function(e){
|
||||
e.preventDefault();
|
||||
$('#member_navigation').toggle();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var app = angular.module('myApp', ['ngAnimate']);
|
||||
|
||||
app.controller('sliderController', function($scope, $interval) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -18,6 +18,7 @@ from pages import competition
|
|||
|
||||
from pages import members
|
||||
|
||||
from pages.donate import donate_pages
|
||||
from pages.google_groups import google_groups_pages
|
||||
from pages.equipment import equipment_pages
|
||||
from pages.profile import profile_pages
|
||||
|
@ -32,6 +33,7 @@ web_app.register_blueprint(authorize_pages)
|
|||
web_app.register_blueprint(equipment_pages)
|
||||
web_app.register_blueprint(profile_pages)
|
||||
web_app.register_blueprint(google_groups_pages)
|
||||
web_app.register_blueprint(donate_pages)
|
||||
|
||||
|
||||
# local testing server, add your pages here
|
||||
|
@ -69,6 +71,11 @@ def index():
|
|||
#~ equipment.insert()
|
||||
#~ return make_response(equipment.index())
|
||||
|
||||
#~ @web_app.route("/donate/", methods=['GET'])
|
||||
#~ def donate_index():
|
||||
#~ """list of members"""
|
||||
#~ return make_response(donate.index())
|
||||
|
||||
@web_app.route("/members/", methods=['GET'])
|
||||
def members_index():
|
||||
"""list of members"""
|
||||
|
|
|
@ -9,8 +9,8 @@ db.config(settings.database)
|
|||
from scaffold.core.data import migrations
|
||||
from scaffold.core.data.migrations import export_schema, import_schema
|
||||
|
||||
#export_schema()
|
||||
import_schema()
|
||||
export_schema()
|
||||
#import_schema()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,11 +12,12 @@ def index():
|
|||
web.page.create('')
|
||||
web.page.section(
|
||||
web.div.create(
|
||||
web.images.create(
|
||||
web.template.uri.add_domain(site.tile_images[0][0])
|
||||
).append(
|
||||
web.template.uri.add_domain(site.tile_images[1][0])
|
||||
).render()
|
||||
web.google_calendar.create().render()
|
||||
#~ web.images.create(
|
||||
#~ web.template.uri.add_domain(site.tile_images[0][0])
|
||||
#~ ).append(
|
||||
#~ web.template.uri.add_domain(site.tile_images[1][0])
|
||||
#~ ).render()
|
||||
).set_classes('tile-right tile-image').render())
|
||||
web.banner_slider.reset()
|
||||
web.banner_slider * site.banner_images
|
||||
|
|
|
@ -11,7 +11,7 @@ from pages import web
|
|||
from pages import header, footer
|
||||
from data.site_user import get_user_details
|
||||
from data.profile import update_description
|
||||
|
||||
from config.settings import gocardless_enviroment, gocardless_credentials
|
||||
|
||||
profile_pages = Blueprint('profile_pages', __name__, template_folder='templates')
|
||||
|
||||
|
@ -24,7 +24,6 @@ def index():
|
|||
header('User Profile', url='/profile')
|
||||
print current_user
|
||||
user = get_user_details({'id': current_user.get_id()}).get()
|
||||
|
||||
|
||||
name = '%s %s' % (user.get('first_name', '').capitalize(), user.get('last_name', '').capitalize())
|
||||
web.page.create('%s - Profile' % name)
|
||||
|
@ -47,15 +46,12 @@ def index():
|
|||
'/profile/details'
|
||||
).set_classes('ajaxPopup').render())
|
||||
|
||||
web.form.create('Join Maidstone Hackspace', '/profile/membership')
|
||||
web.form.append(name='amount', label='Subscription Amount', placeholder='20.00', value='20.00')
|
||||
#~ web.form.append(name='skills', label='skills', placeholder='python, arduino, knitting')
|
||||
web.form.render()
|
||||
#~ web.form.create('Join Maidstone Hackspace', '/profile/membership')
|
||||
#~ web.form.append(name='amount', label='Subscription Amount', placeholder='20.00', value='20.00')
|
||||
#~ web.form.render()
|
||||
|
||||
web.columns.append(web.paragraph.render())
|
||||
web.columns.append(web.google_calendar.create().render())
|
||||
web.columns.append(web.member_card.create(str(user.get('user_id')).zfill(5), name).render())
|
||||
web.columns.append(web.form.render())
|
||||
web.page.section(web.columns.render())
|
||||
web.template.body.append(web.page.render())
|
||||
web.template.body.append(web.popup.create('').render())
|
||||
|
@ -66,14 +62,14 @@ def index():
|
|||
@login_required
|
||||
def pay_membership():
|
||||
import gocardless
|
||||
|
||||
|
||||
gocardless.environment = gocardless_enviroment
|
||||
gocardless.set_details(**gocardless_credentials)
|
||||
url = gocardless.client.new_subscription_url(
|
||||
amount=20.00,
|
||||
amount=request.form.get('amount'),
|
||||
interval_length=1,
|
||||
interval_unit="month",
|
||||
name="Membership Renewal for MH0001")
|
||||
name="Membership Subscription for MH0001")
|
||||
return redirect(url)
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
table_name, column_name, column_type, default
|
||||
#members
|
||||
|
||||
|
||||
#pledges
|
||||
ALTER TABLE pledges ADD INDEX id_UNIQUE (id ASC);
|
||||
|
||||
|
||||
#pledge_amounts
|
||||
ALTER TABLE pledge_amounts ADD INDEX id_UNIQUE (id ASC);
|
||||
|
||||
|
||||
#requests
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
table_name, column_name, column_type, default
|
||||
#members
|
||||
ALTER TABLE members ADD COLUMN id int(5) unsigned zerofill PRIMARY KEY (`id`) ;
|
||||
ALTER TABLE members CHANGE COLUMN id id int(5) unsigned zerofill PRIMARY KEY (`id`) ;
|
||||
ALTER TABLE members ADD COLUMN user_id varchar(45) NULL ;
|
||||
ALTER TABLE members CHANGE COLUMN user_id user_id varchar(45) NULL ;
|
||||
|
||||
|
||||
#pledges
|
||||
ALTER TABLE pledges ADD COLUMN id int(10) unsigned PRIMARY KEY (`id`) AUTO_INCREMENT ;
|
||||
ALTER TABLE pledges CHANGE COLUMN id id int(10) unsigned PRIMARY KEY (`id`) AUTO_INCREMENT ;
|
||||
ALTER TABLE pledges ADD COLUMN name varchar(255) NULL ;
|
||||
ALTER TABLE pledges CHANGE COLUMN name name varchar(255) NULL ;
|
||||
ALTER TABLE pledges ADD COLUMN total decimal(10,2) NULL DEFAULT 0.00;
|
||||
ALTER TABLE pledges CHANGE COLUMN total total decimal(10,2) NULL DEFAULT 0.00;
|
||||
|
||||
|
||||
#pledge_amounts
|
||||
ALTER TABLE pledge_amounts ADD COLUMN amount decimal(10,2) NULL ;
|
||||
ALTER TABLE pledge_amounts CHANGE COLUMN amount amount decimal(10,2) NULL ;
|
||||
ALTER TABLE pledge_amounts ADD COLUMN id int(10) unsigned PRIMARY KEY (`id`) AUTO_INCREMENT ;
|
||||
ALTER TABLE pledge_amounts CHANGE COLUMN id id int(10) unsigned PRIMARY KEY (`id`) AUTO_INCREMENT ;
|
||||
ALTER TABLE pledge_amounts ADD COLUMN pledge_id varchar(20) NULL ;
|
||||
ALTER TABLE pledge_amounts CHANGE COLUMN pledge_id pledge_id varchar(20) NULL ;
|
||||
ALTER TABLE pledge_amounts ADD COLUMN reference varchar(255) NULL ;
|
||||
ALTER TABLE pledge_amounts CHANGE COLUMN reference reference varchar(255) NULL ;
|
||||
|
||||
|
||||
#requests
|
||||
ALTER TABLE requests ADD COLUMN description varchar(255) NULL ;
|
||||
ALTER TABLE requests CHANGE COLUMN description description varchar(255) NULL ;
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
CREATE TABLE IF NOT EXISTS members;
|
||||
CREATE TABLE IF NOT EXISTS pledges;
|
||||
CREATE TABLE IF NOT EXISTS pledge_amounts;
|
||||
CREATE TABLE IF NOT EXISTS requests;
|
||||
CREATE TABLE IF NOT EXISTS users;
|
||||
CREATE TABLE IF NOT EXISTS user_detail;
|
||||
|
|
|
@ -3,6 +3,16 @@ body {margin:0px;padding:0px;}
|
|||
form button {margin:none;}
|
||||
a {color:#fff;}
|
||||
li p {margin: 20px 0px 0px 30px;}
|
||||
fieldset {margin:20px;}
|
||||
label {margin:20px;color:#fff;}
|
||||
input {float:right;margin:0px;color:#000;padding:10px;}
|
||||
/*
|
||||
input {margin:0px;margin-bottom:20px;padding:10px;}
|
||||
*/
|
||||
button {margin-top:20px;background-color: #fff; height: 48px; width:100%; border-radius: 3px;box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);}
|
||||
|
||||
.left {float:left;}
|
||||
.right {float:right;}
|
||||
|
||||
.hide {display:none;}
|
||||
#ajaxPopup {position:absolute;width:750px;height:550px;background-color:#fff;top:68px;left:50%;margin-left: -375px;}
|
||||
|
@ -61,9 +71,6 @@ h2 {margin-left:25px;color:#fff;}
|
|||
h3 {color:#fff;}
|
||||
li {padding-bottom:10px;line-height:150%;}
|
||||
|
||||
label {margin-bottom:10px;color:#fff;}
|
||||
input {margin:0px;margin-bottom:20px;padding:10px;}
|
||||
button {margin-bottom:20px;background-color: #fff; height: 48px; width:100%; border-radius: 3px;box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.2);}
|
||||
|
||||
.tile-right {margin-top:20px;width:230px;float:right;margin-right:20px;}
|
||||
.tile-right img {float:right;}
|
||||
|
@ -175,10 +182,11 @@ height:48px;width:48px; -webkit-animation:spin 2s linear infinite ;-moz-animatio
|
|||
.col {width:480px;float:left;}
|
||||
|
||||
|
||||
#login_box {width:500px; margin:auto}
|
||||
#login_box {width:500px; margin:auto;position:relative;}
|
||||
#login_box p {color:#fff;padding:0px;margin:0px;}
|
||||
#login_box label {display:block;margin: 20px 0px 20px;}
|
||||
#login_box input {margin: 20px 0px 0px;}
|
||||
#login_box input {margin: 20px 0px 0px;float:none;width:100%;}
|
||||
#login_box button {margin: 20px 0px 0px;float:left;width:100%;}
|
||||
#login_box .providers {margin: 20px 0px 20px;}
|
||||
|
||||
|
||||
|
@ -217,6 +225,21 @@ height:48px;width:48px; -webkit-animation:spin 2s linear infinite ;-moz-animatio
|
|||
#membercard .date {position:absolute;margin:25px;top:0px;left:0px;}
|
||||
#membercard .container {position:relative;top:50%; width:100%;}
|
||||
#membercard .middle {position:absolute;top:-60px;width:100%;}
|
||||
#membercard p {margin:0px;}
|
||||
#membercard label {color:#000;}
|
||||
#membercard legend {margin:10px;}
|
||||
#membercard fieldset {margin:20px;border:0px;}
|
||||
|
||||
.calendar {border:2px solid #000;}
|
||||
|
||||
.calendar {width:230px;height:300px;overflow:auto;}
|
||||
.calendar ul{list-style:none;padding:0px;margin:0px;}
|
||||
.calendar li{font-size:14px;padding:6px;}
|
||||
.calendar li:first-child{color:#fff;background-color:#00232D;}
|
||||
.calendar .but {width:80px;text-align:center;}
|
||||
.but{
|
||||
border:1px solid #000a0d; -webkit-border-radius: 3px; -moz-border-radius: 3px;border-radius: 3px;font-size:12px;font-family:arial, helvetica, sans-serif; padding: 10px 10px 10px 10px; text-decoration:none; display:inline-block;text-shadow: -1px -1px 0 rgba(0,0,0,0.3);font-weight:bold; color: #FFFFFF;
|
||||
background-color: #003645; background-image: -webkit-gradient(linear, left top, left bottom, from(#003645), to(#00232D));
|
||||
background-image: -webkit-linear-gradient(top, #003645, #00232D);
|
||||
background-image: -moz-linear-gradient(top, #003645, #00232D);
|
||||
background-image: -ms-linear-gradient(top, #003645, #00232D);
|
||||
background-image: -o-linear-gradient(top, #003645, #00232D);
|
||||
}
|
||||
|
|
|
@ -1,34 +1,36 @@
|
|||
from scaffold.core.widget import base_widget_extended
|
||||
from datetime import datetime
|
||||
import time
|
||||
import requests
|
||||
|
||||
class control(base_widget_extended):
|
||||
contents = []
|
||||
def create(self, title="Events", calendar_id=None, api_key=None):
|
||||
super(control, self).create()
|
||||
response = requests.get('https://www.googleapis.com/calendar/v3/calendars/0rtjmmdbsb8e9351mkip02g8n8@group.calendar.google.com/events?singleEvents=true&maxResults=2&timeMin=2015-12-01T10:00:00-00:00&key=AIzaSyA98JvRDmplA9lVLZeKwrs1f2k17resLy0')
|
||||
date_now = datetime.now().strftime('%Y-%m-%dT%H:%M:%S-00:00')
|
||||
print date_now
|
||||
response = requests.get('https://www.googleapis.com/calendar/v3/calendars/contact@maidstone-hackspace.org.uk/events?singleEvents=true&maxResults=2&timeMin=%s&key=AIzaSyA98JvRDmplA9lVLZeKwrs1f2k17resLy0' % date_now)
|
||||
calendar_data = response.json()
|
||||
self.contents = []
|
||||
print calendar_data
|
||||
for event in calendar_data.get('items'):
|
||||
str_datetime = time.strptime(event.get('start').get('dateTime'), '%Y-%m-%dT%H:%M:%SZ')
|
||||
formatted_date = time.strftime('%d %b %Y %H:%M', str_datetime)
|
||||
description = event.get('description') + '<br />' if event.get('description') else ''
|
||||
location = '<a target="_blank" href="https://www.google.co.uk/maps/search/%s">%s</a>' % (event.get('location'), event.get('location')) if event.get('location') else ''
|
||||
self.contents.append((
|
||||
event.get('summary'), event.get('description'), event.get('location') + ' @ ' + event.get('start').get('dateTime')))
|
||||
event.get('summary')+ '<br />', description, formatted_date+ '<br />' +location))
|
||||
return self
|
||||
|
||||
def render(self):
|
||||
htm = ''
|
||||
for row in self.contents:
|
||||
htm += '<li>%s</li><li>%s</li><li>%s</li>' % row
|
||||
htm += '<li>%s %s %s</li>' % row
|
||||
return '''<div class="calendar">
|
||||
<ul>%s</ul>
|
||||
<span>Subscribe</span><span>View All</span></div>''' % htm
|
||||
|
||||
|
||||
#~ import requests
|
||||
|
||||
#~ requests.get('https://www.googleapis.com/calendar/v3/calendars/%s/events?key=%s')
|
||||
#~ response = requests.get('https://www.googleapis.com/calendar/v3/calendars/0rtjmmdbsb8e9351mkip02g8n8@group.calendar.google.com/events?singleEvents=true&maxResults=2&timeMin=2015-12-01T10:00:00-00:00&key=AIzaSyA98JvRDmplA9lVLZeKwrs1f2k17resLy0')
|
||||
#~ calendar_data = response.json()
|
||||
#~ for event in calendar_data.get('items'):
|
||||
#~ print event.get('summary')
|
||||
#~ print event.get('description')
|
||||
#~ print event.get('location')
|
||||
#~ print event.get('start').get('dateTime')
|
||||
<span>
|
||||
<a class="left but" href="https://calendar.google.com/calendar/render?cid=http://www.google.com/calendar/ical/contact@maidstone-hackspace.org.uk/public/basic.ics">Subscribe</a>
|
||||
</span>
|
||||
<span>
|
||||
<a class="right but" href="https://www.google.com/calendar/embed?src=contact@maidstone-hackspace.org.uk&ctz=Europe/London">View All</a>
|
||||
</span></div>''' % htm
|
||||
|
|
|
@ -26,10 +26,10 @@ class control(base_widget):
|
|||
|
||||
htm+= '''
|
||||
<div id="login_box">
|
||||
<form id="user_info" method="post" action="/login" ><frameset>
|
||||
<form id="user_login" method="post" action="/login" ><frameset>
|
||||
<label for="username">E-Mail<p><input id="username" name="username" type="text"/></p></label>
|
||||
<label for="password">Password<p><input id="password" name="password" type="password"/></p></label>
|
||||
<input class="btn" type="submit" value="Login"/>
|
||||
<button class="btn" form="user_login" type="submit" value="Login"/>Login</button>
|
||||
</frameset></form>
|
||||
<a href="/register">Register for an account</a> | <a href="/reset-password">Reset password</a>'''
|
||||
|
||||
|
|
|
@ -9,4 +9,16 @@ class control(base_widget_extended):
|
|||
return self
|
||||
|
||||
def render(self):
|
||||
return '''<div id="membercard"><div class="date">Joined 02/12/2015</div><div class="container"><div class="middle"><p>MHS%s</p><p>%s</p></div></div></div>''' % (self.reference, self.name)
|
||||
|
||||
content = '''
|
||||
<div class="date">Joined 02/12/2015</div>
|
||||
<div class="container">
|
||||
<div class="middle">
|
||||
<p>MHS%s</p><p>%s</p>
|
||||
</div>
|
||||
</div>''' % (self.reference, self.name)
|
||||
content='<form action="/profile/membership" method="post"><fieldset><legend>Join Maidstone Hackspace</legend><p><label for="amount">Subscription Amount<input name="amount" placeholder="20.00" value="20.00" type="text"></label></p><button type="submit">submit</button></fieldset></form>'
|
||||
return '''
|
||||
<div id="membercard">
|
||||
%s
|
||||
</div>''' % content
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
from scaffold.core.widget import base_widget
|
||||
|
||||
class control(base_widget):
|
||||
#~ class control(base_widget):
|
||||
script = ['$document).ready(function(){$()});']
|
||||
|
||||
|
||||
def create(self, hide=True):
|
||||
super(control, self).create()
|
||||
self.hide = hide
|
||||
|
@ -14,7 +12,6 @@ class control(base_widget):
|
|||
self.content.append((title, link))
|
||||
|
||||
def render(self):
|
||||
|
||||
htm = '<div id="member_navigation" %s><ul>' % ('style="display:none;"' if self.hide is True else '')
|
||||
for title, link in self.content:
|
||||
htm += '<li><a href="%s" title="%s">%s</a></li>' %(link, title, title)
|
||||
|
|
Loading…
Reference in New Issue