Compare commits

..

No commits in common. "47718ce17b805a7c3395aa6aee1d461235661b66" and "69f0f4ccfdf4a084a6850622358023d2e0f33848" have entirely different histories.

7 changed files with 11 additions and 45 deletions

View File

@ -51,8 +51,4 @@ class PlaceImageCreateForm(forms.ModelForm):
class TagSubmitForm(forms.Form): class TagSubmitForm(forms.Form):
tag_list = forms.CharField( tag_list = forms.CharField(max_length=500, required=False)
max_length=500,
required=False,
widget=forms.TextInput(attrs={'autocomplete':'off'})
)

View File

@ -1472,8 +1472,7 @@ body {
line-height: inherit; line-height: inherit;
position: relative; position: relative;
white-space: pre-wrap; white-space: pre-wrap;
margin-left: 15px; margin-left: 15px; }
height: 1em; }
.tagify__tag__removeBtn { .tagify__tag__removeBtn {
order: 5; order: 5;

View File

@ -3,25 +3,14 @@
{% for tag in tag_list %} {% for tag in tag_list %}
<li class="LP-TagList__Item"> <li class="LP-TagList__Item">
<div class="LP-Tag"> <div class="LP-Tag">
<a href="#" class="LP-Link"> <p class="LP-Paragraph">{{tag}}</p>
</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>
</div> </div>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </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"> <fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Tags hinzufügen</legend> <legend class="LP-Form__Legend">Tags hinzufügen</legend>
{% csrf_token %} {% csrf_token %}
@ -30,14 +19,14 @@
<button id="id_tag_submit_button" class="LP-Button"> Tags hinzufügen</button> <button id="id_tag_submit_button" class="LP-Button"> Tags hinzufügen</button>
</div> </div>
<div class="LP-Form__Field"> <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>
</div> </div>
</fieldset> </fieldset>
</form> </form>
<script> <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_form = document.getElementById('id_tag_submit_form')
const submit_button = document.getElementById('id_tag_submit_button') const submit_button = document.getElementById('id_tag_submit_button')

View File

@ -40,7 +40,7 @@
<section class="LP-Section"> <section class="LP-Section">
{% url 'place_tag_submit' place_id=place.id as tag_submit_url%} {% 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> </section>

View File

@ -9,8 +9,7 @@ from .views import (
PlaceDeleteView, PlaceDeleteView,
PhotoAlbumCreateView, PhotoAlbumCreateView,
PhotoAlbumDeleteView, PhotoAlbumDeleteView,
PlaceTagSubmitView, PlaceTagSubmitView
PlaceTagDeleteView
) )
urlpatterns = [ urlpatterns = [
@ -25,5 +24,4 @@ urlpatterns = [
path('place/', PlaceListView.as_view(), name='place_list'), path('place/', PlaceListView.as_view(), name='place_list'),
# POST-only URL for tag submission # POST-only URL for tag submission
path('place/tag/<int:place_id>', PlaceTagSubmitView.as_view(), name='place_tag_submit'), 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')
] ]

View File

@ -33,13 +33,8 @@ class PlaceDetailView(IsAuthenticated, View):
'place': place, 'place': place,
'place_list': [ place ], 'place_list': [ place ],
'place_map_center': [ place.latitude, place.longitude ], 'place_map_center': [ place.latitude, place.longitude ],
'all_tags': Tag.objects.all(), 'tagging_form': TagSubmitForm(),
'tagging_config': { 'all_tags': Tag.objects.all()
'submit_url': reverse_lazy('place_tag_submit', kwargs={'place_id': place.id}),
'submit_form': TagSubmitForm(),
'tagged_item': place,
'delete_url_name': 'place_tag_delete'
}
} }
return render(request, 'place/place_detail.html', context) return render(request, 'place/place_detail.html', context)

View File

@ -5,7 +5,6 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.contrib import messages from django.contrib import messages
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.http import HttpResponseForbidden
from lostplaces_app.forms import ExplorerCreationForm, TagSubmitForm from lostplaces_app.forms import ExplorerCreationForm, TagSubmitForm
from lostplaces_app.models import Place, PhotoAlbum 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 ( from lostplaces_app.views.base_views import (
PlaceAssetCreateView, PlaceAssetCreateView,
PlaceAssetDeleteView, PlaceAssetDeleteView
) )
from taggit.models import Tag
class SignUpView(SuccessMessageMixin, CreateView): class SignUpView(SuccessMessageMixin, CreateView):
form_class = ExplorerCreationForm form_class = ExplorerCreationForm
success_url = reverse_lazy('login') success_url = reverse_lazy('login')
@ -60,10 +56,3 @@ class PlaceTagSubmitView(IsAuthenticated, View):
place.save() place.save()
return redirect(reverse_lazy('place_detail', kwargs={'pk': place.id})) 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}))