feat(templates): Add new MDL based index page
This commit is contained in:
parent
d0d3777eaa
commit
eaf1c46ba8
3 changed files with 157 additions and 36 deletions
|
@ -203,7 +203,8 @@ fn start_http_server(base_url: String,
|
|||
.resource("/oidc/login", |r| r.method(Method::GET).with(login))
|
||||
.resource("/oidc/callback", |r| r.method(Method::POST).with3(callback))
|
||||
.static_file("/static/highlight.css", include_bytes!("../static/highlight.css"))
|
||||
.static_file("/static/highlight.js", include_bytes!("../static/highlight.js"));
|
||||
.static_file("/static/highlight.js", include_bytes!("../static/highlight.js"))
|
||||
.static_file("/static/styles.css", include_bytes!("../static/styles.css"));
|
||||
|
||||
if require_login {
|
||||
app.middleware(RequireLogin)
|
||||
|
|
92
static/styles.css
Normal file
92
static/styles.css
Normal file
|
@ -0,0 +1,92 @@
|
|||
* :not(.material-icons) {
|
||||
font-family: 'Ubuntu', sans-serif !important;
|
||||
}
|
||||
|
||||
.cvs-title, .thread-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.thread-list-item:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.thread-link {
|
||||
padding: 5px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.thread-title {
|
||||
padding-right: 15vw;
|
||||
}
|
||||
|
||||
.search-field {
|
||||
margin-right: 15px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.thread-author {
|
||||
font-style: italic;
|
||||
font-size: 85%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) {
|
||||
.converse main {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.mdl-list__item-text-body {
|
||||
max-height: 40px;
|
||||
}
|
||||
|
||||
.mdl-list__item-primary-content:after {
|
||||
border-bottom: 1px solid rgba(0,0,0,.13);
|
||||
content:"";
|
||||
position: absolute;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.converse .mdl-layout__header-row {
|
||||
padding-left: 40px;
|
||||
}
|
||||
.converse .mdl-layout.is-small-screen .mdl-layout__header-row h3 {
|
||||
font-size: inherit;
|
||||
}
|
||||
.converse .mdl-card {
|
||||
height: auto;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
.converse .mdl-card > * {
|
||||
height: auto;
|
||||
}
|
||||
.converse .mdl-card .mdl-card__supporting-text {
|
||||
margin: 40px;
|
||||
-webkit-flex-grow: 1;
|
||||
-ms-flex-positive: 1;
|
||||
flex-grow: 1;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
width: calc(100% - 80px);
|
||||
}
|
||||
.mdl-demo.converse .mdl-card__supporting-text h4 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.converse .mdl-card__actions {
|
||||
margin: 0;
|
||||
padding: 4px 40px;
|
||||
color: inherit;
|
||||
}
|
||||
.converse section.section--center {
|
||||
max-width: 860px;
|
||||
}
|
|
@ -2,44 +2,72 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self';">
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
<title>Converse Index</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||||
<title>Converse: Index</title>
|
||||
|
||||
<!-- TODO -->
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src https://code.getmdl.io 'self';">
|
||||
<!-- <link rel="shortcut icon" href="images/favicon.png"> -->
|
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue_grey-orange.min.css" />
|
||||
<link rel="stylesheet" href="/static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-light bg-light justify-content-between mb-3">
|
||||
<a class="navbar-brand" href="/">
|
||||
<h2>Converse</h2>
|
||||
</a>
|
||||
<form class="form-inline" method="get" action="/search">
|
||||
<input class="form-control mr-sm-2" type="search" placeholder="Search" name="query" aria-label="Search">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit">Search</button>
|
||||
<a class="btn btn-outline-secondary my-2" href="/thread/new">New thread</a>
|
||||
<body class="converse mdl-base mdl-color-text--grey-700 mdl-color--grey-100">
|
||||
<div class="mdl-layout mdl-layout--fixed-header mdl-js-layout mdl-color--grey-100">
|
||||
<header class="mdl-layout__header mdl-layout__header--scroll mdl-color--primary-dark">
|
||||
<div class="mdl-layout__header-row">
|
||||
<a href="/" class="mdl-layout-title mdl-color-text--blue-grey-50 cvs-title">Converse</a>
|
||||
<div class="mdl-layout-spacer"></div>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdl-color-text--blue-grey-50 search-field">
|
||||
<form method="get" action="/search">
|
||||
<input class="mdl-textfield__input" type="search" id="search-query" aria-label="Search" name="query">
|
||||
<label class="mdl-textfield__label mdl-color-text--blue-grey-100" for="search-query">Search query...</label>
|
||||
<input type="submit" hidden /> <!-- TODO: necessary? -->
|
||||
</form>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="list-group">
|
||||
{% for thread in threads -%}
|
||||
<a href="/thread/{{ thread.id }}" class="list-group-item list-group-item-action flex-column align-items-start {%- if thread.sticky %} bg-secondary text-white {% endif -%}">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<h5 class="mb-1">{% if thread.sticky %}<span class="badge badge-light">Sticky</span> {% endif %}{{ thread.title | safe }}</h5>
|
||||
<small class="{% if thread.sticky %}text-white{% else %}text-muted{% endif %}">{{ thread.posted }}</small>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<p class="mb-1">Created by {{ thread.author_name }}</p>
|
||||
<small>Last post by {{ thread.post_author }}</small>
|
||||
</div>
|
||||
|
||||
<a href="/thread/new">
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect">
|
||||
New Thread
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<main class="mdl-layout__content">
|
||||
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
|
||||
<div class="mdl-card mdl-cell mdl-cell--12-col">
|
||||
<div class="mdl-card__supporting-text mdl-grid">
|
||||
<h4 class="mdl-cell mdl-cell--12-col">Latest threads:</h4>
|
||||
<ul class="mdl-list">
|
||||
{% for thread in threads -%}
|
||||
<li class="mdl-list__item thread-list-item mdl-list__item--three-line">
|
||||
<a class="thread-link mdl-color-text--grey-800" href="/thread/{{ thread.id }}">
|
||||
|
||||
<span class="mdl-list__item-primary-content {% if not loop.last %}thread-divider{% endif %}">
|
||||
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored mdl-list__item-icon">
|
||||
<i class="material-icons">{% if thread.sticky -%} announcement {%- else -%} library_books{% endif %}</i>
|
||||
</button>
|
||||
<span class="thread-title">{{ thread.title | safe }}<span class="thread-author"> by {{ thread.author_name }}</span></span>
|
||||
<span class="mdl-list__item-text-body">
|
||||
Last reply by {{ thread.post_author }} on {{ thread.posted }}.
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="mdl-mini-footer">
|
||||
<div class="mdl-mini-footer--right-section">
|
||||
<p>Powered by <a href="https://github.com/tazjin/converse">Converse</a></p>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue