2023-03-09 23:31:58 +00:00
|
|
|
{% extends 'layout.html' %}
|
2023-03-25 16:22:32 +00:00
|
|
|
{% block nav_groups %}selected{% endblock %}
|
2023-03-26 01:04:13 +00:00
|
|
|
{% block head %}
|
|
|
|
<style>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% if images %}
|
2023-03-26 01:04:13 +00:00
|
|
|
.banner-content p {
|
|
|
|
color: {{ text_colour }} !important;
|
|
|
|
}
|
|
|
|
.banner-content h1 {
|
|
|
|
color: {{ text_colour }} !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.banner-filter {
|
|
|
|
background: linear-gradient(to right, rgb({{ images.0.image_colours.0.0 }}, {{ images.0.image_colours.0.1 }}, {{ images.0.image_colours.0.2 }}), transparent) !important;
|
|
|
|
}
|
|
|
|
@media (max-width: 800px) {
|
|
|
|
.banner-filter {
|
|
|
|
background: linear-gradient(to bottom, rgb({{ images.0.image_colours.0.0 }}, {{ images.0.image_colours.0.1 }}, {{ images.0.image_colours.0.2 }}), transparent) !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<div class="banner {% if not images %}small{% endif %}">
|
|
|
|
{% if not images %}
|
2023-03-10 17:38:24 +00:00
|
|
|
<div class="banner-content">
|
2023-03-26 01:04:13 +00:00
|
|
|
<h1>{{ group.name }}</h1>
|
|
|
|
<p>By {{ group.author_username }}</p>
|
2023-03-10 17:38:24 +00:00
|
|
|
</div>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% else %}
|
2023-03-26 01:04:13 +00:00
|
|
|
<img
|
|
|
|
src="/api/file/{{ images.0.file_name }}?r=1920x1080"
|
|
|
|
onload="imgFade(this)"
|
|
|
|
style="opacity:0;"
|
|
|
|
/>
|
|
|
|
<span class="banner-filter" ></span>
|
2023-03-10 17:38:24 +00:00
|
|
|
<div class="banner-content">
|
2023-03-11 22:14:03 +00:00
|
|
|
<p>By {{ group.author_username }} - {{ images|length }} Images</p>
|
2023-03-26 01:04:13 +00:00
|
|
|
<h1>{{ group.name }}</h1>
|
|
|
|
<p>{{ group.description }}</p>
|
2023-03-10 17:38:24 +00:00
|
|
|
</div>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
2023-03-10 17:38:24 +00:00
|
|
|
<form id="modifyGroup">
|
|
|
|
<input type="text" name="group" placeholder="group id" value="{{ group.id }}">
|
|
|
|
<input type="text" name="image" placeholder="image id">
|
2023-03-09 23:31:58 +00:00
|
|
|
<input type="text" name="action" placeholder="add/remove" value="add">
|
|
|
|
<button type="submit">Submit</button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
{% if images %}
|
|
|
|
<div class="gallery-grid">
|
|
|
|
{% for image in images %}
|
|
|
|
<a id="image-{{ image.id }}" class="gallery-item" href="{{ url_for('group.group_post', group_id=group.id, image_id=image.id) }}" style="background-color: rgb({{ image.image_colours.0.0 }}, {{ image.image_colours.0.1 }}, {{ image.image_colours.0.2 }})">
|
2023-03-11 22:14:03 +00:00
|
|
|
<div class="image-filter">
|
|
|
|
<p class="image-subtitle"></p>
|
|
|
|
<p class="image-title"><span class="time">{{ image.created_at }}</span></p>
|
|
|
|
</div>
|
|
|
|
<img alt="{{ image.post_alt }}" data-src="{{ image.file_name }}" onload="imgFade(this)" style="opacity:0;" id="lazy-load"/>
|
2023-03-09 23:31:58 +00:00
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="big-text">
|
2023-03-26 01:04:13 +00:00
|
|
|
<h1>*crickets chirping*</h1>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% if g.user %}
|
2023-03-26 01:04:13 +00:00
|
|
|
<p>Add some images to the group!</p>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% else %}
|
2023-03-26 01:04:13 +00:00
|
|
|
<p>Login to start managing this image group!</p>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block script %}
|
2023-03-10 17:38:24 +00:00
|
|
|
<script>
|
|
|
|
// /api/group/modify
|
|
|
|
|
|
|
|
modForm = document.querySelector('#modifyGroup');
|
|
|
|
|
|
|
|
modForm.addEventListener('submit', function (event) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
|
|
|
formData.append('group', modForm.group.value);
|
|
|
|
formData.append('image', modForm.image.value);
|
|
|
|
formData.append('action', modForm.action.value);
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: '/api/group/modify',
|
|
|
|
type: 'POST',
|
|
|
|
data: formData,
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
success: function (data) {
|
|
|
|
addNotification('Image added to group', 1);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
2023-03-09 23:31:58 +00:00
|
|
|
{% endblock %}
|