add competition page, fix banner, add favicon
|
@ -11,7 +11,7 @@ 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
|
||||
apt-get install -y python-requests python-lxml python-flask python-tz
|
||||
|
||||
RUN add-apt-repository -y ppa:oly/ppa
|
||||
RUN apt-get update
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
flask
|
||||
lxml
|
||||
requests
|
||||
pytz
|
||||
pip install -e bzr+lp:scaffold#egg=scaffold
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
page_menu = [
|
||||
('Home', '/'),
|
||||
#('About', '#about'),
|
||||
('Competition', '/competition'),
|
||||
('Contact', '#mailing-list-signup')]
|
||||
|
||||
banner_images = [
|
||||
|
|
113
site/generate.py
|
@ -23,6 +23,7 @@ web.template.append('<link rel="icon" type="image/png" href="/static/template/im
|
|||
|
||||
#paths
|
||||
web.document_root = os.path.abspath('./')
|
||||
web.template.domain = 'http://maidstone-hackspace.org.uk/'
|
||||
web.template.theme_full_path = os.path.abspath('./static/template') + os.sep
|
||||
domain = 'http://192.168.21.41:5000/'
|
||||
image_path = domain + os.sep + 'template' + os.sep + 'images' + os.sep
|
||||
|
@ -48,14 +49,21 @@ def dict_to_list(data, keys):
|
|||
#~ footer()
|
||||
|
||||
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.template.body.append(web.header_strip.render())
|
||||
|
||||
# navigation
|
||||
web.menu.create('/', 'leftNav')
|
||||
web.menu * site.page_menu
|
||||
web.template.body.append(web.header_strip.create({}).render())
|
||||
web.template.body.append(web.menu.render())
|
||||
|
||||
# extra javascript libraries
|
||||
web.template.javascript_includes.append('<script type="text/javascript" src="/static/js/jquery-2.1.4.min.js"></script>')
|
||||
web.template.javascript_includes.append('<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.js"></script>')
|
||||
web.template.javascript_includes.append('<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-animate.js"></script>')
|
||||
|
||||
web.template.header.append('<link rel="icon" type="image/png" href="/static/images/favicon.png">')
|
||||
|
||||
def footer():
|
||||
web.footer_content.create().append(
|
||||
|
@ -68,44 +76,60 @@ def footer():
|
|||
def examples():
|
||||
""" page for testing new components"""
|
||||
header()
|
||||
web.page.create('examples')
|
||||
web.twitter_feed.create(username='MHackspace', widget_id='606798560374484992')
|
||||
web.page.section(web.twitter_feed.render())
|
||||
|
||||
web.page.append(
|
||||
web.google_groups.create(
|
||||
' and make yourself known','maidstone-hackspace'
|
||||
).set_id('mailing-list').render()
|
||||
)
|
||||
|
||||
web.tiles.create()
|
||||
#~ feed = feed_reader('')
|
||||
#this is as simple as you can get
|
||||
web.page.section('put some content on the page')
|
||||
|
||||
|
||||
feed = feed_reader(site.rss_feeds)
|
||||
|
||||
for row in feed:
|
||||
print row
|
||||
print type(row.get('description'))
|
||||
web.tiles.append(
|
||||
title = '%s By %s' %(row.get('title'), row.get('author')),
|
||||
link = row.get('url'),
|
||||
image = row.get('image'),
|
||||
description = row.get('description'))
|
||||
web.div.append(row)
|
||||
web.page.append(web.tiles.render())
|
||||
|
||||
#render to the template
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
#finish of the page
|
||||
return footer()
|
||||
|
||||
def competition():
|
||||
""" page for testing new components"""
|
||||
header()
|
||||
|
||||
web.page.create(
|
||||
web.images.create(
|
||||
image='/static/template/images/hackspace-banner.png',
|
||||
title="Screw sorting competition banner").render())
|
||||
|
||||
web.paragraph.create(
|
||||
"""We are some friendly competitions, so if your not sure what to work on consider entering and win some swag.""")
|
||||
web.paragraph.append(
|
||||
"""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.""")
|
||||
web.page.section(web.paragraph.render())
|
||||
|
||||
bullet_list = [
|
||||
("Submit designs by some date here", ),
|
||||
("Images can be design in any software or 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.",)]
|
||||
|
||||
print bullet_list
|
||||
web.list.create(ordered=False).set_classes('bullet-list')
|
||||
web.list * bullet_list
|
||||
web.page.section(web.list.render())
|
||||
|
||||
#render to the template
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
#finish of the page
|
||||
return footer()
|
||||
|
||||
|
||||
def blogs():
|
||||
""" page for testing new components"""
|
||||
header()
|
||||
web.page.create('blogs')
|
||||
|
||||
web.columns.create()
|
||||
web.columns.append('test1')
|
||||
web.columns.append('test2')
|
||||
web.page.section(web.columns.render())
|
||||
|
||||
web.tiles.create()
|
||||
feed = feed_reader(site.rss_feeds)
|
||||
|
||||
for row in feed:
|
||||
print row.get('image')
|
||||
web.tiles.append(
|
||||
|
@ -121,6 +145,7 @@ def blogs():
|
|||
web.template.body.append(web.page.render())
|
||||
return footer()
|
||||
|
||||
|
||||
def index():
|
||||
header()
|
||||
|
||||
|
@ -154,13 +179,11 @@ def index():
|
|||
|
||||
web.page.section(web.title.create('Proposed activities').render())
|
||||
|
||||
bullet_list = []
|
||||
bullet_list.append(
|
||||
("""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.""",))
|
||||
bullet_list.append(
|
||||
("""Build an interactive splash screen to feature on this site.""",))
|
||||
bullet_list.append(
|
||||
(web.link.create('Suggest a new activity', 'Suggest a new activity', '#mailing-list-signup').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
|
||||
|
@ -169,7 +192,24 @@ def index():
|
|||
web.div.create('').set_classes('panel')
|
||||
|
||||
web.twitter_feed.create(username='MHackspace', widget_id='606798560374484992')
|
||||
|
||||
|
||||
web.page.append(web.twitter_feed.render())
|
||||
|
||||
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'))
|
||||
web.div.append(row)
|
||||
web.page.append(web.tiles.render())
|
||||
|
||||
web.template.body.append(web.page.render())
|
||||
|
||||
return footer()
|
||||
|
@ -187,6 +227,9 @@ if __name__ == "__main__":
|
|||
with codecs.open('./html/blog.html', 'w', "utf-8") as fp:
|
||||
fp.write(blogs().decode('utf-8'))
|
||||
|
||||
with codecs.open('./html/competition.html', 'w', "utf-8") as fp:
|
||||
fp.write(competition().decode('utf-8'))
|
||||
|
||||
#~ file = codecs.open("lol", "w", "utf-8")
|
||||
#~ file.write(u'\ufeff')
|
||||
#~ file.close()
|
||||
|
|
|
@ -16,7 +16,7 @@ web_app = Flask(__name__, static_url_path='/static')
|
|||
def examples():
|
||||
"""temporary for testing / examples"""
|
||||
return make_response(pages.examples())
|
||||
|
||||
|
||||
@web_app.route("/blogs/", methods=['GET'])
|
||||
def blogs():
|
||||
"""temporary for testing / examples"""
|
||||
|
@ -27,5 +27,10 @@ def index():
|
|||
"""home page"""
|
||||
return make_response(pages.index())
|
||||
|
||||
@web_app.route("/competition/", methods=['GET'])
|
||||
def competition():
|
||||
"""competition page"""
|
||||
return make_response(pages.competition())
|
||||
|
||||
if __name__ == '__main__':
|
||||
web_app.run(host='0.0.0.0', port=5000, debug=True)
|
||||
|
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -130,3 +130,6 @@ button {margin-bottom:20px;background-color: #fff; height: 48px; width:100%; bor
|
|||
#footerbottom {background-color:#0087A8;height:300px;}
|
||||
#footerbottom div.container {margin:auto;background-color:#0087A8;height:250px;width:960px;}
|
||||
.twitter-feed {width:460px;margin:20px;}
|
||||
|
||||
|
||||
.social {z-index:1;position:absolute;right:0px;top:0px;margin-top:25px;}
|
||||
|
|
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 |
|
@ -7,7 +7,6 @@ class control(www.default.html_ui):
|
|||
buttons = []
|
||||
content = []
|
||||
count = 0
|
||||
|
||||
with open(os.path.abspath('./widgets/banner_slider.js')) as fp:
|
||||
script = [fp.read()]
|
||||
|
||||
|
@ -25,8 +24,8 @@ class control(www.default.html_ui):
|
|||
else:
|
||||
self.content.append(u'<img src="%s" /><div class="content">%s<br />%s</div>' % (image, title, intro))
|
||||
|
||||
def render(self):
|
||||
self.count += 0
|
||||
def render(self):
|
||||
self.count += 1
|
||||
htm = u'<div class="banner-slide" ng-app="myApp" ng-controller="sliderController">'
|
||||
htm += u'<ul ng-switch on="currentSlide" ng-init="length=%d;">' % (len(self.content))
|
||||
count = 0
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
from scaffold.web import www
|
||||
|
||||
class control(www.default.html_ui):
|
||||
|
||||
def create(self, cols=2):
|
||||
self.cols = []
|
||||
self.current_column = 0
|
||||
for c in range(0, cols):
|
||||
self.cols.append([])
|
||||
return self
|
||||
|
||||
def next_column(self):
|
||||
for c in self.cols:
|
||||
yield ''.join(c)
|
||||
|
||||
def append(self, content):
|
||||
if self.current_column > len(self.cols)-1:
|
||||
self.current_column = 0
|
||||
self.cols[self.current_column].append(content)
|
||||
self.current_column += 1
|
||||
|
||||
def render(self):
|
||||
return '<div>%s</div>' % '</div><div>'.join(self.next_column())
|
|
@ -0,0 +1,22 @@
|
|||
import os
|
||||
from scaffold.web import www
|
||||
|
||||
class control(www.default.html_ui):
|
||||
"""Image cycle widgets"""
|
||||
buttons = []
|
||||
count = 0
|
||||
|
||||
with open(os.path.abspath('./widgets/banner_slider.js')) as fp:
|
||||
js = [fp.read()]
|
||||
|
||||
def create(self):
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
self.content = []
|
||||
|
||||
def append(self, text):
|
||||
self.content.append(u'<div class="content">%s</div>' % (text))
|
||||
|
||||
def render(self):
|
||||
return u"".join(self.content)
|
|
@ -1,23 +1,19 @@
|
|||
from scaffold.core.widget import base_widget
|
||||
|
||||
#from scaffold.web import web as html
|
||||
from scaffold.web import www
|
||||
#from scaffold.web import web as html
|
||||
#from libs import html as customhtml
|
||||
|
||||
class control(www.default.html_ui):
|
||||
class control(base_widget):
|
||||
def create(self, params):
|
||||
self.params = params
|
||||
self.social_html = []
|
||||
return self
|
||||
|
||||
def social(self, htm):
|
||||
self.social_html.append(htm)
|
||||
|
||||
def render(self):
|
||||
htm = '<div id="headerstrip"><nav class="navstrip">'
|
||||
htm += '<div class="left mini-logo">Maidstone Hackspace</div>'
|
||||
htm += '<div id="user_info" class="left">'
|
||||
htm += '<div id="newticket"></div>'
|
||||
htm += '<div id="username"></div>'
|
||||
htm += '</div>'
|
||||
htm += '<div class="right">'
|
||||
htm += '<div ></div>'
|
||||
htm += '<div class="social">'
|
||||
htm += "".join(self.social_html)
|
||||
htm += '</div>'
|
||||
htm += '</nav></div>'
|
||||
return htm
|
||||
|
|