Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create agency-list-all page for #116 and some small style tweaks #128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions apps/civic_pulse/static/styles.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.primary-color {
color: #2E2757;
color: #2e2757;
}

.primary-background {
background-color: #2E2757;
background-color: #2e2757;
}

.secondary-color {
color: #0F8EC5;
color: #0f8ec5;
}

.secondary-background {
background-color: #0F8EC5;
background-color: #0f8ec5;
}

body {
Expand Down Expand Up @@ -44,7 +44,7 @@ h4 {

.jumbotron {
background-color: #ff0000;
background-image: url('images/map_boston.png');
background-image: url("images/map_boston.png");
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
Expand Down Expand Up @@ -141,13 +141,12 @@ h4 {
/* total height minus navbar */
.homebody {
height: calc(100vh - 120px);
background: url('images/civicSquare.png') no-repeat fixed;
background: url("images/civicSquare.png") no-repeat fixed;
background-position: center center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;

}

.navbar {
Expand Down Expand Up @@ -254,6 +253,7 @@ footer .glyphicon {
user-select: none;
box-shadow: 1px 1px 2px #0000000f;
line-height: 1.2;
overflow: hidden;
}

.agency-list a {
Expand All @@ -278,10 +278,10 @@ body {

@keyframes fadein {
0% {
opacity: 0;
opacity: 0;
}
100% {
opacity: 1;
opacity: 1;
}
}

Expand All @@ -295,24 +295,24 @@ body {
stroke-width: 6;
animation: donut2 3s;
stroke-dasharray: 80, 20;
filter:url(#shadow);
filter: url(#shadow);
}

@keyframes donut2 {
0% {
stroke-dasharray: 0, 100;
stroke-dasharray: 0, 100;
}
100% {
stroke-dasharray: 80, 20;
stroke-dasharray: 80, 20;
}
}

.our-card {
background-color: rgba(255,255,255,0.8);
background-color: rgba(255, 255, 255, 0.8);
}

.card-header {
color: #2E2757;
color: #2e2757;
font-size: 1.4em;
font-style: bold;
}
20 changes: 20 additions & 0 deletions apps/civic_pulse/templates/agency-list-all.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% extends 'base.html' %} {% load static %} {% block css %} {% endblock css %}
{% block content %}
<div class="container-fluid">
{% if agencies %}
<ul class="agency-list">

{% for agency in agencies %}
<li>
<a href="{% url 'agency-detail' agency.id %}">{{ agency.name }}</a>
</li>
{% endfor %}


{% else %}
<p>No agencies available.</p>
{% endif %}
</div>

</div>
{% endblock content %}
104 changes: 29 additions & 75 deletions apps/civic_pulse/templates/agency-list.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,38 @@
{% extends 'base.html' %}
{% load static %}
{% block css %}

{% endblock css %}
{% extends 'base.html' %} {% load static %} {% block css %} {% endblock css %}
{% block content %}

<!--<div style="font-size: 20em; color: black">Blam</div>
<form action="">
<div class="input-group mb-4">
<input type="search" placeholder="What're you searching for?" aria-describedby="button-addon5" class="form-control">
<div class="input-group-append">
<button id="button-addon5" type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="input-group mb-4">
<input type="search" placeholder="What're you searching for?" aria-describedby="button-addon6" class="form-control">
<div class="input-group-append">
<button id="button-addon6" type="submit" class="btn btn-info"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="input-group mb-4">
<div class="input-group-prepend">
<button id="button-addon7" type="submit" class="btn btn-success"><i class="fa fa-search"></i></button>
</div>
<input type="search" placeholder="What're you searching for?" aria-describedby="button-addon7" class="form-control">
</div>
<div class="input-group">
<div class="input-group-prepend">
<button id="button-addon8" type="submit" class="btn btn-danger"><i class="fa fa-search"></i></button>
</div>
<input type="search" placeholder="What're you searching for?" aria-describedby="button-addon8" class="form-control">
</div>
</form>-->
<div style="padding-top: 8rem;">
<div class="container-fluid">
{% if agencies %}
<!--<ul class="agency-list">-->
<div class="row">

<!--<div class="card-deck">-->
{% for agency in agencies %}
<div class="card our-card">
<!--<img src="..." class="card-img-top" alt="...">-->
<div class="card-body">
<h5 class="card-title">{{ agency.name }}</h5>
<p class="card-text"></p>
</div>
<div class="card-footer">
<a href="{% url 'agency-detail' agency.id %}" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<!--<a href="{% url 'agency-detail' agency.id %}"><li>{{ agency.name }}</li></a>-->
<ul class="agency-list">

{% for agency in agencies %}
<li>
<a href="{% url 'agency-detail' agency.id %}">{{ agency.name }}</a>
</li>
{% endfor %}
<!--</div>-->
</div>
<!--</ul>-->

{% else %}
<p>No agencies available.</p>
{% endif %}
<p>No agencies available.</p>
{% endif %} {% if is_paginated %}
<div class="pagination">
<span class="step-links">
{% if page_obj.has_previous %}
<a href="?page=1">&laquo; first</a>
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
{% endif %}

{% if is_paginated %}
<ul class="pagination">
{% if page_obj.has_previous %}
<li><a href="?page={{ page_obj.previous_page_number }}">&laquo;</a></li>
{% else %}
<li class="disabled"><span>&laquo;</span></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li><a href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li><a href="?page={{ page_obj.next_page_number }}">&raquo;</a></li>
{% else %}
<li class="disabled"><span>&raquo;</span></li>
{% endif %}
</ul>
<span class="current">
Page {{ page_obj.number }} of {{ paginator.num_pages }}.
</span>

{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">Next</a>
<a href="?page={{ paginator.num_pages }}">Last &raquo;</a>
{% endif %}
<a href="{% url 'agency-list-all' %}">View All</a>
</span>
</div>
{% endif %}
</div>

{% endblock content %}
{% endblock content %}
105 changes: 60 additions & 45 deletions apps/civic_pulse/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,64 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com -->
<title>GovLens</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="shortcut icon" href="../static/favicon.ico" type="image/x-icon">
<link rel="icon" href="{% static 'favicon.ico' %}" type="image/x-icon">
<link href="https://fonts.googleapis.com/css?family=Khula:300,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="{% static 'styles.css' %}">
{% block css %}
{% endblock css %}
<head>
<!-- Theme Made By www.w3schools.com -->
<title>GovLens</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css"
/>
<link
rel="shortcut icon"
href="../static/favicon.ico"
type="image/x-icon"
/>
<link
rel="icon"
href="{% static 'favicon.ico' %}"
type="image/x-icon"
/>
<link
href="https://fonts.googleapis.com/css?family=Khula:300,700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Montserrat"
rel="stylesheet"
type="text/css"
/>
<link
href="https://fonts.googleapis.com/css?family=Lato"
rel="stylesheet"
type="text/css"
/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="{% static 'styles.css' %}" />
{% block css %} {% endblock css %}
</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">
<nav class="navbar primary-background navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a
class="navbar-brand fadein"
style="font-family: 'Khula', sans-serif; font-style: normal; font-weight: bold; font-size: 50px; line-height: 64px; letter-spacing: 1px;"
href="{% url 'index' %}"
>
<img
src="{% static 'images/WhiteLogo.png' %}"
alt="GovLens logo"
style="height: 30px; width: 30px; display: inline-block;"
/>
gov<span style="font-weight: 300">lens</span></a
>
</div>
</div>
</nav>

</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">

<nav class="navbar primary-background navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!--<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>-->
<a class="navbar-brand fadein" style="font-family: 'Khula', sans-serif; font-style: normal; font-weight: bold; font-size: 50px; line-height: 64px; letter-spacing: 1px;" href="#myPage">
<img src="{% static 'images/WhiteLogo.png' %}" alt="GovLens logo" style='height: 30px; width: 30px; display: inline-block;'>
gov<span style="font-weight: 300">lens</span></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="#about">ABOUT</a></li>
<li><a href="#contact">CONTACT</a></li>
</ul>
</div>
</div>
</nav>

{% block content %}

{% endblock content %}
</body>
</html>
{% block content %} {% endblock content %}
</body>
</html>
18 changes: 13 additions & 5 deletions apps/civic_pulse/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from django.views import generic
from django.views.generic import ListView, DetailView
from .models import Agency


class AgencyListView(generic.ListView):
class AgencyListView(ListView):
template_name = "agency-list.html"
context_object_name = "agencies"
paginate_by = 25
paginate_by = 50

def get_queryset(self):
return Agency.objects.order_by("created_date")


class AgencyView(generic.DetailView):
class AgencyListViewAll(ListView):
template_name = "agency-list-all.html"
context_object_name = "agencies"

def get_queryset(self):
return Agency.objects.order_by("created_date")


class AgencyView(DetailView):
model = Agency
template_name = "agency-detail.html"

Expand All @@ -22,7 +30,7 @@ def get_context_data(self, **kwargs):
return context


class HomeView(generic.ListView):
class HomeView(ListView):
template_name = "home.html"
model = Agency

Expand Down
3 changes: 2 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
urlpatterns = [
url(r"^admin/", admin.site.urls),
url(r"^api/", include(router.urls)),
# url(r'^$', AgencyListView.as_view(), name='index'),
url(r"^agency-list/$", AgencyListView.as_view(), name="index"),
url(r"^agency-list/all", AgencyListViewAll.as_view(), name="agency-list-all"),
url(r"^$", HomeView.as_view(), name="index"),
url(r"^agency/(?P<pk>[0-9]+)/$", AgencyView.as_view(), name="agency-detail"),
]
Expand Down