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

Add action bar with link to raw data to all charts #85

Merged
merged 1 commit into from
Jan 22, 2018
Merged
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
47 changes: 47 additions & 0 deletions docs/assets/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -636,3 +636,50 @@ a
{
display: none;
}

.action-bar
{
margin-top: 4rem;
margin-bottom: 1rem;
}

.action-bar h3
{
margin: 0;
}

button,
a.button
{
display: inline-block;
padding: 0.35rem 0.8rem;
color: #606c71;
background: linear-gradient(-180deg, #fafafa, #f5f5f5);
outline: 0;
border: 1px solid #c4c4c4;
border-radius: 0.25rem;
}

button:hover,
a.button:hover
{
color: #606c71;
background: linear-gradient(-180deg, #fcfcfc, #f8f8f8);
border-color: #cacaca;
}

button:focus,
a.button:focus
{
border-color: #00c4c8;
box-shadow: #7fdee1 0px 0px 0px 2.4px;
}

button:active,
a.button:active
{
color: #606c71;
background-color: #7fdee1;
border-color: #cacaca;
box-shadow: inset 0 0.15em 0.3em #d8d8d8;
}
16 changes: 14 additions & 2 deletions docs/assets/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,20 @@ $(window).bind('load', function()
const tables = $(chartPlaceholder).find('table');
const infoBoxes = $(chartPlaceholder).find('.info-box');

// Draw the title before the chart container
titles.insertBefore(chartPlaceholder);
// Put a bar with the title and additional actions before the chart container
if ($(canvases.first()).attr('data-url'))
{
titles.insertBefore(chartPlaceholder).wrapAll(
'<div class="row action-bar"><div class="col-main"></div></div>');

// Add an action box as the first info box
const downloadLink = '<a class="button" href="' + $(canvases.first()).attr('data-url')
+ '" target="_blank">Raw data</a>';
titles.parent().parent().append(
'<div class="col-aside"><div class="info-box"><p>' + downloadLink + '</p></div></div>');
}
else
titles.insertBefore(chartPlaceholder).wrap('<div class="row"></div>');

// Turn the placeholder into a proper layout row
$(chartPlaceholder).removeClass('chart-placeholder');
Expand Down