Dodavanje base šablona, sidebara, topbara i dashboard stranice
This commit is contained in:
+8
-2
@@ -1,13 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"ntech/internal/config"
|
||||
"ntech/internal/db/sqlite"
|
||||
"ntech/internal/handler"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/joho/godotenv"
|
||||
@@ -48,9 +48,15 @@ func main() {
|
||||
log.Println("Migracije uspešno izvršene")
|
||||
|
||||
r := chi.NewRouter()
|
||||
|
||||
// statični fajlovi — CSS, JS, slike
|
||||
r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static"))))
|
||||
|
||||
// rute
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "Zdravo iz NTech-a")
|
||||
http.Redirect(w, r, "/dashboard", http.StatusFound)
|
||||
})
|
||||
r.Get("/dashboard", handler.Dashboard)
|
||||
|
||||
log.Printf("NTech pokrenut na portu %s", port)
|
||||
err = http.ListenAndServe(":"+port, r)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
|
||||
"ntech/internal/model"
|
||||
)
|
||||
|
||||
// Dashboard renderuje početnu stranicu
|
||||
func Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||
// za sad koristimo testne podatke — kasnije će ići iz baze
|
||||
podaci := model.PodaciDashboarda{
|
||||
PodaciStranice: model.PodaciStranice{
|
||||
Stranica: "dashboard",
|
||||
NaslovStranice: "Dashboard",
|
||||
Tema: "tamna",
|
||||
NazivFirme: "NTech",
|
||||
Korisnik: "Admin",
|
||||
},
|
||||
BrojArtikala: 0,
|
||||
AktivniServisi: 0,
|
||||
ProdajaOvogMeseca: 0,
|
||||
KriticnaZaliha: 0,
|
||||
PoslednjiServisi: []model.StavkaServisa{},
|
||||
KriticneZalihe: []model.StavkaZalihe{},
|
||||
}
|
||||
|
||||
// učitavamo sve potrebne šablone zajedno
|
||||
tmpl, err := template.ParseFiles(
|
||||
"web/templates/teme/podrazumevana/base.html",
|
||||
"web/templates/komponente/sidebar.html",
|
||||
"web/templates/komponente/topbar.html",
|
||||
"web/templates/stranice/dashboard.html",
|
||||
)
|
||||
if err != nil {
|
||||
http.Error(w, "Greška pri učitavanju stranice", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// renderujemo base šablon sa podacima
|
||||
if err := tmpl.ExecuteTemplate(w, "base", podaci); err != nil {
|
||||
http.Error(w, "Greška pri prikazu stranice", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package model
|
||||
|
||||
// StavkaServisa prikazuje jedan servisni nalog na dashboardu
|
||||
type StavkaServisa struct {
|
||||
Uredjaj string
|
||||
Status string
|
||||
BojaTacke string // "#16a34a" zelena, "#f59e0b" žuta, "#dc2626" crvena
|
||||
}
|
||||
|
||||
// StavkaZalihe prikazuje jedan artikal sa kritičnom zalihom
|
||||
type StavkaZalihe struct {
|
||||
Naziv string
|
||||
Kolicina int
|
||||
BojaTacke string
|
||||
}
|
||||
|
||||
// PodaciStranice su zajednički podaci koje svaka stranica prima
|
||||
type PodaciStranice struct {
|
||||
Stranica string // naziv aktivne stranice za sidebar
|
||||
NaslovStranice string // naslov u topbaru
|
||||
Tema string // aktivna tema: "tamna", "svetla", "zelena", "ljubicasta"
|
||||
NazivFirme string // naziv firme za logo zonu
|
||||
Logo string // putanja do logo fajla, opciono
|
||||
Korisnik string // ime korisnika za avatar
|
||||
}
|
||||
|
||||
// PodaciDashboarda su podaci specifični za dashboard stranicu
|
||||
type PodaciDashboarda struct {
|
||||
PodaciStranice
|
||||
BrojArtikala int
|
||||
AktivniServisi int
|
||||
ProdajaOvogMeseca int
|
||||
KriticnaZaliha int
|
||||
PoslednjiServisi []StavkaServisa
|
||||
KriticneZalihe []StavkaZalihe
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{{define "sidebar"}}
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<!-- vrh sidebara — hamburger i logo -->
|
||||
<div class="sidebar-vrh">
|
||||
<button class="hamburger" id="hamburger" aria-label="Otvori/zatvori meni">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="3" y1="6" x2="21" y2="6"/>
|
||||
<line x1="3" y1="12" x2="21" y2="12"/>
|
||||
<line x1="3" y1="18" x2="21" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="logo-zona">
|
||||
{{if .Logo}}
|
||||
<img src="/static/{{.Logo}}" alt="Logo" style="width:36px;height:36px;object-fit:contain;border-radius:6px;">
|
||||
{{else}}
|
||||
<div style="width:36px;height:36px;border-radius:8px;background:rgba(255,255,255,0.1);border:1.5px dashed rgba(255,255,255,0.25);flex-shrink:0;"></div>
|
||||
{{end}}
|
||||
<div>
|
||||
<div class="logo-naziv">{{if .NazivFirme}}{{.NazivFirme}}{{else}}NTech{{end}}</div>
|
||||
<div class="logo-podnazlov">Servis računara</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- navigacija -->
|
||||
<nav class="sidebar-nav" aria-label="Glavna navigacija">
|
||||
<div class="nav-oznaka">Glavni meni</div>
|
||||
|
||||
<a href="/dashboard" class="nav-stavka {{if eq .Stranica "dashboard"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg>
|
||||
<span>Dashboard</span>
|
||||
<span class="nav-tooltip">Dashboard</span>
|
||||
</a>
|
||||
|
||||
<a href="/magacin" class="nav-stavka {{if eq .Stranica "magacin"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>
|
||||
<span>Magacin</span>
|
||||
<span class="nav-tooltip">Magacin</span>
|
||||
</a>
|
||||
|
||||
<a href="/servis" class="nav-stavka {{if eq .Stranica "servis"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>
|
||||
<span>Servis</span>
|
||||
<span class="nav-tooltip">Servis</span>
|
||||
</a>
|
||||
|
||||
<a href="/prodaja" class="nav-stavka {{if eq .Stranica "prodaja"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>
|
||||
<span>Prodaja</span>
|
||||
<span class="nav-tooltip">Prodaja</span>
|
||||
</a>
|
||||
|
||||
<a href="/klijenti" class="nav-stavka {{if eq .Stranica "klijenti"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
|
||||
<span>Klijenti</span>
|
||||
<span class="nav-tooltip">Klijenti</span>
|
||||
</a>
|
||||
|
||||
<a href="/izvestaji" class="nav-stavka {{if eq .Stranica "izvestaji"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>
|
||||
<span>Izveštaji</span>
|
||||
<span class="nav-tooltip">Izveštaji</span>
|
||||
</a>
|
||||
|
||||
<div class="nav-separator"></div>
|
||||
<div class="nav-oznaka">Sistem</div>
|
||||
|
||||
<a href="/podesavanja" class="nav-stavka {{if eq .Stranica "podesavanja"}}aktivan{{end}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
|
||||
<span>Podešavanja</span>
|
||||
<span class="nav-tooltip">Podešavanja</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<!-- dno sidebara -->
|
||||
<div class="sidebar-dno">
|
||||
<a href="/odjava" class="nav-stavka">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
|
||||
<span>Odjava</span>
|
||||
<span class="nav-tooltip">Odjava</span>
|
||||
</a>
|
||||
</div>
|
||||
</aside>
|
||||
{{end}}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{define "topbar"}}
|
||||
<header class="topbar">
|
||||
<span class="topbar-naslov">{{.NaslovStranice}}</span>
|
||||
|
||||
<!-- dugme za promenu teme -->
|
||||
<div style="display:flex;align-items:center;gap:8px;">
|
||||
<a href="/tema/tamna" style="width:20px;height:20px;border-radius:50%;background:#1a1d2e;border:2px solid {{if eq .Tema "tamna"}}#fff{{else}}transparent{{end}};display:inline-block;" title="Tamna"></a>
|
||||
<a href="/tema/svetla" style="width:20px;height:20px;border-radius:50%;background:#f8fafc;border:2px solid {{if eq .Tema "svetla"}}#1a1d2e{{else}}#cbd5e1{{end}};display:inline-block;" title="Svetla"></a>
|
||||
<a href="/tema/zelena" style="width:20px;height:20px;border-radius:50%;background:#0f2818;border:2px solid {{if eq .Tema "zelena"}}#fff{{else}}transparent{{end}};display:inline-block;" title="Zelena"></a>
|
||||
<a href="/tema/ljubicasta" style="width:20px;height:20px;border-radius:50%;background:#1e1535;border:2px solid {{if eq .Tema "ljubicasta"}}#fff{{else}}transparent{{end}};display:inline-block;" title="Ljubičasta"></a>
|
||||
</div>
|
||||
|
||||
<!-- korisnik -->
|
||||
<div style="width:32px;height:32px;border-radius:50%;background:var(--sb-aktivan);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:500;color:#fff;flex-shrink:0;">
|
||||
{{if .Korisnik}}{{slice .Korisnik 0 2}}{{else}}NT{{end}}
|
||||
</div>
|
||||
</header>
|
||||
{{end}}
|
||||
@@ -0,0 +1,76 @@
|
||||
{{template "base" .}}
|
||||
|
||||
{{define "naslov"}}Dashboard — NTech{{end}}
|
||||
|
||||
{{define "sadrzaj"}}
|
||||
<div class="grid grid-cols-4 gap-3 mb-6">
|
||||
<!-- stat kartice -->
|
||||
<div class="kartica">
|
||||
<div style="width:36px;height:36px;border-radius:8px;background:#eff2ff;display:flex;align-items:center;justify-content:center;margin-bottom:10px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#4f7ef8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/></svg>
|
||||
</div>
|
||||
<div style="font-size:22px;font-weight:500;color:var(--tekst-glavni);">{{.BrojArtikala}}</div>
|
||||
<div style="font-size:12px;color:var(--tekst-sporedni);margin-top:4px;">Artikala na stanju</div>
|
||||
</div>
|
||||
|
||||
<div class="kartica">
|
||||
<div style="width:36px;height:36px;border-radius:8px;background:#f0fdf4;display:flex;align-items:center;justify-content:center;margin-bottom:10px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>
|
||||
</div>
|
||||
<div style="font-size:22px;font-weight:500;color:var(--tekst-glavni);">{{.AktivniServisi}}</div>
|
||||
<div style="font-size:12px;color:var(--tekst-sporedni);margin-top:4px;">Aktivnih servisa</div>
|
||||
</div>
|
||||
|
||||
<div class="kartica">
|
||||
<div style="width:36px;height:36px;border-radius:8px;background:#fff7ed;display:flex;align-items:center;justify-content:center;margin-bottom:10px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#ea580c" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/></svg>
|
||||
</div>
|
||||
<div style="font-size:22px;font-weight:500;color:var(--tekst-glavni);">{{.ProdajaOvogMeseca}}</div>
|
||||
<div style="font-size:12px;color:var(--tekst-sporedni);margin-top:4px;">Prodaja ovog meseca</div>
|
||||
</div>
|
||||
|
||||
<div class="kartica">
|
||||
<div style="width:36px;height:36px;border-radius:8px;background:#fef2f2;display:flex;align-items:center;justify-content:center;margin-bottom:10px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
|
||||
</div>
|
||||
<div style="font-size:22px;font-weight:500;color:var(--tekst-glavni);">{{.KriticnaZaliha}}</div>
|
||||
<div style="font-size:12px;color:var(--tekst-sporedni);margin-top:4px;">Kritično niska zaliha</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<!-- poslednji servisi -->
|
||||
<div class="kartica">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;">
|
||||
<span style="font-size:14px;font-weight:500;color:var(--tekst-glavni);">Poslednji servisi</span>
|
||||
<span style="font-size:11px;padding:2px 8px;border-radius:20px;background:#eff2ff;color:#4f7ef8;font-weight:500;">Danas</span>
|
||||
</div>
|
||||
{{range .PoslednjiServisi}}
|
||||
<div style="display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--ivica);">
|
||||
<div style="width:8px;height:8px;border-radius:50%;flex-shrink:0;background:{{.BojaTacke}};"></div>
|
||||
<span style="font-size:13px;color:var(--tekst-glavni);flex:1;">{{.Uredjaj}}</span>
|
||||
<span style="font-size:12px;color:var(--tekst-sporedni);">{{.Status}}</span>
|
||||
</div>
|
||||
{{else}}
|
||||
<div style="font-size:13px;color:var(--tekst-sporedni);padding:8px 0;">Nema servisnih naloga.</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!-- kritične zalihe -->
|
||||
<div class="kartica">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;">
|
||||
<span style="font-size:14px;font-weight:500;color:var(--tekst-glavni);">Kritične zalihe</span>
|
||||
<span style="font-size:11px;padding:2px 8px;border-radius:20px;background:#fffbeb;color:#b45309;font-weight:500;">Upozorenje</span>
|
||||
</div>
|
||||
{{range .KriticneZalihe}}
|
||||
<div style="display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--ivica);">
|
||||
<div style="width:8px;height:8px;border-radius:50%;flex-shrink:0;background:{{.BojaTacke}};"></div>
|
||||
<span style="font-size:13px;color:var(--tekst-glavni);flex:1;">{{.Naziv}}</span>
|
||||
<span style="font-size:12px;color:var(--tekst-sporedni);">{{.Kolicina}} kom</span>
|
||||
</div>
|
||||
{{else}}
|
||||
<div style="font-size:13px;color:var(--tekst-sporedni);padding:8px 0;">Sve zalihe su uredne.</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -0,0 +1,58 @@
|
||||
{{define "base"}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="sr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{block "naslov" .}}NTech{{end}}</title>
|
||||
|
||||
<!-- tema — učitava se prva -->
|
||||
<link rel="stylesheet" href="/static/css/teme/{{.Tema}}.css">
|
||||
|
||||
<!-- glavni stilovi -->
|
||||
<link rel="stylesheet" href="/static/css/main.css">
|
||||
|
||||
<!-- tailwind -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
{{block "dodatni-css" .}}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<div class="raspored">
|
||||
{{template "sidebar" .}}
|
||||
|
||||
<div class="glavni-sadrzaj">
|
||||
{{template "topbar" .}}
|
||||
|
||||
<main class="sadrzaj">
|
||||
{{block "sadrzaj" .}}{{end}}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- alpine.js za interaktivnost -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
|
||||
|
||||
<!-- htmx za komunikaciju sa serverom -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.x.x/dist/htmx.min.js"></script>
|
||||
|
||||
<!-- sidebar logika -->
|
||||
<script>
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const hamburger = document.getElementById('hamburger');
|
||||
|
||||
// učitaj stanje iz localStorage
|
||||
if (localStorage.getItem('sidebar-skupljen') === 'true') {
|
||||
sidebar.classList.add('skupljen');
|
||||
}
|
||||
|
||||
hamburger.addEventListener('click', () => {
|
||||
sidebar.classList.toggle('skupljen');
|
||||
localStorage.setItem('sidebar-skupljen', sidebar.classList.contains('skupljen'));
|
||||
});
|
||||
</script>
|
||||
|
||||
{{block "dodatni-js" .}}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user