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

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

@ -1,3 +1,14 @@ @@ -1,3 +1,14 @@
.container {
padding-top: 30px
}
body {
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 @@ @@ -12,56 +12,55 @@
</head>
<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>
<!--
<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 class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="{{ url_for('index') }}">Biscd</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</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>
</nav>
</div>
</div>
<div class="container">

17
biscd/biscd/templates/index.html

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

2
installation-files/users_example.yaml

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