Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dan product left nav update#1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
chillenberger merged 23 commits intomasterfromdan-product-left-nav-update
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
b01f9d7
fix current product nav to maintain state on FE
chillenbergerApr 24, 2024
8122f77
left nav works with shift checkpoint
chillenbergerApr 25, 2024
4bcb252
fixed left nav
chillenbergerApr 25, 2024
dcd197e
product mobile menu full length, change menu-item icon color
chillenbergerApr 25, 2024
b044163
Merge branch 'master' into dan-product-left-nav-update
chillenbergerApr 26, 2024
88ce70b
move product engines dropdown to topnav, set dropdown default formatt…
chillenbergerMay 6, 2024
d5d1ac7
Merge branch 'master' into dan-product-left-nav-update
chillenbergerMay 6, 2024
c1664d1
remove product lower left nav, remove account management nav, style u…
chillenbergerMay 6, 2024
79d0a74
make owl a font, default breadcrumb start is home, remove bc on mobile
chillenbergerMay 7, 2024
7656600
Merge branch 'master' into dan-product-left-nav-update
chillenbergerMay 7, 2024
4442192
fix icomoon 400
chillenbergerMay 7, 2024
66bda1d
reduce dropdown height in topnav
chillenbergerMay 7, 2024
0d815fe
fix left and top borders
chillenbergerMay 7, 2024
12725e3
change dashboard to home
chillenbergerMay 7, 2024
2f14bbf
keep left nav updated, reset dropdown on nav
chillenbergerMay 7, 2024
5d282af
reduce product left nav icon size, gap, images
chillenbergerMay 7, 2024
c9f0354
rename upper left nav to product left nav, add status and tier to das…
chillenbergerMay 8, 2024
0ecac2a
Fix dashboard urls
chillenbergerMay 10, 2024
2bdd96b
Merge branch 'master' into dan-product-left-nav-update
chillenbergerMay 10, 2024
9fb64b0
remove all hardcoded deployment urls, change dashboard url to engine,…
chillenbergerMay 10, 2024
082e942
fix warnings
chillenbergerMay 10, 2024
51a01ef
make left nave recursive
chillenbergerMay 13, 2024
1e49bc5
Merge branch 'master' into dan-product-left-nav-update
chillenbergerMay 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
fix current product nav to maintain state on FE
  • Loading branch information
@chillenberger
chillenberger committedApr 24, 2024
commitb01f9d72e2950bc44cde62a8cc6e4162b42e59fe
43 changes: 43 additions & 0 deletionspgml-dashboard/src/components/left_nav_menu/left-nav-menu.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static targets = [
"link",
];

// When page reloads we need to set the left nav to the current window
// location since left nave is turbo permanent. Trigger this on event
// rather than on connect since on connect() will fire prior to backend
// redirects.
connect() {
this.callback = () => {
this.setLeftNavToLocation();
}

document.addEventListener("turbo:load", this.callback);
}

setLeftNavToLocation() {
this.removeAllActive();

let tag = "a[href='" + window.location.pathname + "']";
console.log("tag: " + tag)
let elements = this.element.querySelectorAll(tag);

if (elements.length > 0) {
console.log("found element " + elements[0].href)
elements[0].classList.add("active");
}
}

// Helper function to quickly remove all state styling
removeAllActive() {
for (let i = 0; i < this.linkTargets.length; i++) {
this.linkTargets[i].classList.remove("active");
}
}

disconnect() {
document.removeEventListener("turbo:load", this.callback);
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@
<% if !link.hide_for_lg_screens { %>
<li class="menu-item leftnav-collapse-affect expanded <% if link.disabled { %>disabled<% } %>" >
<a
data-left-nav-menu-target="<%-link.name.to_lowercase() %>"
data-left-nav-menu-target="link"
class="d-flex align-items-center justify-content-start gap-2 <% if link.disabled { %> disabled <% } %> <% if link.active { %> active <% } %>"
href="<%= link.href %>"
>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -52,7 +52,7 @@
<nav class="navbar px-0">
<div class="card nav guides rounded-0 w-100">
<div class="card-body py-2 py-xl-4">
<a class="my-1 d-flex justify-content-between align-items-center text-white" role="button" data-bs-toggle="collapse" href="#guides" aria-expanded="false" aria-congrols="guides">
<a class="my-1 d-flex justify-content-between align-items-center text-white" role="button" data-bs-toggle="collapse" href="#guides" aria-expanded="false" aria-controls="guides">
<span>Docs</span><span class="material-symbols-outlined rotate-on-aria-expanded">expand_more</span>
</a>
<div class="collapse border-top pt-2" id="guides">
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ pub struct WebApp {
pub upper_nav: StaticNav,
pub lower_nav: StaticNav,
pub dropdown_nav: StaticNav,
pub id: Option<String>,
}

impl WebApp {
Expand All@@ -16,8 +17,14 @@ impl WebApp {
upper_nav,
lower_nav,
dropdown_nav,
id: None
}
}

pub fn id(mut self, id: &str) -> WebApp {
self.id = Some(id.to_string());
self
}
}

component!(WebApp);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@

<% use crate::components::{LeftNavMenu, Dropdown}; %>
<div class="leftnav-container py-3 font-family-primary" data-controller="navigation-left-nav-web-app">
<div class="leftnav-container py-3 font-family-primary" data-controller="navigation-left-nav-web-app" data-turbo-permanent id='<%- id.unwrap_or_else(|| String::from("defaultId"))%>'>
<nav class="leftnav nav-pills h-100" data-controller="extend-bs-collapse" data-extend-bs-collapse-affected-value=".leftnav-collapse-affect">
<div class="d-flex flex-column justify-content-between h-100 menu-container leftnav-collapse-affect expanded">
<div class="d-flex flex-column">
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static targets = [];

connect() {}

}
14 changes: 14 additions & 0 deletionspgml-dashboard/src/components/static_nav/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
use crate::components::StaticNavLink;
use std::hash::{DefaultHasher, Hash, Hasher};

#[derive(Debug, Clone, Default)]
pub struct StaticNav {
Expand All@@ -16,4 +17,17 @@ impl StaticNav {
None => StaticNavLink::default(),
}
}

pub fn unique_id(&self) -> String {
let mut id = String::new();
for link in &self.links {
id.push_str(&link.name);
id.push_str(&link.disabled.to_string());
id.push_str(&link.href);
}

let mut s = DefaultHasher::new();
id.hash(&mut s);
format!("nav{}", s.finish().to_string())
}
}
2 changes: 1 addition & 1 deletionpgml-dashboard/static/css/scss/components/_navs.scss
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,7 +184,7 @@
}
}

&:active, &:focus, &:target, .active {
&:active:not(.disabled), &:focus:not(.disabled), &:target:not(.disabled), .active:not(.disabled) {
background-color: #{$neon-tint-100};
color: #{$gray-100};
border-radius: calc($border-radius / 2);
Expand Down
15 changes: 11 additions & 4 deletionspgml-dashboard/static/js/extend-bs-collapse.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
// extends bootstraps collapse component by adding collapse state class to any
// html element you like. This is useful for adding style changes to elements
// that do not need to collapse, when a collapse state changeoccures.
// that do not need to collapse, when a collapse state changeoccurs.
import {
Controller
} from '@hotwired/stimulus'
Expand All@@ -19,10 +19,12 @@ export default class extends Controller {
this.navStates = ['collapsing', 'collapsed', 'expanding', 'expanded']
this.events = ['hide.bs.collapse', 'hidden.bs.collapse', 'show.bs.collapse', 'shown.bs.collapse']

this.callback = () => {
this.getAllAffected().forEach(item => this.toggle(item))
}

this.events.forEach(event => {
this.stateReferenceTarget.addEventListener(event, () => {
this.getAllAffected().forEach(item => this.toggle(item))
})
this.stateReferenceTarget.addEventListener(event, this.callback)
})
}

Expand All@@ -44,4 +46,9 @@ export default class extends Controller {
item.classList.add(eClass)
}

disconnect() {
this.events.forEach(event => {
this.stateReferenceTarget.removeEventListener(event, this.callback)
})
}
}
2 changes: 1 addition & 1 deletionpgml-dashboard/templates/layout/web_app_base.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
<%+ WebAppNavbar::new(left_nav_links, account_management_nav) %>

<div class="d-flex">
<%+ WebAppLeftNav::new( upper_left_nav, lower_left_nav, dropdown_nav ) %>
<%+ WebAppLeftNav::new( upper_left_nav.clone(), lower_left_nav, dropdown_nav).id(&upper_left_nav.unique_id()) %>

<div class="clear-from-under-navbar flex-grow-1 min-vw-0">
<div class="px-4 px-sm-5 py-3" style="position: absolute">
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp