0.7.3 mehr gefixed

This commit is contained in:
holger.trampe 2020-01-05 14:29:03 +01:00
parent 686a8fe6f1
commit 90dd87c9bd
10 changed files with 205 additions and 53 deletions

View File

@ -2,7 +2,7 @@
{% load static %} {% load static %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block content %} {% block content %}
<div class="content-section col-6"> <div class="content-section col-6" onmouseup="javascript:checkValue()">
<h3>Bereich aktualisieren</h3> <h3>Bereich aktualisieren</h3>
<hr> <hr>
<form method="POST"> <form method="POST">
@ -10,12 +10,12 @@
{{ form|crispy }} {{ form|crispy }}
<h6>Mitarbeiter hinzufügen</h6> <h6>Mitarbeiter hinzufügen</h6>
<div class="input-group mb-3"> <div class="input-group mb-3">
<input class="form-control" list="usersfree" name="searchusers" id="searchusers" type="text" onkeyup="javascript:checkValue()"> <input class="form-control" list="usersfree" name="searchusers" id="searchusers" type="text" onkeyup="javascript:checkValue()" onchange="javascript:checkValue()">
<div class="input-group-append"> <div class="input-group-append">
<button type="button" id="addusertoareabtn" onclick="javascript:addUserToArea()" class="btn btn-success" disabled>Mitarbeiter hinzufügen</button> <button type="button" id="addusertoareabtn" onclick="javascript:addUserToArea()" class="btn btn-success" disabled>Mitarbeiter hinzufügen</button>
<button type="button" onclick="javascript:clearSearchfield()" class="btn btn-secondary" ><i class="fas fa-times"></i></button> <button type="button" onclick="javascript:clearSearchfield()" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div> </div>
<datalist id="usersfree"> <datalist id="usersfree" >
{% for us in possible_users %} {% for us in possible_users %}
<option id="{{us.pk}}" value="{{us.first_name}} {{us.last_name}}"></option> <option id="{{us.pk}}" value="{{us.first_name}} {{us.last_name}}"></option>
{% endfor %} {% endfor %}
@ -116,8 +116,9 @@
//Check for valid input on inputfield //Check for valid input on inputfield
function checkValue(){ function checkValue(){
var g = $('#searchusers').val(); var g = $('#searchusers').val();
console.log(g);
var id = $('#usersfree').find('option[value="' + g + '"]').attr('id'); var id = $('#usersfree').find('option[value="' + g + '"]').attr('id');
if(id != undefined && id.length > 0){ if(id != undefined && id.length > 0){
tempid = id; tempid = id;

View File

@ -12,57 +12,138 @@
</div> </div>
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">
<div class="form-group mb-2"> <div class="col-12">
<input class="form-control" id="tableSearch" size="50" type="text" placeholder="Suche in Tabelle..."> <ul class="nav nav-tabs" id="news_tabs" role="tablist">
</div> <li class="nav-item">
<div class="table-responsive"> <a class="nav-link" id="act" data-toggle="tab" href="#t_act" role="tab" aria-controls="news" aria-selected="false">Aktuelle</a>
<table class="table table-hover" > </li>
<thead> <li class="nav-item">
<tr> <a class="nav-link" id="archiv" data-toggle="tab" href="#t_archiv" role="tab" aria-controls="archiv" aria-selected="false">Archiv</a>
<th scope="col">Titel</th> </li>
<th scope="col">Erstellt von</th> </ul>
<th scope="col">Erstellt am</th> </div>
<th scope="col">Sichtbar von/bis</th> <div class="col">
<th scope="col">&nbsp;</th> <div class="tab-content" id="tab_contents">
</tr> <div class="tab-pane fade" id="t_act" role="tabpanel" aria-labelledby="act">
</thead> <h5 class="mt-3"><a href="" style="color: #000000;">Aktuelle News</a></h5>
<tbody id="tableresults"> <hr>
{% for news_single in news %} <div class="row">
<tr> <div class="form-group mb-2">
<td><a href="{% url 'news-single' news_single.pk %}">{{news_single.name }}</a></td> <input class="form-control" id="tableSearch" size="50" type="text" placeholder="Suche in Tabelle...">
<td>{{ news_single.created_by.first_name }} {{ news_single.created_by.last_name }}</td> </div>
<td>{{ news_single.created_date }}</td> <div class="table-responsive">
<td>{{ news_single.go_online_on|date:"d.m.Y, H:i"}} bis {{ news_single.go_offline_on|date:"d.m.Y, H:i"}}</td> <table class="table table-hover" >
<td> <thead>
{% if news_single.created_by == request.user or perms.users.news_management %} <tr>
<div class="dropdown no-arrow"> <th scope="col">Titel</th>
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <th scope="col">Erstellt von</th>
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i> <th scope="col">Erstellt am</th>
</a> <th scope="col">Sichtbar von/bis</th>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink"> <th scope="col">&nbsp;</th>
<a class="dropdown-item" href="{% url 'news-update' news_single.pk %}" class="btn">Bearbeiten</a> </tr>
<div class="dropdown-divider"></div> </thead>
<a class="dropdown-item text-danger" href="{% url 'news-delete' news_single.pk %}">Löschen</a> <tbody id="tableresults">
</div> {% for news_single in news %}
</div> <tr>
{% endif %} <td><a href="{% url 'news-single' news_single.pk %}">{{news_single.name }}</a></td>
<td>{{ news_single.created_by.first_name }} {{ news_single.created_by.last_name }}</td>
<td>{{ news_single.created_date }}</td>
<td>{{ news_single.go_online_on|date:"d.m.Y, H:i"}} bis {{ news_single.go_offline_on|date:"d.m.Y, H:i"}}</td>
<td>
{% if news_single.created_by == request.user or perms.users.news_management %}
<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 'news-update' news_single.pk %}" class="btn">Bearbeiten</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'news-delete' news_single.pk %}">Löschen</a>
</div>
</div>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="t_archiv" role="tabpanel" aria-labelledby="act">
<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>
</td> <div class="table-responsive">
</tr> <table class="table table-hover" >
{% endfor %} <thead>
</tbody> <tr>
</table> <th scope="col">Titel</th>
</div> <th scope="col">Erstellt von</th>
</div> <th scope="col">Erstellt am</th>
<th scope="col">Sichtbar von/bis</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody id="tableresults_arch">
{% for news_single in news_arch %}
<tr>
<td><a href="{% url 'news-single' news_single.pk %}">{{news_single.name }}</a></td>
<td>{{ news_single.created_by.first_name }} {{ news_single.created_by.last_name }}</td>
<td>{{ news_single.created_date }}</td>
<td>{{ news_single.go_online_on|date:"d.m.Y, H:i"}} bis {{ news_single.go_offline_on|date:"d.m.Y, H:i"}}</td>
<td>
{% if news_single.created_by == request.user or perms.users.news_management %}
<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 'news-update' news_single.pk %}" class="btn">Bearbeiten</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'news-delete' news_single.pk %}">Löschen</a>
</div>
</div>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('#news_tabs li:first-child a').tab('show');
$("#tableSearch").on("keyup", function() { $("#tableSearch").on("keyup", function() {
var value = $(this).val().toLowerCase(); var value = $(this).val().toLowerCase();
$("#tableresults tr").filter(function() { $("#tableresults tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
}); });
}); });
$("#tableSearch_arch").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#tableresults_arch tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
}); });
$('#news_tabs a').on('click', function (e) {
e.preventDefault()
$(this).tab('show')
});
</script> </script>
{% endblock content %} {% endblock content %}

View File

@ -0,0 +1,68 @@
{% extends "users/base.html" %}
{% block content %}
<div class="content-section col-12">
<h3>News</h3>
<hr>
<p>
Hier können aktuelle Nachrichten für die Agentur erstellt und verwaltet werden.
</p>
<div class="row">
<div class="content-section col-4">
<a class="btn btn-primary" href="{% url 'news-add' %} ">News anlegen</a>
</div>
</div>
<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" >
<thead>
<tr>
<th scope="col">Titel</th>
<th scope="col">Erstellt von</th>
<th scope="col">Erstellt am</th>
<th scope="col">Sichtbar von/bis</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody id="tableresults">
{% for news_single in news %}
<tr>
<td><a href="{% url 'news-single' news_single.pk %}">{{news_single.name }}</a></td>
<td>{{ news_single.created_by.first_name }} {{ news_single.created_by.last_name }}</td>
<td>{{ news_single.created_date }}</td>
<td>{{ news_single.go_online_on|date:"d.m.Y, H:i"}} bis {{ news_single.go_offline_on|date:"d.m.Y, H:i"}}</td>
<td>
{% if news_single.created_by == request.user or perms.users.news_management %}
<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 'news-update' news_single.pk %}" class="btn">Bearbeiten</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="{% url 'news-delete' news_single.pk %}">Löschen</a>
</div>
</div>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$(document).ready(function(){
$("#tableSearch").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#tableresults tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
{% endblock content %}

View File

@ -8,6 +8,7 @@ from django.contrib.auth.decorators import login_required
from datetime import datetime from datetime import datetime
from django.contrib import messages from django.contrib import messages
from django.utils.dateparse import parse_date from django.utils.dateparse import parse_date
from django.utils import timezone
# Create your views here. # Create your views here.
# ALLE STANDARDS EINER AGENTUR # ALLE STANDARDS EINER AGENTUR
class NewsManagement(LoginRequiredMixin, ListView): class NewsManagement(LoginRequiredMixin, ListView):
@ -16,10 +17,11 @@ class NewsManagement(LoginRequiredMixin, ListView):
# Loading only user same agency # Loading only user same agency
# Change context and return for template-data # Change context and return for template-data
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
filterdate = datetime.now() filterdate = timezone.now()
news = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by('-created_date') news = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_online_on__lt=filterdate).filter(go_offline_on__gt=filterdate).order_by('-created_date')
news_arch = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_offline_on__lt=filterdate).order_by('-created_date')
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context.update({'active_link' : 'newsmanagement', 'news' : news}) context.update({'active_link' : 'newsmanagement', 'news' : news, 'news_arch' : news_arch})
return context return context
''' '''
class NewsAddNews(LoginRequiredMixin, CreateView): class NewsAddNews(LoginRequiredMixin, CreateView):

View File

@ -195,7 +195,7 @@
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
}); });
}); });
}) })
$('#area_tabs a').on('click', function (e) { $('#area_tabs a').on('click', function (e) {

View File

@ -10,7 +10,7 @@
{{ form|crispy }} {{ form|crispy }}
<h6>Mitarbeiter hinzufügen</h6> <h6>Mitarbeiter hinzufügen</h6>
<div class="input-group mb-3"> <div class="input-group mb-3">
<input class="form-control" list="usersfree" name="searchusers" id="searchusers" type="text" onkeyup="javascript:checkSearchUser()"> <input class="form-control" list="usersfree" name="searchusers" id="searchusers" type="text" onkeyup="javascript:checkSearchUser()" onchange="javascript:checkSearchUser()">
<div class="input-group-append"> <div class="input-group-append">
<button type="button" id="addusertotaskbtn" onclick="javascript:addUserToTask()" class="btn btn-success" disabled>Mitarbeiter hinzufügen</button> <button type="button" id="addusertotaskbtn" onclick="javascript:addUserToTask()" class="btn btn-success" disabled>Mitarbeiter hinzufügen</button>
<button type="button" onclick="javascript:clearSearchfield()" class="btn btn-secondary" ><i class="fas fa-times"></i></button> <button type="button" onclick="javascript:clearSearchfield()" class="btn btn-secondary" ><i class="fas fa-times"></i></button>

View File

@ -1 +1 @@
<p>TODO Datenschutz Content</p> <p>Informationen über den Datenschutz</p>

View File

@ -1 +1 @@
<p>TODO Impressum Content</p> <p>E-Mail: support@digitale-agentur.com</p>