Skip to content

Commit

Permalink
Merge pull request #663 from upconsulting/develop
Browse files Browse the repository at this point in the history
prepare relese
  • Loading branch information
jdamerow authored Aug 18, 2020
2 parents 087e9f7 + 83a1099 commit 9c17639
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
10 changes: 10 additions & 0 deletions isiscb/curation/templates/curation/citation_list_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,16 @@ <h4 class="modal-title">Link Records</h4>
<form id="filter_form" action="{% url 'curation:citation_list' %}" class="form-horizontal clearfix" method="GET" style="margin-bottom: 0px; margin-top: 10px;">
<div>
<div class="col-sm-4">
{% for error in objects.form.multi_field_filter.errors %}
<div class="alert alert-warning">{{ error }}</div>
{% endfor %}
<div class="form-group form-group-xs clearable">
<label class="col-lg-2 control-label">Combined</label>
<div class="col-lg-10">
{{ objects.form.multi_field_filter|addcss:"form-control;Title, Author, Description, Abstract, Subject, Category" }}
</div>
</div>

{% for error in objects.form.title.errors %}
<div class="alert alert-warning">{{ error }}</div>
{% endfor %}
Expand Down
27 changes: 27 additions & 0 deletions isiscb/isisdata/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class CitationFilter(django_filters.FilterSet):
MARKED_DELETE = 'MD'

print_status = django_filters.ChoiceFilter(empty_label="Print Status (select one)",choices=[(READY_FOR_PRINT_CLASS, 'ReadyForPrint Classified'), (READY_FOR_PRINT_NOT_CLASS, 'ReadyForPrint NotClassified'), (READY_FOR_PRINT_ALL, 'ReadyForPrint All'), (ALREADY_PRINTED, 'Already Printed'), (NOT_READY_YET, 'NotReadyForPrint'), (MARKED_DELETE, 'MarkedDelete')], method='filter_print_status')
multi_field_filter = django_filters.CharFilter(method='filter_in_multiple_fields')

def __init__(self, params, **kwargs):
if 'in_collections' in params and params.get('collection_only', False):
Expand Down Expand Up @@ -339,6 +340,32 @@ def filter_in_collections(self, queryset, field, value):

return queryset.filter(Q(in_collections=value))

def filter_in_multiple_fields(self, queryset, field, value):
if not value:
return queryset

value = normalize(unidecode(value))

q_title = Q()
q_description = Q()
q_author = Q()
q_abstract = Q()
for part in value.split():
q_title = q_title & Q(title_for_sort__icontains=part)
q_author = q_author & Q(acrelation__authority__name__icontains=part,
acrelation__type_controlled__in=[
ACRelation.AUTHOR])

q_description = q_description & Q(description__icontains=value)
q_abstract = q_abstract & Q(abstract__icontains=value)
q_subject = Q(acrelation__authority__name__icontains=value,
acrelation__type_controlled=ACRelation.SUBJECT)
q_category = Q(acrelation__authority__name__icontains=value,
acrelation__type_controlled=ACRelation.CATEGORY)



return queryset.filter(q_title | q_description | q_author | q_abstract | q_subject | q_category)

class AuthorityFilter(django_filters.FilterSet):

Expand Down
5 changes: 4 additions & 1 deletion isiscb/isisdata/templates/isisdata/authority.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,13 @@ <h3 style="margin-top: 5px;">{{ authority.name }}</h3>
<p><strong>Description:</strong> <span id="desc_snippet" class="hidden-print">{{ authority.description|truncatewords:15 }}</span>
{% if authority.description|truncatewords:15|length < authority.description|length %}
<a href="#" id="desc_more" class="hidden-print">More</a>
<span id="desc_full" class="visible-print-block" style="display:none">
<span id="desc_full" class="hidden-print" style="display:none">
{{ authority.description }}
<a href="#" id="desc_hide">Less</a>
</span>
<span class="visible-print-block">
{{ authority.description }}
</span>
{% endif %}
</p>
<script>
Expand Down
17 changes: 8 additions & 9 deletions isiscb/isisdata/templates/isisdata/citation.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{#% block title %}Citation{% endblock %#}

{% block content %}
<div class="row" ng-app="commentsApp">
<div class="col-sm-3 col-md-2 hidden-print">
<div class="row">
<div class="col-sm-12 col-md-2 hidden-print">
<div class="menu hidden-print">
<a href="{% if last_query %}{{ last_query }}{% else %}javascript:window.history.back(){% endif %}"><span class="glyphicon glyphicon-arrow-left"></span></a>
&nbsp; &nbsp;
Expand All @@ -51,7 +51,7 @@
{% include "isisdata/citation_nav.html" %}

</div>
<div class=" main col-sm-5 col-md-7">
<div class=" main col-sm-12 col-md-10">
<!-- Progress through search results, if arriving from search view. -->
{% if search_results|length > 0 and fromsearch and search_current %}
<div class="alert alert-warning hidden-print">
Expand Down Expand Up @@ -307,14 +307,13 @@ <h4>Associated with</h4>
{% include "isisdata/citation_nav.html" %}

</div>
</div>

<div class="row" ng-app="commentsApp">
<div class="col-sm-12">
{% include "isisdata/comments.html" %}


<div class="col-sm-4 col-md-3 main">
{% include "isisdata/comments.html" %}

</div>
</div>

</div>

{% endblock %}

0 comments on commit 9c17639

Please sign in to comment.