Browse Source

Fix homepage css

master
Burathar 4 years ago
parent
commit
26c33e819c
  1. 13
      biscd/biscd/routes.py
  2. 17
      biscd/biscd/static/css/custom.css
  3. 95
      biscd/biscd/templates/base.html
  4. 17
      biscd/biscd/templates/index.html
  5. 2
      installation-files/users_example.yaml

13
biscd/biscd/routes.py

@ -7,15 +7,12 @@ from .froms import NewProjectForm, LoginForm, RegistrationForm
@app.route('/', methods=['GET', 'POST']) @app.route('/', methods=['GET', 'POST'])
@app.route('/index', methods=['GET', 'POST']) @app.route('/index', methods=['GET', 'POST'])
@login_required
def index(): def index():
form = NewProjectForm() if current_user.is_authenticated:
if form.validate_on_submit(): project_names = Project.list_names()
project = Project.first_or_404(name=form.projectname.data) else:
project.save() project_names = None
flash('You added a project!') return render_template('index.html', project_names=project_names)
project_names = Project.list_names()
return render_template('index.html', form=form, project_names=project_names)
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])
def login(): def login():

17
biscd/biscd/static/css/custom.css

@ -1,3 +1,14 @@
.container { body {
padding-top: 30px padding-top: 120px
} }
/*
.page-header h1 {
padding: 2rem 0;
font-size: 3rem;
}
h2 {
padding: 2rem 0;
}
*/

95
biscd/biscd/templates/base.html

@ -12,56 +12,55 @@
</head> </head>
<body> <body>
<div class="bs-component">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="{{ url_for('index') }}">Biscd</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor02">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{{ url_for('index') }}">Home
</a>
</li>
<!--
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
-->
</ul>
<ul class="navbar-nav pr-3">
{% if current_user.is_anonymous %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('login') }}">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('register') }}">Register</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('logout') }}">Logout</a>
</li>
{% endif %}
</ul> <div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<!-- <div class="container">
<form class="form-inline my-2 my-lg-0"> <a class="navbar-brand" href="{{ url_for('index') }}">Biscd</a>
<input class="form-control mr-sm-2" type="text" placeholder="Search"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button> <span class="navbar-toggler-icon"></span>
</form> </button>
-->
<div class="navbar-collapse collapse" id="navbarResponsive">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index') }}">Home
</a>
</li>
<!--
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
-->
</ul>
<ul class="navbar-nav pr-3">
{% if current_user.is_anonymous %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('login') }}">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ url_for('register') }}">Register</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('logout') }}">Logout</a>
</li>
{% endif %}
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search">
<button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</div> </div>
</nav> </div>
</div>
<div class="container"> <div class="container">

17
biscd/biscd/templates/index.html

@ -1,5 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% import 'bootstrap/wtf.html' as wtf %}
{% block app_content %} {% block app_content %}
<div class="page-header"> <div class="page-header">
@ -10,7 +9,11 @@
</div> </div>
</div> </div>
</div> </div>
{% if project_names %}
<div class="col-lg-12">
<h2 id="typography">Your Projects</h2>
</div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">
<tbody> <tbody>
@ -22,10 +25,8 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% else %}
<div class="row"> <h2>Welcome!</h2>
<div class="col-md-4"> <p>Please <a href="{{ url_for('login') }}">login</a>, or <a href="{{ url_for('register') }}">sign up</a>!</p>
{{ wtf.quick_form(form, button_map={'submit': 'primary'}) }} {% endif %}
</div>
</div>
{% endblock %} {% endblock %}

2
installation-files/users_example.yaml

@ -4,4 +4,4 @@ users:
password_hash: pbkdf2:sha256:150000$uuFRyvLs$ee9863f169db786e82b9e2abe0c2cf3434e925479d0919f3b4046ebbfa0aeb28 password_hash: pbkdf2:sha256:150000$uuFRyvLs$ee9863f169db786e82b9e2abe0c2cf3434e925479d0919f3b4046ebbfa0aeb28
- Carl: - Carl:
email: carl@mail.com email: carl@mail.com
password_hash: pbkdf2:sha256:150000$v4UyXVie$898ba71cdf3adefd7c1b6ed611897a3c8ca3151bd2628b490a052f554bae113e password_hash: pbkdf2:sha256:150000$v4UyXVie$898ba71cdf3adefd7c1b6ed611897a3c8ca3151bd2628b490a052f554bae113e
Loading…
Cancel
Save