Kategorien in Modal, Newsstyle angepasst
This commit is contained in:
parent
8286cd97bc
commit
9ad4e7c621
|
|
@ -68,15 +68,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
/* TEST FÜR RECHTE - GEHT, SO DANN DIE TEXTFELDER UND DEN BUTTON ENTFERNEN! */
|
||||
/*
|
||||
$(document).ready(function(){
|
||||
$(".textinput").attr("disabled", true);
|
||||
$(".emailinput").attr("disabled", true);
|
||||
$(".clearablefileinput").attr("disabled", true);
|
||||
})*/
|
||||
|
||||
/* CROPPER */
|
||||
$("#id_x").val(0);
|
||||
$("#id_y").val(0);
|
||||
|
|
@ -317,7 +308,17 @@ function updateFunc(id, funcname){
|
|||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="delFuncBody">
|
||||
<div class="modal-body" id="delFuncBody">
|
||||
{% for ele in agencyjobs %}
|
||||
<tr id="agencyjob_{{ele.pk}}">
|
||||
<td>
|
||||
<input class="form-control" type="text" value="{{ele.name}}" onkeyup="javascript:updateFunc({{ele.pk}}, this.value)">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger" onclick="javascript:funcDel({{ele.pk}})" data-toggle="tooltip" data-placement="top" title="Agenturfunktion löschen"><i class="fas fa-trash-alt"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:doDelAgencyJob()">Agenturfunktion löschen</button>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -19,6 +19,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
############################################## DEV #####################################
|
||||
BASE_URL = "https://dev01.digitale-agentur.com/"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
# MAIL DEV
|
||||
EMAIL_HOST = 'smtp.strato.de'
|
||||
EMAIL_PORT = 587
|
||||
|
|
@ -52,8 +55,7 @@ X_FRAME_OPTIONS = 'SAMEORIGIN'
|
|||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '_qv2t2lmsctjxpbb4rrp=op%_20_hxzonv^mvty1o85c)l$s^q'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
|
||||
ALLOWED_HOSTS = ['digitale-agentur.com', 'www.digitale-agentur.com', 'localhost', 'dev01.digitale-agentur.com']
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@
|
|||
<h5 class="mt-3"><a href="" style="color: #000000;">Aktuelle News</a></h5>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group mb-2">
|
||||
<input class="form-control" id="tableSearch" size="50" type="text" placeholder="Suche in Tabelle...">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover" id="activenews" >
|
||||
<thead>
|
||||
|
|
@ -87,7 +84,7 @@
|
|||
<hr>
|
||||
<div class="row">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover" id="comingnews">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Titel</th>
|
||||
|
|
@ -137,11 +134,8 @@
|
|||
<h5 class="mt-3"><a href="" style="color: #000000;">Archivierte News</a></h5>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group mb-2">
|
||||
<input class="form-control" id="tableSearch_arch" size="50" type="text" placeholder="Suche in Tabelle...">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover" id="archnews">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Titel</th>
|
||||
|
|
@ -182,22 +176,75 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* DATATABLES */
|
||||
.paginate_button {
|
||||
padding: 0px !important;
|
||||
border: 0px !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/*
|
||||
var table = $('#activenews').DataTable({
|
||||
searching: true,
|
||||
"language": {
|
||||
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
|
||||
|
||||
$('#activenews').DataTable({
|
||||
"language": {
|
||||
"search" : "Suche",
|
||||
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"lengthMenu": "Zeige _MENU_ Einträge",
|
||||
"zeroRecords": "Nichts gefunden",
|
||||
"infoEmpty": "Keine Einträge",
|
||||
"paginate": {
|
||||
"first": "Erste",
|
||||
"last": "Letzte",
|
||||
"next": "Nächste",
|
||||
"previous": "Zurück"
|
||||
},
|
||||
buttons: {
|
||||
buttons: [
|
||||
{ extend: 'next', className: 'paginate_button_custom' },
|
||||
{ extend: 'previous', className: 'paginate_button_custom' }
|
||||
]
|
||||
}
|
||||
|
||||
});*/
|
||||
},
|
||||
"buttons" : {
|
||||
"className" : "btn-danger"
|
||||
}
|
||||
});
|
||||
|
||||
$('#archnews').DataTable({
|
||||
"language": {
|
||||
"search" : "Suche",
|
||||
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"lengthMenu": "Zeige _MENU_ Einträge",
|
||||
"zeroRecords": "Nichts gefunden",
|
||||
"infoEmpty": "Keine Einträge",
|
||||
"paginate": {
|
||||
"first": "Erste",
|
||||
"last": "Letzte",
|
||||
"next": "Nächste",
|
||||
"previous": "Zurück"
|
||||
},
|
||||
},
|
||||
"buttons" : {
|
||||
"className" : "btn-danger"
|
||||
}
|
||||
});
|
||||
|
||||
$('#comingnews').DataTable({
|
||||
"language": {
|
||||
"search" : "Suche",
|
||||
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"lengthMenu": "Zeige _MENU_ Einträge",
|
||||
"zeroRecords": "Nichts gefunden",
|
||||
"infoEmpty": "Keine Einträge",
|
||||
"paginate": {
|
||||
"first": "Erste",
|
||||
"last": "Letzte",
|
||||
"next": "Nächste",
|
||||
"previous": "Zurück"
|
||||
},
|
||||
},
|
||||
"buttons" : {
|
||||
"className" : "btn-danger"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#news_tabs li:first-child a').tab('show');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,34 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% block content %}
|
||||
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-12">
|
||||
<small>
|
||||
<h2>{{news.name}}</h2>
|
||||
Erstellt durch <a href="{% url 'orga-single' news.created_by.pk %}">{{news.created_by.first_name}} {{news.created_by.last_name}}</a> am {{news.created_date}} | Zuletzt bearbeitet von <a href="{% url 'orga-single' news.last_modified_by.pk %}">{{ news.last_modified_by.first_name}} {{ news.last_modified_by.last_name}}</a> am {{ news.last_modified_on}}
|
||||
{% if news.created_by == user or perms.users.news_management %}
|
||||
| <a href="{% url 'news-update' news.pk %}">Bearbeiten</a>
|
||||
{% endif %}
|
||||
<h2>{{news.name}}
|
||||
|
||||
<span style="float: right">
|
||||
{% if news.created_by == user or perms.users.modulenews %}
|
||||
<a style="float: right" class="btn btn-secondary btn-sm ml-2" href="{% url 'news-delete' news.pk %}"><small><i class="fas fa-trash"></i></small></a>
|
||||
<a href="{% url 'news-update' news.pk %}" style="float: right" class="btn btn-secondary btn-sm "><small><i class="fas fa-pen"></i></small></a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</h2>
|
||||
</small>
|
||||
<hr>
|
||||
{{news.media}}
|
||||
{{news.content|safe}}
|
||||
<div class="card col-12" style="min-height: 500px">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"></h5>
|
||||
<p class="card-text">
|
||||
{{news.media}}
|
||||
{{news.content|safe}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<small>
|
||||
Erstellt durch <a href="{% url 'orga-single' news.created_by.pk %}">{{news.created_by.first_name}} {{news.created_by.last_name}}</a> am {{news.created_date}} | Zuletzt bearbeitet von <a href="{% url 'orga-single' news.last_modified_by.pk %}">{{ news.last_modified_by.first_name}} {{ news.last_modified_by.last_name}}</a> am {{ news.last_modified_on}}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>Das Modul News wurde in ihrer Agentur deaktiviert.</h3>
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_organizer %}
|
||||
<div class="content-section col-6">
|
||||
<h3>Kategory anlegen</h3>
|
||||
<hr>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success">Kategorie speichern</button>
|
||||
<a class="btn" href="{% url 'organizer-management' %} ">Abbrechen</a>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>Das Modul Quicklinks wurden in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_organizer %}
|
||||
<div class="content-section col-12">
|
||||
<h3>Kategorien{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verwalten Sie hier Kategorien für Ihre Kontakte." class="far fa-question-circle"></i></small>{% endif %}
|
||||
<a style="float: right" href="{% url 'organizer-management' %}" type="button" class="btn btn-secondary btn-sm"><i class="fas fa-chevron-circle-left"></i></a>
|
||||
</h3>
|
||||
<hr>
|
||||
<a class="btn btn-primary" href="{% url 'ql-addcategory' %}"><i class="fas fa-plus"></i> Kategorie</a>
|
||||
<div class="table-responsive mt-3">
|
||||
<table class="table table-hover" id="category_table" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for cat in categorys %}
|
||||
<tr>
|
||||
<td>
|
||||
{{cat.name}}
|
||||
</td>
|
||||
<td>
|
||||
{% if user|usergperm:"moduleorganizer" %}
|
||||
<div class="dropdown no-arrow">
|
||||
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<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">
|
||||
<a class="dropdown-item" href="{% url 'cat-update' cat.pk%}">Bearbeiten</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="{% url 'ql-cat-delete' cat.pk%}">Löschen</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<style>
|
||||
/* DATATABLES */
|
||||
.paginate_button {
|
||||
padding: 0px !important;
|
||||
border: 0px !important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#category_table').DataTable({
|
||||
"language": {
|
||||
"search" : "Suche",
|
||||
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"lengthMenu": "Zeige _MENU_ Einträge",
|
||||
"zeroRecords": "Nichts gefunden",
|
||||
"infoEmpty": "Keine Einträge",
|
||||
"paginate": {
|
||||
"first": "Erste",
|
||||
"last": "Letzte",
|
||||
"next": "Nächste",
|
||||
"previous": "Zurück"
|
||||
},
|
||||
},
|
||||
"buttons" : {
|
||||
"className" : "btn-danger"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<h3>Das Modul Organizer wurden in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_organizer %}
|
||||
<!-- SECTION -->
|
||||
<div class="content-section col-9">
|
||||
<h3>Kontakt anlegen</h3>
|
||||
<hr>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<div class="row"><div class="content-section col-12">
|
||||
{% if user|usergperm:"moduleorganizer" %}
|
||||
<a class="btn btn-primary" href="{% url 'addcontact' %}"><i class="fas fa-plus"></i> Kontakt</a>
|
||||
<a class="btn btn-secondary mr-l btn-sm" style="vertical-align: bottom;" href="{% url 'category-management' %}"><i class="fas fa-pen"></i> Kategorien</a>
|
||||
<button class="btn btn-secondary mr-l btn-sm" style="vertical-align: bottom;" onclick="javascript:showCategoryMod()"><i class="fas fa-pen"></i> Kategorien</button>
|
||||
{% endif %}
|
||||
<hr>
|
||||
</div></div>
|
||||
|
|
@ -101,6 +101,65 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<!-- MODAL FOR AGENCYJOBS -->
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="categorymodal" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="agencyFunction" aria-hidden="true">
|
||||
<div class="modal-dialog " role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">Kategorien bearbeiten</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-hover" id="allCategory">
|
||||
<tbody>
|
||||
{% for ele in categorys %}
|
||||
<tr id="categorys_{{ele.pk}}">
|
||||
<td>
|
||||
<input class="form-control" type="text" value="{{ele.name}}" onkeyup="javascript:updateCategory({{ele.pk}}, this.value)">
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger" onclick="javascript:catDel({{ele.pk}})" data-toggle="tooltip" data-placement="top" title="Kategorie löschen"><i class="fas fa-trash-alt"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="erroninput" class="alert alert-danger" style="display: none">Falsche Eingabe! Es wird nichts gespeichert.</div>
|
||||
<div id="savebreak" class="alert alert-success" style="display: none">Speichern pausiert...</div>
|
||||
<div id="funcupdate" class="alert alert-success" style="display: none">Kategorien aktualisiert.</div>
|
||||
<button type="button" class="btn btn-primary" title="Neue Kategorie hinzufügen" onclick="javascript:addCategory()" data-toggle="tooltip" data-placement="top" title="Dialog für eine neue Kategorie öffnen"><i class="fas fa-plus"></i> Kategorie</button>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CONFIRMA DELETE DIALOG -->
|
||||
<div class="modal fade" id="delCategoryConfirm" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="agencyDelFunction" aria-hidden="true">
|
||||
<div class="modal-dialog " role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">Kategorie löschen</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="delCatBody">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:delCategory()">Kategorie löschen</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:$('#categorymodal').modal('toggle')">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* DATATABLES */
|
||||
.paginate_button {
|
||||
|
|
@ -110,6 +169,124 @@
|
|||
</style>
|
||||
<script>
|
||||
|
||||
function showCategoryMod(){
|
||||
$("#categorymodal").modal("toggle");
|
||||
}
|
||||
|
||||
|
||||
$('#categorymodal').on('hidden.bs.modal', function (e) {
|
||||
if(!delmode) {location.href = location.href;}
|
||||
})
|
||||
|
||||
$('#delCategoryConfirm').on('hidden.bs.modal', function (e) {
|
||||
delmode = false;
|
||||
})
|
||||
|
||||
timeout = null;
|
||||
function updateCategory(id, catname){
|
||||
var letters = /^[A-Za-zßäöüÄÖÜ_0-9 ]+$/;
|
||||
if(catname.match(letters))
|
||||
{
|
||||
//SAVE ONLY EVERY SECOND
|
||||
$("#erroninput").hide();
|
||||
$("#savebreak").show();
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(function () {
|
||||
if(catname.match(letters))
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "{% url 'ajaxorganizer' %}",
|
||||
data:{
|
||||
action : "update_category",
|
||||
id : id,
|
||||
newvalue : catname
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
if(data["success"]){
|
||||
$("#savebreak").hide();
|
||||
$("#funcupdate").fadeTo(2000, 500).slideUp(500, function(){
|
||||
$("#funcupdate").fadeOut(500);
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#erroninput").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#erroninput").show();
|
||||
$("#savebreak").hide();
|
||||
$("#funcupdate").hide();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
else{
|
||||
$("#erroninput").show();
|
||||
$("#savebreak").hide();
|
||||
$("#funcupdate").hide();
|
||||
}
|
||||
}
|
||||
|
||||
var todelid = "";
|
||||
var delmode = false;
|
||||
function catDel(id){
|
||||
delmode = true;
|
||||
todelid = id;
|
||||
$("#categorymodal").modal("hide");
|
||||
$("#delCategoryConfirm").modal("toggle");
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "{% url 'ajaxorganizer' %}",
|
||||
data:{
|
||||
action : "get_catname",
|
||||
id : id
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
$("#delCatBody").html("Achtung! Die Kategorie <b>" + data['catname'] + "</b> wird gelöscht. Alle Kontakte mit dieser Kategorie erhalten eine leere Kategorie. Fortfahren?");
|
||||
//delmode = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delCategory(){
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "{% url 'ajaxorganizer' %}",
|
||||
data:{
|
||||
action : "delete_category",
|
||||
id : todelid
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
location.href = location.href
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function addCategory(){
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "{% url 'ajaxorganizer' %}",
|
||||
data:{
|
||||
action : "add_category"
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
new_id = data["new_id"];
|
||||
$('#allCategory > tbody:last-child').append('<tr id="categorys_'+new_id+'"><td><input class="form-control" type="text" value="" placeholder="Neue Kateogire" onkeyup="javascript:updateCategory('+new_id+', this.value)"></td><td><button type="button" class="btn btn-danger" onclick="javascript:catDel('+new_id+')" data-toggle="tooltip" data-placement="top" title="Kategorie löschen"><i class="fas fa-trash-alt"></i></button></td></tr>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#table_contactsall').DataTable({
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
from django.urls import path
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from .views import OrganizerManagement, OrganizerAdd, OrganizerDeleteView, OrganizerUpdateView, OrganizerAddContact, OrganizerDelContact, OrganizerUpdateContact, OrganizerAddPassword, OrganizerDelPassword, OrganizerUpdatePassword, CategoryManagement, CategoryAdd, CategoryUpdateView, CategoryDeleteView
|
||||
from .views import OrganizerManagement, OrganizerAdd, OrganizerDeleteView, OrganizerUpdateView, OrganizerAddContact, OrganizerDelContact, OrganizerUpdateContact, OrganizerAddPassword, OrganizerDelPassword, OrganizerUpdatePassword
|
||||
from . import views
|
||||
'''
|
||||
Permissions definiert in models.py bei USERS und dann hier vor die View geschrieben!
|
||||
'''
|
||||
urlpatterns = [
|
||||
path('', OrganizerManagement.as_view(template_name="organizer/organizer_management.html"), name='organizer-management'),
|
||||
path('category/', CategoryManagement.as_view(template_name="organizer/category_management.html"), name='category-management'),
|
||||
path('addcat/', permission_required('users.moduleorganizer')(CategoryAdd.as_view(template_name="organizer/category_add.html")), name='ql-addcategory'),
|
||||
path('addcat/<int:pk>/delete', permission_required('users.moduleorganizer')(CategoryDeleteView.as_view()), name='ql-cat-delete'),
|
||||
path('addcat/<int:pk>/', permission_required('users.moduleorganizer')(CategoryUpdateView.as_view()), name='cat-update'),
|
||||
path('addql/', permission_required('users.moduleorganizer')(OrganizerAdd.as_view(template_name="organizer/ql_add.html")), name='ql-addql'),
|
||||
path('addql/', permission_required('users.moduleorganizer')(OrganizerAdd.as_view(template_name="organizer/ql_add.html")), name='ql-addql'),
|
||||
path('addcontact/', permission_required('users.moduleorganizer')(OrganizerAddContact.as_view(template_name="organizer/contact_add.html")), name='addcontact'),
|
||||
path('addql/<int:pk>/delete', permission_required('users.moduleorganizer')(OrganizerDeleteView.as_view()), name='ql-delete'),
|
||||
path('remco/<int:pk>/delete', permission_required('users.moduleorganizer')(OrganizerDelContact.as_view()), name='cont-delete'),
|
||||
|
|
@ -22,4 +18,5 @@ urlpatterns = [
|
|||
path('uppass/<int:pk>/', permission_required('users.moduleorganizer')(OrganizerUpdatePassword.as_view()), name='aggpass-update'),
|
||||
path('addpass/', permission_required('users.moduleorganizer')(OrganizerAddPassword.as_view(template_name="organizer/agpass_add.html")), name='add-agpass'),
|
||||
path('lerg/', views.loaddefaultql, name="ql-ajaxloaddef"),
|
||||
path('ajo/', views.ajaxorganizer, name="ajaxorganizer"),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -12,62 +12,6 @@ from users.models import AgencyGroup
|
|||
|
||||
|
||||
|
||||
class CategoryManagement(LoginRequiredMixin, ListView):
|
||||
model = AGContactsCagetory
|
||||
# Adding active_link
|
||||
# Loading only user same agency
|
||||
# Change context and return for template-data
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context.update({'active_link' : 'organizer', 'categorys' : AGContactsCagetory.objects.filter(agency=self.request.user.profile.agency).order_by('name') })
|
||||
return context
|
||||
|
||||
class CategoryAdd(LoginRequiredMixin, CreateView):
|
||||
model = AGContactsCagetory
|
||||
success_url = reverse_lazy('category-management')
|
||||
form_class = OrganizerAddCategoryForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context.update({"active_link" : "organizer"})
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
messages.success(self.request, f'Kategorie angelegt!')
|
||||
form.instance.agency = self.request.user.profile.agency
|
||||
return super().form_valid(form)
|
||||
|
||||
class CategoryUpdateView(LoginRequiredMixin, UpdateView):
|
||||
model = AGContactsCagetory
|
||||
template_name = 'organizer/cat_update.html'
|
||||
success_url = reverse_lazy('category-management')
|
||||
form_class = OrganizerAddCategoryForm
|
||||
|
||||
def form_valid(self, form):
|
||||
# Send message to the site
|
||||
messages.success(self.request, f'Kategorie aktualisiert!')
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CategoryUpdateView, self).get_context_data(**kwargs)
|
||||
context['active_link'] = 'organizer'
|
||||
return context
|
||||
|
||||
class CategoryDeleteView(LoginRequiredMixin, DeleteView):
|
||||
model = AGContactsCagetory
|
||||
success_url = reverse_lazy('category-management')
|
||||
template_name = 'organizer/cat_confirm_delete.html'
|
||||
|
||||
def delete(self, request, *args, **kwargs):
|
||||
response = super(CategoryDeleteView, self).delete(request, *args, **kwargs)
|
||||
messages.success(request, f'Kategorie wurde gelöscht!')
|
||||
return response
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(CategoryDeleteView, self).get_context_data(**kwargs)
|
||||
context['active_link'] = 'organizer'
|
||||
return context
|
||||
|
||||
class OrganizerManagement(LoginRequiredMixin, ListView):
|
||||
model = QuickLinks
|
||||
# Adding active_link
|
||||
|
|
@ -76,7 +20,7 @@ class OrganizerManagement(LoginRequiredMixin, ListView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
quicklinks = QuickLinks.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name')
|
||||
context.update({'active_link' : 'organizer', 'quicklinks' : quicklinks, 'contacts' : AGContacts.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('personname'), 'agpass' : AGPassword.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name'), 'agencygroups' : AgencyGroup.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('agencygroupname') })
|
||||
context.update({'active_link' : 'organizer', 'quicklinks' : quicklinks, 'contacts' : AGContacts.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('personname'), 'agpass' : AGPassword.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name'), 'agencygroups' : AgencyGroup.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('agencygroupname'), 'categorys' : AGContactsCagetory.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('name')})
|
||||
return context
|
||||
|
||||
class OrganizerAdd(LoginRequiredMixin, CreateView):
|
||||
|
|
@ -286,4 +230,44 @@ def loaddefaultql(request):
|
|||
|
||||
data = {'success' : False}
|
||||
return JsonResponse(data)
|
||||
return redirect("ql-addql")
|
||||
return redirect("ql-addql")
|
||||
|
||||
@login_required
|
||||
def ajaxorganizer(request):
|
||||
data = {'success' : False}
|
||||
|
||||
if request.method == 'GET':
|
||||
#UPDATE CATEGORYNAME
|
||||
if request.GET['action'] == 'update_category':
|
||||
workingcat = AGContactsCagetory.objects.get(pk=request.GET['id'])
|
||||
if(request.user.profile.agency == workingcat.agency):
|
||||
workingcat.name = request.GET["newvalue"]
|
||||
workingcat.save()
|
||||
data["success"] = True
|
||||
else:
|
||||
data["success"] = False
|
||||
return JsonResponse(data)
|
||||
# GET CATEGORY NAME
|
||||
elif request.GET['action'] == 'get_catname':
|
||||
workingcat = AGContactsCagetory.objects.get(pk=request.GET['id'])
|
||||
data["catname"] = workingcat.name
|
||||
return JsonResponse(data)
|
||||
# DELETE A CATEGORY
|
||||
elif request.GET['action'] == 'delete_category':
|
||||
workingcat = AGContactsCagetory.objects.get(pk=request.GET['id'])
|
||||
if(request.user.profile.agency == workingcat.agency):
|
||||
workingcat.delete()
|
||||
data["success"] = True
|
||||
else:
|
||||
data["success"] = False
|
||||
return JsonResponse(data)
|
||||
# ADD CATEGORY
|
||||
elif request.GET['action'] == 'add_category':
|
||||
workingcat = AGContactsCagetory(name="", agency=request.user.profile.agency)
|
||||
workingcat.save()
|
||||
data["new_id"] = workingcat.pk
|
||||
return JsonResponse(data)
|
||||
|
||||
|
||||
else:
|
||||
return JsonResponse(data)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
|
|
@ -198,7 +198,7 @@
|
|||
</li>
|
||||
|
||||
<div style="" class="sidebar-heading">
|
||||
<img src="{% static 'users/img/vvelogo.png' %}" width="30%" class="mb-2">
|
||||
<img src="{% static 'users/img/VVE-Logo.png' %}" width="30%" class="mb-2">
|
||||
<br />
|
||||
<a style="color: #999; text-decoration: none;" href="{% url 'datenschutzda' %}">Datenschutz</a><br />
|
||||
<a style="color: #999; text-decoration: none;" href="{% url 'impressumda' %}">Impressum</a>
|
||||
|
|
|
|||
|
|
@ -44,13 +44,17 @@
|
|||
|
||||
<!-- Divider -->
|
||||
<hr class="sidebar-divider my-0">
|
||||
<div style="bottom: 10px; position: absolute;" class="sidebar-heading">
|
||||
Version 0.8.3
|
||||
</div>
|
||||
<div style="bottom: 40px; position: absolute;" class="sidebar-heading">
|
||||
|
||||
|
||||
<div class="sidebar-heading">
|
||||
<img src="{% static 'users/img/VVE-Logo.png' %}" width="30%" class="mt-2 mb-2">
|
||||
<br />
|
||||
<a style="color: #999; text-decoration: none;" href="{% url 'datenschutzda' %}">Datenschutz</a><br />
|
||||
<a style="color: #999; text-decoration: none;" href="{% url 'impressumda' %}">Impressum</a>
|
||||
</div>
|
||||
<div style="margin-top: 10px; margin-bottom: 5px;" class="sidebar-heading">
|
||||
Version 0.8.3
|
||||
</div>
|
||||
</ul>
|
||||
<!-- End of Sidebar -->
|
||||
|
||||
|
|
|
|||
|
|
@ -171,11 +171,11 @@ def dashboard(request):
|
|||
toUpdate(request)
|
||||
|
||||
|
||||
storageinfo = sys.getfilesystemencoding()
|
||||
#storageinfo = sys.getfilesystemencoding()
|
||||
|
||||
context = {
|
||||
'active_link' : 'dashboard',
|
||||
"systemencode" : storageinfo
|
||||
#"systemencode" : storageinfo
|
||||
}
|
||||
# Adding active_link
|
||||
# Loading only user same agency
|
||||
|
|
|
|||
Loading…
Reference in New Issue