Skip to content

Commit

Permalink
feat(interval omr search): add frontend components for interval search
Browse files Browse the repository at this point in the history
- Adds interval search to the OMRSearchProvider
- Creates front-end helpers for entering interval search
  • Loading branch information
dchiller committed Aug 19, 2024
1 parent 4322ab9 commit 2e7f0a4
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Marionette from 'marionette';

import template from './interval-choice-list.template.html';

export default Marionette.CompositeView.extend({
template,

events: {
'click [data-search-value]': 'onChoiceClicked'
},

onChoiceClicked: function (event)
{
this.trigger('use:interval', $(event.target).attr('data-search-value'));
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import IncrementalClientSideLoader from "utils/IncrementalClientSideLoader";
import SearchResultHeadingView from "../SearchResultHeadingView";
import NeumeGalleryView from "./NeumeGalleryView";
import ContourChoiceView from "./ContourChoiceView";
import IntervalChoiceView from "./IntervalChoiceView";
import InputView from "./InputView";
import ResultView from "./ResultView";

Expand Down Expand Up @@ -54,11 +55,10 @@ export default Marionette.Object.extend({
name: 'Contour',
type: 'contour'
},
// TODO: Implement interval search (see #875)
// {
// name: 'Interval',
// type: 'intervals'
// }
{
name: 'Interval',
type: 'intervals'
}
]
}
],
Expand Down Expand Up @@ -188,6 +188,14 @@ export default Marionette.Object.extend({
});
regions.searchHelper.show(contourChoices);
}
else if (field.type === 'intervals'){
var intervalChoices = new IntervalChoiceView();
inputView.listenTo(intervalChoices, 'use:interval', function(newQuery)
{
inputView.insertSearchString(newQuery, true);
});
regions.searchHelper.show(intervalChoices);
}
else
{
regions.searchHelper.empty();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="text-center">
<div class="btn-group" role="group">
<button class="btn btn-default" data-search-value="u">Up</button>
<button class="btn btn-default" data-search-value="d">Down</button>
<button class="btn btn-default" data-search-value="r">Repeat</button>
<button class="btn btn-default" data-search-value="u">Up</button>
<button class="btn btn-default" data-search-value="d">Down</button>
<button class="btn btn-default" data-search-value="r">Repeat</button>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<div class="btn-group" role="group">
<div class="btn-group" role="group">
<button type="button"
class="btn btn-default btn-sm dropdown-toggle"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
5<sup>th</sup><span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="#" data-search-value="d5">5<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="d6">6<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="d7">7<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="d8">8<sup>ve</sup></a>
</li>
</ul>
</div>
<button class="btn btn-default btn-sm" data-search-value="d4">
4<sup>th</sup>
</button>
<button class="btn btn-default btn-sm" data-search-value="d3">
3<sup>rd</sup>
</button>
<button class="btn btn-default btn-sm" data-search-value="d2">
2<sup>nd</sup>
</button>
<button class="btn btn-default btn-sm" data-search-value="r">U</button>
<button class="btn btn-default btn-sm" data-search-value="u2">
2<sup>nd</sup>
</button>
<button class="btn btn-default btn-sm" data-search-value="d3">
3<sup>rd</sup>
</button>
<button class="btn btn-default btn-sm" data-search-value="u4">
4<sup>th</sup>
</button>
<div class="btn-group" role="group">
<button type="button"
class="btn btn-default btn-sm dropdown-toggle"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
5<sup>th</sup><span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="#" data-search-value="u5">5<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="u6">6<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="u7">7<sup>th</sup></a>
</li>
<li>
<a href="#" data-search-value="u8">8<sup>ve</sup></a>
</li>
</ul>
</div>
</div>

0 comments on commit 2e7f0a4

Please sign in to comment.