Created expert witnesses pages

This commit is contained in:
Zak Timson 2017-09-14 13:52:39 -04:00
parent 81083bf8c8
commit df148909bf
6 changed files with 62 additions and 9 deletions

View File

@ -10,6 +10,7 @@ from django.views.static import serve
import main.views
import case_law.views
import charter_members.views
import expert_witnesses.views
import newsletters.views
@ -25,7 +26,9 @@ urlpatterns = [
url(r'^admin/logout', main.views.logout, name='logout'),
url(r'^admin/', admin.site.urls, name='admin'),
url(r'^attorney/(?P<id>\d+)', charter_members.views.index, name='attorney'),
url(r'^caselaw/', case_law.views.browser, name='browser'),
url(r'^caselaw/', case_law.views.browser, name='caselaw'),
url(r'^experts/', expert_witnesses.views.browser, name='experts'),
url(r'^experts/(<?P<id>\d+)', expert_witnesses.views.viewer, name='expert'),
url(r'^media/secure/(?P<path>.*)$', protected_serve, {'document_root': os.path.join(settings.MEDIA_ROOT, 'secure')}, name='secure media'),
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
url(r'^newsletter/subscribe', newsletters.views.subscribe, name='subscribe'),

View File

@ -34,11 +34,11 @@
<a href="{% url 'home' %}"><i class="fa fa-home"></i></a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'browser' %}">Case Law</a>
<a href="{% url 'caselaw' %}">Case Law</a>
</li>
{% for item in urls %}
<li class="breadcrumb-item{% if forloop.last %} active{% endif %}">
<a {% if not forloop.last %}href="{% url 'browser' %}?path=
<a {% if not forloop.last %}href="{% url 'caselaw' %}?path=
{% for item2 in urls %}{% if forloop.counter0 <= forloop.parentloop.counter0 %}{{ item }}{% endif %}{% endfor %}"{% endif %}>
{{ item }}
@ -56,7 +56,7 @@
{% if headingCount > 1 and caseCount > 1 and not filter %}
{% for heading in headings %}
<div>
<a href="{% url 'browser' %}?path={% if url %}{{ url }}/{% endif %}{{ heading }}">
<a href="{% url 'caselaw' %}?path={% if url %}{{ url }}/{% endif %}{{ heading }}">
<h4 class="d-inline-block" style="color:#D8D8D8"><i
class="fa fa-folder-open-o"></i> {{ heading }}
</h4>
@ -105,7 +105,7 @@
return $(e).val()
});
window.location.href = '{% url 'browser' %}?filter=' + selected.toArray().join('/');
window.location.href = '{% url 'caselaw' %}?filter=' + selected.toArray().join('/');
})
</script>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends 'base.html' %}
{% block body %}
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-md-3 bg-dark-primary">
{% for filter in filters %}
<div class="badge badge-primary">{{ filter.field }}</div>
{% endfor %}
</div>
<div class="col-md-9 bg-light-blue">
{% for expert in experts %}
{{ expert.name }} - <i class="fa fa-institution"></i> {{ expert.institute }}
{% for e in expert.expertise.all|dictsort:'field' %}
<i class="fa fa-graduation-cap"></i> {{ e.field }}
{% endfor %}
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block body %}
test
{% endblock %}

View File

@ -1,3 +1,18 @@
from django.shortcuts import render
# Create your views here.
from .models import AreaOfExpertise, Expert
def browser(request):
filters = AreaOfExpertise.objects.all().order_by('field')
filter = filters.filter(field=request.POST.get('filter')).values_list('field')
experts = Expert.objects.all()
if filter:
experts = experts.filter(expertise__in=filter)
return render(request, 'expertBrowser.html', {'experts': experts, 'filters': filters})
def viewer(request, id):
expert = Expert.objects.get(id=id)
return render(request, 'expertViewer.html', {'expert': expert})

View File

@ -50,10 +50,17 @@
<a class="nav-link" href="#">FORUM</a>
</li>
<li class="nav-item text-dark-primary">
<a class="nav-link" href="{% url 'browser' %}">CASE LAW</a>
<a class="nav-link" href="{% url 'caselaw' %}">CASE LAW</a>
</li>
<li class="nav-item text-dark-primary">
<a class="nav-link" href="#">EXPERTS</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="{% url 'experts' %}" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
EXPERTS
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="{% url 'experts' %}?filter=Abuse">Abuse</a>
<a class="dropdown-item" href="{% url 'experts' %}?filter=DNA">DNA</a>
<a class="dropdown-item" href="{% url 'experts' %}?filter=Forensics">Forensics</a>
</div>
</li>
{% if request.user.is_staff %}
<li class="nav-item text-dark-primary">