Bug bei Standard-Ansicht gelöst
Direktes veröffentlichen bei Standards geht jetzt, wird aber auf false gesetzt, sollte der User nicht über ausreichende Rechte verfügen.
This commit is contained in:
parent
8458b456d9
commit
67d8e40595
Binary file not shown.
Binary file not shown.
|
|
@ -16,9 +16,10 @@ class StandardAddStandard(forms.ModelForm):
|
|||
"name" : "Titel",
|
||||
"area" : "Übergeordneter Bereich",
|
||||
"task" : "Aufgabenbereich",
|
||||
"content": "Inhalt"
|
||||
"content": "Inhalt",
|
||||
"public" : "Direkt veröffentlichen?"
|
||||
}
|
||||
fields = ['name', 'area', 'task', 'content']
|
||||
fields = ['name', 'area', 'task', 'content', 'public']
|
||||
'''
|
||||
|
||||
Hier werden die Elemente für die DropDowns erstellt, damit
|
||||
|
|
@ -39,11 +40,11 @@ class StandardAddStandard(forms.ModelForm):
|
|||
self.fields['task'].queryset = Tasks.objects.filter(area__id=areaid).order_by('name')
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
|
||||
elif self.instance.pk:
|
||||
self.fields['task'].queryset = Tasks.objects.none()
|
||||
|
||||
|
||||
|
||||
class StandardAddStandardEditor(forms.ModelForm):
|
||||
|
||||
#content = forms.CharField(widget=CKEditorWidget())
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
{{normalForm|crispy}}
|
||||
|
||||
|
||||
<p>Wenn ein Standard erstellt wurde, kann er nur von einer Person mit dem Recht <i>Standards bearbeiten und freischalten</i> veröffentlicht werden.</p>
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'standard-add' %} ">Standard anlegen</button>
|
||||
|
|
@ -37,5 +35,4 @@ $(document).ready(function() {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
||||
|
|
|
|||
|
|
@ -101,12 +101,16 @@
|
|||
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
|
||||
{% if standard.public %}
|
||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
|
||||
{% if perms.users.standard_management %}
|
||||
{% if standard.public %}
|
||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if standard.created_standard_by == request.user or perms.users.standard_management %}
|
||||
<a class="dropdown-item" href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
|
||||
{% endif %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="{% url 'standard-delete' standard.pk %}" >Löschen</a>
|
||||
</div>
|
||||
|
|
@ -116,6 +120,7 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -53,10 +53,16 @@ def StandardAdd(request):
|
|||
new_standard.task = normalForm.cleaned_data['task']
|
||||
new_standard.area = normalForm.cleaned_data['area']
|
||||
new_standard.name = normalForm.cleaned_data['name']
|
||||
new_standard.content = editorForm.cleaned_data['content']
|
||||
new_standard.content = editorForm.cleaned_data['content']
|
||||
new_standard.public = normalForm.cleaned_data['public']
|
||||
new_standard.save()
|
||||
tempstandardname = normalForm.cleaned_data['name']
|
||||
messages.success(request, f'Standard {tempstandardname} hinzugefügt! Dieser muss noch veröffentlicht werden.')
|
||||
if(new_standard.public and request.user.has_perm('standard-management')):
|
||||
messages.success(request, f'Standard {tempstandardname} hinzugefügt und veröffentlicht.')
|
||||
else:
|
||||
new_standard.public = False
|
||||
new_standard.save()
|
||||
messages.success(request, f'Standard {tempstandardname} hinzugefügt! Dieser muss noch veröffentlicht werden.')
|
||||
return redirect('standards')
|
||||
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@
|
|||
<!-- Topbar Search -->
|
||||
<form class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
|
||||
<div class="input-group">
|
||||
<input list="searchres" placeholder="Suche..." id="search_string" onkeyup="javascript:startSearch(this.value)" class="form-control bg-light border-0 small" >
|
||||
<input list="searchres" placeholder="Agenturweite Suche..." id="search_string" onkeyup="javascript:startSearch(this.value)" class="form-control bg-light border-0 small" >
|
||||
<!--
|
||||
<input type="text" onkeyup="javascript:startSearch(this.value)" class="form-control bg-light border-0 small" placeholder="Suche..." aria-label="Suche" aria-describedby="basic-addon2" id="searchfield">
|
||||
-->
|
||||
|
|
|
|||
Loading…
Reference in New Issue