Added Fixed Sidenav implementation for guildnav

This commit is contained in:
Jeremy Zhang 2018-05-07 19:17:58 +00:00
parent 5da061a3d5
commit 2feec0e597
4 changed files with 66 additions and 32 deletions

View File

@ -89,7 +89,8 @@ def guild_embed(guild_id):
css=customcss,
cssvariables=parse_css_variable(customcss),
same_target=request.args.get("sametarget", False) == "true",
userscalable=request.args.get("userscalable", "True").lower().startswith("t")
userscalable=request.args.get("userscalable", "True").lower().startswith("t"),
fixed_sidenav=request.args.get("fixedsidenav", "False").lower().startswith("t")
)
abort(404)

View File

@ -11,6 +11,22 @@ QUERY_PARAMETERS = [
"description": "Instead of having the top channel as the first channel your users see, you may change it. Enable Discord's Developer mode in the Appearances tab of the User Settings and copy the channel ID. Here is a <a href=\"https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-server-ID-\" target=\"_blank\">tutorial</a> on obtaining the channel ID.",
"example": "1234567890",
},
{
"name": "fixedsidenav",
"type": "boolean",
"description": "Always show the left server navigation sidebar on large screens.",
"example": "true",
"options": [
{
"name": "true",
"default": False,
},
{
"name": "false",
"default": True,
},
],
},
{
"name": "lang",
"type": "language",

View File

@ -33,6 +33,21 @@ html {
font-family: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif;
}
@media (min-width: 992px) {
body.fixed-sidenav #overall-main-content, body.fixed-sidenav #overall-main-content nav, body.fixed-sidenav #overall-main-content footer {
margin-left: auto;
width: calc(100% - 300px);
}
body.fixed-sidenav #overall-main-content #message-spinner {
left: calc(50% + 150px);
}
body.fixed-sidenav #guild-nav {
z-index: 995;
}
}
main {
min-height: calc(100vh - 80px);
overflow-x: hidden;

View File

@ -47,28 +47,43 @@
{% endif %}
</style>
</head>
<body>
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper">
<a href="#" data-activates="guild-nav" class="button-collapse" id="guild-btn"><i class="material-icons">menu</i></a>
<div class="container">
<a href="{{ url_for("index") }}" target="_blank" class="brand-logo"><img src="{{ url_for('static', filename='img/titanembeds_shield.png') }}" /><span class="brand-logo-text"><strong class="align-top">Titan</strong><span class="align-top">Embeds</span> <span class="betatag align-top">BETA</span></span></a>
<body {% if fixed_sidenav %}class="fixed-sidenav"{% endif %}>
<div id="overall-main-content">
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper">
<a href="#" data-activates="guild-nav" class="button-collapse {% if fixed_sidenav %}hide-on-large-only{% endif %}" id="guild-btn"><i class="material-icons">menu</i></a>
<div class="container">
<a href="{{ url_for("index") }}" target="_blank" class="brand-logo"><img src="{{ url_for('static', filename='img/titanembeds_shield.png') }}" /><span class="brand-logo-text"><strong class="align-top">Titan</strong><span class="align-top">Embeds</span> <span class="betatag align-top">BETA</span></span></a>
</div>
<a href="#" data-activates="members-nav" class="button-collapse right" id="members-btn"><i class="material-icons">people</i></a>
</div>
<a href="#" data-activates="members-nav" class="button-collapse right" id="members-btn"><i class="material-icons">people</i></a>
</div>
</nav>
</div>
<main>
<div id="message-spinner" class="sk-double-bounce">
<div class="sk-child sk-double-bounce1"></div>
<div class="sk-child sk-double-bounce2"></div>
</nav>
</div>
<main>
<div id="message-spinner" class="sk-double-bounce">
<div class="sk-child sk-double-bounce1"></div>
<div class="sk-child sk-double-bounce2"></div>
</div>
<div id="chatcontent" class="chatcontent"></div>
</main>
<div id="chatcontent" class="chatcontent"></div>
</main>
<ul id="guild-nav" class="side-nav">
<footer id="footer" class="footer">
<div id="footercontainer" class="footercontainer">
<div class="currentuserchip" id="nameplate">
<div id="currentuserimage_parent"><img id="currentuserimage" src="" class="circle currentuserimage" style="display: none;"></div>
<div id="currentusername" class="currentusername"><span id="curuser_name">Titan</span><span id="curuser_discrim">#0001</span></div>
</div>
<div id="messageboxouter" class="input-field inline">
<textarea placeholder="Enter message" id="messagebox" type="text" class="materialize-textarea wdt-emoji-open-on-colon" rows="1"></textarea>
<span id="visitor_mode_message" style="display:none;"><span id="visitor_mode_message_note">{{ _("Please login to post a message.") }}</span> <a id="visitor_login_btn" class="waves-effect waves-light btn">{{ _("Login") }}</a></span>
</div>
</div>
</footer>
</div>
<ul id="guild-nav" class="side-nav {% if fixed_sidenav %}fixed{% endif %}">
<li>
<div class="userView">
<img id="guild_icon" class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}" {% if not guild['icon'] %}style="display: none;"{% endif %}>
@ -292,19 +307,6 @@
</div>
</div>
<footer id="footer" class="footer">
<div id="footercontainer" class="footercontainer">
<div class="currentuserchip" id="nameplate">
<div id="currentuserimage_parent"><img id="currentuserimage" src="" class="circle currentuserimage" style="display: none;"></div>
<div id="currentusername" class="currentusername"><span id="curuser_name">Titan</span><span id="curuser_discrim">#0001</span></div>
</div>
<div id="messageboxouter" class="input-field inline">
<textarea placeholder="Enter message" id="messagebox" type="text" class="materialize-textarea wdt-emoji-open-on-colon" rows="1"></textarea>
<span id="visitor_mode_message" style="display:none;"><span id="visitor_mode_message_note">{{ _("Please login to post a message.") }}</span> <a id="visitor_login_btn" class="waves-effect waves-light btn">{{ _("Login") }}</a></span>
</div>
</div>
</footer>
<!-- Electron fix -->
<script>
if (typeof module === "object") {