Browse Source

Fix homepage css

master
Burathar 4 years ago
parent
commit
26c33e819c
  1. 11
      biscd/biscd/routes.py
  2. 15
      biscd/biscd/static/css/custom.css
  3. 19
      biscd/biscd/templates/base.html
  4. 15
      biscd/biscd/templates/index.html

11
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!')
if current_user.is_authenticated:
project_names = Project.list_names()
return render_template('index.html', form=form, project_names=project_names)
else:
project_names = None
return render_template('index.html', project_names=project_names)
@app.route('/login', methods=['GET', 'POST'])
def login():

15
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;
}
*/

19
biscd/biscd/templates/base.html

@ -12,16 +12,17 @@ @@ -12,16 +12,17 @@
</head>
<body>
<div class="bs-component">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<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="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<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="collapse navbar-collapse" id="navbarColor02">
<div class="navbar-collapse collapse" id="navbarResponsive">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<li class="nav-item">
<a class="nav-link" href="{{ url_for('index') }}">Home
</a>
</li>
@ -51,17 +52,15 @@ @@ -51,17 +52,15 @@
<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>
</nav>
</div>
</div>
</div>
<div class="container">

15
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 %}

Loading…
Cancel
Save