feat(templates): Add new MDL-themed search result view

This commit is contained in:
Vincent Ambo 2018-05-21 23:50:02 +02:00 committed by Vincent Ambo
parent ef15752b59
commit ff697ff792
2 changed files with 69 additions and 43 deletions

View file

@ -131,3 +131,9 @@ html, body {
.converse .reply-box { .converse .reply-box {
padding-top: 10px; padding-top: 10px;
} }
.search-result {
margin: 8px;
}
.search-result .mdl-button {
margin: 3px;
}

View file

@ -1,47 +1,67 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="script-src 'self';"> <title>Converse: Search results</title>
<!-- 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"> <!-- TODO -->
<title>Converse Index</title> <meta http-equiv="Content-Security-Policy" content="script-src https://code.getmdl.io 'self';">
</head> <!-- <link rel="shortcut icon" href="images/favicon.png"> -->
<body>
<header> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu">
<nav class="navbar navbar-light bg-light justify-content-between mb-3"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<a class="navbar-brand" href="/"> <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.blue_grey-orange.min.css" />
<h2>Converse</h2> <link rel="stylesheet" href="/static/styles.css">
</a> </head>
<form class="form-inline" method="get" action="/search"> <body class="converse mdl-base mdl-color-text--grey-700 mdl-color--grey-100">
<input class="form-control mr-sm-2" type="search" placeholder="Search" name="query" aria-label="Search"> <div class="mdl-layout mdl-layout--fixed-header mdl-js-layout mdl-color--grey-100">
<button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit">Search</button> <header class="mdl-layout__header mdl-layout__header--scroll mdl-color--primary-dark">
<a class="btn btn-outline-secondary my-2" href="/thread/new">New thread</a> <div class="mdl-layout__header-row">
<a class="btn btn-outline-secondary my-2" href="/">Back to index</a> <a href="/" class="mdl-layout-title mdl-color-text--blue-grey-50 cvs-title">Converse</a>
</form> <div class="mdl-layout-spacer"></div>
</nav> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdl-color-text--blue-grey-50 search-field">
</header> <form method="get" action="/search">
<div class="container"> <input class="mdl-textfield__input" type="search" id="search-query" aria-label="Search" name="query">
<div class="row"> <label class="mdl-textfield__label mdl-color-text--blue-grey-100" for="search-query">Search query...</label>
<div class="col-4"> <input type="submit" hidden />
<h2>Search results for '{{ query }}':</h2> </form>
</div>
&nbsp;
<a href="/">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect">
Back to index
</button>
</a>
</div>
</header>
<main class="mdl-layout__content">
<section class="section--center mdl-grid">
<div class="mdl-cell--12-col">
<h4>Search results for '{{ query }}':</h4>
</div>
{% for result in results %}
<div class="mdl-card mdl-cell--6-col search-result mdl-shadow--2dp">
<div class="mdl-card__supporting-text">
<p>Posted in '{{ result.title }}' by {{ result.author }}:</p>
<p>{{ result.headline | safe }}</p>
</div>
<div class="mdl-card__actions mdl-card--border post-actions">
<div class="mdl-layout-spacer"></div>
<a class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored" href="/thread/{{ result.thread_id }}#post-{{ result.post_id }}">
<i class="material-icons">arrow_forward</i>
</a>
</div>
</div>
{% endfor %}
</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> </div>
</div> <script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<div class="row"> </body>
<div class="col-12">
<div class="list-group">
{% for result in results -%}
<a href="/thread/{{ result.thread_id }}#post-{{ result.post_id }}" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<p class="mb-1">{{ result.headline | safe }}</p>
<small class="float-right text-muted"><i>(Posted in '{{ result.title }}' by {{ result.author }})</i></small>
</div>
</a>
{%- endfor %}
</div>
</div>
</div>
</div>
</body>
</html> </html>