Skip to content

Commit

Permalink
Merge pull request #5056 from galaxyproject/atlas-magellanic
Browse files Browse the repository at this point in the history
Feed widgets for embedding
  • Loading branch information
hexylena committed Jun 18, 2024
2 parents cf80eb5 + 65690e5 commit 61e7b9b
Show file tree
Hide file tree
Showing 22 changed files with 543 additions and 308 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ jobs:
run: |
! fgrep -R 'lt;blockquote' _site
- name: Ensure no poorly rendered FAQs
run: |
! fgrep -R 'box_type:' _site/
- name: Ensure no poorly indented code blocks
run: |
bundle exec ruby bin/check-indent.rb
Expand Down
301 changes: 173 additions & 128 deletions _plugins/feeds.rb

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions _plugins/gtn/contributors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,17 @@ def self._load_file(site, category)
# Returns:
# +Hash+ of contributor information
# +String+ type of contributor (e.g. 'contributor', 'organisation', 'funder')
def self.fetch(site, c)
def self.fetch(site, c, warn: false)
if _load_file(site, 'contributors').key?(c)
return ['contributor', site.data['contributors'][c]]
elsif _load_file(site, 'organisations').key?(c)
return ['organisation', site.data['organisations'][c]]
elsif _load_file(site, 'funders').key?(c)
return ['funder', site.data['funders'][c]]
else
Jekyll.logger.warn "Contributor #{c} not found"
if ! warn
Jekyll.logger.warn "Contributor #{c} not found"
end
end

['contributor', { 'name' => c }]
Expand All @@ -150,8 +152,8 @@ def self.fetch_contributor(site, c)
# +c+:: +String+ of contributor ID
# Returns:
# +String+ of contributor name
def self.fetch_name(site, c)
fetch(site, c)[1].fetch('name', c)
def self.fetch_name(site, c, warn: false)
fetch(site, c, warn: warn)[1].fetch('name', c)
end

##
Expand Down
2 changes: 1 addition & 1 deletion _plugins/gtn/mod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def self.init_cache
.map { |x| x.split("\n\n") }
.select { |x| x.length > 1 }
.each do |date, files|
files.split("\n").grep(/\.(md|html)$/).each do |f|
files.split("\n").grep(/\.(md|html|ga)$/).each do |f|
modification_type, path = f.split("\t")
if modification_type == 'A'
# Chase the renames.
Expand Down
3 changes: 3 additions & 0 deletions _plugins/jekyll-topic-filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ def self.list_materials_structured(site, topic_name)
# Returns:
# +Hash+:: The tutorial material
def self.fetch_tutorial_material(site, topic_name, tutorial_name)
if topic_name.nil?
return nil
end
fill_cache(site)
if site.data['cache_topic_filter'][topic_name].nil?
Jekyll.logger.warn "Cannot fetch tutorial material for #{topic_name}"
Expand Down
Binary file added assets/images/GTN-400px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/GTN-60px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions faqs/galaxy/account_create.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
redirect_from:
- /faqs/galaxy/galaxy_creating_an_account
- /faqs/galaxy/creating_account
redirect_from: [/faqs/galaxy/galaxy_creating_an_account, /faqs/galaxy/creating_account]
title: How do I create an account on a public Galaxy instance?
area: account
layout: faq
Expand Down
1 change: 0 additions & 1 deletion faqs/galaxy/workflows_run_trs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ examples:
Incredibly generic box that does not tell you which workflow to import: {}
Importing a QC workflow: {path: "topics/assembly/tutorials/largegenome/workflows/Galaxy-Workflow-Data_QC.ga", title:"Galaxy Workflow Data QC" }
Importing a pre-treatments workflow: {path: "topics/proteomics/tutorials/metaproteomics/workflows/workflow.ga", title:"Pretreatments"}

---

{% if include.path %}
Expand Down
106 changes: 0 additions & 106 deletions feed-html.xslt.xml

This file was deleted.

159 changes: 159 additions & 0 deletions feed-widget.xslt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="atom"
>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<title><xsl:value-of select="atom:feed/atom:title"/> • GTN News </title>
<link rel="icon" type="image/png">
<xsl:attribute name="href">
<xsl:value-of select="atom:feed/atom:logo"/>
</xsl:attribute>
</link>
<link href="https://fonts.googleapis.com/css2?family=Recursive:slnt,wght,CASL,CRSV,MONO@-15..0,300..800,0..1,0..1,1&amp;display=swap" rel="stylesheet"/>
<style type="text/css">
:root {--step--2: clamp(0.7813rem, 0.7747rem + 0.0326vi, 0.8rem);--step--1: clamp(0.9375rem, 0.9158rem + 0.1087vi, 1rem);--step-0: clamp(1.125rem, 1.0815rem + 0.2174vi, 1.25rem);--step-1: clamp(1.35rem, 1.2761rem + 0.3696vi, 1.5625rem);--step-2: clamp(1.62rem, 1.5041rem + 0.5793vi, 1.9531rem);--step-3: clamp(1.944rem, 1.771rem + 0.8651vi, 2.4414rem);--step-4: clamp(2.3328rem, 2.0827rem + 1.2504vi, 3.0518rem);--step-5: clamp(2.7994rem, 2.4462rem + 1.7658vi, 3.8147rem);--brand: #782760;--secondary: #b970a3;--brand-contrast: white;}
body {max-width:768px; margin: 0 auto; font-family: 'Recursive', serif; color: var(--brand);}
h1{font-size:var(--step-1);line-height:1.125em;margin:0; weight: 900; text-transform: capitalize;font-variation-settings: "wght" 900, "CRSV" 0.5, "CASL" 0;}
h2{margin:0;font-size:var(--step-0); font-weight: 500; font-variation-settings: "CRSV" 0.5, "CASL" 1;}
p { margin: 0; }
a{text-decoration:none; color: var(--brand);}
div.entry { position: relative; pointer: cursor; margin-bottom: 0.6rem; padding: 0.4rem; border: 1px solid var(--brand);}
div.entry[data-has-link="true"]:hover { box-shadow: 4px 4px 0px #782760; }
div.entry[data-has-link="true"]:active{ box-shadow: 2px 2px 0px #782760; }
div a.cover {position: absolute;width: 100%;height: 100%;top: 0;left: 0;text-decoration: none;z-index: 10;}
div small {display: none;}
div.entry:nth-child(2n) { --brand: white; --brand-contrast: #782760; color: var(--brand); background: var(--brand-contrast); }
.authors{font-style: italic; font-variation-settings: "wght" 300, "CRSV" 1, "CASL" 1; margin-bottom: 0.4rem;}
body { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: 'header' 'main' 'footer'; height: 100vh; }
header {grid-area: header; padding: 0.5em; border-bottom: 2px solid var(--secondary); display: flex; align-items: center; justify-content: space-between;}
header img {margin-right: 0.5em}
main { grid-area: main; padding: 15px 5px 10px 5px;}
footer { grid-area: footer; padding: 0.5em; border-top: 2px solid var(--secondary); }
div.entry ul a { text-decoration: underline; }
div.entry ul a:hover{ text-decoration: underline; font-weight: 700;}
footer a { text-decoration: underline; }
footer a:hover{ font-weight:700; }
main { background: /* Shadow Cover TOP */ linear-gradient( white 30%, rgba(255, 255, 255, 0) ) center top, /* Shadow Cover BOTTOM */ linear-gradient( rgba(255, 255, 255, 0), white 70% ) center bottom, /* Shadow TOP */ radial-gradient( farthest-side at 50% 0, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0) ) center top, /* Shadow BOTTOM */ radial-gradient( farthest-side at 50% 100%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0) ) center bottom; background-repeat: no-repeat; background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px; background-attachment: local, local, scroll, scroll;}
main { overflow-y: auto; overflow-x: hidden; }

</style>
</head>
<body>
<header>
<hgroup>
<h1>
<a class="head_link" target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="concat(atom:feed/atom:link[@rel='alternate']/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
</xsl:attribute>
<xsl:value-of select="atom:feed/atom:title"/>
</a>
</h1>
<p><xsl:value-of select="atom:feed/atom:subtitle"/></p>
</hgroup>
<a class="head_link" target="_blank" href="https://training.galaxyproject.org?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss">
<img width="30px" alt="gtn logo">
<xsl:attribute name="src">
<xsl:value-of select="atom:feed/atom:logo"/>
</xsl:attribute>
</img>
</a>
</header>
<main>
<xsl:apply-templates select="atom:feed/atom:entry" />
</main>
<footer>
<a target="_blank" href="https://training.galaxyproject.org/training-material/news/2024/06/04/gtn-standards-rss.html?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss">GTN RSS</a>
<a target="_blank" href="https://spdx.org/licenses/CC-BY-4.0">CC-BY 4.0</a>
<a target="_blank" href="https://training.galaxyproject.org/training-material/faqs/gtn/fair_training.html?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss">FAIR</a>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="concat(atom:feed/atom:link[@rel='self']/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
</xsl:attribute>
🔗
</a>
</footer>
</body>
</html>
</xsl:template>

<xsl:template match="atom:entry">
<div class="entry">
<xsl:attribute name="data-has-link">
<xsl:choose>
<xsl:when test="atom:link/@href">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<h2>
<xsl:choose>
<xsl:when test="atom:link/@href">
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="concat(atom:link/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
</xsl:attribute>
<xsl:value-of select="atom:title"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="atom:title"/>
</xsl:otherwise>
</xsl:choose>
</h2>
<!-- If author isn't "GTN" -->
<xsl:if test="atom:author/atom:name != 'GTN'">
<p class="authors">
<i>By: </i><xsl:for-each select="atom:author">
<a href="{atom:uri}">
<xsl:value-of select="atom:name" />
</a>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</p>
</xsl:if>
<!-- if summary -->
<p class="summary">
<xsl:choose>
<xsl:when test="atom:summary">
<xsl:value-of select="atom:summary" disable-output-escaping="yes" />
</xsl:when>
<xsl:when test="atom:content">
<xsl:copy-of select="atom:content" />
</xsl:when>
</xsl:choose>
</p>
<small>
Published: <xsl:value-of select="atom:updated" /> <br/>
Tags:
<xsl:for-each select="atom:category">
<xsl:value-of select="@term" />
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</small>

<!-- https://stackoverflow.com/questions/796087/make-a-div-into-a-link -->
<!-- check if it has a link at all -->
<xsl:if test="atom:link/@href">
<a target="_blank" class="cover">
<xsl:attribute name="href">
<xsl:value-of select="concat(atom:link/@href, '?utm_source=embed&amp;utm_medium=rss-widget&amp;utm_campaign=rss')"/>
</xsl:attribute>
</a>
</xsl:if>
</div>
</xsl:template>
</xsl:stylesheet>

0 comments on commit 61e7b9b

Please sign in to comment.