Skip to content

Commit 4006456

Browse files
committed
add questionnaires and welcome page
1 parent cb1ff1c commit 4006456

File tree

216 files changed

+46375
-18
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+46375
-18
lines changed

app.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
# Views
66
from main import Main
7-
from login import Login
7+
from login import Login, Welcome
8+
from gform import Qpreboarding, Qonboarding, Q24hfood, QInsideTracker
89
from physical import Physical, coachPhysical, clientPhysical, gformPhysical, gres
910
from nutrition import Nutrition, coachNutrition, clientNutrition, gformNutrition
1011
from activity import Activity, coachActivity, clientActivity, gformActivity
@@ -38,6 +39,11 @@
3839
view_func=Main.as_view('main'),
3940
methods=["GET"])
4041
# Dynamic URL rule
42+
# List of forms
43+
# 1. Preboarding questionaire
44+
# 2. Onboarding questionaire
45+
# 3.
46+
4147
# List of view
4248
# 0. Login
4349
# 1. Welcome/Goal
@@ -52,6 +58,25 @@
5258
view_func=Login.as_view('login'),
5359
methods=["GET", "POST"])
5460

61+
# Welcome page
62+
app.add_url_rule('/welcome/',
63+
view_func=Welcome.as_view('welcome'),
64+
methods=["GET", "POST"])
65+
66+
# Form Views
67+
app.add_url_rule('/questionaire/preboarding/',
68+
view_func=Qpreboarding.as_view('questionnaire-preboarding'),
69+
methods=["GET", "POST"])
70+
app.add_url_rule('/questionaire/onboarding/',
71+
view_func=Qonboarding.as_view('questionnaire-onboarding'),
72+
methods=["GET", "POST"])
73+
app.add_url_rule('/questionaire/24hfood/',
74+
view_func=Q24hfood.as_view('questionnaire-24hfood'),
75+
methods=["GET", "POST"])
76+
app.add_url_rule('/input/insidetracker/',
77+
view_func=QInsideTracker.as_view('input-insidetracker'),
78+
methods=["GET", "POST"])
79+
5580
# Physical Measurements Views
5681
app.add_url_rule('/physical/',
5782
view_func=Physical.as_view('physical'),
@@ -115,7 +140,7 @@
115140

116141
@app.route('/favicon.ico')
117142
def favicon():
118-
return send_from_directory(os.path.join(app.root_path, 'static'), 'ico/favicon.ico')
143+
return send_from_directory(os.path.join(app.root_path, 'static'), 'ico/optmeico.ico')
119144

120145
@app.errorhandler(404)
121146
def page_not_found(e):

gform.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import flask, flask.views
2+
import os
3+
import utils
4+
5+
class gform(flask.views.MethodView):
6+
@utils.login_required
7+
def get(self, page="gform"):
8+
page += ".html"
9+
if os.path.isfile('templates/' + page):
10+
return flask.render_template(page)
11+
flask.abort(404)
12+
13+
class Qpreboarding(flask.views.MethodView):
14+
@utils.login_required
15+
def get(self, page="questionnaire-preboarding"):
16+
page += ".html"
17+
if os.path.isfile('templates/' + page):
18+
return flask.render_template(page)
19+
flask.abort(404)
20+
21+
class Qonboarding(flask.views.MethodView):
22+
@utils.login_required
23+
def get(self, page="questionnaire-onboarding"):
24+
page += ".html"
25+
if os.path.isfile('templates/' + page):
26+
return flask.render_template(page)
27+
flask.abort(404)
28+
29+
class Q24hfood(flask.views.MethodView):
30+
@utils.login_required
31+
def get(self, page="questionnaire-24hfood"):
32+
page += ".html"
33+
if os.path.isfile('templates/' + page):
34+
return flask.render_template(page)
35+
flask.abort(404)
36+
37+
class QInsideTracker(flask.views.MethodView):
38+
@utils.login_required
39+
def get(self, page="input-insidetracker"):
40+
page += ".html"
41+
if os.path.isfile('templates/' + page):
42+
return flask.render_template(page)
43+
flask.abort(404)

login.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,32 @@ def post(self):
3030
else:
3131
flask.flash("Username does not exist or incorrect password")
3232
# Return to login page
33-
return flask.redirect(flask.url_for('login'))
33+
return flask.redirect(flask.url_for('login'))
34+
35+
class Welcome(flask.views.MethodView):
36+
def get(self):
37+
return flask.render_template('welcome.html')
38+
39+
def post(self):
40+
# Check if user need to log out
41+
if 'logout' in flask.request.form:
42+
# Pop user out of session
43+
flask.session.pop('usr', None)
44+
return flask.redirect(flask.url_for('login'))
45+
46+
required = ['usr','pswd']
47+
for r in required:
48+
if r not in flask.request.form:
49+
flask.flash("Error: {0} is required.".format(r))
50+
return flask.redirect(flask.url_for('login'))
51+
# Receive usr, pwd input
52+
usr = flask.request.form['usr']
53+
pswd = flask.request.form['pswd']
54+
# Check that usr and pwd exist in dictionary
55+
if usr in users and users[usr] == pswd:
56+
# Accept user
57+
flask.session['usr'] = usr
58+
else:
59+
flask.flash("Username does not exist or incorrect password")
60+
# Return to login page
61+
return flask.redirect(flask.url_for('login'))

main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33

44
class Main(flask.views.MethodView):
5-
def get(self, page="index"):
5+
def get(self, page="welcome"):
66
page += ".html"
77
if os.path.isfile('templates/' + page):
88
return flask.render_template(page)

static/css/CSS Theme.zip

2.36 MB
Binary file not shown.

static/css/detail-wrap/README.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Detail Admin Bootstrap Theme
2+
3+
Credits:
4+
5+
- Open sans webfont http://www.google.com/fonts/specimen/Open+Sans
6+
- Icons by Brankic1979 http://www.brankic1979.com/icons/
7+
- Blurred bgs from http://clikfocus.com/blog/26-free-high-resolution-blurred-backgrounds-psd
8+
9+
***
10+
Documentation on doc.txt
11+
12+
13+
***
14+
Changelog
15+
16+
v1.0
17+
Initial release
18+
19+
v1.2
20+
- Added a dark skin on css/skins folder
21+
- Added custom dropdown menus on navbar for messages and notifications, styles are located on layout.css
22+
- Added wizard form page using fuelux js plugin (http://exacttarget.github.io/fuelux/#wizard), styles are located on form-wizard.css
23+
- Added code editor page using Ace Editor (http://ace.ajax.org/)
24+
_ Added grids page to showcase how grids can be used in theme, styles located on grids.css
25+
- Added submenus on sidebar navigation menu, styles are located on layout.css
26+
- Changed how the navigation menu is shown on tablet and mobile devices, now sliding from the left side like facebook-app-style

0 commit comments

Comments
 (0)