Adding Upload page

Added templates for main pages
Updated Nav urls
Made error page prettier
This commit is contained in:
Michał 2023-01-09 21:07:02 +00:00
parent f730ecd0c9
commit c3096a8ca3
12 changed files with 138 additions and 36 deletions

30
app.py
View file

@ -74,10 +74,40 @@ def internal_server_error(e):
def home():
return render_template('home.html')
@app.route('/group')
def group():
return render_template('group.html', group_id='gwa gwa')
@app.route('/group/<group_id>')
def group_id(group_id):
try:
group_id = int(group_id)
except ValueError:
abort(404)
return render_template('group.html', group_id=group_id)
@app.route('/upload')
def upload():
return render_template('upload.html')
@app.route('/profile')
def profile():
return render_template('profile.html', user_id='gwa gwa')
@app.route('/profile/<user_id>')
def profile_id(user_id):
try:
user_id = int(user_id)
except ValueError:
abort(404)
return render_template('profile.html', user_id=user_id)
@app.route('/settings')
def settings():
return render_template('settings.html')
@app.route('/image/<request_id>')
def image(request_id):
# Check if request_id is valid

View file

@ -61,32 +61,4 @@ class Sassy():
print("Copied fonts to:", dest)
except Exception as e:
print("Failed to copy fonts!\nFull error:", e)
sys.exit(1)
#print ("Removing old fonts from:", dest)
#for old in os.listdir(dest):
# dir = os.path.join(dest , old)
#
# try:
# if os.path.isfile(dir) or os.path.islink(dir):
# os.unlink(dir)
# print("Removed:", old)
# elif os.path.isdir(dir):
# shutil.rmtree(dir)
# print("Removed:", old)
# except Exception as e:
# print("Failed to remove:", dir)
# print("Full error:", e)
#print ("Loading new fonts")
#for font in os.listdir(font_path):
# dir = os.path.join(font_path, dest)
# new_dir = os.path.join(dest, font)
#
# try:
# if os.path.isfile(dir):
# shutil.copy(dir, new_dir)
# print("Copied font:", font)
# except Exception as e:
# print("Failed to copy font:", font)
# print("Full error:", e)
sys.exit(1)

View file

@ -4,7 +4,7 @@
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<div class="app err-warning">
<h1>{{error}}</h1>
<p>{{msg}}</p>
</div>

11
templates/group.html Normal file
View file

@ -0,0 +1,11 @@
{% extends 'layout.html' %}
{% block content %}
<header>
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<h1>Image Group</h1>
<p>{{group_id}}</p>
</div>
{% endblock %}

View file

@ -21,7 +21,7 @@
<span>Home</span>
</a>
<a href="{{url_for('home')}}">
<a href="{{url_for('group')}}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -4 24 24" width="24" fill="currentColor">
<path d="M17 4H9.415l-.471-1.334A1.001 1.001 0 0 0 8 2H3a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zm-6.17-2H17a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3h5c1.306 0 2.417.835 2.83 2z"></path>
</svg>
@ -36,14 +36,14 @@
</a>
</div>
<div>
<a href="{{url_for('home')}}">
<a href="{{url_for('profile')}}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
<path d="M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-14a4 4 0 0 1 4 4v2a4 4 0 1 1-8 0V8a4 4 0 0 1 4-4zm0 2a2 2 0 0 0-2 2v2a2 2 0 1 0 4 0V8a2 2 0 0 0-2-2zM5.91 16.876a8.033 8.033 0 0 1-1.58-1.232 5.57 5.57 0 0 1 2.204-1.574 1 1 0 1 1 .733 1.86c-.532.21-.993.538-1.358.946zm8.144.022a3.652 3.652 0 0 0-1.41-.964 1 1 0 1 1 .712-1.868 5.65 5.65 0 0 1 2.284 1.607 8.032 8.032 0 0 1-1.586 1.225z"></path>
</svg>
<span>Profile</span>
</a>
<a href="{{url_for('home')}}">
<a href="{{url_for('settings')}}">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -2 24 24" width="24" fill="currentColor">
<path d="M9.815 3.094a3.467 3.467 0 0 1-2.78-1.09l-.084-.001a3.467 3.467 0 0 1-2.781 1.09 3.477 3.477 0 0 1-1.727 2.51 3.471 3.471 0 0 1 0 2.794 3.477 3.477 0 0 1 1.727 2.51 3.467 3.467 0 0 1 2.78 1.09h.084a3.467 3.467 0 0 1 2.78-1.09 3.477 3.477 0 0 1 1.727-2.51 3.471 3.471 0 0 1 0-2.794 3.477 3.477 0 0 1-1.726-2.51zM14 5.714a1.474 1.474 0 0 0 0 2.572l-.502 1.684a1.473 1.473 0 0 0-1.553 2.14l-1.443 1.122A1.473 1.473 0 0 0 8.143 14l-2.304-.006a1.473 1.473 0 0 0-2.352-.765l-1.442-1.131A1.473 1.473 0 0 0 .5 9.968L0 8.278a1.474 1.474 0 0 0 0-2.555l.5-1.69a1.473 1.473 0 0 0 1.545-2.13L3.487.77A1.473 1.473 0 0 0 5.84.005L8.143 0a1.473 1.473 0 0 0 2.358.768l1.444 1.122a1.473 1.473 0 0 0 1.553 2.14L14 5.714zm-5.812 9.198a7.943 7.943 0 0 0 2.342-.73 3.468 3.468 0 0 1-.087.215 3.477 3.477 0 0 1 1.727 2.51 3.467 3.467 0 0 1 2.78 1.09h.084a3.467 3.467 0 0 1 2.78-1.09 3.477 3.477 0 0 1 1.727-2.51 3.471 3.471 0 0 1 0-2.794 3.477 3.477 0 0 1-1.726-2.51 3.467 3.467 0 0 1-2.78-1.09h-.084l-.015.016a8.077 8.077 0 0 0 .002-2.016L16.144 6a1.473 1.473 0 0 0 2.358.768l1.444 1.122a1.473 1.473 0 0 0 1.553 2.14L22 11.714a1.474 1.474 0 0 0 0 2.572l-.502 1.684a1.473 1.473 0 0 0-1.553 2.14l-1.443 1.122a1.473 1.473 0 0 0-2.359.768l-2.304-.006a1.473 1.473 0 0 0-2.352-.765l-1.442-1.131a1.473 1.473 0 0 0-1.545-2.13l-.312-1.056zM7 10a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm8 8a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path>
</svg>

11
templates/profile.html Normal file
View file

@ -0,0 +1,11 @@
{% extends 'layout.html' %}
{% block content %}
<header>
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<h1>User</h1>
<p>{{user_id}}</p>
</div>
{% endblock %}

10
templates/settings.html Normal file
View file

@ -0,0 +1,10 @@
{% extends 'layout.html' %}
{% block content %}
<header>
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<h1>Settings</h1>
</div>
{% endblock %}

View file

@ -6,7 +6,45 @@
</header>
<div class="app">
<h1>Upload!!!!!</h1>
<div id="upload" class="upload"></div>
<div id="upload" class="upload">
<form action="{{ url_for('upload') }}" method="post" enctype="multipart/form-data"
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-5 -5 24 24" width="24" fill="currentColor">
<path d="M8 3.414v5.642a1 1 0 1 1-2 0V3.414L4.879 4.536A1 1 0 0 1 3.464 3.12L6.293.293a1 1 0 0 1 1.414 0l2.829 2.828A1 1 0 1 1 9.12 4.536L8 3.414zM1 12h12a1 1 0 0 1 0 2H1a1 1 0 0 1 0-2z"></path>
</svg>
<input type="file" name="file" id="file" class="inputfile"/>
</span>
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -2 24 24" width="24" fill="currentColor">
<path d="M14 8.322V2H2v12h3.576l3.97-5.292A3 3 0 0 1 14 8.322zm0 3.753l-1.188-2.066a1 1 0 0 0-1.667-.101L8.076 14H14v-1.925zM14 16H2v2h12v-2zM2 0h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm4 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"></path>
</svg>
<input type="text" name="alt" placeholder="alt" />
</span>
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" width="24" fill="currentColor">
<path d="M5.72 14.456l1.761-.508 10.603-10.73a.456.456 0 0 0-.003-.64l-.635-.642a.443.443 0 0 0-.632-.003L6.239 12.635l-.52 1.82zM18.703.664l.635.643c.876.887.884 2.318.016 3.196L8.428 15.561l-3.764 1.084a.901.901 0 0 1-1.11-.623.915.915 0 0 1-.002-.506l1.095-3.84L15.544.647a2.215 2.215 0 0 1 3.159.016zM7.184 1.817c.496 0 .898.407.898.909a.903.903 0 0 1-.898.909H3.592c-.992 0-1.796.814-1.796 1.817v10.906c0 1.004.804 1.818 1.796 1.818h10.776c.992 0 1.797-.814 1.797-1.818v-3.635c0-.502.402-.909.898-.909s.898.407.898.91v3.634c0 2.008-1.609 3.636-3.593 3.636H3.592C1.608 19.994 0 18.366 0 16.358V5.452c0-2.007 1.608-3.635 3.592-3.635h3.592z"></path>
</svg>
<input type="text" name="description" placeholder="description" />
</span>
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -3 24 24" width="24" fill="currentColor">
<path d="M11.586 15.071L13 13.657l1.414 1.414 6.165-6.165 1.09-3.552-2.484-2.483-1.079.336-1.598-1.598L18.591.96a2 2 0 0 1 2.008.496l2.483 2.483a2 2 0 0 1 .498 2L22.345 9.97l-7.93 7.93-2.83-2.828zM14.236.75l2.482 2.483a2 2 0 0 1 .498 2l-1.235 4.028-7.93 7.931-7.78-7.778L8.17 1.516 12.227.254a2 2 0 0 1 2.008.496zM3.1 9.414l4.95 4.95 6.164-6.165 1.09-3.552-2.484-2.483-3.585 1.115L3.1 9.414zm7.424-2.475a1.5 1.5 0 1 1 2.121-2.121 1.5 1.5 0 0 1-2.12 2.121zm6.886 1.022l.782-2.878c.45.152.755.325.917.518a1.5 1.5 0 0 1-.185 2.113c-.29.244-.795.326-1.514.247z"></path>
</svg>
<input type="text" name="tags" placeholder="tags" />
</span>
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -4 24 24" width="24" fill="currentColor">
<path d="M10.83 2H17a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3h5c1.306 0 2.417.835 2.83 2zM17 4H9.415l-.471-1.334A1.001 1.001 0 0 0 8 2H3a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1z"></path><path d="M1 5h18v2H1z"></path>
</svg>
<input type="checkbox" name="group" placeholder="group" />
</span>
<input type="submit" value="Upload" name="submit" />
</form>
</div>
</div>
<script>

View file

@ -55,6 +55,35 @@
}
}
.err-warning {
min-height: 60vh;
gap: 0;
h1 {
margin: 0 auto;
padding: 0;
font-family: $font-header;
font-size: 5rem;
font-weight: 900;
line-height: 1;
color: $green;
}
p {
margin: 0 auto;
padding: 0;
font-family: $font-body;
font-size: 2rem;
font-weight: 600;
line-height: 1;
color: $white100;
}
}
.gallery {
margin: 0;
padding: 0;

View file

@ -54,7 +54,7 @@ nav {
span {
margin: 0;
padding: 0.5rem 1rem;
padding: 0.5rem 0.75rem;
display: block;

View file

@ -1,5 +1,6 @@
* {
box-sizing: border-box;
line-height: 1;
}
html,

View file

@ -12,7 +12,7 @@ $green: #8C977D;
$blue: #8DA3B9;
$purple: #A988B0;
$rad: 8px;
$rad: 3px;
$font-header: "Work Sans", sans-serif;
$font-body: "Work Sans", sans-serif;