seperate out the code and update the social share buttons
|
@ -2,7 +2,7 @@
|
|||
page_menu = [
|
||||
('Home', '/'),
|
||||
#('About', '#about'),
|
||||
#~ ('Competition', '/competition'),
|
||||
('Competition', '/competition'),
|
||||
('Contact', '#mailing-list-signup')]
|
||||
|
||||
banner_images = [
|
||||
|
@ -20,7 +20,17 @@ rss_feeds = [
|
|||
{'author':'Simon Ridley',
|
||||
'url': 'http://waistcoatforensicator.blogspot.com/feeds/posts/default?alt=rss'},
|
||||
{'author':'Mathew Beddow', 'tags': ['tech'], 'url': 'http://www.matthewbeddow.co.uk/?feed=rss2'},
|
||||
{'author':'Oliver Marks', 'url': 'http://www.digitaloctave.co.uk/rss.xml'},
|
||||
#{'author':'Oliver Marks', 'url': 'http://www.digitaloctave.co.uk/rss.xml'},
|
||||
{'author':'Mike McRoberts', 'url': 'http://thearduinoguy.org/?feed=rss2'}]
|
||||
|
||||
kent_hackspace = ['http://www.medwaymakers.co.uk/', 'http://canterbury.hackspace.org.uk/']
|
||||
|
||||
email = 'support@maidstone-hackspace.org.uk'
|
||||
|
||||
email_server = {
|
||||
'user': '',
|
||||
'password': '',
|
||||
'host': 'email-smtp.us-east-1.amazonaws.com',
|
||||
'port': 465,
|
||||
'from': 'support@maidstone-hackspace.org.uk',
|
||||
'to': 'support@maidstone-hackspace.org.uk'}
|
||||
|
|
|
@ -9,6 +9,7 @@ from scaffold.web import www
|
|||
from libs.rss_fetcher import feed_reader
|
||||
|
||||
import constants as site
|
||||
import pages
|
||||
from pages import web
|
||||
from pages import header, footer
|
||||
from pages import blog
|
||||
|
@ -29,89 +30,21 @@ def examples():
|
|||
return footer()
|
||||
|
||||
|
||||
def index():
|
||||
header()
|
||||
|
||||
web.template.body.append(web.header_strip.create({}).render())
|
||||
web.template.body.append(web.menu.render())
|
||||
|
||||
web.page.create('')
|
||||
web.page.section(
|
||||
web.images.create(
|
||||
'/static/template/images/tile-01.jpg'
|
||||
).append(
|
||||
'/static/template/images/tile-01.jpg'
|
||||
).set_classes('tile-right').render())
|
||||
web.banner_slider.reset()
|
||||
web.banner_slider * site.banner_images
|
||||
|
||||
web.page.append(web.banner_slider.render())
|
||||
|
||||
web.page.section(web.title.create('Introduction').render())
|
||||
|
||||
web.paragraph.create(
|
||||
"""Hackspaces are a shared space where artists, designers, makers, hackers, programmers, tinkerers, professionals and hobbyists
|
||||
can work on their projects, share knowledge and collaborate.""")
|
||||
|
||||
web.paragraph.append(
|
||||
"""We are in the process of developing Maidstone Hackspace. We're previous members of <span class="info" title="Innovation center medway prototype">(ICMP)</span> and looking to form a new space in the future.
|
||||
At the moment, communication is via google groups, email, and the website. If you're at all intrested please join our <a href="#mailing-list-signup">mailing list</a>
|
||||
and make yourself known!""")
|
||||
web.page.section(web.paragraph.render())
|
||||
|
||||
web.page.section(web.title.create('Proposed activities').render())
|
||||
|
||||
bullet_list = [
|
||||
("Workshop on building a mobile application which can run on ios and android,"
|
||||
"potentially game oriented for a bit of fun, but open to suggestions.", ),
|
||||
("Build an interactive splash screen to feature on this site.",),
|
||||
(web.link.create('Suggest a new activity', 'Suggest a new activity', '#mailing-list-signup').render(),)]
|
||||
|
||||
web.list.create(ordered=False).set_classes('bullet-list')
|
||||
web.list * bullet_list
|
||||
web.page.append(web.list.render())
|
||||
|
||||
web.div.create('').set_classes('panel')
|
||||
|
||||
web.twitter_feed.create(username='MHackspace', widget_id='606798560374484992')
|
||||
|
||||
|
||||
web.page.append(web.twitter_feed.render())
|
||||
|
||||
feed = feed_reader(site.rss_feeds)
|
||||
|
||||
web.columns.create()
|
||||
for row in feed:
|
||||
web.tiles.create()
|
||||
web.columns.append(
|
||||
web.tiles.append(
|
||||
title = row.get('title'),
|
||||
author = row.get('author'),
|
||||
link = row.get('url'),
|
||||
image = row.get('image'),
|
||||
date = row.get('date'),
|
||||
description = row.get('description')).render())
|
||||
web.page.append(web.columns.render())
|
||||
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
return footer()
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description = 'Generate static pages')
|
||||
parser = argparse.ArgumentParser(description='Generate static pages')
|
||||
parser.add_argument('--folder', dest='folder', nargs='?', help='output folder')
|
||||
#~ args = parser.parse_args()
|
||||
#~ print(args.accumulate(args.integers))
|
||||
|
||||
with codecs.open('./html/index.html', 'w', "utf-8") as fp:
|
||||
fp.write(index().decode('utf-8'))
|
||||
|
||||
#~ with open('./html/examples.html', 'w') as fp:
|
||||
#~ fp.write(examples())
|
||||
|
||||
with codecs.open('./html/blog.html', 'w', "utf-8") as fp:
|
||||
fp.write(blog.index().decode('utf-8'))
|
||||
|
||||
with codecs.open('./html/competition.html', 'w', "utf-8") as fp:
|
||||
fp.write(competition.index().decode('utf-8'))
|
||||
#module, function, output file
|
||||
pages_list = (
|
||||
('pages.homepage', 'index', 'index.html'),
|
||||
('pages.blog', 'index', 'blog.html'),
|
||||
('pages.competition', 'index', 'competition.html'))
|
||||
|
||||
for module, page, filename in pages_list:
|
||||
page_module = __import__(module, globals(), locals(), page)
|
||||
with codecs.open('./html/%s' % filename, 'w', "utf-8") as fp:
|
||||
try:
|
||||
fp.write(getattr(page_module, page)().decode('utf-8'))
|
||||
print('Successfully Generated ./html/%s' % filename)
|
||||
except:
|
||||
print('Failed to Generate ./html/%s' % filename)
|
||||
|
|
|
@ -21,23 +21,20 @@
|
|||
<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>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<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>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<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>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="headerstrip"><nav class="navstrip"><div class="left mini-logo">Maidstone Hackspace</div><div class="social"><div size="standard" class="g-plusone" data-href="http://maidstone-hackspace.org.uk/" data-size="medium" data-annotation="inline" count="true"></div><a href="https://twitter.com/share" class="twitter-share-button" data-via="True">Tweet</a><div size="standard" class="g-plusone" data-size="medium" data-annotation="inline" count="true"></div></div></nav></div>
|
||||
<nav id="leftNav" class="menu" ><ul><li class="active mi0"><a href="/" >Home</a></li><li class="mi1"><a href="#mailing-list-signup" >Contact</a></li></ul><div style="clear:both;"></div></nav>
|
||||
<div id="headerstrip"><nav class="navstrip"><div class="left mini-logo">Maidstone Hackspace</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"><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="/competition" >Competition</a></li><li class="mi2"><a href="#mailing-list-signup" >Contact</a></li></ul><div style="clear:both;"></div></nav>
|
||||
<div class="page" ><header class="pageHeader"><img src="/static/images/competitions/screw_sorting_competition_banner.jpg" alt="Screw sorting competition banner" align="middle" style="margin:auto;display:block;width:500px;" /></header><section class="pageSection"><p>Welcome to the first ever maidstone hackspace competition, we are a new hackspace, so we are looking to get the word out and get some collaberation going.The First cometition will be to design a device which can sort a jar of screws by size, the winning entry we will attempt to build.</p></section><section class="pageSection"><ul class="bullet-list" >
|
||||
<li>Submit designs by some date here</li>
|
||||
<li>Submit designs by 31st of July</li>
|
||||
<li>Images can be design in any software or drawn on a piece of paper but must be submitted as a jpg on the mailing list.</li>
|
||||
<li>Stick figures and crude line drawing are fine, we are not judge your artistic ability.</li>
|
||||
</ul></section><section class="pageSection"><h2>Win a UNO Basic Starter Kit</h2></section><section class="pageSection"><p><img src="http://imgapp.banggood.com/thumb/large/2014/xiemeijuan/03/SKU208787/SKU208787a.jpg" alt="Arduino starter kit" align="middle" style="margin:auto;display:block;width:500px;" />This kit comes with an arduino board and various sensors and components, list below of every thing in the kit.<ul class="bullet-list" >
|
||||
|
|
|
@ -6,6 +6,7 @@ from flask import Flask
|
|||
from flask import make_response
|
||||
|
||||
import generate
|
||||
from pages import homepage
|
||||
from pages import blog
|
||||
from pages import competition
|
||||
|
||||
|
@ -27,7 +28,7 @@ def blogs():
|
|||
@web_app.route("/", methods=['GET'])
|
||||
def index():
|
||||
"""home page"""
|
||||
return make_response(generate.index())
|
||||
return make_response(homepage.index())
|
||||
|
||||
@web_app.route("/competition/", methods=['GET'])
|
||||
def competition_index():
|
||||
|
|
|
@ -26,10 +26,10 @@ web.template.css_includes.append('/static/template/js/jquery-ui/themes/base/jque
|
|||
def header():
|
||||
# logo and social links at very top of the page
|
||||
web.header_strip.create({})
|
||||
|
||||
web.header_strip.social(web.google_plus.create(web.template.domain, plus=True, share=False, comments=False).render())
|
||||
|
||||
web.header_strip.social(web.like.create(url=web.template.domain, plus=True, twitter='MHackspace').render())
|
||||
|
||||
#web.header_strip.social(web.google_plus.create(web.template.domain, plus=True, share=False, comments=False).render())
|
||||
|
||||
web.header_strip.social(web.like.create(url=web.template.domain, plus=True, linkedin=True, twitter='MHackspace').render())
|
||||
web.template.body.append(web.header_strip.render())
|
||||
|
||||
# navigation
|
||||
|
|
|
@ -5,6 +5,7 @@ from libs.rss_fetcher import feed_reader
|
|||
from pages import web
|
||||
from pages import header, footer
|
||||
|
||||
|
||||
def index():
|
||||
header()
|
||||
web.page.create('blogs')
|
||||
|
@ -17,14 +18,13 @@ def index():
|
|||
web.tiles.create()
|
||||
feed = feed_reader(site.rss_feeds)
|
||||
for row in feed:
|
||||
print row.get('image')
|
||||
web.tiles.append(
|
||||
title = row.get('title'),
|
||||
author = row.get('author'),
|
||||
link = row.get('url'),
|
||||
image = row.get('image'),
|
||||
date = row.get('date'),
|
||||
description = row.get('description'))
|
||||
title=row.get('title'),
|
||||
author=row.get('author'),
|
||||
link=row.get('url'),
|
||||
image=row.get('image'),
|
||||
date=row.get('date'),
|
||||
description=row.get('description'))
|
||||
web.div.append(row)
|
||||
web.page.section(web.tiles.render())
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ def index():
|
|||
web.page.section(web.paragraph.render())
|
||||
|
||||
bullet_list = [
|
||||
("Submit designs by some date here", ),
|
||||
("Submit designs by 31st of July", ),
|
||||
("Images can be design in any software or drawn on a piece of paper but must be submitted as a jpg on the mailing list.", ),
|
||||
("Stick figures and crude line drawing are fine, we are not judge your artistic ability.",)]
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
import constants as site
|
||||
|
||||
from libs.rss_fetcher import feed_reader
|
||||
|
||||
from pages import web
|
||||
from pages import header, footer
|
||||
|
||||
|
||||
def index():
|
||||
header()
|
||||
|
||||
web.template.body.append(web.header_strip.create({}).render())
|
||||
web.template.body.append(web.menu.render())
|
||||
|
||||
web.page.create('')
|
||||
web.page.section(
|
||||
web.images.create(
|
||||
'/static/template/images/tile-01.jpg'
|
||||
).append(
|
||||
'/static/template/images/tile-01.jpg'
|
||||
).set_classes('tile-right').render())
|
||||
web.banner_slider.reset()
|
||||
web.banner_slider * site.banner_images
|
||||
|
||||
web.page.append(web.banner_slider.render())
|
||||
|
||||
web.page.section(web.title.create('Introduction').render())
|
||||
|
||||
web.paragraph.create(
|
||||
"""Hackspaces are a shared space where artists, designers, makers, hackers, programmers, tinkerers, professionals and hobbyists
|
||||
can work on their projects, share knowledge and collaborate.""")
|
||||
|
||||
web.paragraph.append(
|
||||
"""We are in the process of developing Maidstone Hackspace. We're previous members of <span class="info" title="Innovation center medway prototype">(ICMP)</span> and looking to form a new space in the future.
|
||||
At the moment, communication is via google groups, email, and the website. If you're at all intrested please join our <a href="#mailing-list-signup">mailing list</a>
|
||||
and make yourself known!""")
|
||||
web.page.section(web.paragraph.render())
|
||||
|
||||
web.page.section(web.title.create('Proposed activities').render())
|
||||
|
||||
bullet_list = [
|
||||
("Workshop on building a mobile application which can run on ios and android,"
|
||||
"potentially game oriented for a bit of fun, but open to suggestions.", ),
|
||||
("Build an interactive splash screen to feature on this site.",),
|
||||
(web.link.create('Suggest a new activity', 'Suggest a new activity', 'https://groups.google.com/forum/#!forum/maidstone-hackspace').render(),)]
|
||||
|
||||
web.list.create(ordered=False).set_classes('bullet-list')
|
||||
web.list * bullet_list
|
||||
web.page.append(web.list.render())
|
||||
|
||||
web.div.create('').set_classes('panel')
|
||||
|
||||
web.twitter_feed.create(username='MHackspace', widget_id='606798560374484992')
|
||||
feed = feed_reader(site.rss_feeds)
|
||||
|
||||
web.columns.create()
|
||||
web.columns.append(web.twitter_feed.render())
|
||||
for row in feed:
|
||||
web.tiles.create()
|
||||
web.columns.append(
|
||||
web.tiles.append(
|
||||
title = row.get('title'),
|
||||
author = row.get('author'),
|
||||
link = row.get('url'),
|
||||
image = row.get('image'),
|
||||
date = row.get('date'),
|
||||
description = row.get('description')).render())
|
||||
web.page.append(web.columns.render())
|
||||
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
return footer()
|
|
@ -118,7 +118,7 @@ button {margin-bottom:20px;background-color: #fff; height: 48px; width:100%; bor
|
|||
|
||||
.bullet-list li {margin:0px;margin-left:10px;line-height:100%;}
|
||||
|
||||
.tile {position:relative;background-color:#eee;width:460px;margin-left:20px;margin-bottom:20px;float:left;box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.26);}
|
||||
.tile {position:relative;background-color:#eee;width:460px;margin-left:20px;margin-bottom:20px;box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.26);}
|
||||
.tile-img {margin:20px;width:420px;height:200px;overflow:hidden;background-repeat: no-repeat;background-position: center;background-image:url('/static/template/images/background.png');}
|
||||
.tile header {background-color: #00232D;width:100%;bottom:20px;top:220px;overflow:auto;left:20px;right:20px;text-align:justify;line-height:150%;font-size:12px;}
|
||||
.tile h2 {line-height:150%;font-size:12px;margin-right:20px;}
|
||||
|
@ -133,3 +133,5 @@ button {margin-bottom:20px;background-color: #fff; height: 48px; width:100%; bor
|
|||
|
||||
|
||||
.social {z-index:1;position:absolute;right:0px;top:0px;margin-top:25px;}
|
||||
.social div{float:left;margin-left:20px;}
|
||||
.col {width:480px;float:left;}
|
||||
|
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
@ -18,6 +18,7 @@ class control(www.default.html_ui):
|
|||
self.current_column = 0
|
||||
self.cols[self.current_column].append(content)
|
||||
self.current_column += 1
|
||||
return self
|
||||
|
||||
def render(self):
|
||||
return '<div>%s</div>' % '</div><div>'.join(self.next_column())
|
||||
return '<div class="col">%s</div>' % '</div><div class="col">'.join(self.next_column())
|
||||
|
|
|
@ -7,29 +7,39 @@ class control(base_widget):
|
|||
script = []
|
||||
|
||||
facebook = False
|
||||
twitter = True
|
||||
plus = True
|
||||
twitter = False
|
||||
plus = False
|
||||
linkedin = False
|
||||
|
||||
plus_script = False
|
||||
linkedin_script = False
|
||||
facebook_script = False
|
||||
twitter_script = False
|
||||
|
||||
size = 'medium'
|
||||
annotation = 'inline'
|
||||
|
||||
def create(self, url, plus=None, twitter=None, facebook=None, linkedin=None):
|
||||
self.url = url
|
||||
self.plus = plus
|
||||
self.twitter = twitter
|
||||
self.facebook = facebook
|
||||
self.linkedin = linkedin
|
||||
|
||||
if plus:
|
||||
if self.plus_script is False:
|
||||
self.plus_script = True
|
||||
self.includes.append('<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>')
|
||||
self.includes.append("""<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>""")
|
||||
|
||||
if twitter:
|
||||
if self.twitter_script is False:
|
||||
self.twitter_script = True
|
||||
self.footer.append("""
|
||||
<script>!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>""")
|
||||
|
||||
|
||||
if linkedin:
|
||||
if self.linkedin_script is False:
|
||||
self.linkedin_script = True
|
||||
self.footer.append("""
|
||||
<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>""")
|
||||
|
||||
if facebook:
|
||||
if self.facebook_script is False:
|
||||
self.facebook_script = True
|
||||
|
@ -38,21 +48,16 @@ class control(base_widget):
|
|||
|
||||
return self
|
||||
|
||||
def url(self, link=None):
|
||||
self.link = link
|
||||
return self
|
||||
|
||||
def render(self):
|
||||
link = ''
|
||||
self.count += 1
|
||||
htm = ''
|
||||
if self.twitter:
|
||||
htm += '<a href="https://twitter.com/share" class="twitter-share-button" data-via="%s">Tweet</a>' % self.twitter
|
||||
htm += '<div class="btn"><a href="https://twitter.com/share" class="twitter-share-button" data-via="%s">Tweet</a></div>' % self.twitter
|
||||
if self.facebook:
|
||||
htm += '<div class="fb-like" data-href="%s" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>' % self.url
|
||||
if self.link:
|
||||
link = ' data-href="' + self.link + '" '
|
||||
htm += '<div class="btn"><div class="fb-share-button" data-href="%s" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div></div>' % self.url
|
||||
if self.linkedin:
|
||||
htm += '<div class="btn"><script type="IN/Share" data-url="%s" data-counter="right"></script></div>' % self.url
|
||||
if self.plus is True:
|
||||
htm += '<div size="standard" class="g-plusone" ' + link + self.action + ' data-size="' + self.size + '" data-annotation="' + self.annotation + '" count="true"></div>'
|
||||
htm += '<div class="btn"><div size="standard" class="g-plusone" data-href="%s" data-size="medium" data-annotation="bubble" count="true"></div></div>' % self.url
|
||||
return htm
|
||||
|
||||
|
|