misc: disable zones when there's no item to act on (#9048)
This commit is contained in:
parent
96f0fba328
commit
08b943b1fd
|
@ -1,5 +1,5 @@
|
|||
{% load i18n %}
|
||||
<div data-contact-fragment-url="{% url 'contacts-zone' %}/">
|
||||
<div {% if not source_pk %}class="inactive"{% endif %} data-contact-fragment-url="{% url 'contacts-zone' %}/">
|
||||
<div class="search">
|
||||
<input type="text" autocomplete="off" placeholder="{% trans 'Name, phone, etc.' %}" data-autocomplete-json="{% url 'contacts-search-json' %}" name="q"/>
|
||||
<ul class="result">
|
||||
|
|
|
@ -47,6 +47,7 @@ class ContactsZone(TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ContactsZone, self).get_context_data(**kwargs)
|
||||
context['source_pk'] = self.request.GET.get('source_pk')
|
||||
if 'source_pk' in self.request.GET:
|
||||
source_class = ContentType.objects.get(
|
||||
id=self.request.GET['source_type']).model_class()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load i18n %}
|
||||
<div data-page-fragment-url="{% url 'kb-zone' %}/">
|
||||
<div {% if not source_pk %}class="inactive"{% endif %} data-page-fragment-url="{% url 'kb-zone' %}/">
|
||||
<div class="search">
|
||||
<input type="text" autocomplete="off" placeholder="{% trans 'Keywords...' %}" data-autocomplete-json="{% url 'kb-page-search-json' %}" name="q"/>
|
||||
<ul class="result">
|
||||
|
|
|
@ -165,6 +165,7 @@ class KbZone(TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(KbZone, self).get_context_data(**kwargs)
|
||||
context['source_pk'] = self.request.GET.get('source_pk')
|
||||
context['form'] = SearchForm()
|
||||
context['tags'] = Tag.objects.all().annotate(
|
||||
num_times=Count('taggit_taggeditem_items')).filter(num_times__gt=0)
|
||||
|
|
|
@ -575,3 +575,8 @@ div.tagcloud span {
|
|||
div.tagcloud span:hover {
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
|
||||
div.inactive {
|
||||
opacity: 0.3;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load i18n %}
|
||||
<div>
|
||||
<div {% if not source_pk %}class="inactive"{% endif %}>
|
||||
{% if source_pk %}
|
||||
<form>
|
||||
{% if associations|length %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load i18n %}
|
||||
<div>
|
||||
<div {% if not source_pk %}class="inactive"{% endif %}>
|
||||
{% if source_pk %}
|
||||
<form>
|
||||
{% if associations|length %}
|
||||
|
|
Loading…
Reference in New Issue