Commit 64e143f introduce the browseheader_message macro

7 files Authored and Committed by ryanlerch 5 days ago
introduce the browseheader_message macro

Introduces a new macro for themes, the browseheader_message.
This allows a theme to define the message that is shown on the
browse pages. In the default theme, this message was and is only
shown on the browse projects.

This also updates the srcfpo theme to use this new macro, and remove
the overridden template that was being used to do this.

Fixes #3617

    
 1 @@ -113,6 +113,30 @@
 2       {% endmacro %}
 3   
 4   
 5 + `browseheader_message(select)` macro
 6 + ######################
 7 + 
 8 + An optional Jinja macro that defines the welcome message that is shown
 9 + above the tabs on the Browse Pages (Projects, Users, and Groups). The 
10 + select parameter is a string with the name of the page being shown
11 + Example:
12 + 
13 + ::
14 + 
15 +     {% macro browseheader_message(select) %}
16 +         {% if select == 'projects' %}
17 +         <div class="row justify-content-around">
18 +         <div class="col-md-8">
19 +             <div class="jumbotron bg-transparent m-0 py-4 text-center">
20 +                 <h1 class="display-5">Welcome to my Pagure</h1>
21 +                 <p class="lead">Pagure is an Open Source software code hosting system.</p>
22 +             </div>
23 +         </div>
24 +         </div>
25 +         {% endif %}
26 +     {% endmacro %}
27 + 
28 + 
29   `footer()` macro
30   ######################
31   
 1 @@ -1,15 +1,9 @@
 2 + {% import "theme.html" as theme with context %}
 3 + 
 4   {% macro browse_header(select) -%}
 5   
 6 - {% if select == 'projects' %}
 7 - <div class="row justify-content-around">
 8 -   <div class="col-md-8">
 9 -       <div class="jumbotron bg-transparent m-0 py-4 text-center">
10 -           <h1 class="display-5">Welcome to Pagure</h1>
11 -           <p class="lead">Pagure is an Open Source software code hosting system.</p>
12 -         </div>
13 -   </div>
14 - </div>
15 - {% endif %}
16 + {{ theme.browseheader_message(select) if theme.browseheader_message is defined }}
17 + 
18   <ul class="nav nav-tabs nav-small border-bottom-0">
19     <li class="nav-item">
20       <a {% if select == 'projects' %}class="nav-link active" {%
 1 @@ -15,6 +15,19 @@
 2   <script src="{{ url_for('static', filename='vendor/bootstrap/bootstrap.bundle.min.js')}}"></script>
 3   {% endmacro %}
 4   
 5 + {% macro browseheader_message(select) %}
 6 +     {% if select == 'projects' %}
 7 +     <div class="row justify-content-around">
 8 +     <div class="col-md-8">
 9 +         <div class="jumbotron bg-transparent m-0 py-4 text-center">
10 +             <h1 class="display-5">Welcome to Pagure</h1>
11 +             <p class="lead">Pagure is an Open Source software code hosting system.</p>
12 +         </div>
13 +     </div>
14 +     </div>
15 +     {% endif %}
16 + {% endmacro %}
17 + 
18   {% macro footer() %}
19       <div class="footer bg-light py-3">
20           <div class="container">
 1 @@ -16,6 +16,24 @@
 2   <script src="{{ url_for('static', filename='vendor/bootstrap/bootstrap.bundle.min.js')}}"></script>
 3   {% endmacro %}
 4   
 5 + {% macro browseheader_message(select) %}
 6 +     {# 
 7 +         message that shows at the top of the browse pages:
 8 +         'select' is the browse page. It can be either: 'projects',
 9 +         'users', or 'groups'. 
10 +     #}
11 +     {% if select == 'projects' %}
12 +     <div class="row justify-content-around">
13 +     <div class="col-md-8">
14 +         <div class="jumbotron bg-transparent m-0 py-4 text-center">
15 +             <h1 class="display-5">Welcome to Pagure</h1>
16 +             <p class="lead">Pagure is an Open Source software code hosting system.</p>
17 +         </div>
18 +     </div>
19 +     </div>
20 +     {% endif %}
21 + {% endmacro %}
22 + 
23   {% macro footer() %}
24       <div class="footer py-3 bg-light border-top text-center">
25           <div class="container">
 1 @@ -21,6 +21,19 @@
 2   <script src="{{ url_for('static', filename='vendor/bootstrap/bootstrap.bundle.min.js')}}"></script>
 3   {% endmacro %}
 4   
 5 + {% macro browseheader_message(select) %}
 6 +     {% if select == 'projects' %}
 7 +     <div class="row justify-content-around">
 8 +     <div class="col-md-8">
 9 +         <div class="jumbotron bg-transparent m-0 py-4 text-center">
10 +             <h1 class="display-5">Welcome to Fedora Pagure</h1>
11 +             <p class="lead">Pagure is an Open Source software code hosting system.</p>
12 +         </div>
13 +     </div>
14 +     </div>
15 +     {% endif %}
16 + {% endmacro %}
17 + 
18   {% macro footer() %}
19       <div class="footer py-3">
20           <div class="container">
 1 @@ -1,65 +0,0 @@
 2 - {% macro browse_header(select) -%}
 3 - 
 4 - {% if select == 'projects' %}
 5 - <div class="row justify-content-around">
 6 -   <div class="col-md-8">
 7 -       <div class="jumbotron bg-transparent m-0 py-4 text-center">
 8 -           <h1 class="display-5">Welcome to src.fedoraproject.org</h1>
 9 -           <p class="lead">Fedora's repository for package maintenance.</p>
10 -         </div>
11 -   </div>
12 - </div>
13 - 
14 -   {% if not g.authenticated %}
15 -     <section class="container p-t-2">
16 -       <p>
17 -         Welcome, if you're looking to download software to run, look at
18 -         <a href="https://getfedora.org/">https://getfedora.org/</a>, or a
19 -         <a href="https://mirrors.fedoraproject.org/">Fedora Mirror</a>.
20 -         You can also find source RPMs for Fedora-packaged software there.
21 -         The source code for building those packages is found here.
22 -       </p>
23 - 
24 -       <p>
25 -         If you are looking for RPM spec files, module and container definitions,
26 -         Fedora-specific patches, tests, and so on, you're in the right place.
27 -         You can browse <a href="/browse/projects/">packages</a> and
28 -         <a href="/users">packagers</a> — and you can fork, improve, and submit
29 -         pull requests.
30 -         </p>
31 - 
32 -       <p>
33 -         If you are already a package maintainer, feel free to consult the
34 -         <a href="https://docs.pagure.org/pagure/usage.html">docs on using
35 -         pagure</a>. If you'd like to become a package maintainer, see
36 -         <a href="https://fedoraproject.org/wiki/Join_the_package_collection_maintainers">
37 -         this guide</a>.
38 -       </p>
39 - 
40 -       <p>
41 -         Note that package issues are still tracked in
42 -         <a href="https://bugzilla.redhat.com/">Bugzilla</a>,
43 -         not with Pagure's issue feature.
44 -       </p>
45 -       </section>
46 -   {% endif %}
47 - {% endif %}
48 - 
49 - <ul class="nav nav-tabs nav-small border-bottom-0">
50 -   <li class="nav-item">
51 -     <a {% if select == 'projects' %}class="nav-link active" {%
52 -         else %}class="nav-link"{%
53 -         endif %} href="{{ url_for('ui_ns.browse_projects') }}">Projects</a>
54 -   </li>
55 -   <li class="nav-item">
56 -     <a {% if select == 'users' %}class="nav-link active" {%
57 -         else %}class="nav-link"{%
58 -         endif %} href="{{ url_for('ui_ns.view_users') }}">Users</a>
59 -   </li>
60 -   <li class="nav-item">
61 -     <a {% if select == 'groups' %}class="nav-link active" {%
62 -         else %}class="nav-link"{%
63 -         endif %} href="{{ url_for('ui_ns.group_lists') }}">Groups</a>
64 -   </li>
65 - </ul>
66 - {%- endmacro %}
 1 @@ -21,6 +21,53 @@
 2   <script src="{{ url_for('static', filename='vendor/bootstrap/bootstrap.bundle.min.js')}}"></script>
 3   {% endmacro %}
 4   
 5 + {% macro browseheader_message(select) %}
 6 +     {% if select == 'projects' %}
 7 +     <div class="row justify-content-around">
 8 +     <div class="col-md-8">
 9 +         <div class="jumbotron bg-transparent m-0 py-4 text-center">
10 +             <h1 class="display-5">Welcome to Fedora Package Sources</h1>
11 +             <p class="lead">Fedora's repository for package maintenance.</p>
12 +             </div>
13 +     </div>
14 +     </div>
15 + 
16 +     {% if not g.authenticated %}
17 +         <section class="container p-t-2">
18 +         <p>
19 +             Welcome, if you're looking to download software to run, look at
20 +             <a href="https://getfedora.org/">https://getfedora.org/</a>, or a
21 +             <a href="https://mirrors.fedoraproject.org/">Fedora Mirror</a>.
22 +             You can also find source RPMs for Fedora-packaged software there.
23 +             The source code for building those packages is found here.
24 +         </p>
25 + 
26 +         <p>
27 +             If you are looking for RPM spec files, module and container definitions,
28 +             Fedora-specific patches, tests, and so on, you're in the right place.
29 +             You can browse <a href="/browse/projects/">packages</a> and
30 +             <a href="/users">packagers</a> — and you can fork, improve, and submit
31 +             pull requests.
32 +             </p>
33 + 
34 +         <p>
35 +             If you are already a package maintainer, feel free to consult the
36 +             <a href="https://docs.pagure.org/pagure/usage.html">docs on using
37 +             pagure</a>. If you'd like to become a package maintainer, see
38 +             <a href="https://fedoraproject.org/wiki/Join_the_package_collection_maintainers">
39 +             this guide</a>.
40 +         </p>
41 + 
42 +         <p>
43 +             Note that package issues are still tracked in
44 +             <a href="https://bugzilla.redhat.com/">Bugzilla</a>,
45 +             not with Pagure's issue feature.
46 +         </p>
47 +         </section>
48 +     {% endif %}
49 +     {% endif %}
50 + {% endmacro %}
51 + 
52   {% macro footer() %}
53       <div class="footer py-3">
54           <div class="container">