-
Notifications
You must be signed in to change notification settings - Fork 6
Development subsites
Cameron Hyde edited this page Jan 8, 2024
·
7 revisions
Subsite (lab) landing pages are built and served from the Galaxy Media Site under
/landing/<lab-name>
. GMS has a framework for building new labs pages in a
consistent and reproducible manner, with a schema written in Python. It goes
something like this:
# As defined in sections.py:
sections = [
{
"id": str,
"title": str, # e.g. "Data import and preparation"
"tabs": [
{
"id": str, # e.g. "tools"
"title": str, # e.g. "Tools"
"heading_html": str, # accepts inline HTML e.g. <code> <b> <i> <a>
"content": content,
},
# ...
],
},
# ...
]
# As defined in content/*.py:
content = [
{ # Each of these will make an accordion item
"title_html": str, # inline HTML
"description_html": str, # inline HTML; should be a <p>; can have internal line breaks etc.
"inputs": [
{
'datatypes': [str, ], # List of accepted Galaxy datatypes for this input
'label': str, # Name of this input
},
{ # An example input:
'datatypes': ['fastq', 'bam', 'sam'], # List of accepted datatypes for this input
'label': 'Raw sequencing reads', # Descriptive name for this input
},
# ...
],
# These are all optional:
"button_link": str, # URL for run button e.g. Galaxy tool link
"button_html": str, # defaults to "play" icon
"button_tip": str, # tooltip text; defaults to "Run tool"
"view_link": str, # URL for view button e.g. workflowhub link
"view_html": str, # defaults to "eye" icon
"view_tip": str, # tooltip text; defaults to None
},
# ...
]
The button_link
or view_link
can be omitted to hide that button.
The above schema will render a webpage that looks something like this:
For examples of the above, please see genome/content/assembly.py.
- Create a git branch for the new lab
- Decide on a consisteny lab name to use. This will be referred to as $LAB here.
- Create a new subsite dir by cloning webapp/home/subdomains/genome/ to webapp/home/subdomains/${LAB}.
- Create webpage content for the new lab by modifying the ${LAB}/sections.py ${LAB}/content/*.py files, observing the Python schema.
- Clone the HTML template webapp/home/templates/home/subdomains/genome.html to ${LAB}.html
- Edit the HTML template to make the landing page for your lab. It will render the content created in the step above as sections/accordion elements.
- You may wish to reuse/create snippets for this template in webapp/home/templates/home/subdomains/components
- Run the branch with local development server
- In the web admin, add a
Subsite
record with the lab name "$LAB" - You should find the lab landing page at /landing/$LAB.