mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-28 01:45:07 +01:00
Use Jinja macro to deduplicate navigation header HTML
This commit is contained in:
parent
c631b61a81
commit
2e3a4a6a9b
4 changed files with 31 additions and 69 deletions
|
@ -12,24 +12,11 @@
|
||||||
<body class="khoj-configure">
|
<body class="khoj-configure">
|
||||||
<div class="khoj-header-wrapper">
|
<div class="khoj-header-wrapper">
|
||||||
<div class="filler"></div>
|
<div class="filler"></div>
|
||||||
<div class="khoj-header">
|
|
||||||
<a class="khoj-logo" href="https://khoj.dev" target="_blank">
|
<!--Add Header Logo and Nav Pane-->
|
||||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
{% import 'utils.html' as utils %}
|
||||||
</a>
|
{{ utils.heading_pane(user_photo, username) }}
|
||||||
<nav class="khoj-nav">
|
|
||||||
<a class="khoj-nav" href="/chat">💬 Chat</a>
|
|
||||||
<a class="khoj-nav" href="/">🔎 Search</a>
|
|
||||||
<!-- Dropdown Menu -->
|
|
||||||
<div id="khoj-nav-menu-container" class="khoj-nav dropdown">
|
|
||||||
<img class="circle" src="{{ user_photo }}" alt="{{ username }}" onclick="toggleMenu()">
|
|
||||||
<div id="khoj-nav-menu" class="khoj-nav-dropdown-content">
|
|
||||||
<div class="khoj-nav-username"> {{ username }} </div>
|
|
||||||
<a class="khoj-nav khoj-nav-selected" href="/config">⚙️ Settings</a>
|
|
||||||
<a class="khoj-nav" href="/auth/logout">🔑 Logout</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
<div class="filler"></div>
|
<div class="filler"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class=”content”>
|
<div class=”content”>
|
||||||
|
|
|
@ -270,32 +270,10 @@
|
||||||
<button id="khoj-banner-submit" class="khoj-banner-button">Submit</button>
|
<button id="khoj-banner-submit" class="khoj-banner-button">Submit</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--Add Header Logo and Nav Pane-->
|
<!--Add Header Logo and Nav Pane-->
|
||||||
<div class="khoj-header">
|
{% import 'utils.html' as utils %}
|
||||||
{% if demo %}
|
{{ utils.heading_pane(user_photo, username) }}
|
||||||
<a class="khoj-logo" href="https://khoj.dev" target="_blank">
|
|
||||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="khoj-logo" href="/">
|
|
||||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
<nav class="khoj-nav">
|
|
||||||
<a class="khoj-nav khoj-nav-selected" href="/chat">💬 Chat</a>
|
|
||||||
<a class="khoj-nav" href="/">🔎 Search</a>
|
|
||||||
{% if not demo %}
|
|
||||||
<!-- Dropdown Menu -->
|
|
||||||
<div id="khoj-nav-menu-container" class="khoj-nav dropdown">
|
|
||||||
<img class="circle" src="{{ user_photo }}" alt="{{ username }}" onclick="toggleMenu()">
|
|
||||||
<div id="khoj-nav-menu" class="khoj-nav-dropdown-content">
|
|
||||||
<div class="khoj-nav-username"> {{ username }} </div>
|
|
||||||
<a class="khoj-nav khoj-nav-selected" href="/config">⚙️ Settings</a>
|
|
||||||
<a class="khoj-nav" href="/auth/logout">🔑 Logout</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Chat Body -->
|
<!-- Chat Body -->
|
||||||
<div id="chat-body"></div>
|
<div id="chat-body"></div>
|
||||||
|
|
|
@ -282,33 +282,10 @@
|
||||||
<button id="khoj-banner-submit" class="khoj-banner-button">Submit</button>
|
<button id="khoj-banner-submit" class="khoj-banner-button">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!--Add Header Logo and Nav Pane-->
|
<!--Add Header Logo and Nav Pane-->
|
||||||
<div class="khoj-header">
|
{% import 'utils.html' as utils %}
|
||||||
{% if demo %}
|
{{ utils.heading_pane(user_photo, username) }}
|
||||||
<a class="khoj-logo" href="https://khoj.dev" target="_blank">
|
|
||||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="khoj-logo" href="/">
|
|
||||||
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
<nav class="khoj-nav">
|
|
||||||
<a class="khoj-nav" href="/chat">💬 Chat</a>
|
|
||||||
<a class="khoj-nav khoj-nav-selected" href="/">🔎 Search</a>
|
|
||||||
{% if not demo %}
|
|
||||||
<!-- Dropdown Menu -->
|
|
||||||
<div id="khoj-nav-menu-container" class="khoj-nav dropdown">
|
|
||||||
<img class="circle" src="{{ user_photo }}" alt="{{ username }}" onclick="toggleMenu()">
|
|
||||||
<div id="khoj-nav-menu" class="khoj-nav-dropdown-content">
|
|
||||||
<div class="khoj-nav-username"> {{ username }} </div>
|
|
||||||
<a class="khoj-nav" href="/config">⚙️ Settings</a>
|
|
||||||
<a class="khoj-nav" href="/auth/logout">🔑 Logout</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--Add Text Box To Enter Query, Trigger Incremental Search OnChange -->
|
<!--Add Text Box To Enter Query, Trigger Incremental Search OnChange -->
|
||||||
<input type="text" id="query" class="option" onkeyup=incrementalSearch(event) autofocus="autofocus" placeholder="Search your knowledge base using natural language">
|
<input type="text" id="query" class="option" onkeyup=incrementalSearch(event) autofocus="autofocus" placeholder="Search your knowledge base using natural language">
|
||||||
|
|
20
src/khoj/interface/web/utils.html
Normal file
20
src/khoj/interface/web/utils.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% macro heading_pane(user_photo="/static/assets/icons/anon.png", username="Anon") -%}
|
||||||
|
<div class="khoj-header">
|
||||||
|
<a class="khoj-logo" href="/" target="_blank">
|
||||||
|
<img class="khoj-logo" src="/static/assets/icons/khoj-logo-sideways-500.png" alt="Khoj"></img>
|
||||||
|
</a>
|
||||||
|
<nav class="khoj-nav">
|
||||||
|
<a class="khoj-nav" href="/chat">💬 Chat</a>
|
||||||
|
<a class="khoj-nav" href="/">🔎 Search</a>
|
||||||
|
<!-- Dropdown Menu -->
|
||||||
|
<div id="khoj-nav-menu-container" class="khoj-nav dropdown">
|
||||||
|
<img class="circle" src="{{ user_photo }}" alt="{{ username[0].upper() }}" onclick="toggleMenu()" referrerpolicy="no-referrer">
|
||||||
|
<div id="khoj-nav-menu" class="khoj-nav-dropdown-content">
|
||||||
|
<div class="khoj-nav-username"> {{ username }} </div>
|
||||||
|
<a class="khoj-nav khoj-nav-selected" href="/config">⚙️ Settings</a>
|
||||||
|
<a class="khoj-nav" href="/auth/logout">🔑 Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
{%- endmacro %}
|
Loading…
Reference in a new issue