~sircmpwn/core.sr.ht

ref: db099290d919a7ea3d1b241ee76ebaecc0b705ec core.sr.ht/srht/templates/nav.html -rw-r--r-- 1.3 KiB
db099290Drew DeVault Overhaul site navigation 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{% if "hub.sr.ht" in network %}
<a class="navbar-brand" href="{{get_origin("hub.sr.ht", external=True)}}">
  {{icon('circle', cls='text-muted')}}
  {{site_name}}
</a>
{% else %}
<a class="navbar-brand" href="/">
  {{icon('circle', cls='text-muted')}}
  {{site_name}}
  <span class="text-danger">{{site.split(".")[0]}}</span>
</a>
{% endif %}
<ul class="navbar-nav">
  {% if current_user %}
  {% for _site in network %}

  {% if _site != "hub.sr.ht" %}
  <li class="nav-item {{'active' if _site == site else ''}}">
    <a
      class="nav-link"
      href="{{get_origin(_site, external=True)}}"
    >{{_site.split(".")[0]}}</a>
  </li>
  {% endif %}

  {% endfor %}
  {% endif %}
</ul>
<div class="login">
  {% if current_user %}
  <span class="navbar-text">
    Logged in as
    <a href="{{get_origin("meta.sr.ht", external=True)}}/profile">
      {{current_user.username}}</a>
    &mdash;
    <a href="{{logout_url}}">Log out</a>
  </span>
  {% else %}
  <span class="navbar-text">
    {% if site == 'meta.sr.ht' %}
    <a href="/login">Log in</a>
    &mdash;
    <a href="/">Register</a>
    {% else %}
    <a href="{{ oauth_url }}" rel="nofollow">Log in</a>
    &mdash;
    <a href="{{get_origin("meta.sr.ht", external=True)}}">Register</a>
    {% endif %}
  </span>
  {% endif %}
</div>