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",
|
"name" : "Titel",
|
||||||
"area" : "Übergeordneter Bereich",
|
"area" : "Übergeordneter Bereich",
|
||||||
"task" : "Aufgabenbereich",
|
"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
|
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')
|
self.fields['task'].queryset = Tasks.objects.filter(area__id=areaid).order_by('name')
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif self.instance.pk:
|
elif self.instance.pk:
|
||||||
self.fields['task'].queryset = Tasks.objects.none()
|
self.fields['task'].queryset = Tasks.objects.none()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class StandardAddStandardEditor(forms.ModelForm):
|
class StandardAddStandardEditor(forms.ModelForm):
|
||||||
|
|
||||||
#content = forms.CharField(widget=CKEditorWidget())
|
#content = forms.CharField(widget=CKEditorWidget())
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
<form method="POST" id="taskareaform">
|
<form method="POST" id="taskareaform">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{normalForm|crispy}}
|
{{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>
|
<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>
|
<hr>
|
||||||
<button type="submit" class="btn btn-success" href="{% url 'standard-add' %} ">Standard anlegen</button>
|
<button type="submit" class="btn btn-success" href="{% url 'standard-add' %} ">Standard anlegen</button>
|
||||||
|
|
@ -37,5 +35,4 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
||||||
|
|
@ -101,12 +101,16 @@
|
||||||
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
|
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
|
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
|
||||||
{% if standard.public %}
|
{% if perms.users.standard_management %}
|
||||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
|
{% if standard.public %}
|
||||||
{% else %}
|
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichung aufheben</a>
|
||||||
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
|
{% else %}
|
||||||
|
<a class="dropdown-item" href="{% url 'standard-status' standard.pk %}">Veröffentlichen</a>
|
||||||
|
{% endif %}
|
||||||
{% 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>
|
<a class="dropdown-item" href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
|
||||||
|
{% endif %}
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item text-danger" href="{% url 'standard-delete' standard.pk %}" >Löschen</a>
|
<a class="dropdown-item text-danger" href="{% url 'standard-delete' standard.pk %}" >Löschen</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -116,6 +120,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,15 @@ def StandardAdd(request):
|
||||||
new_standard.area = normalForm.cleaned_data['area']
|
new_standard.area = normalForm.cleaned_data['area']
|
||||||
new_standard.name = normalForm.cleaned_data['name']
|
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()
|
new_standard.save()
|
||||||
tempstandardname = normalForm.cleaned_data['name']
|
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')
|
return redirect('standards')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@
|
||||||
<!-- Topbar Search -->
|
<!-- 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">
|
<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">
|
<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">
|
<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