Compare commits

...

2 Commits

Author SHA1 Message Date
b4bd86ed44 View for submitting additionale place images 2020-09-26 09:48:06 +02:00
277cac323e CSS for adding and deleting images 2020-09-26 09:47:34 +02:00
5 changed files with 100 additions and 18 deletions

View File

@ -1588,23 +1588,56 @@ body {
border: none; } border: none; }
.LP-ImageGrid__Container { .LP-ImageGrid__Container {
gap: 10px; } gap: 10px; }
.LP-ImageGrid .LP-ImageGrid__Item, .LP-ImageGrid .LP-ImageGrid__Item * { .LP-ImageGrid__Item {
overflow: hidden; position: relative; }
word-break: break-all; } .LP-ImageGrid__Item, .LP-ImageGrid__Item * {
.LP-ImageGrid .LP-ImageGrid__Item img { overflow: hidden;
width: 100%; word-break: break-all; }
height: 100%; .LP-ImageGrid__Item img {
object-fit: cover; } width: 100%;
.LP-ImageGrid .LP-ImageGrid__Item--left img { height: 100%;
object-position: left; } object-fit: cover; }
.LP-ImageGrid .LP-ImageGrid__Item--center img { .LP-ImageGrid__Item--left img {
object-position: center; } object-position: left; }
.LP-ImageGrid .LP-ImageGrid__Item--top img { .LP-ImageGrid__Item--center img {
object-position: top; } object-position: center; }
.LP-ImageGrid .LP-ImageGrid__Item--bottom img { .LP-ImageGrid__Item--top img {
object-position: botom; } object-position: top; }
.LP-ImageGrid .LP-ImageGrid__Item--center img { .LP-ImageGrid__Item--bottom img {
object-position: center; } object-position: botom; }
.LP-ImageGrid__Item--center img {
object-position: center; }
.LP-ImageGrid__Item--add .LP-Link {
width: 100%;
height: 100%;
position: relative;
display: block;
background: #f9f9f9; }
.LP-ImageGrid__Item--add .LP-Link .LP-Icon {
width: 35px;
height: 35px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%); }
.LP-ImageGrid__DeleteItem {
opacity: 0.7;
visibility: hidden;
position: absolute;
top: 10px;
right: 10px;
background-color: #C09F80;
border-radius: 50%;
height: 35px;
width: 35px; }
.LP-ImageGrid__DeleteItem .LP-Link .LP-Icon {
height: 20px;
width: 20px;
position: relative;
left: 8.33333px;
top: 8.33333px; }
.LP-ImageGrid__Item > .LP-Link:hover + .LP-ImageGrid__DeleteItem, .LP-ImageGrid__DeleteItem:hover {
visibility: visible; }
.LP-MainContainer { .LP-MainContainer {
margin: 0 auto; margin: 0 auto;

View File

@ -0,0 +1,28 @@
{% extends 'global.html'%}
{% block maincontent %}
<form class="LP-Form" method="POST" enctype="multipart/form-data">
<fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Submit images to an place</legend>
{% csrf_token %}
<div class="LP-Form__Composition">
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.filename %}
</div>
</div>
<div class="LP-Form__Composition LP-Form__Composition--buttons">
<div class="LP-Form__Field LP-Form__Button LP-Input">
<button class="LP-Button">Submitt</button>
</div>
<div class="LP-Form__Field LP-Form__Button LP-Input">
<a class="LP-Link" href="{% url 'place_list' %}">
<button type="button" class="LP-Button LP-Button--cancel">Cancel</button>
</a>
</div>
</div>
</fieldset>
</form>
{% endblock maincontent %}

View File

@ -13,6 +13,7 @@ from lostplaces.views import (
PlaceTagSubmitView, PlaceTagSubmitView,
PhotoAlbumCreateView, PhotoAlbumCreateView,
PhotoAlbumDeleteView, PhotoAlbumDeleteView,
PlaceImageCreateView,
FlatView FlatView
) )
@ -25,6 +26,7 @@ urlpatterns = [
path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'), path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'),
path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'), path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'),
path('place/', PlaceListView.as_view(), name='place_list'), path('place/', PlaceListView.as_view(), name='place_list'),
path('place_image/create/<int:place_id>', PlaceImageCreateView.as_view(), name='place_image_create'),
path('flat/<slug:slug>/', FlatView, name='flatpage'), path('flat/<slug:slug>/', FlatView, name='flatpage'),
# POST-only URLs for tag submission # POST-only URLs for tag submission

View File

@ -3,4 +3,5 @@
from lostplaces.views.base_views import * from lostplaces.views.base_views import *
from lostplaces.views.views import * from lostplaces.views.views import *
from lostplaces.views.place_views import * from lostplaces.views.place_views import *
from lostplaces.views.place_image_views import *

View File

@ -0,0 +1,18 @@
from django.views import View
from django.shortcuts import get_object_or_404
from lostplaces.views.base_views import PlaceAssetCreateView
from lostplaces.models import PlaceImage, Place
class PlaceImageCreateView(PlaceAssetCreateView):
model = PlaceImage
fields = ['filename']
template_name = 'place_image/place_image_create.html'
success_message = 'Place Images submitted'
def post(self, request, place_id, *args, **kwargs):
place = get_object_or_404(Place, pk=place_id)
super().post(request, place_id)
self.object.place = place
self.object = self.request.user
self.object.save()