Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public function widget( $args, $instance ) {
$articles_tab_name = 'Articles + chapters';
$more_template = 'templates/tab-more-alma.php';
}
if ( 'use' == $instance['targets'] ) {
$all_template = 'templates/tab-all-use.php';
}

// Strip initial arguments.
$args = null;
Expand Down Expand Up @@ -84,27 +87,44 @@ public function widget( $args, $instance ) {
include( 'templates/form_nojs.html' );
echo '</noscript>';
echo '<div id="multisearch" class="' . esc_attr( $this->widgetClasses( $instance ) ) . ' nojs">';
echo '<h2 id="searchtabsheader" class="sr">Search the MIT libraries</h2>
<ul id="search_tabs_nav" aria-labelledby="searchtabsheader">
echo '<h2 id="searchtabsheader" class="sr">Search the MIT libraries</h2>';

// Render the search tabs only when "Unified Search" option is not selected
if ( $instance['targets'] != 'use' ) {

echo '<ul id="search_tabs_nav" aria-labelledby="searchtabsheader">
<li><a id="tab-all" href="#search-all"><span>All</span></a></li>
<li><a id="tab-books" href="#search-books"><span>Books + media</span></a></li>
<li><a id="tab-articles" href="#search-articles"><span>'
. esc_html( $articles_tab_name )
. '</span></a></li>
<li><a id="tab-more" href="#search-more"><span>More...</span></a></li>
</ul>';
echo '<div id="search-all" aria-labelledby="tab-all">';
include( $all_template );
echo '</div>';
echo '<div id="search-books" aria-labelledby="tab-books">';
include( $books_template );
echo '</div>';
echo '<div id="search-articles" aria-labelledby="tab-articles">';
include( $articles_template );
echo '</div>';
echo '<div id="search-more" aria-labelledby="tab-more">';
include( $more_template );
echo '</div>';
</ul>';

// Render the individual tab panes
echo '<div id="search-all" aria-labelledby="tab-all">';
include( $all_template );
echo '</div>';
echo '<div id="search-books" aria-labelledby="tab-books">';
include( $books_template );
echo '</div>';
echo '<div id="search-articles" aria-labelledby="tab-articles">';
include( $articles_template );
echo '</div>';
echo '<div id="search-more" aria-labelledby="tab-more">';
include( $more_template );
echo '</div>';

};

if ( $instance['targets'] == 'use' ) {

echo '<div id="search-all" class="r-tabs-panel r-tabs-state-active use" aria-labelledby="tab-all">';
include( $all_template );
echo '</div>';

};

if ( $instance['banner_text'] ) {
$allowed = array(
'a' => array(
Expand Down Expand Up @@ -186,6 +206,21 @@ class="widefat"
Alma and Primo
</label>
</li>
<li>
<label>
<input
type="radio"
name="<?php echo esc_attr( $this->get_field_name( 'targets' ) ); ?>"
value="use"
<?php
if ( 'use' == $targets ) {
echo "checked='checked'";
}
?>
>
Unified Search
</label>
</li>
</ul>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'bento_url' ) ); ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,60 @@
}
}

/* Updates for the USE search panel option */

.r-tabs .use {

.search-option-links {
display: flex;
font-size: 0.8rem;
color: #ccc;
justify-content: space-between;

a:link {
color: #000;
}

.nls-toggle {

a {
line-height: 1.3;
}

.toggle {
margin-right: 8px;
}

.toggle::before {
background-color: #333;
color: #fff;
font-size: 0.6rem;
font-weight: 500;
letter-spacing: 0.08em;
padding: 3px 6px;
border-radius: 4px;
display: inline-block;
margin-right: 6px;
position: relative;
top: -1px;
}

.toggle.off::before {
content: "OFF";
}

.toggle.on::before {
background-color: #CC00CC;
content: "ON";
}

.learn-more {
color: #666;
}

.learn-more:hover {
color: #000;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* The "Alma variant" of the search tab for all content - which will search the Bento app.
*
* @package Multisearch Widget
* @since 1.5.0
*/

?>
<h3 class="sr">All panel</h3>
<form
class="form search-bento"
action="https://search.libraries.mit.edu/results"
method="get"
data-target="bento">
<label for="searchinput-bento">Search the MIT Libraries</label>
<div class="wrap-flex">
<div class="flex-left">
<input
class="field field-text"
type="text"
id="searchinput-bento"
name="q"
placeholder="Search across collections, services, and website content">
</div>
<div class="flex-right">
<input class="button button-search" type="submit" value="Search">
</div>
</div>
</form>
<div class="search-option-links">
<div>
<a href="/search-advanced/">Advanced search</a> | <a href="/search/">More ways to search</a>
</div>
<div class="nls-toggle">
<a class="toggle on" href="#">Try natural language search</a>
<a class="learn-more" href="https://search.libraries.mit.edu/about-natural-language-search">Learn more</a>
</div>
</div>