Globale Suche ins Dropdown
Links bei den Standards zum Hersteller und zum LastModified Dashboard angefangen
This commit is contained in:
parent
32c8b69457
commit
076583e8bd
Binary file not shown.
|
|
@ -24,7 +24,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
SECRET_KEY = '_qv2t2lmsctjxpbb4rrp=op%_20_hxzonv^mvty1o85c)l$s^q'
|
SECRET_KEY = '_qv2t2lmsctjxpbb4rrp=op%_20_hxzonv^mvty1o85c)l$s^q'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['digitale-agentur.com', 'www.digitale-agentur.com', 'localhost']
|
ALLOWED_HOSTS = ['digitale-agentur.com', 'www.digitale-agentur.com', 'localhost']
|
||||||
|
|
||||||
|
|
@ -169,12 +169,10 @@ LOGIN_REDIRECT_URL = 'users-dashboard'
|
||||||
#SITE_ROOT = '/var/www/digitale-agentur.com/digitaleagentur/digitaleagentur/../'
|
#SITE_ROOT = '/var/www/digitale-agentur.com/digitaleagentur/digitaleagentur/../'
|
||||||
#STATIC_ROOT = (os.path.join(SITE_ROOT, 'static/'))
|
#STATIC_ROOT = (os.path.join(SITE_ROOT, 'static/'))
|
||||||
|
|
||||||
|
if DEBUG:
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
else:
|
||||||
STATIC_URL = 'users/static/'
|
STATIC_URL = 'users/static/'
|
||||||
#STATIC_URL = '/static/'
|
|
||||||
|
|
||||||
|
|
||||||
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) + '/..'
|
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) + '/..'
|
||||||
STATIC_ROOT = (os.path.join(SITE_ROOT, 'users/static/'))
|
STATIC_ROOT = (os.path.join(SITE_ROOT, 'users/static/'))
|
||||||
STATICFILES_DIRS = (
|
STATICFILES_DIRS = (
|
||||||
|
|
|
||||||
|
|
@ -14,40 +14,6 @@
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for item in standards_of_agency %}
|
|
||||||
{% if item.public or item.created_standard_by == user or perms.users.standard_management %}
|
|
||||||
<div class=" mb-4 col-5">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
|
|
||||||
<a href="{% url 'standard-single' item.pk%}">
|
|
||||||
{% if item.public %}
|
|
||||||
<h4><u>{{item.name}}</u></h4>
|
|
||||||
{% else %}
|
|
||||||
<h4 class="text-warning"><u>{{item.name}}</u></h4>
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
||||||
{% if item.created_standard_by == user or perms.users.standard_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">
|
|
||||||
<!--<div class="dropdown-header">Benutzerdaten</div>-->
|
|
||||||
<a class="dropdown-item" href="{% url 'standard-update' item.pk %}">Bearbeiten</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger" href="{% url 'standard-delete' item.pk %}" >Löschen</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}} <h6>Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}</h6>
|
|
||||||
</h5>
|
|
||||||
<p class="card-text">{{ item.content|truncatechars:250|safe}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor%}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
<small>
|
<small>
|
||||||
<h2>{{standard.name}}</h2>
|
<h2>{{standard.name}}</h2>
|
||||||
Erstellt durch {{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}} am {{standard.created_standard_date}} | Zuletzt bearbeitet von {{ standard.last_modified_by.first_name}} {{ standard.last_modified_by.last_name}} am {{ standard.last_modified_on}}
|
Erstellt durch <a href="{% url 'orga-single' standard.created_standard_by.pk %}">{{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}}</a> am {{standard.created_standard_date}} | Zuletzt bearbeitet von <a href="{% url 'orga-single' standard.last_modified_by.pk %}">{{ standard.last_modified_by.first_name}} {{ standard.last_modified_by.last_name}}</a> am {{ standard.last_modified_on}}
|
||||||
{% if standard.created_standard_by == user or perms.users.standard_management %}
|
{% if standard.created_standard_by == user or perms.users.standard_management %}
|
||||||
| <a href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
|
| <a href="{% url 'standard-update' standard.pk %}">Bearbeiten</a>
|
||||||
{% endif%}
|
{% endif%}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -173,13 +173,18 @@
|
||||||
<!-- 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 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 list="searchres" placeholder="Suche..." id="search_string" onchange="javascript:checkValue()" onkeyup="javascript:startSearch(this.value)" class="form-control bg-light border-0 small" >
|
||||||
|
<datalist id="searchres" >
|
||||||
|
</datalist>
|
||||||
|
|
||||||
<div class="input-group-append">
|
<!--
|
||||||
|
<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">
|
||||||
|
-->
|
||||||
|
<!--<div class="input-group-append">
|
||||||
<button class="btn btn-primary" type="button" onclick="javascript:clearSF()">
|
<button class="btn btn-primary" type="button" onclick="javascript:clearSF()">
|
||||||
<i class="fas fa-times fa-sm"></i>
|
<i class="fas fa-times fa-sm"></i>
|
||||||
</button>
|
</button>-->
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -221,8 +226,6 @@
|
||||||
|
|
||||||
<!-- Begin Page Content -->
|
<!-- Begin Page Content -->
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- RESULTS -->
|
|
||||||
<div id="searchresults_div"></div>
|
|
||||||
|
|
||||||
<!-- MESSAGES -->
|
<!-- MESSAGES -->
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
|
|
@ -233,17 +236,9 @@
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
//Ausfaden der Meldungen erstmal rausgenommen
|
|
||||||
/*
|
|
||||||
setTimeout(function() {
|
|
||||||
$('#message_{{forloop.counter}}').fadeOut();
|
|
||||||
}, 3000 );
|
|
||||||
*/
|
|
||||||
</script>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="maincontent_for_search">
|
<div id="maincontent">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -296,19 +291,10 @@
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function clearSF(){
|
|
||||||
$("#searchfield").val("");
|
|
||||||
$("#searchresults_div").empty();
|
|
||||||
$("#searchresults_div").hide();
|
|
||||||
$("#maincontent_for_search").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function startSearch(searchstring){
|
function startSearch(searchstring){
|
||||||
if(searchstring.length > 2){
|
|
||||||
|
|
||||||
$("#maincontent_for_search").hide();
|
if(searchstring.length > 2){
|
||||||
$("#searchresults_div").show();
|
|
||||||
$.ajax(
|
$.ajax(
|
||||||
{
|
{
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
|
@ -318,43 +304,28 @@
|
||||||
},
|
},
|
||||||
success: function( data )
|
success: function( data )
|
||||||
{
|
{
|
||||||
$("#searchresults_div").empty();
|
$("#searchres").empty();
|
||||||
if(data['res'].length > 1){
|
|
||||||
$("#searchresults_div").append('<h4>' + data['res'].length + ' Sucherergebnisse</h4><hr>');
|
|
||||||
}
|
|
||||||
else if(data['res'].length == 1){
|
|
||||||
$("#searchresults_div").append('<h4>' + data['res'].length + ' Sucherergebnis</h4><hr>');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#searchresults_div").append('<h4>Keine Sucherergebnis</h4><hr>');
|
|
||||||
}
|
|
||||||
for (var i = 0; i < data['res'].length; i++)
|
for (var i = 0; i < data['res'].length; i++)
|
||||||
{
|
{
|
||||||
$("#searchresults_div").append('<div class="mb-4"><div class="card"><div class="card-header py-3 d-flex flex-row align-items-center justify-content-between"><a href="/standards/standard/'+data['res'][i]['id']+'/single"><h5><u>'+data['res'][i]['name']+'</u></h5></a><div class="dropdown no-arrow"></div></div><div class="card-body"><h6 class="card-title">Von '+data['res'][i]['first_name']+' '+data['res'][i]['last_name']+' | <small>Zuletzt bearbeitet von '+data['res'][i]['first_name_mod']+' '+data['res'][i]['last_name_mod']+' am '+data['res'][i]['last_modified_on']+'</small></h6><p class="card-text">'+data['res'][i]['content']+'</p></div></div></div>');
|
id = data['res'][i]['id'];
|
||||||
|
name = data['res'][i]['name'] + " | " + data['res'][i]['content'];
|
||||||
|
$("#searchres").append('<option id="'+id+'" value="'+name+'"></option>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$("#searchresults_div").empty();
|
|
||||||
$("#searchresults_div").hide();
|
|
||||||
$("#maincontent_for_search").show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check valid input and go to standard by click
|
||||||
function goToStandard(id){
|
function checkValue(){
|
||||||
$.ajax(
|
for(i = 0; i < document.getElementById("searchres").options.length; i++){
|
||||||
{
|
var value = $("#search_string").val();
|
||||||
type: "GET",
|
var choosen = document.getElementById("searchres").options[i].value;
|
||||||
url: "/dashboard/standardrout",
|
if(value.search(choosen) != -1){
|
||||||
data:{
|
window.location = "/standards/standard/"+document.getElementById("searchres").options[i]['id']+"/single";
|
||||||
's_id': id
|
}
|
||||||
},
|
|
||||||
success (data){
|
|
||||||
console.log(data);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -5,8 +5,44 @@
|
||||||
<small>Letzter Login: {{ request.user.last_login }}</small>
|
<small>Letzter Login: {{ request.user.last_login }}</small>
|
||||||
<hr>
|
<hr>
|
||||||
Agentur: <b>{{ request.user.profile.agency.name }}</b>
|
Agentur: <b>{{ request.user.profile.agency.name }}</b>
|
||||||
<div class="col-md-6">
|
<div class="">
|
||||||
<img class="img-profile" width="75%" src="{{ request.user.profile.agency.agencypic.url }}">
|
<img class="img-profile" width="75%" src="{{ request.user.profile.agency.agencypic.url }}">
|
||||||
|
<hr>
|
||||||
|
{% for item in standards_of_agency %}
|
||||||
|
{% if item.public or item.created_standard_by == user or perms.users.standard_management %}
|
||||||
|
<div class=" mb-4 col-5">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
|
||||||
|
<a href="{% url 'standard-single' item.pk%}">
|
||||||
|
{% if item.public %}
|
||||||
|
<h4><u>{{item.name}}</u></h4>
|
||||||
|
{% else %}
|
||||||
|
<h4 class="text-warning"><u>{{item.name}}</u></h4>
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
{% if item.created_standard_by == user or perms.users.standard_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">
|
||||||
|
<!--<div class="dropdown-header">Benutzerdaten</div>-->
|
||||||
|
<a class="dropdown-item" href="{% url 'standard-update' item.pk %}">Bearbeiten</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger" href="{% url 'standard-delete' item.pk %}" >Löschen</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{item.created_standard_by.first_name}} {{item.created_standard_by.last_name}} <h6>Zuletzt bearbeitet von {{ item.last_modified_by.first_name }} {{ item.last_modified_by.last_name }} am {{ item.last_modified_on }}</h6>
|
||||||
|
</h5>
|
||||||
|
<p class="card-text">{{ item.content|truncatechars:250|safe}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
@ -58,6 +58,13 @@ def dashboard(request):
|
||||||
context = {
|
context = {
|
||||||
'active_link' : 'dashboard'
|
'active_link' : 'dashboard'
|
||||||
}
|
}
|
||||||
|
# Adding active_link
|
||||||
|
# Loading only user same agency
|
||||||
|
# Change context and return for template-data
|
||||||
|
# # Get all Users of the Same Agency as logged user
|
||||||
|
standards_of_agency = Standards.objects.filter(agency__pk=request.user.profile.agency.pk).order_by('-last_modified_on')[:10]
|
||||||
|
context.update({'active_link' : 'standards', 'standards_of_agency' : standards_of_agency})
|
||||||
|
#return context
|
||||||
|
|
||||||
return render (request, 'users/dashboard.html', context)
|
return render (request, 'users/dashboard.html', context)
|
||||||
|
|
||||||
|
|
@ -270,6 +277,14 @@ def UsersPrioUpdate(request):
|
||||||
else:
|
else:
|
||||||
return HttpResponse("Request method is not a GET")
|
return HttpResponse("Request method is not a GET")
|
||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
def cleanhtml(raw_html):
|
||||||
|
cleanr = re.compile('<.*?>')
|
||||||
|
cleantext = re.sub(cleanr, '', raw_html)
|
||||||
|
return cleantext
|
||||||
|
|
||||||
# Searxh for Standards by name, content, creator - standards needs to be public!
|
# Searxh for Standards by name, content, creator - standards needs to be public!
|
||||||
def GlobalSearch(request):
|
def GlobalSearch(request):
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
|
|
@ -288,7 +303,7 @@ def GlobalSearch(request):
|
||||||
tempele['id'] = ele.pk
|
tempele['id'] = ele.pk
|
||||||
tempele['name'] = ele.name
|
tempele['name'] = ele.name
|
||||||
# First 100 chars of the Content
|
# First 100 chars of the Content
|
||||||
tempele['content'] = ele.content[:100]
|
tempele['content'] = cleanhtml(ele.content[:100])
|
||||||
tempele['first_name'] = ele.created_standard_by.first_name
|
tempele['first_name'] = ele.created_standard_by.first_name
|
||||||
tempele['last_name'] = ele.created_standard_by.last_name
|
tempele['last_name'] = ele.created_standard_by.last_name
|
||||||
tempele['first_name_mod'] = ele.last_modified_by.first_name
|
tempele['first_name_mod'] = ele.last_modified_by.first_name
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue