|
Ryan Lerch |
2a8d61 |
Theming Guide
|
|
Pierre-Yves Chibon |
6387ab |
=============
|
|
Pierre-Yves Chibon |
704577 |
|
|
Ryan Lerch |
2a8d61 |
Pagure is built on Flask, and uses Jinja2 for templates. Pagure also
|
|
Ryan Lerch |
2a8d61 |
includes the ability to apply different themes that control the look
|
|
Ryan Lerch |
2a8d61 |
and feel of your pagure instance, or add or remove elements from the
|
|
Ryan Lerch |
2a8d61 |
interface.
|
|
Pierre-Yves Chibon |
704577 |
|
|
Ryan Lerch |
2a8d61 |
Setting a theme
|
|
Ryan Lerch |
2a8d61 |
---------------
|
|
Pierre-Yves Chibon |
96aaa1 |
The theme is set in the Pagure configuration file. The theme name is defined by
|
|
Pierre-Yves Chibon |
96aaa1 |
the name of the directory in the /themes/ folder that contains the theme. For
|
|
Pierre-Yves Chibon |
96aaa1 |
example to enable the theme that is used on Pagure.io, add the following line
|
|
Pierre-Yves Chibon |
96aaa1 |
to your Pagure configuration:
|
|
Pierre-Yves Chibon |
704577 |
|
|
Ryan Lerch |
2a8d61 |
::
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
eac6d9 |
THEME = "pagureio"
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
9dd1c0 |
|
|
Ryan Lerch |
2a8d61 |
Theme contents
|
|
Pierre-Yves Chibon |
6387ab |
--------------
|
|
Ryan Lerch |
2a8d61 |
A theme requires two directories (`templates` and `static`) in the directory
|
|
Ryan Lerch |
2a8d61 |
that contains the theme. The only other required file is theme.html which
|
|
Ryan Lerch |
2a8d61 |
is placed in the templates directory
|
|
Pierre-Yves Chibon |
9dd1c0 |
|
|
Ryan Lerch |
2a8d61 |
templates/
|
|
Ryan Lerch |
2a8d61 |
~~~~~~~~~~
|
|
Ryan Lerch |
2a8d61 |
The `templates` directory is where pagure will look for the `theme.html`
|
|
Ryan Lerch |
2a8d61 |
template. Additionally, if you wish to override any template in Pagure,
|
|
Ryan Lerch |
2a8d61 |
place it in the theme templates/ directory, and pagure will use that
|
|
Ryan Lerch |
2a8d61 |
template rather than the standard one.
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
96aaa1 |
.. warning:: Take care when overriding templates, as any changes to Pagure
|
|
Pierre-Yves Chibon |
96aaa1 |
upstream will need to be backported to your theme template override.
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
static/
|
|
Ryan Lerch |
2a8d61 |
~~~~~~~
|
|
Ryan Lerch |
2a8d61 |
The `static` directory contains all the static elements for the theme,
|
|
Ryan Lerch |
2a8d61 |
including additional a favicon, images, Javascript, and CSS files. To
|
|
Ryan Lerch |
2a8d61 |
reference a file in the theme static directory use the jinja2 tag
|
|
Ryan Lerch |
2a8d61 |
`{{ url_for('theme.static', filename='filename')}}`. For example:
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
1342a6 |
::
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
rel="stylesheet" type="text/css" />
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
templates/theme.html
|
|
Ryan Lerch |
2a8d61 |
~~~~~~~~~~~~~~~~~~~~
|
|
Ryan Lerch |
2a8d61 |
The theme.html file defines a subset of items in the Pagure interface that
|
|
Ryan Lerch |
2a8d61 |
are commonly changed when creating a new theme. Theming is a new feature in
|
|
Ryan Lerch |
2a8d61 |
Pagure, so this set is currently small, but please file issues or PRs against
|
|
Ryan Lerch |
2a8d61 |
pagure with ideas of new items to include.
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
The current items configurable in theme.html are:
|
|
Ryan Lerch |
2a8d61 |
|
|
Pierre-Yves Chibon |
96aaa1 |
|
|
Ryan Lerch |
2a8d61 |
`masthead_class` variable
|
|
Ryan Lerch |
2a8d61 |
#########################
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
f85bcc |
A string of additional CSS class(es) to be added to the navbar element.
|
|
Ryan Lerch |
f85bcc |
This navbar element is the topbar in Pagure. For example:
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
1342a6 |
::
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
f85bcc |
{% set masthead_class = "navbar-dark bg-dark" %}
|
|
Ryan Lerch |
2a8d61 |
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
96aaa1 |
|
|
Ryan Lerch |
2a8d61 |
`site_title` variable
|
|
Pierre-Yves Chibon |
6387ab |
#####################
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
A string containing the text to append at the end of the html title
|
|
Ryan Lerch |
2a8d61 |
on every page on the site. Usage:
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
1342a6 |
::
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
{% set site_title = "Pagure" %}
|
|
Ryan Lerch |
2a8d61 |
|
|
Pierre-Yves Chibon |
96aaa1 |
|
|
Ryan Lerch |
0c654b |
`projectstring(Bool:plural)` macro
|
|
Pierre-Yves Chibon |
6387ab |
##################################
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
A macro that returns a string used to refer to Projects in Pagure
|
|
Ryan Lerch |
0c654b |
The plural parameter informs if the string to be returned is the
|
|
Ryan Lerch |
0c654b |
plural form.
|
|
Ryan Lerch |
0c654b |
This macro is optional.
|
|
Ryan Lerch |
0c654b |
Usage:
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
::
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
{% macro projectstring(plural=False) -%}
|
|
Ryan Lerch |
0c654b |
{% if plural %}
|
|
Ryan Lerch |
0c654b |
Repositories
|
|
Ryan Lerch |
0c654b |
{% else %}
|
|
Ryan Lerch |
0c654b |
Repository
|
|
Ryan Lerch |
0c654b |
{% endif %}
|
|
Ryan Lerch |
0c654b |
{% endmacro -%}
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
`projecticon` variable
|
|
Pierre-Yves Chibon |
6387ab |
######################
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
A string containing the name of the fontawesome icon to use for
|
|
Ryan Lerch |
0c654b |
Projects. This variable is optional. Usage:
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
::
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
{% set projecticon = "Package" %}
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
0c654b |
|
|
Ryan Lerch |
2a8d61 |
`head_imports()` macro
|
|
Ryan Lerch |
2a8d61 |
######################
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Ryan Lerch |
2a8d61 |
A Jinja macro that defines the additional items in the html head to
|
|
Ryan Lerch |
2a8d61 |
be imported. The base templates do not include the bootstrap CSS, so
|
|
Ryan Lerch |
2a8d61 |
this needs to be included in this macro in your theme. Additionally,
|
|
Ryan Lerch |
2a8d61 |
include your favicon here, and a link to any additional CSS files your
|
|
Ryan Lerch |
2a8d61 |
theme uses. Example:
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
c669d2 |
::
|
|
Pierre-Yves Chibon |
c669d2 |
|
|
Ryan Lerch |
2a8d61 |
{% macro head_imports() %}
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
href="{{ url_for('theme.static', filename='favicon.ico')}}"/>
|
|
Ryan Lerch |
2a8d61 |
<link href="{{ url_for('theme.static', filename='bootstrap/bootstrap.min.css')}}" rel="stylesheet">
|
|
Ryan Lerch |
2a8d61 |
<link href="{{ url_for('theme.static', filename='theme.css') }}" rel="stylesheet" type="text/css">
|
|
Ryan Lerch |
2a8d61 |
{% endmacro %}
|
|
Pierre-Yves Chibon |
1342a6 |
|
|
Pierre-Yves Chibon |
96aaa1 |
|
|
Ryan Lerch |
2a8d61 |
`js_imports()` macro
|
|
Pierre-Yves Chibon |
6387ab |
####################
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
A Jinja macro that defines the additional javascript files to
|
|
Ryan Lerch |
2a8d61 |
be imported. The base templates do not include the bootstrap JS, so
|
|
Ryan Lerch |
2a8d61 |
this needs to be included in this macro in your theme. Example:
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
::
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
{% macro js_imports() %}
|
|
Ryan Lerch |
2a8d61 |
<script src="{{ url_for('theme.static', filename='bootstrap/bootstrap.bundle.min.js')}}"></script>
|
|
Ryan Lerch |
2a8d61 |
{% endmacro %}
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Pierre-Yves Chibon |
96aaa1 |
|
|
Ryan Lerch |
64e143 |
`browseheader_message(select)` macro
|
|
Pierre-Yves Chibon |
6387ab |
####################################
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
An optional Jinja macro that defines the welcome message that is shown
|
|
Mary Kate Fain |
a16918 |
above the tabs on the Browse Pages (Projects, Users, and Groups). The
|
|
Ryan Lerch |
64e143 |
select parameter is a string with the name of the page being shown
|
|
Ryan Lerch |
64e143 |
Example:
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
::
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
{% macro browseheader_message(select) %}
|
|
Ryan Lerch |
64e143 |
{% if select == 'projects' %}
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
Welcome to my Pagure
|
|
Ryan Lerch |
64e143 |
Pagure is an Open Source software code hosting system.
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
{% endif %}
|
|
Ryan Lerch |
64e143 |
{% endmacro %}
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
64e143 |
|
|
Ryan Lerch |
2a8d61 |
`footer()` macro
|
|
Pierre-Yves Chibon |
6387ab |
################
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
A Jinja macro that defines the footer of the Pagure site. Example:
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
::
|
|
Pierre-Yves Chibon |
d66fc1 |
|
|
Ryan Lerch |
2a8d61 |
{% macro footer() %}
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
Powered by
|
|
Ryan Lerch |
2a8d61 |
Pagure
|
|
Ryan Lerch |
2a8d61 |
{{ g.version }}
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
SSH Hostkey/Fingerprint | Documentation
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
|
|
Ryan Lerch |
2a8d61 |
{% endmacro %}
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
`about_page()` macro
|
|
Mary Kate Fain |
a16918 |
######################
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
A Jinja macro that defines the content of the About page (available at /about). You may want to replace the links to contact links for your own instance. Example:
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
::
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
{% macro about_page() %}
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
About
|
|
Mary Kate Fain |
a16918 |
This is an instance of Pagure, a git forge.
|
|
Mary Kate Fain |
a16918 |
If you experience a bug or security concern, please submit an issue.
|
|
Mary Kate Fain |
a16918 |
You may also post questions to the Pagure Development list by emailing: pagure-devel@lists.pagure.io or subscribe to the list.
|
|
Mary Kate Fain |
a16918 |
Subscribe to announcements about Pagure.
|
|
Mary Kate Fain |
a16918 |
|
|
Mary Kate Fain |
a16918 |
{% endmacro %}
|