Skip to content

Commit

Permalink
Merge pull request #166 from njritter/feature/164-about-page
Browse files Browse the repository at this point in the history
About Page
  • Loading branch information
hndrewaall authored Nov 21, 2017
2 parents 775fdcd + d53ec05 commit fe8dc84
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/league/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class SiteSettingsForm(FlaskForm):
this_episode_phrase = StringField('This episode phrase',
validators=[DataRequired(),
Length(min=1, max=10)])
about_page_text = StringField('About Page text',
validators=[DataRequired(),
Length(min=1, max=1000)])

update = SubmitField('Update Site Settings')

def validate(self):
Expand Down
3 changes: 2 additions & 1 deletion app/league/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def manage_site_settings():
update_site_settings(
app=current_app,
dashboard_title=form.dashboard_title.data,
this_episode_phrase=form.this_episode_phrase.data
this_episode_phrase=form.this_episode_phrase.data,
about_page_text=form.about_page_text.data
)
flash('Site settings updated!', 'success')
else:
Expand Down
7 changes: 5 additions & 2 deletions app/league/public/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask import (Blueprint, current_app, flash, redirect, render_template,
request, url_for)
from flask_login import login_required, logout_user

from league.admin.models import User
Expand Down Expand Up @@ -35,4 +36,6 @@ def logout():
def about():
"""About page."""
form = LoginForm(request.form)
return render_template('public/about.html', login_form=form)
site_settings = current_app.config['SITE_SETTINGS']
return render_template('public/about.html', site_settings=site_settings,
login_form=form)
12 changes: 9 additions & 3 deletions app/league/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ class Config(object):
CACHE_TYPE = 'simple' # Can be "memcached", "redis", etc.
SQLALCHEMY_TRACK_MODIFICATIONS = False
LEAGUE_ROOT_PASS = os.environ.get('LEAGUE_ROOT_PASS', 'root')
SITE_SETTINGS = {'dashboard_title': 'Dashboard',
'this_episode_phrase': 'in Current Episode',
'contact_email': 'hndrewaall@gmail.com'}
SITE_SETTINGS = {
'dashboard_title': 'Dashboard',
'this_episode_phrase': 'in Current Episode',
'contact_email': 'hndrewaall@gmail.com',
'about_page_text': (
'An app for managing Go leagues. Learn more and contribute on '
'<a href="https://github.com/massgo/league">GitHub</a>.'
)
}


class ProdConfig(Config):
Expand Down
6 changes: 6 additions & 0 deletions app/league/templates/admin/site_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ <h1>Site Settings</h1>
value=site_settings.this_episode_phrase)}}
</div>

<div class="form-group">
{{ site_settings_form.about_page_text.label }}
{{ site_settings_form.about_page_text(class_="form-control",
value=site_settings.about_page_text) }}
</div>

{{ site_settings_form.update(class="btn btn-default btn-submit") }}
</form>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/league/templates/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><a href="{{ url_for('dashboard.prizes') }}">Prizes</a></li>
<li><a href="{{ url_for('public.about') }}">About</a></li>
{% if current_user and current_user.is_authenticated %}
<li><a href="{{ url_for('dashboard.get_players') }}">Players</a></li>
<li><a href="{{ url_for('dashboard.list_games') }}">Games</a></li>
Expand Down
5 changes: 2 additions & 3 deletions app/league/templates/public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
{% block content %}
<div class="body-content">
<div class="row">
<h1>About</h1>
<p>This template was created by <a href="http://github.com/sloria/">Steven Loria</a> for use with the <a href="http://github.com/audreyr/cookiecutter/">cookiecutter</a> package by <a href="http://github.com/audreyr/">Audrey Roy</a>.</p>
<!-- TODO: https://github.com/massgo/league/issues/167 -->
{{ site_settings.about_page_text|safe }}
</div>
</div>
{% endblock %}

0 comments on commit fe8dc84

Please sign in to comment.