~sircmpwn/core.sr.ht

core.sr.ht/srht/templates/nav.html -rw-r--r-- 1.5 KiB
99a8168dTommy Nguyen Don't inject styles for every call to markdown a day 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
52
53
54
55
56
57
58
59
60
{% if "hub.sr.ht" in network %}
<span class="navbar-brand">
  {{icon('circle')}}
  <a href="{{get_origin("hub.sr.ht", external=True)}}">
    {{site_name}}
  </a>
</span>
{% else %}
<span class="navbar-brand">
  {{icon('circle')}}
  <a class="navbar-brand" href="/">
    {{site_name}}
    <span class="text-danger">{{site.split(".")[0]}}</span>
  </a>
</span>
{% 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
    {% set hubsrht = get_origin("hub.sr.ht", external=True, default=None) %}
    {% if hubsrht %}
    <a href="{{hubsrht}}/~{{current_user.username}}">
    {% else %}
    <a href="{{get_origin("meta.sr.ht", external=True)}}/profile">
    {% endif %}
      {{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>