Skip to content

Commit

Permalink
Move manuscript column first in search results in multi-manuscript se…
Browse files Browse the repository at this point in the history
…arch
  • Loading branch information
dchiller committed May 7, 2024
1 parent 1bf8cba commit 5a07b00
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ export default Marionette.CompositeView.extend({

this.listenTo(this.searchParameters, 'change:sortBy change:reverseSort', this._triggerSortingChanged);
this.listenTo(this.searchParameters, 'change:query change:field', this._resetScrolling);

// Show manuscript column if additional fields requested in search
// includes the manuscript (in other words, if we are doing a
// cross-manuscript search)
this.showManuscript = _.some(this.getOption("infoFields"), field => field.type === 'manuscript');
},

childViewOptions: function ()
{
return {
searchType: this.searchParameters.get('field'),
query: this.searchParameters.get('query'),
infoFields: this.getOption('infoFields')
infoFields: this.getOption('infoFields'),
showManuscript: this.showManuscript
};
},

Expand Down Expand Up @@ -215,7 +221,8 @@ export default Marionette.CompositeView.extend({
templateHelpers: function()
{
return {
infoFields: _.toArray(this.getOption('infoFields'))
infoFields: _.toArray(this.getOption('infoFields')),
showManuscript: this.showManuscript
};
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default Marionette.ItemView.extend({

return {
infoFields: infoFields,
showManuscript: this.getOption('showManuscript'),
searchType: searchType,
result: this.model.getFormattedData(searchType, query),
isVolpianoSearch: searchType === 'volpiano' || searchType === 'volpiano_literal',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<table class="table table-condensed result-list child-container">
<thead>
<tr>
<% if (showManuscript) { %>
<th>
<a href="#">Manuscript</a>
<span class="search-caret"></span>
</th>
<% } %>
<th>
<a href="#">Folio</a>
<span class="search-caret"></span>
Expand All @@ -13,10 +19,12 @@
</th>

<% _.forEach(infoFields, function (field) { %>
<% if (field.type != 'manuscript') { %>
<th>
<a href="#"><%= field.name %></a>
<span class="search-caret"></span>
</th>
<% } %>
<% }); %>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<tr>
<% if (showManuscript) { %>
<td><%= result.manuscript %></td>
<% } %>

<td><%= result.folio %></td>

<td>
Expand All @@ -9,7 +13,9 @@
</td>

<% _.forEach(infoFields, function (field) { %>
<% if (field.type != 'manuscript') { %>
<td><%= result[field.type] %></td>
<% } %>
<% }); %>
</tr>

Expand Down

0 comments on commit 5a07b00

Please sign in to comment.