@@ -63,12 +82,37 @@ class Corpora extends Component {
));
}
+
+ handleChange = (e) => {
+ let list = this.state.listCorpus;
+ let index = list.indexOf(e.target.value);
+ if (index !== -1) {
+ list.splice(index, 1);
+ } else {
+ list.push(e.target.value);
+ }
+ this.setState({
+ listCorpus: list
+ });
+ this.handleCorpusSelected(e.target.value);
+ }
+
+ isChecked(corpus) {
+ const selection = Selection.fromURI();
+ return selection.isSelectedOrExcluded(corpus) !== 'Excluded';
+ }
+
+ handleCorpusSelected(corpusId) {
+ const selection = Selection.fromURI();
+ selection.toggleCorpus(corpusId);
+ this.props.history.push(selection.toURI());
+ }
}
function Item(props) {
let uri = `/item/${props.item.corpus}/${props.item.id}`;
let name = [props.item.name].join(', '); //Name can be an array
- let thumbnail = props.item.thumbnail &&
;
+ let thumbnail = props.item.thumbnail &&
;
let criteria = (props.criteria !== 'name')
&&
{props.item[props.criteria]}
;
return (
diff --git a/src/components/portfolioPage/Portfolio.jsx b/src/components/portfolioPage/Portfolio.jsx
index af5a53bd..df65d3ad 100644
--- a/src/components/portfolioPage/Portfolio.jsx
+++ b/src/components/portfolioPage/Portfolio.jsx
@@ -155,10 +155,11 @@ class Portfolio extends Component {
}
_getItemAttributes(item) {
- return new Items(
+ let result = new Items(
[item]
).getAttributes()
.map(([key, value]) => key.concat(' : ', value.replace('\'', '’')));
+ return result;
}
_isSelected(item) {
@@ -260,6 +261,7 @@ class Portfolio extends Component {
from={this.state.items.length}
items={this.state.selectedItems}
conf={conf}
+ history={this.props.history}
/>
);
}
diff --git a/src/components/portfolioPage/SearchBar.jsx b/src/components/portfolioPage/SearchBar.jsx
index 0562460d..67e8e4a6 100644
--- a/src/components/portfolioPage/SearchBar.jsx
+++ b/src/components/portfolioPage/SearchBar.jsx
@@ -46,7 +46,11 @@ class SearchBar extends React.Component {
handleSuggestionSelected = (_, { suggestion }) => {
this.setState({pattern: ''});
const selection = Selection.fromURI();
- selection.addTopic(suggestion.id);
+ if (suggestion.id.includes('corpus')) {
+ selection.addCorpus(suggestion.id);
+ } else {
+ selection.addTopic(suggestion.id);
+ }
this.props.history.push(selection.toURI());
};
diff --git a/src/components/portfolioPage/Status.jsx b/src/components/portfolioPage/Status.jsx
index a124cf49..2f37c7e3 100644
--- a/src/components/portfolioPage/Status.jsx
+++ b/src/components/portfolioPage/Status.jsx
@@ -20,10 +20,10 @@ class Status extends Component {
...clause.exclusion.map(id => ({excluded: true, id, topic: this._getCandidate(id)}))]
.sort(filter)
.map(
- t =>
- (t.topic === null)
- ?
Rubrique inconnue
- :
+ t => {
+ let res = (t.topic === null) ? Rubrique inconnue : ;
+ return res;
+ }
);
status.push(topicsHTML.map((e, i) => i < topicsHTML.length - 1 ? [e,