Skip to content

Commit

Permalink
Patched default frontend to be able to run as alternate one
Browse files Browse the repository at this point in the history
  • Loading branch information
tailhook committed Jan 17, 2018
1 parent 8b81efd commit 58b87b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import {Router} from 'khufu-routing'

import {main} from './main.khufu'

let router = new Router(window);
let prefix = []
if(window.location.pathname.charAt(1) == '~') {
// check different site root
prefix = [window.location.pathname.split('/', 2)[1]]
console.log("Running as frontend named", prefix)
}
let router = new Router(window, prefix);
let khufu_instance = attach(document.getElementById('app'),
main(router, VERSION), {
store(reducer, middleware, state) {
Expand Down
14 changes: 7 additions & 7 deletions frontend/main.khufu
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ view _navbar(status, frontend_version, @expert_mode, router):
<nav.navbar.navbar-default>
<div.container-fluid>
<div.navbar-header>
<a.navbar-brand.red?(status.debug_force_leader) href="/">
<a.navbar-brand.red?(status.debug_force_leader) href=router.rel('/')>
"Verwalter"
if status.debug_force_leader:
<div.subtext.red>
Expand All @@ -46,32 +46,32 @@ view _navbar(status, frontend_version, @expert_mode, router):
<div.collapse.navbar-collapse>
<ul.nav.navbar-nav>
<li.active?(router.at('roles'))>
<a href="/roles">
<a href=router.rel("/roles")>
link {click} go(event) -> @router
"Roles"
if status:
` [${status.roles}]`
<li.active?(router.at('peers'))>
<a href="/peers">
<a href=router.rel("/peers")>
link {click} go(event) -> @router
"Servers"
if status:
` [${status.peers}]`
<li.active?(router.at('services'))>
<a href="/services">
<a href=router.rel("/services")>
link {click} go(event) -> @router
"Services"
<li.active?(router.at('api_links'))>
<a href="/api_links">
<a href=router.rel("/api_links")>
link {click} go(event) -> @router
"API Links"
<li.active?(router.at('logs'))>
<a href="/logs">
<a href=router.rel("/logs")>
link {click} go(event) -> @router
"Logs"
if @expert_mode:
<li.active?(router.at('backups'))>
<a href="/backups">
<a href=router.rel("/backups")>
link {click} go(event) -> @router
"Backups"
<ul.nav.navbar-nav.navbar-right>
Expand Down

0 comments on commit 58b87b7

Please sign in to comment.