Added materialize, started process for login page.
This commit is contained in:
parent
a408fb003b
commit
bd4ee67144
17 changed files with 21641 additions and 26 deletions
13
app.py
13
app.py
|
@ -1,6 +1,8 @@
|
|||
from .lib.helpers import get_static_paths, get_content_text
|
||||
from flask import Flask, render_template, redirect, url_for, request
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if(request.method == 'POST'):
|
||||
|
@ -9,15 +11,14 @@ def login():
|
|||
else:
|
||||
return redirect(url_for('home'))
|
||||
elif(request.method == 'GET'):
|
||||
return render_template('login.html', error=None)
|
||||
return render_template('login/index.html', static_paths=get_static_paths(), content_text=get_content_text())
|
||||
return 'ERROR: Invalid method.'
|
||||
|
||||
|
||||
@app.route("/", methods=['GET'])
|
||||
def hello():
|
||||
homepage_text_file = open('static/assets/homepage.txt')
|
||||
homepage_text = homepage_text_file.readlines()
|
||||
homepage_text.remove('\n')
|
||||
return render_template('homepage.html', homepage_text=homepage_text)
|
||||
return render_template('homepage.html', static_paths=get_static_paths(), content_text=get_content_text())
|
||||
|
||||
|
||||
def main():
|
||||
app.run(host='0.0.0.0', debug=True)
|
||||
app.run(host='0.0.0.0', debug=True)
|
||||
|
|
0
assets/login/content.txt
Normal file
0
assets/login/content.txt
Normal file
0
lib/__init__.py
Normal file
0
lib/__init__.py
Normal file
17
lib/helpers.py
Normal file
17
lib/helpers.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from flask import request
|
||||
|
||||
def get_content_text():
|
||||
if(str(request.url_rule == '/')):
|
||||
homepage_text_file = open('assets/content.txt')
|
||||
homepage_text_file = open(f'assets{request.url_rule}/content.txt')
|
||||
homepage_text = homepage_text_file.readlines()
|
||||
try:
|
||||
homepage_text.remove('\n')
|
||||
except:
|
||||
pass
|
||||
return homepage_text
|
||||
|
||||
def get_static_paths():
|
||||
if(str(request.url_rule) == '/'):
|
||||
return (f'static/css/index.css', f'static/js/index.js')
|
||||
return (f'static/css{request.url_rule}/index.css', f'static/js{request.url_rule}/index.js')
|
BIN
static/assets/favicon.png
Executable file
BIN
static/assets/favicon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
0
static/css/login/index.css
Normal file
0
static/css/login/index.css
Normal file
0
static/js/login/index.js
Normal file
0
static/js/login/index.js
Normal file
21
static/materialize/LICENSE
Normal file
21
static/materialize/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018 Materialize
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
91
static/materialize/README.md
Normal file
91
static/materialize/README.md
Normal file
|
@ -0,0 +1,91 @@
|
|||
<p align="center">
|
||||
<a href="http://materializecss.com/">
|
||||
<img src="http://materializecss.com/res/materialize.svg" width="150">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3 align="center">MaterializeCSS</h3>
|
||||
|
||||
<p align="center">
|
||||
Materialize, a CSS Framework based on material design.
|
||||
<br>
|
||||
<a href="http://materializecss.com/"><strong>-- Browse the docs --</strong></a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://travis-ci.org/Dogfalo/materialize">
|
||||
<img src="https://travis-ci.org/Dogfalo/materialize.svg?branch=master" alt="Travis CI badge">
|
||||
</a>
|
||||
<a href="https://badge.fury.io/js/materialize-css">
|
||||
<img src="https://badge.fury.io/js/materialize-css.svg" alt="npm version badge">
|
||||
</a>
|
||||
<a href="https://cdnjs.com/libraries/materialize">
|
||||
<img src="https://img.shields.io/cdnjs/v/materialize.svg" alt="CDNJS version badge">
|
||||
</a>
|
||||
<a href="https://david-dm.org/Dogfalo/materialize">
|
||||
<img src="https://david-dm.org/Dogfalo/materialize/status.svg" alt="dependencies Status badge">
|
||||
</a>
|
||||
<a href="https://david-dm.org/Dogfalo/materialize#info=devDependencies">
|
||||
<img src="https://david-dm.org/Dogfalo/materialize/dev-status.svg" alt="devDependency Status badge">
|
||||
</a>
|
||||
<a href="https://gitter.im/Dogfalo/materialize">
|
||||
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter badge">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Table of Contents
|
||||
- [Quickstart](#quickstart)
|
||||
- [Documentation](#documentation)
|
||||
- [Supported Browsers](#supported-browsers)
|
||||
- [Changelog](#changelog)
|
||||
- [Testing](#testing)
|
||||
- [Contributing](#contributing)
|
||||
- [Copyright and license](#copyright-and-license)
|
||||
|
||||
## Quickstart:
|
||||
Read the [getting started guide](http://materializecss.com/getting-started.html) for more information on how to use materialize.
|
||||
|
||||
- [Download the latest release](https://github.com/Dogfalo/materialize/releases/latest) of materialize directly from GitHub. ([Beta](https://github.com/Dogfalo/materialize/releases/))
|
||||
- Clone the repo: `git clone https://github.com/Dogfalo/materialize.git` (Beta: `git clone -b v1-dev https://github.com/Dogfalo/materialize.git`)
|
||||
- Include the files via [cdnjs](https://cdnjs.com/libraries/materialize). More [here](http://materializecss.com/getting-started.html). ([Beta](https://cdnjs.com/libraries/materialize/1.0.0-beta))
|
||||
- Install with [npm](https://www.npmjs.com): `npm install materialize-css` (Beta: `npm install materialize-css@next`)
|
||||
- Install with [Bower](https://bower.io): `bower install materialize` ([DEPRECATED](https://bower.io/blog/2017/how-to-migrate-away-from-bower/))
|
||||
- Install with [Atmosphere](https://atmospherejs.com): `meteor add materialize:materialize` (Beta: `meteor add materialize:materialize@=1.0.0-beta`)
|
||||
|
||||
## Documentation
|
||||
The documentation can be found at <http://materializecss.com>. To run the documentation locally on your machine, you need [Node.js](https://nodejs.org/en/) installed on your computer.
|
||||
|
||||
### Running documentation locally
|
||||
Run these commands to set up the documentation:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Dogfalo/materialize
|
||||
cd materialize
|
||||
npm install
|
||||
```
|
||||
|
||||
Then run `grunt monitor` to compile the documentation. When it finishes, open a new browser window and navigate to `localhost:8000`. We use [BrowserSync](https://www.browsersync.io/) to display the documentation.
|
||||
|
||||
### Documentation for previous releases
|
||||
Previous releases and their documentation are available for [download](https://github.com/Dogfalo/materialize/releases).
|
||||
|
||||
## Supported Browsers:
|
||||
Materialize is compatible with:
|
||||
|
||||
- Chrome 35+
|
||||
- Firefox 31+
|
||||
- Safari 9+
|
||||
- Opera
|
||||
- Edge
|
||||
- IE 11+
|
||||
|
||||
## Changelog
|
||||
For changelogs, check out [the Releases section of materialize](https://github.com/Dogfalo/materialize/releases) or the [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## Testing
|
||||
We use Jasmine as our testing framework and we're trying to write a robust test suite for our components. If you want to help, [here's a starting guide on how to write tests in Jasmine](CONTRIBUTING.md#jasmine-testing-guide).
|
||||
|
||||
## Contributing
|
||||
Check out the [CONTRIBUTING document](CONTRIBUTING.md) in the root of the repository to learn how you can contribute. You can also browse the [help-wanted](https://github.com/Dogfalo/materialize/labels/help-wanted) tag in our issue tracker to find things to do.
|
||||
|
||||
## Copyright and license
|
||||
Code Copyright 2018 Materialize. Code released under the MIT license.
|
9067
static/materialize/css/materialize.css
vendored
Normal file
9067
static/materialize/css/materialize.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
13
static/materialize/css/materialize.min.css
vendored
Normal file
13
static/materialize/css/materialize.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
12374
static/materialize/js/materialize.js
vendored
Normal file
12374
static/materialize/js/materialize.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
static/materialize/js/materialize.min.js
vendored
Normal file
6
static/materialize/js/materialize.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,18 +1,19 @@
|
|||
{% extends 'index.html' %}
|
||||
|
||||
{% block homepage_header %}
|
||||
<div class="card-panel grey darken-3">
|
||||
<header>
|
||||
<h1 class="blue-grey-text text-lighten-5 center">
|
||||
UwU Me!!
|
||||
</h1>
|
||||
</header>
|
||||
</div>
|
||||
{% block header %}
|
||||
<h1 class="blue-grey-text text-lighten-5 center">
|
||||
UwU Me!
|
||||
</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block homepage_info %}
|
||||
{% block content %}
|
||||
<div class="card-panel grey darken-3">
|
||||
{% for item in homepage_text %}
|
||||
<div class="center">
|
||||
<a class="waves-effect waves-light btn blue darken-2" href="/login">
|
||||
Login
|
||||
</a>
|
||||
</div>
|
||||
{% for item in content_text %}
|
||||
<p class="blue-grey-text text-lighten-5">
|
||||
{{ item }}
|
||||
</p>
|
||||
|
|
|
@ -2,19 +2,23 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
|
||||
/>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="static/css/index.css" />
|
||||
<script type="text/javascript" src="static/js/index.js"></script>
|
||||
<link rel="icon" type="image/png" href="static/assets/favicon.png" />
|
||||
<link rel="stylesheet" href="static/materialize/css/materialize.min.css" />
|
||||
<script src="static/materialize/js/materialize.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static_paths[0] }}" />
|
||||
<script type="text/javascript" src="{{ static_paths[1] }}"></script>
|
||||
</head>
|
||||
<body class="grey darken-4">
|
||||
<title>UwU Me!</title>
|
||||
<title>UwU Me!{{ optional_title_status }}</title>
|
||||
<div class="container">
|
||||
{% block homepage_header %}{% endblock %}
|
||||
{% block homepage_info %}{% endblock %}
|
||||
<a href="/">
|
||||
<div class="card-panel grey darken-3">
|
||||
<header>
|
||||
{% block header %}{% endblock %}
|
||||
</header>
|
||||
</div>
|
||||
</a>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
20
templates/login/index.html
Normal file
20
templates/login/index.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends 'index.html' %}
|
||||
|
||||
{% block header %}
|
||||
<h1 class="blue-grey-text text-lighten-5 center">
|
||||
UwU Me!
|
||||
</h1>
|
||||
<h5 class="grey-text text-lighten-1 center">
|
||||
Login Page
|
||||
</h5>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card-panel grey darken-3">
|
||||
{% for item in content_text %}
|
||||
<p class="blue-grey-text text-lighten-5">
|
||||
{{ item }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
Reference in a new issue