Compare commits
No commits in common. "47718ce17b805a7c3395aa6aee1d461235661b66" and "69f0f4ccfdf4a084a6850622358023d2e0f33848" have entirely different histories.
47718ce17b
...
69f0f4ccfd
@ -51,8 +51,4 @@ class PlaceImageCreateForm(forms.ModelForm):
|
||||
|
||||
|
||||
class TagSubmitForm(forms.Form):
|
||||
tag_list = forms.CharField(
|
||||
max_length=500,
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={'autocomplete':'off'})
|
||||
)
|
||||
tag_list = forms.CharField(max_length=500, required=False)
|
@ -1472,8 +1472,7 @@ body {
|
||||
line-height: inherit;
|
||||
position: relative;
|
||||
white-space: pre-wrap;
|
||||
margin-left: 15px;
|
||||
height: 1em; }
|
||||
margin-left: 15px; }
|
||||
|
||||
.tagify__tag__removeBtn {
|
||||
order: 5;
|
||||
|
@ -3,25 +3,14 @@
|
||||
{% for tag in tag_list %}
|
||||
<li class="LP-TagList__Item">
|
||||
<div class="LP-Tag">
|
||||
<a href="#" class="LP-Link">
|
||||
</a>
|
||||
<span class="LP-Link__Text">{{tag}}</span>
|
||||
<a href="{% url config.delete_url_name tagged_id=config.tagged_item.id tag_id=tag.id %}" class="LP-Link">
|
||||
<span class="LP-Tag__Remove RV-Iconized__Container RV-Iconized__Container--extraSmall">
|
||||
<svg class="RV-Iconized__Icon" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z">
|
||||
</path>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
<p class="LP-Paragraph">{{tag}}</p>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="id_tag_submit_form" class="LP-Form LP-Form--inline LP-Form--tagging" method="POST" action="{{config.submit_url}}">
|
||||
<form id="id_tag_submit_form" class="LP-Form LP-Form--inline LP-Form--tagging" method="POST" action="{{url}}">
|
||||
<fieldset class="LP-Form__Fieldset">
|
||||
<legend class="LP-Form__Legend">Tags hinzufügen</legend>
|
||||
{% csrf_token %}
|
||||
@ -30,14 +19,14 @@
|
||||
<button id="id_tag_submit_button" class="LP-Button"> Tags hinzufügen</button>
|
||||
</div>
|
||||
<div class="LP-Form__Field">
|
||||
{% include 'partials/form/inputField.html' with field=config.submit_form.tag_list classes="LP-Input--tagging" %}
|
||||
{% include 'partials/form/inputField.html' with field=input_field classes="LP-Input--tagging" %}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const input = document.getElementById('{{config.submit_form.tag_list.auto_id}}')
|
||||
const input = document.getElementById('{{input_field.auto_id}}')
|
||||
const submit_form = document.getElementById('id_tag_submit_form')
|
||||
const submit_button = document.getElementById('id_tag_submit_button')
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
<section class="LP-Section">
|
||||
|
||||
{% url 'place_tag_submit' place_id=place.id as tag_submit_url%}
|
||||
{% include 'partials/tagging.html' with tag_list=place.tags.all config=tagging_config all_tags=all_tags %}
|
||||
{% include 'partials/tagging.html' with tag_list=place.tags.all url=tag_submit_url input_field=tagging_form.tag_list%}
|
||||
|
||||
</section>
|
||||
|
||||
|
@ -9,8 +9,7 @@ from .views import (
|
||||
PlaceDeleteView,
|
||||
PhotoAlbumCreateView,
|
||||
PhotoAlbumDeleteView,
|
||||
PlaceTagSubmitView,
|
||||
PlaceTagDeleteView
|
||||
PlaceTagSubmitView
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
@ -25,5 +24,4 @@ urlpatterns = [
|
||||
path('place/', PlaceListView.as_view(), name='place_list'),
|
||||
# POST-only URL for tag submission
|
||||
path('place/tag/<int:place_id>', PlaceTagSubmitView.as_view(), name='place_tag_submit'),
|
||||
path('place/tag/delete/<int:tagged_id>/<int:tag_id>', PlaceTagDeleteView.as_view(), name='place_tag_delete')
|
||||
]
|
||||
|
@ -33,13 +33,8 @@ class PlaceDetailView(IsAuthenticated, View):
|
||||
'place': place,
|
||||
'place_list': [ place ],
|
||||
'place_map_center': [ place.latitude, place.longitude ],
|
||||
'all_tags': Tag.objects.all(),
|
||||
'tagging_config': {
|
||||
'submit_url': reverse_lazy('place_tag_submit', kwargs={'place_id': place.id}),
|
||||
'submit_form': TagSubmitForm(),
|
||||
'tagged_item': place,
|
||||
'delete_url_name': 'place_tag_delete'
|
||||
}
|
||||
'tagging_form': TagSubmitForm(),
|
||||
'all_tags': Tag.objects.all()
|
||||
}
|
||||
return render(request, 'place/place_detail.html', context)
|
||||
|
||||
|
@ -5,7 +5,6 @@ from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.contrib import messages
|
||||
from django.urls import reverse_lazy
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import HttpResponseForbidden
|
||||
|
||||
from lostplaces_app.forms import ExplorerCreationForm, TagSubmitForm
|
||||
from lostplaces_app.models import Place, PhotoAlbum
|
||||
@ -13,11 +12,8 @@ from lostplaces_app.views.base_views import IsAuthenticated
|
||||
|
||||
from lostplaces_app.views.base_views import (
|
||||
PlaceAssetCreateView,
|
||||
PlaceAssetDeleteView,
|
||||
PlaceAssetDeleteView
|
||||
)
|
||||
|
||||
from taggit.models import Tag
|
||||
|
||||
class SignUpView(SuccessMessageMixin, CreateView):
|
||||
form_class = ExplorerCreationForm
|
||||
success_url = reverse_lazy('login')
|
||||
@ -60,10 +56,3 @@ class PlaceTagSubmitView(IsAuthenticated, View):
|
||||
place.save()
|
||||
|
||||
return redirect(reverse_lazy('place_detail', kwargs={'pk': place.id}))
|
||||
|
||||
class PlaceTagDeleteView(IsAuthenticated, View):
|
||||
def get(self, request, tagged_id, tag_id, *args, **kwargs):
|
||||
place = Place.objects.get(pk=tagged_id)
|
||||
tag = Tag.objects.get(pk=tag_id)
|
||||
place.tags.remove(tag)
|
||||
return redirect(reverse_lazy('place_detail', kwargs={'pk': tagged_id}))
|
Loading…
Reference in New Issue
Block a user