Skip to content

Commit

Permalink
Refactor app navbar
Browse files Browse the repository at this point in the history
- Remove review items
- Add dropdown for user profile and logout
- Display federatedcode version in navbar

Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Dec 31, 2024
1 parent 4d21e78 commit 452c952
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 64 deletions.
107 changes: 43 additions & 64 deletions fedcode/templates/navbar.html
Original file line number Diff line number Diff line change
@@ -1,80 +1,59 @@
<nav class="navbar is-dark mb-6" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<div class="navbar-brand ml-3">
<a class="navbar-item is-size-4 has-text-weight-bold" href="/">
Federated Code<span class="nexb-orange">.</span>io
</a>
</div>

<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<nav class="navbar is-dark mb-6 border-bottom-radius" role="navigation" aria-label="main navigation">
<div class="navbar-brand ml-3">
<a class="navbar-item is-size-4 has-text-weight-bold" href="/">
FederatedCode<span class="nexb-orange">.</span>io
</a>
</div>
<div class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="/review-list">
Reviews
{% if user.person %}
<a class="navbar-item" href="{% url 'home-page' %}">
My Packages
</a>

<a class="navbar-item" href="/purl-list">
Packages
</a>

{% if user.service %}
<a class="navbar-item" href="/create-repo">
Create Git Repo
</a>
{% endif %}

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
<a class="navbar-item" href="{% url 'purl-list' %}">
All Packages
</a>
<a class="navbar-item" href="https://federatedcode.readthedocs.io/en/latest/" target="_blank">
Documentation
</a>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
{% if not user.is_authenticated %}
<a class="button is-info" href="{% url 'signup' %}">
<strong>Sign up</strong>
</a>
<a class="button is-light" href="{% url 'login' %}">
<strong>Log in</strong>
</a>

<div class="navbar-dropdown">
<a class="navbar-item" href="/repo-list">
Git Repo List
</a>

<hr class="navbar-divider">
<a class="navbar-item" href="https://github.com/nexB/federatedcode#readme">
About
</a>
<a class="navbar-item" href="https://github.com/nexB/federatedcode/issues/new">
Report an issue
</a>
{% if user.is_authenticated %}
<hr class="navbar-divider">
<a class="navbar-item is-light" href="/accounts/logout">
Log out
</a>
{% endif %}
</div>
</div>
</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
{% if not user.is_authenticated %}
<a class="button is-primary" href="/accounts/sign-up">
<strong>Sign up</strong>
</a>
<a class="button is-light" href="/accounts/login">
<strong>Log in</strong>
</a>
{% endif %}
{% if user.person %}
<div class="navbar-item has-dropdown is-hoverable">
<div class="navbar-link is-arrowless">
<figure class="image is-32x32">
<img src="{{ user.person.avatar }}">
</figure>
</div>

<div class="navbar-dropdown is-right mr-2">
<a class="navbar-item" href="{% url 'user-profile' user.username %}">
<strong>Profile</strong>
</a>
<a class="navbar-item has-text-danger" href="{% url 'logout' %}">
<strong>Log out</strong>
</a>
<hr class="navbar-divider">
<div class="navbar-item">
v{{ FEDERATEDCODE_VERSION }}
</div>
</div>
<figure class="image is-48x48 mt-1 ml-1 mr-1">
{% if user.person %}
<a href="{% url 'user-profile' user.username %}">
<img class="is-rounded" src="{{ user.person.avatar.url }}" >
</a>
{% endif %}
</figure>
</div>
{% endif %}
</div>
</nav>
17 changes: 17 additions & 0 deletions federatedcode/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# FederatedCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/federatedcode for support or download.
# See https://aboutcode.org for more information about AboutCode.org OSS projects.
#


from federatedcode import __version__ as federatedcode_version


def version(request):
return {
"FEDERATEDCODE_VERSION": federatedcode_version,
}
1 change: 1 addition & 0 deletions federatedcode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.request",
"federatedcode.context_processors.version",
],
},
},
Expand Down
12 changes: 12 additions & 0 deletions federatedcode/static/css/font-awesome.css.ABOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
about_resource: font-awesome.css
version: 4.7.0
download_url: https://raw.githubusercontent.com/FortAwesome/Font-Awesome/v4.7.0/css/font-awesome.css

name: font-awesome.css
homepage_url: https://github.com/FortAwesome/Font-Awesome
owner: FortAwesome
author: Dave Gandy
notes: This is the minified version of Font Awesome.

license: mit
license_file: font-awesome.css.LICENSE
20 changes: 20 additions & 0 deletions federatedcode/static/css/font-awesome.css.LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit 452c952

Please sign in to comment.