misc: disable zones when there's no item to act on (#9048)

This commit is contained in:
Frédéric Péters 2015-12-03 17:49:30 +01:00
parent 96f0fba328
commit 08b943b1fd
7 changed files with 11 additions and 4 deletions

View File

@ -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">

View File

@ -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()

View File

@ -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">

View File

@ -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)

View File

@ -575,3 +575,8 @@ div.tagcloud span {
div.tagcloud span:hover {
border-bottom: 1px solid #aaa;
}
div.inactive {
opacity: 0.3;
pointer-events: none;
}

View File

@ -1,5 +1,5 @@
{% load i18n %}
<div>
<div {% if not source_pk %}class="inactive"{% endif %}>
{% if source_pk %}
<form>
{% if associations|length %}

View File

@ -1,5 +1,5 @@
{% load i18n %}
<div>
<div {% if not source_pk %}class="inactive"{% endif %}>
{% if source_pk %}
<form>
{% if associations|length %}