Skip to content

Commit

Permalink
Create header above table when displaying listed search results:
Browse files Browse the repository at this point in the history
"These <item-type>s contain '<phrase>'
  • Loading branch information
mikhuang committed Jul 2, 2013
1 parent 48fa195 commit dc3b1b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
23 changes: 13 additions & 10 deletions deme_django/cms/templates/item/list_bare.html
Expand Up @@ -13,6 +13,15 @@ <h3 class="popup-title">Select {{item_type_name|an}} {{item_type_name}}</h3>
{% if receiver_input_id %}<input type="hidden" name="id" value="{{ receiver_input_id }}">{% endif %}
{% if src %}<input type="hidden" name="src" value="{{ src }}">{% endif %}
{% if base_type %}<input type="hidden" name="base_type" value="{{ base_type }}">{% endif %}
<div class="row">
<label class="hidden-sm col col-lg-3 control-label" for="q">
Search term:
</label>
<div class="col col-lg-9 input-group">
<input type="text" name="q" value="{{ search_query }}" />
<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="glyphicon glyphicon-search"></i> Search</button></span>
</div>
</div>
<div class="row">
<label class="hidden-sm col col-lg-3 control-label">
Item Type Filter:
Expand Down Expand Up @@ -86,20 +95,14 @@ <h3 class="popup-title">Select {{item_type_name|an}} {{item_type_name}}</h3>
</div>
</div>
</div>
<div class="row">
<label class="hidden-sm col col-lg-3 control-label" for="q">
Search term:
</label>
<div class="col col-lg-9 input-group">
<input type="text" name="q" value="{{ search_query }}" />
<span class="input-group-btn"><button type="submit" class="btn btn-info"><i class="glyphicon glyphicon-search"></i> Search</button></span>
</div>
</div>
</form>

<div class="row">
<div class="col col-lg-12">
{% listgridbox accepted_item_type %}
{% if search_query %}
<h5>{{ item_type_name_plural|capfirst }} containing &ldquo;{{ search_query}}&rdquo;</h5>
{% endif %}
{% listgridbox accepted_item_type %}
</div>
</div>
<br>
Expand Down
1 change: 1 addition & 0 deletions deme_django/cms/views.py
Expand Up @@ -139,6 +139,7 @@ def type_list_html(self):
self.context['action_title'] = ''
self.context['metabar_contents'] = u'List %s' % self.accepted_item_type._meta.verbose_name_plural
self.context['item_type_name'] = self.accepted_item_type._meta.verbose_name
self.context['item_type_name_plural'] = self.accepted_item_type._meta.verbose_name_plural
self.context['item_type_lower'] = self.accepted_item_type.__name__.lower()
self.context['item_create_ability'] = "create %s" % (self.accepted_item_type.__name__)
self.context['search_query'] = self.request.GET.get('q', '')
Expand Down

0 comments on commit dc3b1b5

Please sign in to comment.