Skip to content

Commit bcf8b98

Browse files
committed
Add the top-level semantic search view (#455)
1 parent a4c12b6 commit bcf8b98

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<h3 class="title is-3">{{#i18n 'semsearch-title'}}Semantic search{{/i18n}}</h3>
2+
<h5 class="subtitle is-5">{{#i18n 'semsearch-subtitle'}}Find linked data items based on semantic features{{/i18n}}</h5>
3+
<div class="field">
4+
<div class="control">
5+
<button class="button is-primary rit-submit-sem" type=button>
6+
<span>{{#i18n 'semsearch-submit'}}Search{{/i18n}}</span>
7+
<span class="icon is-small"><i class="fa fa-search"></i></span>
8+
</button>
9+
</div>
10+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { extend } from 'lodash';
2+
3+
import Model from '../core/model';
4+
import { CompositeView } from '../core/view';
5+
import Multifield from '../forms/multifield-view';
6+
7+
import semChannel from './radio';
8+
import Chain from './chain-view';
9+
import Multibranch from './multibranch-view';
10+
import semTemplate from './semantic-search-template';
11+
12+
export default class SemanticSearchView extends CompositeView {
13+
topChain: Chain;
14+
15+
initialize(): void {
16+
this.topChain = new Chain({ model: this.model });
17+
semChannel.reply('branchout', this.branchout, this);
18+
this.render();
19+
}
20+
21+
renderContainer(): this {
22+
this.$el.html(this.template({}));
23+
return this;
24+
}
25+
26+
remove(): this {
27+
semChannel.stopReplying('branchout', this.branchout);
28+
return super.remove();
29+
}
30+
31+
branchout(model: Model): Multifield {
32+
const collectionView = new Multibranch({ model });
33+
return new Multifield({ collectionView });
34+
}
35+
}
36+
37+
extend(SemanticSearchView.prototype, {
38+
className: 'rit-semantic-search',
39+
template: semTemplate,
40+
subviews: [{
41+
view: 'topChain',
42+
method: 'after',
43+
selector: '.subtitle',
44+
}],
45+
});

0 commit comments

Comments
 (0)