Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #17 from hasgeek/update-template
Browse files Browse the repository at this point in the history
rename .html to .html.jinja2
  • Loading branch information
StephanieBr authored Oct 13, 2017
2 parents 3b0db9a + 9dcfc23 commit 4055314
Show file tree
Hide file tree
Showing 28 changed files with 61 additions and 45 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ language: python
python:
- "2.7"
install:
- pip install -r requirements.txt --use-mirrors
- pip install -r requirements.txt
- pip install -r test_requirements.txt
script:
- coverage run `which nosetests`
- ./runtests.sh
notifications:
email: false
slack:
- hasgeek:HDCoMDj3T4ICB59qFFVorCG8
- friendsofhasgeek:3bLViYSzhfaThJovFYCVD3fX

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "layout.html" %}
{% from 'macros.html' import ajaxform %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import ajaxform %}
{% block title %}This page does not exist{% endblock %}
{% block content %}
<h2>This page does not exist</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{# Render a form asking for the access key #}
{% extends "layout.html" %}
{% from 'macros.html' import renderform %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import renderform %}
{% block title %}Access Key Required{% endblock %}

{% block header %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# Approve participants #}
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}Approve Participants{% endblock %}

{% block header %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}{{ participant.event.title|e }}{% endblock %}

{% block header %}
Expand All @@ -13,7 +13,7 @@ <h1>Registration Confirmation</h1>
#container, footer {
max-width: 100%;
}
footer {
text-align: left;
}
Expand All @@ -26,17 +26,17 @@ <h1>Registration Confirmation</h1>
<a href="https://twitter.com/share?url={{ url_for('eventpage', year=participant.event.year, eventname=participant.event.name, _external=True) }}" class="twitter-share-button" data-url="{{ url_for('eventpage', year=participant.event.year, eventname=participant.event.name, _external=True) }}" data-text="{{ tweet }}">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<div id="rsvp-form">
{% include 'rsvpform.html' %}
{% include 'rsvpform.html.jinja2' %}
</div>
{% endblock %}
{% block footerscripts %}

<!-- Ajax form -->
{% from "macros.html" import ajaxform -%}
{% from "macros.html.jinja2" import ajaxform -%}
{{ ajaxform('regform', request, True) }}

<!-- Ajax form -->
{% from "macros.html" import ajaxform %}
{% from "macros.html.jinja2" import ajaxform %}
{{ ajaxform('rsvpform', request, True) }}

{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# Render a data table. Nothing fancy #}
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}{{ title|e }}{% endblock %}

{% block header %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "layout.html" %}
{% from 'macros.html' import ajaxform, render_schedule %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import ajaxform, render_schedule %}
{% block title %}{{ event.title }}{% endblock %}
{% block main %}
<article id="about">
Expand Down Expand Up @@ -51,7 +51,7 @@ <h3>The venue has limited capacity</h3>
</p>
</div>
<div id="register-form">
{% include 'regform.html' %}
{% include 'regform.html.jinja2' %}
</div>
{% endif %}
</div>
Expand Down Expand Up @@ -87,7 +87,7 @@ <h2>{{ event.venue.title }}</h2>
{% block footerscripts %}

<!-- Ajax form -->
{% from "macros.html" import ajaxform -%}
{% from "macros.html.jinja2" import ajaxform -%}
{{ ajaxform('regform', request, True) }}

<script type="text/javascript">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends "layout.html" %}
{% from 'macros.html' import ajaxform %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import ajaxform %}
{% block title %}Geekup{% endblock %}
{% block content %}
{% for event in events %}
<h2><a href="{{ url_for('eventpage', event=event.name) }}">{{ event }}</a></h2>
{{ event.description | safe }}
{{ event.description | safe }}
{% endfor %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from "baseframe/components.html" import networkbar with context -%}
{% from "baseframe/components.html.jinja2" import networkbar with context -%}
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
Expand All @@ -7,7 +7,7 @@
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<!--
Does this website look familiar? That's because it was adapted from
two earlier websites: Scaling PHP in the Cloud (https://phpcloud.hasgeek.com)
and DocType HTML5 (http://www.doctypehtml5.in).
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "layout.html" %}
{% from 'macros.html' import ajaxform %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import ajaxform %}
{% block title %}GeekUp{% endblock %}
{% block content %}
<h2><a href="{{ url_for('eventpage', year=event.year, eventname=event.name) }}">{{ event }}</a></h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'macros.html' import renderform, ajaxform %}
{% from 'macros.html.jinja2' import renderform, ajaxform %}
{{ renderform(regform, 'regform', 'Register') }}
{% if ajax_re_register %}
{{ ajaxform('regform', request, False) }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}{{ title|e }}{% endblock %}

{% block header %}
Expand All @@ -13,7 +13,7 @@ <h1>{{ title|e }}</h1>
#container, footer {
max-width: 100%;
}
footer {
text-align: left;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'macros.html' import renderform, ajaxform %}
{% from 'macros.html.jinja2' import renderform, ajaxform %}
{{ renderform(rsvpform, 'rsvpform', 'Submit') }}
{% if ajax_re_register %}
{{ ajaxform('rsvpform', request, False) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}Statistics{% endblock %}

{% block header %}
Expand All @@ -16,7 +16,7 @@ <h1>Statistics</h1>
}
h1 {
text-transform: none;
}
}
</style>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}DocType HTML5 At Venue Registration{% endblock %}

{% block pageheaders %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}DocType HTML5 At Venue Registration{% endblock %}

{% block pageheaders %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% from 'macros.html' import renderform, ajaxform %}
{% from 'macros.html.jinja2' import renderform, ajaxform %}
{{ renderform(regform, 'venueregform', url_for('admin_venue', edition=edition), 'Register') }}
{% if ajax_re_register %}
{{ ajaxform('venueregform') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "layout.html" %}
{% from 'macros.html' import renderform, ajaxform %}
{% extends "layout.html.jinja2" %}
{% from 'macros.html.jinja2' import renderform, ajaxform %}
{% block title %}DocType HTML5 At Venue Registration{% endblock %}

{% block pageheaders %}
Expand All @@ -22,7 +22,7 @@ <h1><span class="brkt">&lt;</span><span class="bang">!</span>DocType HTML<sup>5<
Hello there! We didn’t recognise you. Would you like to register?
Or, <a href="{{ url_for('admin_venue', edition=edition) }}">search again</a>.
</p>
{% include 'venueregform.html' %}
{% include 'venueregform.html.jinja2' %}
{% endblock %}

{% block footer %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{# Sign-in sheet #}
{% extends "layout.html" %}
{% extends "layout.html.jinja2" %}
{% block title %}At Venue Sign-in{% endblock %}

{% block header %}
Expand Down
2 changes: 1 addition & 1 deletion geekup/views/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
return render_template('404.html.jinja2'), 404
14 changes: 7 additions & 7 deletions geekup/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def eventpage(year, eventname, regform=None):
'venue_description': Markup(event.venue.description),
'venue_address': Markup(event.venue.address),
}
return render_template('event.html', **context)
return render_template('event.html.jinja2', **context)


@app.route('/<year>/<eventname>', methods=['POST'])
Expand All @@ -80,10 +80,10 @@ def register(year, eventname):
mail.send(msg)
participant.email_sent = True
db.session.commit()
return render_template('regsuccess.html')
return render_template('regsuccess.html.jinja2')
else:
if request.is_xhr:
return render_template('regform.html',
return render_template('regform.html.jinja2',
regform=form, ajax_re_register=True)
else:
flash("Please check your details and try again.", 'error')
Expand All @@ -106,7 +106,7 @@ def confirm_email(pid, key, rsvpform=None):
'rsvpform': rsvpform,
'tweet': tweet,
}
return render_template('confirm.html', **context)
return render_template('confirm.html.jinja2', **context)
return redirect(url_for('index'))


Expand All @@ -118,15 +118,15 @@ def rsvp(pid, key):
if form.validate_on_submit():
participant.rsvp = form.data['rsvp']
db.session.commit()
return render_template('rsvpsuccess.html')
return render_template('rsvpsuccess.html.jinja2')
else:
if request.is_xhr:
context = {
'rsvpform': form,
'participant': participant,
'ajax_re_register': True,
}
return render_template('rsvpform.html', **context)
return render_template('rsvpform.html.jinja2', **context)
else:
flash("Please check your details and try again.", 'error')
return confirm_email(pid, key, rsvpform=form)
Expand All @@ -146,4 +146,4 @@ def participant_list(year, eventname):
'confirmed_participants': [participant for participant in participants if participant.email_status],
'unconfirmed_participants': [participant for participant in participants if not participant.email_status],
}
return render_template('participants.html', **context)
return render_template('participants.html.jinja2', **context)
4 changes: 4 additions & 0 deletions instance/testing.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#: Database backend
SQLALCHEMY_DATABASE_URI = 'sqlite:///'
LASTUSER_SERVER = 'https://auth.hasgeek.com'
LASTUSER_CLIENT_ID = ''
LASTUSER_CLIENT_SECRET = ''

5 changes: 5 additions & 0 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
export FLASK_ENV="TESTING"
coverage run `which nosetests` "$@"
coverage report -m
5 changes: 5 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
nose
mock
coveralls

0 comments on commit 4055314

Please sign in to comment.