Added variables to site

This commit is contained in:
Zakary Timson 2018-01-31 18:55:36 -05:00
parent 5e013a6aeb
commit 9a1f801344
16 changed files with 177 additions and 59 deletions

View File

@ -53,7 +53,8 @@ INSTALLED_APPS = [
'main.apps.MainConfig', 'main.apps.MainConfig',
'newsletters.apps.NewslettersConfig', 'newsletters.apps.NewslettersConfig',
'tinymce', 'tinymce',
'widget_tweaks' 'widget_tweaks',
'variables'
] ]
MIDDLEWARE = [ MIDDLEWARE = [

View File

@ -5,7 +5,7 @@
<script> <script>
$(function() { $(function() {
// Show modal for live youtube conference // Show modal for live youtube conference
{% if youtube %} {% if popup_header.value %}
$('#liveModal').modal('show'); $('#liveModal').modal('show');
{% endif %} {% endif %}
@ -95,36 +95,7 @@
<div class="row text-center"> <div class="row text-center">
<h2 class="mx-auto mb-5">OUR OBJECTIVES</h2> <h2 class="mx-auto mb-5">OUR OBJECTIVES</h2>
<div style="font-size: 22px"> <div style="font-size: 22px">
<p> {{ objectives.value | safe }}
The Ontario Association of Child Protection Lawyers consists of parents council, children's council who also do parent side work, representatives of Native Canadian organizations,
law students, and students-at-law who are completing their articles under the direction of parents council.
</p>
<p>
It started in Spring 2017 in Windsor, Ontario with a
group
of Family Lawyers who saw a need to increase the level of advocacy for children, families, and
communities
that were struggling in terms of Child Welfare.
</p>
<p>
The OACPL as an organization seeks to:
</p>
<p>
- increase the efficiency and level of professional expertise offered by Child Protection Lawyers in
Ontario
</p>
<p>
- provide public and professional education and input from Recognized Child Protection Lawyers on Child
Welfare Reform and Practice
</p>
<p>
- provide an organized body of Recognized Child Protection Lawyers that advocate politically and
socially on Child Welfare Matters in Ontario
</p>
<p>
- encourage the highest standards of practice and support for children, families and communities
affected by Child Protection Litigation.
</p>
</div> </div>
</div> </div>
</div> </div>
@ -224,18 +195,18 @@
</a> </a>
</div> </div>
{% if youtube %} {% if popup_header.value %}
<div id="liveModal" class="modal" tabindex="-1" role="dialog"> <div id="liveModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg modal-fade" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fa fa-circle text-danger"></i> Live Conference</h5> <h5 class="modal-title" id="exampleModalLabel">{{ popup_header.value | safe }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<iframe width="100%" height="400px" src="{{ youtube }}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> {{ popup_body.value | safe }}
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

View File

@ -149,13 +149,13 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-12"> <div class="form-group col-12">
<div class="form-check"> <div class="form-check">
{{ register.newsletter|add_class:"form-check-input" }} <label class="form-check-label">Receive {{ register.newsletter|add_class:"form-check-input" }} <label for="id_newsletter" class="form-check-label">Receive
newsletters</label> newsletters</label>
</div> </div>
</div> </div>
<div class="form-group col-12"> <div class="form-group col-12">
<div class="form-check"> <div class="form-check">
{{ register.case_law|add_class:"form-check-input" }} <label class="form-check-label">Request {{ register.case_law|add_class:"form-check-input" }} <label for="id_case_law" class="form-check-label">Request
access to case law database</label> access to case law database</label>
</div> </div>
</div> </div>
@ -167,13 +167,7 @@
</div> </div>
<div class="form-group col-12 my-3"> <div class="form-group col-12 my-3">
<div class="form-check"> <div class="form-check">
{{ register.tos|add_class:"form-check-input" }} <label class="form-check-label"> {{ register.tos|add_class:"form-check-input" }} <label for="id_tos" class="form-check-label">{{ terms.value }}</label>
I certify that I am a member in good standing of the Law Society of Ontario, practicing in
the field of defence side child protection law, or am a member of the Rights Panel with the
office of The Children's Lawyer, also practicing defence work, or am a law student, lawyer
representing a band or Native Organization, or a student completing articles under the
direction of one of the foregoing.
</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,11 +12,16 @@ from charter_members.forms import RegisterForm
from OACPL.utils import url_fix_render_to_string from OACPL.utils import url_fix_render_to_string
from charter_members.models import Attorney from charter_members.models import Attorney
from OACPL import settings from OACPL import settings
from variables.models import Variable
def index(request): def index(request):
attorneys = Attorney.objects.filter(front_page=True).order_by('order') attorneys = Attorney.objects.filter(front_page=True).order_by('order')
return render(request, 'index.html', {'attorneys': attorneys, 'contact': settings.EMAIL_CONTACT, 'youtube': settings.YOUTUBE_CONFERENCE}) banner = Variable.objects.get(key='banner')
popup_header = Variable.objects.get(key='popup_header')
popup_body = Variable.objects.get(key='popup_body')
objectives = Variable.objects.get(key='objectives')
return render(request, 'index.html', {'attorneys': attorneys, 'contact': settings.EMAIL_CONTACT, 'youtube': settings.YOUTUBE_CONFERENCE, 'banner': banner, 'objectives': objectives, 'popup_header': popup_header, 'popup_body': popup_body})
def contact(request): def contact(request):
@ -34,6 +39,7 @@ def contact(request):
def login(request): def login(request):
terms = Variable.objects.get(key='terms')
if request.method == 'POST': if request.method == 'POST':
if request.POST.get('request') == 'register': if request.POST.get('request') == 'register':
register_form = RegisterForm(request.POST, request.FILES) register_form = RegisterForm(request.POST, request.FILES)
@ -51,7 +57,7 @@ def login(request):
if 'register_form' not in vars(): if 'register_form' not in vars():
register_form = RegisterForm() register_form = RegisterForm()
return render(request, 'login.html', {'navbar': False, 'footer': False, 'register': register_form}) return render(request, 'login.html', {'navbar': False, 'footer': False, 'register': register_form, 'terms': terms})
def reset(request): def reset(request):

View File

@ -4,13 +4,15 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="description" content="The Ontario Association of Child Protection Lawyers started in Spring 2017 in Windsor, Ontario with a group of Family Lawyers who saw a need to increase the level of advocacy for children, families, and communities that were struggling in terms of Child Welfare. "> <meta name="description"
content="The Ontario Association of Child Protection Lawyers started in Spring 2017 in Windsor, Ontario with a group of Family Lawyers who saw a need to increase the level of advocacy for children, families, and communities that were struggling in terms of Child Welfare. ">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>OACPL{% if title %} - {{ title }}{% endif %}</title> <title>OACPL{% if title %} - {{ title }}{% endif %}</title>
<link rel="icon" type="image/png" href="{% static 'main/img/logo.png' %}" /> <link rel="icon" type="image/png" href="{% static 'main/img/logo.png' %}"/>
<link rel="stylesheet" href="{% static 'main/css/index.css' %}" /> <link rel="stylesheet" href="{% static 'main/css/index.css' %}"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/css/bootstrap.min.css" /> <link rel="stylesheet"
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Raleway" /> href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Raleway"/>
<script src="https://use.fontawesome.com/d71773005c.js"></script> <script src="https://use.fontawesome.com/d71773005c.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
@ -18,10 +20,12 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/js/bootstrap.min.js"></script>
<script> <script>
$.ajaxSetup({beforeSend: function(xhr, settings){ $.ajaxSetup({
beforeSend: function (xhr, settings) {
xhr.setRequestHeader('X-CSRFToken', xhr.setRequestHeader('X-CSRFToken',
'{{ csrf_token }}'); '{{ csrf_token }}');
}}); }
});
</script> </script>
{{ form.media }} {{ form.media }}
@ -37,7 +41,8 @@
<nav class="navbar navbar-expand-lg navbar-light bg-white py-4"> <nav class="navbar navbar-expand-lg navbar-light bg-white py-4">
<div class="container"> <div class="container">
<a class="navbar-brand text-dark-primary" href="{% url 'home' %}"> <a class="navbar-brand text-dark-primary" href="{% url 'home' %}">
<img src="{% static 'main/img/logo.png' %}" width="30" height="30" class="d-inline-block align-top" alt=""> <img src="{% static 'main/img/logo.png' %}" width="30" height="30" class="d-inline-block align-top"
alt="">
<div class="d-none d-sm-inline-block"> <div class="d-none d-sm-inline-block">
ONTARIO ASSOCIATION OF ONTARIO ASSOCIATION OF
<br> <br>
@ -50,7 +55,8 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li class="nav-item dropdown text-dark-primary"> <li class="nav-item dropdown text-dark-primary">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">HOME</a> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">HOME</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown"> <div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{% url 'home' %}">Front Page</a> <a class="dropdown-item" href="{% url 'home' %}">Front Page</a>
<a class="dropdown-item" href="{% url 'newsletters' %}">Newsletters</a> <a class="dropdown-item" href="{% url 'newsletters' %}">Newsletters</a>
@ -71,7 +77,7 @@
<a class="nav-link" href="/admin">ADMIN PANEL</a> <a class="nav-link" href="/admin">ADMIN PANEL</a>
</li> </li>
{% endif %} {% endif %}
{% if request.user.is_authenticated%} {% if request.user.is_authenticated %}
<li class="nav-item text-dark-primary"> <li class="nav-item text-dark-primary">
<a class="nav-link" href="{% url 'logout' %}">LOGOUT</a> <a class="nav-link" href="{% url 'logout' %}">LOGOUT</a>
</li> </li>
@ -83,12 +89,17 @@
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
</div> </div>
</nav> </nav>
{% if banner.value %}
<div class="bg-danger w-100 text-center py-1">{{ banner.value | safe }}</div>
{% endif %}
{% endif %} {% endif %}
<!-- Content --> <!-- Content -->
@ -99,7 +110,8 @@
<!-- Footer --> <!-- Footer -->
<footer class="container-fluid bg-white text-dark-primary py-3"> <footer class="container-fluid bg-white text-dark-primary py-3">
<div class="container text-center"> <div class="container text-center">
<p class="mb-0">© 2017 Ontario Association of Child Protection Lawyers. Created By <a href="http://zakscode.com">Zak Timson</a></p> <p class="mb-0">© 2017 Ontario Association of Child Protection Lawyers. Created By <a
href="http://zakscode.com">Zak Timson</a></p>
</div> </div>
</footer> </footer>
{% endif %} {% endif %}

0
variables/__init__.py Normal file
View File

16
variables/admin.py Normal file
View File

@ -0,0 +1,16 @@
from django.contrib import admin
from .models import Variable
@admin.register(Variable)
class VariableAdmin(admin.ModelAdmin):
fields = ['key', 'help_text', 'value']
list_display = ['key', 'value', 'help_text']
def get_form(self, request, obj=None, **kwargs):
if obj:
self.readonly_fields = ['help_text', 'key']
else:
self.readonly_fields = []
return super().get_form(request, obj, **kwargs)

5
variables/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class VariablesConfig(AppConfig):
name = 'variables'

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-31 23:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Variable',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.CharField(max_length=20)),
('value', models.CharField(max_length=1000)),
('help_text', models.CharField(max_length=1000)),
],
),
]

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-31 23:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('variables', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='variable',
name='help_text',
field=models.CharField(blank=True, max_length=1000, null=True),
),
migrations.AlterField(
model_name='variable',
name='key',
field=models.CharField(max_length=20, unique=True),
),
migrations.AlterField(
model_name='variable',
name='value',
field=models.CharField(blank=True, max_length=1000, null=True),
),
]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-31 23:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('variables', '0002_auto_20180131_1829'),
]
operations = [
migrations.AlterField(
model_name='variable',
name='help_text',
field=models.TextField(blank=True, null=True),
),
]

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-31 23:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('variables', '0003_auto_20180131_1834'),
]
operations = [
migrations.AlterField(
model_name='variable',
name='help_text',
field=models.CharField(blank=True, max_length=1000, null=True),
),
migrations.AlterField(
model_name='variable',
name='value',
field=models.TextField(blank=True, null=True),
),
]

View File

7
variables/models.py Normal file
View File

@ -0,0 +1,7 @@
from django.db import models
class Variable(models.Model):
key = models.CharField(max_length=20, unique=True)
value = models.TextField(blank=True, null=True)
help_text = models.CharField(max_length=1000, blank=True, null=True)

3
variables/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
variables/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.