Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Availability keys added to macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevgene Bogomolny committed Oct 24, 2016
1 parent 54f2245 commit bc2f7c1
Show file tree
Hide file tree
Showing 3 changed files with 189 additions and 26 deletions.
47 changes: 21 additions & 26 deletions census/views/entry.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% from "macros/availability_keys.html" import availability_keys %}

{% block title %}
{{format("Entry for %(place)s / %(title)s", { place: place.name, title: dataset.name}) }}
Expand Down Expand Up @@ -42,28 +43,22 @@ <h3>{{gettext("Data Availability")}}</h3>
<ul class="data-availability clearfix unstyled">

{% for qu in questions %}
{% if qu.type == '' %}

{% set description = '' %}
{% set state = entry.answers[qu.id] %}

{% if state == true %}
{% set stateClass = 'yes' %}
{% set stateDisplay = 'Y' %}
{% elif state == false %}
{% set stateClass = 'no' %}
{% set stateDisplay = 'N' %}
{% elif state == null %}
{% set stateClass = 'maybe' %}
{% set stateDisplay = '?' %}

{% else %}

{% set stateClass = '' %}
{% set stateDisplay = 'No data' %}

{% endif %}

{% if qu.type == '' %}
{% set description = '' %}
{% set state = entry.answers[qu.id] %}
{% if state == true %}
{% set stateClass = 'yes' %}
{% set stateDisplay = 'Y' %}
{% elif state == false %}
{% set stateClass = 'no' %}
{% set stateDisplay = 'N' %}
{% elif state == null %}
{% set stateClass = 'maybe' %}
{% set stateDisplay = '?' %}
{% else %}
{% set stateClass = '' %}
{% set stateDisplay = 'No data' %}
{% endif %}
<li>
<span class="data-icon-wrapper">
<span class="data-icon {{ stateClass }}">
Expand All @@ -83,14 +78,14 @@ <h3>{{gettext("Data Availability")}}</h3>
{% endfor %}
</ul>

{% include '_snippets/key.html' %}
{{availability_keys(gettext)}}

<h3>{{gettext("Details")}}</h3>
<h3>{{ gettext("Details") }}</h3>
<table class="table table-striped yntable">
<tr>
<td>{{gettext("Date the data became available")}}</td>
<td>&nbsp;&nbsp;&nbsp;{% if entry.answers.dateavailable %}{{ entry.answers.dateavailable }}{% else
%}{{gettext("Unknown")}}{% endif %}
<td>&nbsp;&nbsp;&nbsp;{% if entry.answers.dateavailable %}{{ entry.answers.dateavailable }}{% else %}
{{gettext("Unknown")}}{% endif %}
</td>
</tr>
<tr>
Expand Down
11 changes: 11 additions & 0 deletions census/views/macros/availability_keys.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% macro availability_keys(gettext) %}
<div class="key well availability">
<h5>{{gettext("Key:")}}</h5>
<ul>
<li class="yes">{{gettext("Yes")}}</li>
<li class="no">{{gettext("No")}}</li>
<li class="maybe">{{gettext("Unsure")}}</li>
<li>{{gettext("No data")}}</li>
</ul>
</div>
{% endmacro %}
157 changes: 157 additions & 0 deletions census/views/place.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{% extends "base.html" %}
{% import '_snippets/entry-summary-row.html' as entrysummary_macro %}

{% block title %}
{{place.name}} &mdash; {{gettext("Places")}}
{% endblock %}

{% block content %}

<div class="container">
<h1>
{% if overview %}<a href="{{urlFor('overview')}}" data-toggle="tooltip" class="count-0"
title="Return to results overview">{{gettext("Places")}}</a>
/ {% endif %}{{ place.name }} {% if not cascade %}/ {{ year }}{% endif %}

<span class="pull-right">
{% include '_snippets/share_page_buttons.html' %}
</span>
</h1>

<div id="spacer"></div>
<div class="tabbable"> <!-- Only required for left/right tabs -->
<div class="tab-content">
<div class="tab-pane active" id="table-overview">
<div class="table">
<p>{{gettext("This is the overview page where you can see the state of open data across each key
dataset.")}}</p>

<table class="table table-striped">
<colgroup>
<col width="25%"/>
<col width="1%"/>
<col width="25%"/>
<col/>
<col/>
<col width="13%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr>
<th>{{gettext("Dataset")}}</th>
<th>{{gettext("Score")}}</th>
<th>{{gettext("Breakdown")}}</th>
<th>{{ gettext("Last Updated") }}</th>
<th>{{gettext("Location (URL)")}}</th>
<th>{{gettext("Information")}}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for dataset in datasets %}
{% set entry = entries|find({'dataset': dataset.id}) %}
{% set submissions = pending|where({'dataset': dataset.id, 'place': place.id, 'year': year}) %}
<tr>
<td>
{% if entry %}<a href="/entry/{{place.id}}/{{dataset.id}}{{ urlContext }}">{% endif %}
{{ dataset.name }}
{% if entry %}</a>{% endif %}
&nbsp;
<a href="javascript:;"
data-toggle="popover"
class="count-0"
data-content="{{ dataset.description }}"
title="{{ dataset.title }}"><i class="icon-info-sign"></i></a>
</td>
{{entrysummary_macro.entrysummary(dataset, place, entry, questions, gettext)}}

<td>
{% if submissionsAllowed %}

{% if entry %}
<a id="submit-{{ dataset.id }}" href="/submit/?dataset={{ dataset.id }}&place={{ place.id }}"
class="btn btn-mini btn-primary">
<!-- <i class="icon-plus"></i> -->{{gettext("Propose Revisions")}}
</a>
{% else %}
<a id="submit-{{ dataset.id }}" href="/submit/?dataset={{ dataset.id }}&place={{ place.id }}"
class="btn btn-mini btn-primary">
<!-- <i class="icon-plus"></i> -->{{gettext("Submit information")}}
</a>
{% endif %}

{% else %}
<i class="muted">{{ gettext('Closed') }}</i>
{% endif %}
</td>

</tr>
{% for submission in submissions %}
<tr class="queued">
<td>
<strong>{{gettext("&#8627; Awaiting review")}}</strong><br/>

<span title="{{ gettext('Submitted by')}} {{ submission.Submitter.firstName}}" class="queued-context">
<i class="icon icon-user"></i>&nbsp;
{{ submission.Submitter.firstName }}
</span>
<br/>
<span title="{{ gettext('Submitted on')}} {{ submission.createdAt|dateformat }}" class="queued-context">
<i class="icon icon-time"></i>&nbsp;
{{ submission.createdAt|simpledelta }}
</span>
</td>
{{entrysummary_macro.entrysummary(dataset, place, submission, questions, gettext)}}
<td>
<a href="/submission/{{submission.id}}" class="btn btn-mini btn-danger">
{{gettext("View Submission")}}
</a>
<script>
$("#submit-{{ dataset.id }}").addClass("disabled");
$("#submit-{{ dataset.id }}").attr("onclick", "return false");
$("#submit-{{ dataset.id }}").attr("href", "#");
$("#submit-{{ dataset.id }}").attr("data-toggle", "tooltip");
$("#submit-{{ dataset.id }}").attr("title",
'{{gettext("Sorry, only one submission can be waiting for review at a time - please come back in a few days to submit new information")}}');
</script>
</td>
</tr>
{% endfor %}

{% endfor %}
</tbody>
</table>

{% include '_snippets/key.html' %}

<h3>{{gettext("Contributors")}}</h3>
<h4>{{ format("Reviewers for %(name)s:", { name: place.name }) }}</h4>
<p>
{% if reviewers %}
{% for reviewer in reviewers %}
{% if loop.index>1 %}, {% endif %}
{% if reviewer %}
{{reviewer.fullName()}}
{% endif %}
{% endfor %}
{% endif %}
</p>
<h4>{{gettext("With submissions from:")}} </h4>
<p>
{% if submitters %}
{% for submitter in submitters %}
{% if loop.index>1 %}, {% endif %}
{% if submitter %}
{{submitter.fullName()}}
{% endif %}
{% endfor %}
{% endif %}
</p>
</div>
</div>
</div>
</div>
</div>
<script src="{{page.root}}/src/common.js?{{currentTime}}"></script>
<script src="{{page.root}}/src/census.js?{{currentTime}}"></script>
{% endblock %}

0 comments on commit bc2f7c1

Please sign in to comment.