Skip to content

Commit

Permalink
Help icon placed now also next to advanced search on manage page;
Browse files Browse the repository at this point in the history
Arrow behavior and open/close logic also made right
  • Loading branch information
Andy Mardesich committed Oct 11, 2016
1 parent 5418f25 commit df0d794
Showing 9 changed files with 69 additions and 15 deletions.
1 change: 1 addition & 0 deletions code/ui_manage.py
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
def index(request):
""" Manage Page, listing all Ids owned by user, or if groupadmin, all group users """
d = { 'menu_item' : 'ui_manage.index' }
d['collapse_advanced_search'] = "collapsed"
if request.method != "GET":
return uic.methodNotAllowed(request)
noConstraintsReqd = True # Empty 'manage' form means search everything
6 changes: 3 additions & 3 deletions code/ui_search.py
Original file line number Diff line number Diff line change
@@ -109,13 +109,13 @@ def index(request):
if request.method != "GET":
return uic.methodNotAllowed(request)
d = { 'menu_item' : 'ui_search.index' }
d['show_advanced_search'] = "closed"
d['collapse_advanced_search'] = "collapsed"
d['q'] = queryDict(request)
d['form'] = form_objects.BaseSearchIdForm(d['q'])
# if users are coming back to an advanced search, auto-open adv. search block
if 'modify_search' in d['q'] and d['q']['modify_search'] == 't':
if 'keywords' in d['q'] and d['q']['keywords'].strip() == '':
d['show_advanced_search'] = "open"
d['collapse_advanced_search'] = "" # Leaving this empty actually opens advanced search block
else:
if d['q']:
d['p'] = 1
@@ -246,7 +246,7 @@ def search(d, request, noConstraintsReqd=False, s_type="public"):
d['heading_title'] = _("Your Identifiers") + " (" + d['total_results_str'] + ")"
d['search_success'] = True
else: # Form did not validate
d['show_advanced_search'] = "open" # Open up adv. search html block
d['collapse_advanced_search'] = "" # Open up adv. search html block
if '__all__' in d['form'].errors:
# non_form_error, probably due to all fields being empty
all_errors = ''
6 changes: 6 additions & 0 deletions dev/images/icon_up-arrow2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dev/includes/showhide_help.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="showhide2">
<a class="showhide2__title-heading" data-toggle="collapse" href="#showhide2__accordion-body">
<div class="showhide__summary">
<div class="showhide2__summary">
Advanced Search
</div>
</a>
30 changes: 29 additions & 1 deletion dev/scss/_showhide.scss
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
height: 32px;
}

.showhide__summary {
%showhide__summary-base {
position: relative;
margin: 0 0 30px;
padding: 7px 0 7px 40px;
@@ -49,6 +49,10 @@
background: $design-form-element-bg;
content: '';
}
}

.showhide__summary {
@extend %showhide__summary-base;

&::after { // icon image
@extend %showhide-icon-base;
@@ -58,6 +62,17 @@

}

.showhide2__summary {
@extend %showhide__summary-base;

&::after { // icon image
@extend %showhide-icon-base;
background: url('../images/icon_up-arrow2.svg') center / 12px no-repeat;
content: '';
}

}

.showhide__title-heading {
margin: 0;
font-size: inherit;
@@ -66,6 +81,19 @@
.showhide2__title-heading {
margin: 0 10px 0 0;

&:hover {
text-decoration: none; // bootstrap override
}

&[class~="collapsed"] .showhide2__summary {

&::after { // flip down arrow to up
transform: rotate(-180deg);
}

}


}

.showhide2__icon-help {
6 changes: 6 additions & 0 deletions static/images/icon_up-arrow2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion static/stylesheets/main2.min.css

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions templates/manage/index.html
Original file line number Diff line number Diff line change
@@ -30,8 +30,17 @@
<button class="manage__simple-search-button search__action" type="submit">{% trans "Search Your Identifiers" %}</button>
</div>
{% include "includes/search_help.html" %}
<details {{ show_advanced_search }} class="showhide">
<summary class="showhide__summary">{% trans "Advanced Search" %}</summary>
<div class="showhide2">
<a id="showhide2__title-heading" class="showhide2__title-heading {{ collapse_advanced_search }}" data-toggle="collapse" href="#showhide2__accordion-body">
<div class="showhide2__summary">{% trans "Advanced Search" %}</div>
</a>
{% help_icon "search_advanced" _("on using advanced fields") "button__icon-help" %}
</div>
{% if collapse_advanced_search == 'collapsed' %}
<div id="showhide2__accordion-body" class="showhide2__accordion-body collapse" aria-expanded="false">
{% else %}
<div id="showhide2__accordion-body" class="showhide2__accordion-body collapse in" aria-expanded="true"/>
{% endif %}
<div class="row">
<div class="col-md-6 manage__form-element-container">
<div class="fcontrol__group-stacked{% if form.identifier.errors %}--invalid{% endif %}">
@@ -215,12 +224,14 @@
<button id="reset_search" type="button" class="button__primary manage__reset-button">Reset Search Fields</button>
</div>
</div>
</details>
</div>
</form>

{% include "search/_results.html" with primary_page="ui_manage.index" %}

<script type="text/javascript" src="/static/javascripts/readmoreless.js"></script>
{% include "info/popup_help.html" %}
<script type="text/javascript" src="/static/javascripts/help_box_.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Hide header on Manage page always. It just adds too much information on an already full page.
14 changes: 8 additions & 6 deletions templates/search/index.html
Original file line number Diff line number Diff line change
@@ -22,14 +22,17 @@
</div>
{% include "includes/search_help.html" %}

<!-- ToDo {{ show_advanced_search }} -->
<div class="showhide2">
<a id="showhide2__title-heading" class="showhide2__title-heading" data-toggle="collapse" href="#showhide2__accordion-body">
<div class="showhide__summary">{% trans "Advanced Search" %}</div>
<a id="showhide2__title-heading" class="showhide2__title-heading {{ collapse_advanced_search }}" data-toggle="collapse" href="#showhide2__accordion-body">
<div class="showhide2__summary">{% trans "Advanced Search" %}</div>
</a>
{% help_icon "search_advanced" _("on using advanced fields") "button__icon-help" "right" %}
{% help_icon "search_advanced" _("on using advanced fields") "button__icon-help" %}
</div>
<div id="showhide2__accordion-body" class="showhide2__accordion-body collapse">
{% if collapse_advanced_search == 'collapsed' %}
<div id="showhide2__accordion-body" class="showhide2__accordion-body collapse" aria-expanded="false">
{% else %}
<div id="showhide2__accordion-body" class="showhide2__accordion-body collapse in" aria-expanded="true"/>
{% endif %}
<div class="row">
<div class="col-md-6 search__form-element-container">
<div class="fcontrol__group-stacked{% if form.identifier.errors %}--invalid{% endif %}">
@@ -129,5 +132,4 @@
// focus on page load
$("#search__simple-label").focus();
</script>

{% endblock %}

0 comments on commit df0d794

Please sign in to comment.