This commit is contained in:
Michał Gdula 2022-12-01 18:48:31 +00:00
parent 98adc6af4a
commit 4279ebed00
11 changed files with 980 additions and 0 deletions

10
templates/error.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"/>
</header>
<div class="app">
<h1>{{error}}</h1>
<p>{{msg}}</p>
</div>
{% endblock %}

33
templates/home.html Normal file
View file

@ -0,0 +1,33 @@
{% extends 'layout.html' %}
{% block content %}
<header>
<img src="{{ url_for('static', filename='images/leaves.jpg') }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<h1 style="margin-bottom: 1rem">Gallery</h1>
<div id="gallery" class="gallery"></div>
</div>
<script>
$.ajax({
url: '/fileList',
type: 'get',
success: function(response) {
for (var i = 0; i < response.length; i++) {
var imgDiv = `
<a class="gallery__item" href="/image/${i}">
<div class="gallery__item-info">
<p>${i}</p>\
<h2>${response[i]}</h2>
</div>
<span class="gallery__item-filter"></span>
<img class="gallery__item-image" src="/file/${response[i]}" onload="imgFade(this)" style="display:none;"/>
</a>
`;
$(imgDiv).hide().appendTo('#gallery').fadeIn(250);
}
}
});
</script>
{% endblock %}

16
templates/image.html Normal file
View file

@ -0,0 +1,16 @@
{% extends 'layout.html' %}
{% block content %}
<header>
<img src="/file/{{ fileName }}" alt="leaves"/>
<span></span>
</header>
<div class="app">
<div class="image__container">
<img class="image__item" src="/file/{{ fileName }}" onload="imgFade(this)" style="display:none;"/>
</div>
<div class="image__info">
<h2>{{ fileName }}</h2>
<p>{{ id }}</p>
</div>
</div>
{% endblock %}

57
templates/layout.html Normal file
View file

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gallery</title>
<link rel="stylesheet" href="{{url_for('static', filename='css/style.css')}}" defer>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous">
</script>
<script src="https://unpkg.com/phosphor-icons" defer></script>
</head>
<body>
<nav>
<div>
<a href="{{ url_for('home') }}"><i class="ph-house-line-fill"></i><span>Home</span></a>
<a href=""><i class="ph-package-fill"></i><span>Groups</span></a>
<a href=""><i class="ph-upload-fill"></i><span>Upload</span></a>
</div>
<div>
<a href=""><i class="ph-user-circle-fill"></i><span>Profile</span></a>
<a href=""><i class="ph-gear-fill"></i><span>Settings</span></a>
</div>
</nav>
<main>
{% block content %}
{% endblock %}
<i class="ph-arrow-circle-up-fill" id="topButton"></i>
</main>
<script>
document.onscroll = function() {
document.querySelector('header').style.opacity = `${1 - window.scrollY / 169}`;
document.querySelector('header').style.height = `calc(40vh + ${window.scrollY / 5}px)`;
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
document.querySelector('#topButton').style.opacity = 1;
document.querySelector('#topButton').style.right = "1rem";
} else {
document.querySelector('#topButton').style.opacity = 0;
document.querySelector('#topButton').style.right = "-3rem";
}
}
document.querySelector('#topButton').onclick = function() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
function imgFade(obj) {
$(obj).fadeIn(1000);
}
</script>
</body>
</html>