commit
bc5c7a383b
|
@ -106,7 +106,7 @@ $j(document).ready(function() {
|
||||||
loader: '<img src="/static/images/loading.gif" alt="loading..." />',
|
loader: '<img src="/static/images/loading.gif" alt="loading..." />',
|
||||||
callback: function(p) {
|
callback: function(p) {
|
||||||
page += 1;
|
page += 1;
|
||||||
var url = "?q={{ q }}&gbo={{ gbo }}&page=" + page;
|
var url = "?q={{ q }}&gbo={{ gbo }}&ty={{ ty }}&page=" + page;
|
||||||
$j.get(url, function(html) {
|
$j.get(url, function(html) {
|
||||||
var view = $j(".listview").length > 0 ? "list" : "panel";
|
var view = $j(".listview").length > 0 ? "list" : "panel";
|
||||||
var results = $j(html).find(".book");
|
var results = $j(html).find(".book");
|
||||||
|
|
|
@ -96,9 +96,9 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="pubinfo">
|
<div class="pubinfo">
|
||||||
<h3 class="book-author">
|
<h3 class="book-author">
|
||||||
<span itemprop="author">{{ work.relators.0.name }}</span>{% ifequal work.authors.count 2 %}
|
<span itemprop="author"><a href="{% url 'search' %}?q={{ work.relators.0.author.name|urlencode }}&ty=au" />{{ work.relators.0.name }}</a></span>{% ifequal work.authors.count 2 %}
|
||||||
and <span itemprop="author">{{ work.relators.1.name }}</span>
|
and <span itemprop="author"><a href="{% url 'search' %}?q={{ work.relators.1.author.name|urlencode }}&ty=au" />{{ work.relators.1.name }}</a></span>
|
||||||
{% endifequal %}{% if work.relators.count > 2 %}{% for author in work.relators %}{% if not forloop.first %}, <span itemprop="author">{{ author.name }}</span>{% endif %}{% endfor %}
|
{% endifequal %}{% if work.relators.count > 2 %}{% for author in work.relators %}{% if not forloop.first %}, <span itemprop="author"><a href="{% url 'search' %}?q={{ author.author.name|urlencode }}&ty=au" />{{ author.name }}</a></span>{% endif %}{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
<h3 class="book-year">
|
<h3 class="book-year">
|
||||||
|
|
|
@ -2218,6 +2218,7 @@ class ManageAccount(FormView):
|
||||||
|
|
||||||
def search(request):
|
def search(request):
|
||||||
q = request.GET.get('q', '')
|
q = request.GET.get('q', '')
|
||||||
|
ty = request.GET.get('q', 'g') # ge= 'general, au= 'author'
|
||||||
request.session['q']=q
|
request.session['q']=q
|
||||||
page = int(request.GET.get('page', 1))
|
page = int(request.GET.get('page', 1))
|
||||||
gbo = request.GET.get('gbo', 'n') # gbo is flag for google books only
|
gbo = request.GET.get('gbo', 'n') # gbo is flag for google books only
|
||||||
|
@ -2226,6 +2227,8 @@ def search(request):
|
||||||
isbnq = ISBN(q)
|
isbnq = ISBN(q)
|
||||||
if isbnq.valid:
|
if isbnq.valid:
|
||||||
work_query = Q(identifiers__value=str(isbnq), identifiers__type="isbn")
|
work_query = Q(identifiers__value=str(isbnq), identifiers__type="isbn")
|
||||||
|
elif ty=='au':
|
||||||
|
work_query = Q(editions__authors__name=q)
|
||||||
else:
|
else:
|
||||||
work_query = Q(title__icontains=q) | Q(editions__authors__name__icontains=q) | Q(subjects__name__iexact=q)
|
work_query = Q(title__icontains=q) | Q(editions__authors__name__icontains=q) | Q(subjects__name__iexact=q)
|
||||||
campaign_works = models.Work.objects.filter(our_stuff).filter(work_query).distinct()
|
campaign_works = models.Work.objects.filter(our_stuff).filter(work_query).distinct()
|
||||||
|
@ -2252,6 +2255,7 @@ def search(request):
|
||||||
context = {
|
context = {
|
||||||
"q": q,
|
"q": q,
|
||||||
"gbo": gbo,
|
"gbo": gbo,
|
||||||
|
"ty": ty,
|
||||||
"results": works,
|
"results": works,
|
||||||
"campaign_works": campaign_works
|
"campaign_works": campaign_works
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -41,6 +41,12 @@
|
||||||
font-weight:normal;
|
font-weight:normal;
|
||||||
color:@text-blue;
|
color:@text-blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3.book-author span a, h3.book-year span a{
|
||||||
|
font-size: @font-size-default;
|
||||||
|
font-weight:normal;
|
||||||
|
color:@link-color;
|
||||||
|
}
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
width:100%;
|
width:100%;
|
||||||
|
|
Loading…
Reference in New Issue