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

Commit

Permalink
[#785] Dataset page markup for slice table
Browse files Browse the repository at this point in the history
  • Loading branch information
brew committed Nov 4, 2016
1 parent 638ff12 commit b94cbcc
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 966 deletions.
8 changes: 4 additions & 4 deletions census/controllers/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ var place = function(req, res) {

var dataset = function(req, res) {
/**
* An overview of datasets, optionally by year.
* An overview of a single dataset, optionally by year.
*/
modelUtils.getData(modelUtils.getDataOptions(req))
.then(function(data) {
if (!data.dataset) {
return res.status(404)
.send('There is no matching dataset in our database. ' +
'Are you sure you have spelled it correctly? Please check the ' +
'<a href="/">overview page</a> for the list of places');
'Are you sure it is spelled correctly? Please check the ' +
'<a href="/">overview page</a> for the list of datasets.');
}

data.urlContext = '';
Expand All @@ -150,7 +150,7 @@ var dataset = function(req, res) {
data.loggedin = req.session.loggedin;
data.year = req.params.year;
data.submissionsAllowed = req.params.year === req.app.get('year');
data.breadcrumbTitle = 'Dataset';
data.breadcrumbTitle = data.dataset.name;

// TODO calculate relative score od dataset
data.computedRelativeScore = 0;
Expand Down
12 changes: 6 additions & 6 deletions census/static/scripts/site/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ define(['jquery', 'bootstrap', 'chroma', 'tablesorter', 'stickykit'],
}
},
tablesorterDatasetOptions = {
sortList: [[0, 0]],
sortList: [[1, 0]],
headers: {
2: {sorter: false},
3: {sorter: false}
}
},
tablesorterSliceOptions = {
sortList: [[0, 0]],
sortList: [[1, 0]],
headers: {
2: {sorter: false},
3: {sorter: false},
Expand All @@ -50,16 +50,16 @@ define(['jquery', 'bootstrap', 'chroma', 'tablesorter', 'stickykit'],
$('#datasets_overview_table').tablesorter(tablesorterDatasetOptions);
$('#slice-table').tablesorter(tablesorterSliceOptions);

$("#datasets_overview_table thead").stick_in_parent();
$("#slice-table thead").stick_in_parent();
$('#datasets_overview_table thead').stick_in_parent();
$('#slice-table thead').stick_in_parent();

$('.content').on('click', '.sort_rank, .sort_place',
function(e) {
$("#places_overview_table").trigger("sorton",
$('#places_overview_table').trigger('sorton',
[[[$(e.target).hasClass('sort_place') / 1, sortFlag]]]);
$('.headerSortDown').removeClass('headerSortDown');
$('.headerSortUp').removeClass('headerSortUp');
$(e.target).addClass((sortFlag) ? "headerSortUp" : "headerSortDown");
$(e.target).addClass((sortFlag) ? 'headerSortUp' : 'headerSortDown');
sortFlag = !sortFlag;
});

Expand Down
78 changes: 40 additions & 38 deletions census/views/dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,47 @@
<div class="container">
<div class="row">
<div class="col-md-{% if is_index %}6{% else %}12{% endif %}">
<h1>
<a href="http://index.okfn.org/dataset/{{ dataset.id }}/" title="{{ format("See more data on %(name)s in the Open Data Index", {name: dataset.name}) }}">{{ dataset.name }}</a>
<span style="background-color: rgb(223, 204, 51); color: white;" class="dataset-openness" data-score="{{ computedRelativeScore }}">{{ format("%(score)s% open (avg.)", {score: computedRelativeScore}) }}</span>
</h1>
{% if is_index == "true" %}
<div class="col-md-12 place-rank statistics">
<span>{{ gettext("Ranked #1 against other datasets in the Index (avg.)") }}</span>
</div>
<h1>
<a href="http://index.okfn.org/dataset/{{ dataset.id }}/" title="{{ format("See more data on %(name)s in the Open Data Index", {name: dataset.name}) }}">{{ dataset.name }}</a>
<span style="background-color: rgb(223, 204, 51); color: white;" class="dataset-openness" data-score="{{ stats.openDataPercent }}">{{ format("%(score)s% open (avg.)", {score: stats.openDataPercent}) }}</span>
</h1>
{% if is_index == "true" -%}
<div class="col-md-12 place-rank statistics">
<span>{{ gettext("Ranked #1 against other datasets in the Index (avg.)") }}</span>
</div>

<div class="row relative">
<div class="col-md-1 change"><i class="fa fa-minus"></i></div>
<div class="col-md-11">
{{ format("The Index average ranking for %(name)s is no change from #1 in 2014", {name: dataset.name}) }}
<div class="row relative">
<div class="col-md-1 change"><i class="fa fa-minus"></i></div>
<div class="col-md-11">
{{ format("The Index average ranking for %(name)s is no change from #1 in 2014", {name: dataset.name}) }}
</div>
</div>
{%- endif %}
<div class="row navigate">
<div class="col-md-12">
{% include 'includes/share_buttons.html' %}
{% if is_index == "true" -%}
<div class="history">
<h6>{{ gettext("See other years") }}</h6>
<ul>
<li><a href="http://index.okfn.org/dataset/{{ dataset.id }}/2014/" title="2014">2014</a></li>
<li><a href="http://index.okfn.org/dataset/{{ dataset.id }}/2013/" title="2013">2013</a></li>
</ul>
</div>
{%- endif %}
</div>
</div>
</div>
{% endif %}
<div class="row navigate">

<div class="col-md-12">
{% include 'includes/share_buttons.html' %}

{% if is_index == "true" %}
<div class="history">
<h6>{{ gettext("See other years") }}</h6>
<ul>
<li><a href="http://index.okfn.org/dataset/{{ dataset.id }}/2014/" title="2014">2014</a></li>
<li><a href="http://index.okfn.org/dataset/{{ dataset.id }}/2013/" title="2013">2013</a></li>
</ul>
</div>
{% endif %}
{% if is_index == "true" %}
<div class="col-md-6">
<div id="map-container">
{% include 'includes/dataviews/embed_map.html' %}
</div>
</div>
</div>
{% endif %}

{% if is_index == "true" %}
<div class="col-md-6">
<div id="map-container">
{% include 'includes/dataviews/embed_map.html' %}
</div>
</div>
{% endif %}

</div>
</div>
</section>

Expand All @@ -62,8 +60,12 @@ <h6>{{ gettext("See other years") }}</h6>
{% if is_index == "true" %}
<h3>{{ gettext("About") }}</h3>
{% endif %}

{{dataset.description}}
{{ dataset.description }}
<ul>
{% for characteristic in dataset.characteristics %}
<li>{{ characteristic }}</li>
{% endfor %}
</ul>
</div>
</section>
{% endif %}
Expand All @@ -76,4 +78,4 @@ <h3>{{ gettext("About") }}</h3>
</div>
</section>

{% endblock %}
{% endblock %}

0 comments on commit b94cbcc

Please sign in to comment.