Skip to content

Commit

Permalink
Visual tweaks to the pipelines page
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed Oct 12, 2018
1 parent 78d274b commit c6b897a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
11 changes: 10 additions & 1 deletion public_html/assets/css/nf-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ blockquote a {
min-width: 100%;
}
}
/* Don't stretch the final card across the full row if an odd number */
@media only screen and (min-width: 1000px) {
.card_deck_card.card {
max-width: calc(50% - 30px);
}
}

.site-nav {
padding: .2rem 1rem;
Expand Down Expand Up @@ -350,7 +356,7 @@ Based on https://codepen.io/wintr/pen/beBJBb */
*/

.pipelines-toolbar .pipeline-filters input {
max-width: 6rem;
max-width: 10rem;
}
.pipelines-toolbar .btn.active {
opacity: 0.8;
Expand All @@ -374,6 +380,9 @@ Based on https://codepen.io/wintr/pen/beBJBb */
font-size: 0.8rem;
color: #999;
}
.pipeline .stargazers .far {
color: #DAA520;
}
.pipeline .stargazers:hover {
color: #DAA520;
text-decoration: none;
Expand Down
51 changes: 30 additions & 21 deletions public_html/pipelines.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

function rsort_releases($a, $b){
$t1 = strtotime($a->published_at);
$t2 = strtotime($b->published_at);
return $t2 - $t1;
}
function rsort_pipelines($a, $b){
$t1 = strtotime($a->last_release);
$t2 = strtotime($b->last_release);
return $t2 - $t1;
}

$pipelines_json = json_decode(file_get_contents('pipelines.json'));
$pipelines = $pipelines_json->remote_workflows;
usort($pipelines, 'rsort_pipelines');

// From https://stackoverflow.com/a/18891474/713980
function time_ago($date) {
Expand Down Expand Up @@ -34,14 +46,9 @@ function time_ago($date) {
}
return "$difference $periods[$j] {$tense}";
}
function rsort_releases($a, $b){
$t1 = strtotime($a->published_at);
$t2 = strtotime($b->published_at);
return $t2 - $t1;
}

$title = 'Pipelines';
$subtitle = 'Browse the '.$pipelines_json->pipeline_count.' pipelines that are currently available as part of nf-core.';
$subtitle = 'Browse the <strong>'.$pipelines_json->pipeline_count.'</strong> pipelines that are currently available as part of nf-core.';
include('../includes/header.php');
?>

Expand All @@ -50,31 +57,31 @@ function rsort_releases($a, $b){
<a href="https://gitter.im/nf-core/Lobby">Let us know!</a></p>

<div class="btn-toolbar mb-4 pipelines-toolbar" role="toolbar">
<div class="pipeline-filters input-group input-group-sm mr-2 mt-2">
<input type="text" class="form-control" placeholder="Search keywords">
</div>
<div class="btn-group btn-group-sm mt-2 d-none d-sm-block" role="group">
<button type="button" class="btn btn-link text-body">Filter:</button>
</div>
<div class="pipeline-filters input-group input-group-sm mr-2 mt-2">
<input type="text" class="form-control" placeholder="Filter Text">
<div class="input-group-append">
<?php if($pipelines_json->published_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-released">Released</button>
<?php endif;
if($pipelines_json->devel_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-dev">Development</button>
<?php endif;
if($pipelines_json->archived_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-archived">Archived</button>
<?php endif; ?>
</div>
<div class="pipeline-filters btn-group btn-group-sm mr-2 mt-2">
<?php if($pipelines_json->published_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-released">Released <span class="badge badge-light"><?php echo $pipelines_json->published_count; ?></span></button>
<?php endif;
if($pipelines_json->devel_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-dev">Under development <span class="badge badge-light"><?php echo $pipelines_json->devel_count; ?></span></button>
<?php endif;
if($pipelines_json->archived_count > 0): ?>
<button type="button" class="btn btn-sm btn-outline-success active" data-target=".pipeline-archived">Archived <span class="badge badge-light"><?php echo $pipelines_json->archived_count; ?></span></button>
<?php endif; ?>
</div>
<div class="btn-group btn-group-sm mt-2 d-none d-sm-block" role="group">
<button type="button" class="btn btn-link text-body">Sort:</button>
</div>
<div class="pipeline-sorts btn-group btn-group-sm mr-2 mt-2" role="group">
<button type="button" class="btn btn-outline-success active">Alphabetical</button>
<button type="button" class="btn btn-outline-success active">Last Release</button>
<button type="button" class="btn btn-outline-success">Alphabetical</button>
<button type="button" class="btn btn-outline-success">Status</button>
<button type="button" class="btn btn-outline-success">Stars</button>
<button type="button" class="btn btn-outline-success">Last Release</button>
</div>
</div>

Expand All @@ -85,10 +92,12 @@ function rsort_releases($a, $b){
<div class="card card_deck_card pipeline <?php if($wf->archived): ?>pipeline-archived<?php elseif(count($wf->releases) == 0): ?>pipeline-dev<?php else: ?>pipeline-released<?php endif; ?>">
<div class="card-body">
<h3 class="card-title mb-0">
<?php if($wf->stargazers_count > 0): ?>
<a href="<?php echo $wf->html_url; ?>/stargazers" target="_blank" class="stargazers mt-2 ml-2" title="<?php echo $wf->stargazers_count; ?> stargazers on GitHub <small class='fas fa-external-link-alt ml-2'></small>" data-toggle="tooltip" data-html="true">
<i class="far fa-star"></i>
<?php echo $wf->stargazers_count; ?>
</a>
<?php endif; ?>
<a href="<?php echo $wf->html_url; ?>" target="_blank" class="pipeline-name">
<?php echo $wf->full_name; ?>
</a>
Expand Down
4 changes: 4 additions & 0 deletions update_pipeline_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function sort_datestamp($a,$b) {
'created_at' => $repo->created_at,
'updated_at' => $repo->updated_at,
'pushed_at' => $repo->pushed_at,
'last_release' => 0,
'git_url' => $repo->git_url,
'ssh_url' => $repo->ssh_url,
'clone_url' => $repo->clone_url,
Expand Down Expand Up @@ -113,6 +114,9 @@ function sort_datestamp($a,$b) {
'draft' => $rel->draft,
'prerelease' => $rel->prerelease
);
if(strtotime($rel->published_at) > strtotime($results['remote_workflows'][$idx]['last_release'])){
$results['remote_workflows'][$idx]['last_release'] = $rel->published_at;
}
}
if(count($results['remote_workflows'][$idx]['releases']) > 0){
// Sort releases by date, descending
Expand Down

0 comments on commit c6b897a

Please sign in to comment.