Skip to content

Commit

Permalink
Merge pull request #114 from unt-libraries/universal-search-default
Browse files Browse the repository at this point in the history
Universal search default
  • Loading branch information
somexpert authored Mar 29, 2017
2 parents 6ab31f3 + 55d826e commit 683bcb6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2014, Regents of the University of North Texas
Copyright © 2017, Regents of the University of North Texas
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Contributors:
- [Damon Kelley](https://github.com/damonkelley)
- [Lauren Ko](https://github.com/ldko)
- [Mark Phillips](https://github.com/vphill)
- [Gio Gottardi](https://github.com/somexpert)


## Developing
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

# General information about the project.
project = u'Django Name'
copyright = u'2015, University of North Texas Libraries'
copyright = u'2017, University of North Texas Libraries'
author = u'University of North Texas Libraries'

# The version info for the project you're documenting, acts as replacement for
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ Acknowledgements
- `Damon Kelley`_
- `Lauren Ko`_
- `Mark Phillips`_
- `Gio Gottardi`_

.. _`Joey Liechty`: http://github.com/yeahdef
.. _`Damon Kelley`: http://github.com/damonkelley
.. _`Lauren Ko`: http://github.com/ldko
.. _`Mark Phillips`: http://github.com/vphill
.. _`Gio Gottardi`: http://github.com/somexpert

2 changes: 1 addition & 1 deletion name/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = 'Django Name'
__version__ = '1.1.0'
__version__ = '1.1.1'
3 changes: 2 additions & 1 deletion name/templates/name/_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
<select class="form-control" name="q_type" id="q_type">
{# Show current searched type as the default selection, if it exists #}
{% for k, v in name_types.items %}
{% if q_type == v %}
{% if request.GET.q_type == v %}
<option value="{{ v }}" selected>{{ v }}</option>
{% else %}
<option value="{{ v }}">{{ v }}</option>
{% endif %}
{% endfor %}
<option value="Any Type" {% if not request.GET.q_type or request.GET.q_type == "Any Type" %}selected{% endif %}>Any Type</option>
</select>
<input class="form-control" type="text" name="q" id="names" value="{{ q }}">
<input type="hidden" value="{% url "name:search-json" %}" id="autocomplete">
Expand Down
1 change: 1 addition & 0 deletions name/templates/name/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h3>Search {{ name_app_title }}</h3>
<option value="{{ v }}">{{ v }}</option>
{% endif %}
{% endfor %}
<option value="Any Type" {% if not request.GET.q_type or request.GET.q_type == "Any Type" %}selected{% endif %}>Any Type</option>
</select>
<input class="form-control" type="text" name="q" id="large_names" value="{{ request.GET.q }}">
<button class="btn btn-default" type="submit">Submit</button>
Expand Down
9 changes: 6 additions & 3 deletions name/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ def resolve_type(q_type):

q_type = q_type.split(',')

# Iterate through the Name Types and create a list of Name IDs
# using the corresponding strings values in q_type
return [k for k, v in Name.NAME_TYPE_CHOICES if v in q_type]
if "Any Type" in q_type:
return [k for k, v in Name.NAME_TYPE_CHOICES]
else:
# Iterate through the Name Types and create a list of Name IDs
# using the corresponding strings values in q_type
return [k for k, v in Name.NAME_TYPE_CHOICES if v in q_type]


# TODO: Look at reducing the number of queries.
Expand Down

0 comments on commit 683bcb6

Please sign in to comment.