diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2019-03-15 23:32:06 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2019-03-15 23:32:06 +0100 |
commit | 7a0cdd41297431fcb515efea98c6ba2bc9a993c8 (patch) | |
tree | bc1328d6d13223444baa436e094a8baac6fa209d /pastepy/templates | |
parent | dcf0e725b2c709a8c5ac6e6ba1311003bfe7e672 (diff) |
Redesign everything with bootstrap 4 and bootswatch themes
Diffstat (limited to 'pastepy/templates')
-rw-r--r-- | pastepy/templates/base.html | 42 | ||||
-rw-r--r-- | pastepy/templates/full.html | 13 | ||||
-rw-r--r-- | pastepy/templates/paste.html | 82 | ||||
-rw-r--r-- | pastepy/templates/view.html | 53 |
4 files changed, 117 insertions, 73 deletions
diff --git a/pastepy/templates/base.html b/pastepy/templates/base.html index e208b6b..bd74a91 100644 --- a/pastepy/templates/base.html +++ b/pastepy/templates/base.html @@ -1,20 +1,30 @@ <!DOCTYPE html> <html lang="en"> - <head> - <title>{{ config.PASTEBIN_NAME }}{% if title %} – {{ title }}{% endif %}</title> - <link rel="StyleSheet" href="{{ url_for('static', filename='paste.css') }}" type="text/css"> -{% block head %} -{% endblock %} - </head> - <body> - <div id="page"> - <div id="page-header"> - <h1><a href="/">{{ title }}</a></h1> - </div> - <div id="page-content"> -{% block content %} -{% endblock %} - </div> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>{{ config.PASTEBIN_NAME }}{% if title %} – {{ title }}{% endif %}</title> + <link rel="StyleSheet" href="{{ url_for('static', filename='css/bootstrap.flatly.min.css') }}" type="text/css" id="bootstrap-css"> + <link rel="StyleSheet" href="{{ url_for('static', filename='css/paste.css') }}" type="text/css" id="pastepy-css"> + <script src="{{ url_for('static', filename='js/theme.js') }}" type="text/javascript"></script> + {% block head %} + {% endblock %} +</head> +<body> + <nav class="navbar navbar-expand-lg navbar-light bg-light"> + <a class="navbar-brand" href="/">{{ config.PASTEBIN_NAME }}</a> + <div class="collapse navbar-collapse" id="navbar-dropdown"> + {% block nav %} + {% endblock %} + <span class="navbar-text"> + <button class="btn btn-sm btn-light" onclick="switch_theme(event)" id="theme-button">Switch theme</button> + </span> </div> - </body> + </nav> + <div class="container{% if title != 'New paste' %}-fluid{% endif %}"> + {% block content %} + {% endblock %} + </div> +</div> +</body> </html> diff --git a/pastepy/templates/full.html b/pastepy/templates/full.html index c60126e..743bed9 100644 --- a/pastepy/templates/full.html +++ b/pastepy/templates/full.html @@ -1,14 +1,17 @@ <!DOCTYPE html> <html lang="en"> <head> - <title>{{ title }}</title> - <link rel="StyleSheet" href="{{ url_for('.highlight_stylesheet') }}" type="text/css"> - <link rel="StyleSheet" href="{{ url_for('static', filename='paste.css') }}" type="text/css"> - <script type="text/javascript" src="{{ url_for('static', filename='view.js') }}"></script> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <title>{{ config.PASTEBIN_NAME }}{% if title %} – {{ title }}{% endif %}</title> + <link rel="StyleSheet" href="{{ url_for('static', filename='css/bootstrap.flatly.min.css') }}" type="text/css" id="bootstrap-css"> + <link rel="StyleSheet" href="{{ url_for('static', filename='css/paste.css') }}" type="text/css" id="pastepy-css"> + <link rel="StyleSheet" href="{{ url_for('.highlight_stylesheet') }}" type="text/css" id="pygments-css"> + <script src="{{ url_for('static', filename='js/theme.js') }}" type="text/javascript"></script> </head> <body> {% if rendered %} -<div class="paste-rendered"> +<div class="container-fluid"> {% endif %} {{ text|safe }} {% if rendered %} diff --git a/pastepy/templates/paste.html b/pastepy/templates/paste.html index ddb321e..6504e9e 100644 --- a/pastepy/templates/paste.html +++ b/pastepy/templates/paste.html @@ -1,34 +1,58 @@ {% extends "base.html" %} {% block head %} - <script src="{{ url_for('static', filename='edit.js') }}" type="text/javascript"></script> + <script src="{{ url_for('static', filename='js/edit.js') }}" type="text/javascript"></script> +{% endblock %} +{% block nav %} +<ul class="navbar-nav mr-auto"> + <li class="nav-item active"><a href="{{ url_for('.paste') }}" class="nav-link">{{ title }}</a></li> +</ul> {% endblock %} {% block content %} - <form action="/paste" method="post" id="pasteform"> - <ul> - <li id="syntaxli"> - <select name="syntax" id="syntax"> - {% for cat, ls in config.LEXERS %} - <optgroup label="{{ cat }}"> - {% for k, v in ls %} - <option value="{{ v }}"{% if v == (session.syntax or config.DEFAULT_SYNTAX) %} selected="selected"{% endif %}>{{ k }}</option> - {% endfor %} - </optgroup> - {% endfor %} - </select> - <input type="checkbox" name="remember_syntax" id="remember_syntax"{% if session.syntax %} checked{% endif %}> - <label for="remember_syntax">Remember syntax</label> - </li> - <li> - <input type="text" name="nick" id="nick" value="{{ session.nick or 'Anonymous' }}"> - <input type="checkbox" name="remember_me" id="remember_me"{% if session.nick %} checked{% endif %}> - <label for="remember_me">Remember me</label> - </li> - <li><input type="text" name="title" id="title" value="Untitled"></li> - <li><textarea rows="15" cols="80" name="text" id="text"></textarea></li> - <li> - <input type="submit" id="pastesubmit" name="type" value="Paste"> - <input type="submit" id="pastesubmit2" name="type" value="Preview"> - </li> - </ul> - </form> +<h1>New paste</h1> +<form action="/paste" method="post" id="pasteform"> + <div class="form-row mb-3"> + <div class="col-auto"> + <select name="syntax" id="syntax" class="custom-select"> + {% for cat, ls in config.LEXERS %} + <optgroup label="{{ cat }}"> + {% for k, v in ls %} + <option value="{{ v }}"{% if v == (session.syntax or config.DEFAULT_SYNTAX) %} selected="selected"{% endif %}>{{ k }}</option> + {% endfor %} + </optgroup> + {% endfor %} + </select> + </div> + <div class="col-auto"> + <div class="custom-control custom-checkbox"> + <input type="checkbox" name="remember_syntax" id="remember_syntax"{% if session.syntax %} checked{% endif %} class="custom-control-input"> + <label for="remember_syntax" class="custom-control-label">Remember syntax</label> + </div> + </div> + </div> + <div class="form-row mb-3"> + <div class="col-auto"> + <input type="text" name="nick" id="nick" value="{{ session.nick }}" class="form-control" placeholder="Name"> + </div> + <div class="col-auto"> + <div class="custom-control custom-checkbox"> + <input type="checkbox" name="remember_me" id="remember_me"{% if session.nick %} checked{% endif %} class="custom-control-input"> + <label for="remember_me" class="custom-control-label">Remember me</label> + </div> + </div> + </div> + <div class="form-row mb-3"> + <div class="col-auto"> + <input type="text" name="title" id="title" class="form-control" placeholder="Title"> + </div> + </div> + <div class="form-row mb-3"> + <div class="col"> + <textarea rows="15" name="text" id="text" class="form-control text-monospace"></textarea> + </div> + </div> + <div class="form-row mb-3"> + <button type="submit" id="pastesubmit" name="type" class="btn btn-primary" value="Paste">Paste</button> + <button type="submit" id="pastesubmit2" name="type" class="btn btn-secondary" value="Preview">Preview</button> + </div> +</form> {% endblock %} diff --git a/pastepy/templates/view.html b/pastepy/templates/view.html index b0b114c..8cf60cd 100644 --- a/pastepy/templates/view.html +++ b/pastepy/templates/view.html @@ -1,28 +1,35 @@ {% extends "base.html" %} {% block head %} - <link rel="StyleSheet" href="{{ url_for('.highlight_stylesheet') }}" type="text/css"> - <script type="text/javascript" src="{{ url_for('static', filename='view.js') }}"></script> + <link rel="StyleSheet" href="{{ url_for('.highlight_stylesheet') }}" type="text/css" id="pygments-css"> + <script type="text/javascript" src="{{ url_for('static', filename='js/view.js') }}"></script> +{% endblock %} +{% block nav %} +<ul class="navbar-nav mr-auto"> + <li class="nav-item"><a href="{{ url_for('.paste') }}" class="nav-link">New paste</a></li> + {% if hash %} + <li class="nav-item active"><a href="{{ url_for('.view_paste', paste_hash=hash) }}" class="nav-link">View {{ pastetitle }}</a></li> + {% endif %} +</ul> {% endblock %} {% block content %} - <p><a href="/">New paste</a></p> - <div id="paste"> - <h3>{{ pastetitle }}</h3> - <div id="info">Pasted by <span id="nick">{{ nick }}</span> on <span id="date">{{date }}</span> - {% if syntax %} as <span id="syntax-type">{{ syntax }}</span>{% endif %} - </div> - <div id="alt-links"> - {% if hash %} - <a href="/raw/{{ hash }}">Download as plain text</a> - — - <a href="/full/{{ hash }}">View in fullscreen</a> - {% endif %} - </div> - {% if rendered %} - <div class="paste-rendered"> - {% endif %} - {{ text|safe }} - {% if rendered %} - </div> - {% endif %} - </div> +<h1>{{ pastetitle }}</h1> +<div class="paste-header"> + <div id="info">Pasted by <span id="nick">{{ nick }}</span> on <span id="date">{{date }}</span> + {% if syntax %} as <span id="syntax-type">{{ syntax }}</span>{% endif %} + </div> + <div id="alt-links"> + {% if hash %} + <a href="/raw/{{ hash }}">Download as plain text</a> + — + <a href="/full/{{ hash }}">View in fullscreen</a> + {% endif %} + </div> +</div> +{% if rendered %} +<div class="paste-rendered"> +{% endif %} +{{ text|safe }} +{% if rendered %} +</div> +{% endif %} {% endblock %} |