1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-09 17:00:27 +00:00
TiddlyWiki5/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid

187 lines
3.8 KiB
Plaintext

title: $:/plugins/tiddlywiki/multiwikiserver/templates/mws-header
<div class="mws-header">
<h1>
<a href="/">
<span class="mws-logo">🏠</span>
</a>
<span class="divider">|</span>
<$text text=<<page-title>>/>
</h1>
<div class="mws-user-info">
<span>Hello, <$text text=<<username>>/></span>
<% if [<user-is-admin>match[yes]] %>
<div class="mws-admin-dropdown">
<button class="mws-admin-dropbtn">⚙️</button>
<div class="mws-admin-dropdown-content">
<form action="/admin/users" method="get" class="mws-admin-form">
<input type="hidden" name="q" value="*" />
<input type="submit" value="Manage Users" class="mws-admin-form-button"/>
</form>
<form action="/admin/roles" method="get" class="mws-admin-form">
<input type="hidden" name="q" value="*" />
<input type="submit" value="Manage Roles" class="mws-admin-form-button"/>
</form>
<form action="/admin/anon" method="post" class="mws-admin-form">
<input type="submit" value="Reconfigure Anonymous Access" class="mws-admin-form-button"/>
</form>
</div>
</div>
<% endif %>
<% if [<user-is-logged-in>match[yes]] %>
<%if [<first-guest-user>match[no]] %>
<%if [<user-is-admin>match[no]] %>
<$set name="userId" value={{{ [<user>jsonget[user_id]] }}}>
<a href={{{ [<userId>addprefix[/admin/users/]] }}}>
<button class="mws-profile-btn">Profile</button>
</a>
</$set>
<% endif %>
<% endif %>
<% endif %>
<% if [<user-is-logged-in>match[yes]] %>
<form action="/logout" method="post" class="mws-logout-form">
<input type="submit" value="Logout" class="mws-logout-button"/>
</form>
<% else %>
<a class="mws-login-btn" href="/login">Login</a>
<% endif %>
</div>
</div>
<style>
.mws-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
background-color: #f0f0f0;
margin-bottom: 20px;
}
.mws-header h1 {
display: flex;
align-items: center;
gap: 10px;
}
.mws-header h1 .divider {
font-size: 16px;
color: #ccc;
}
.mws-user-info {
display: flex;
align-items: center;
}
.mws-logout-form {
margin-left: 10px;
}
.mws-logout-button {
padding: 5px 10px;
background-color: #f44336;
color: white;
border: none;
cursor: pointer;
}
.mws-logout-button:hover {
background-color: #d32f2f;
}
.mws-login-btn {
margin-left: 5px;
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
text-decoration: none;
height: 27px;
width: 62px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.mws-login-btn:hover {
background-color: #388e3c;
}
.mws-admin-dropdown {
position: relative;
display: inline-block;
margin-left: 10px;
}
.mws-admin-dropbtn {
color: white;
padding: 5px;
font-size: 16px;
border: none;
cursor: pointer;
}
.mws-admin-dropbtn:hover, .mws-admin-dropbtn:focus {
cursor: pointer;
opacity: 0.8;
}
.mws-admin-dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
right: 0;
}
.mws-admin-dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.mws-admin-dropdown-content a:hover {background-color: #ddd;}
.mws-admin-dropdown:hover .mws-admin-dropdown-content {display: block;}
.mws-admin-dropdown:hover {background-color: #2980B9;}
.mws-profile-btn {
background-color: #2980B9;
margin-left: 10px;
color: white;
border: none;
cursor: pointer;
padding: 5px 10px;
}
.mws-admin-form {
margin: 0;
}
.mws-admin-form-button {
width: 100%;
text-align: left;
padding: 12px 16px;
background: none;
border: none;
color: black;
cursor: pointer;
font-size: inherit;
}
.mws-admin-form-button:hover {
background-color: #ddd;
}
.mws-logo {
font-size: 24px;
}
</style>