Use orderedMap for language books

This commit is contained in:
Samy Pessé
2016-04-27 16:26:16 +02:00
parent e50422bce5
commit 869822d180
2 changed files with 15 additions and 4 deletions
+14
View File
@@ -161,6 +161,20 @@ Book.prototype.isMultilingual = function() {
return (this.getLanguages().getList().size > 0);
};
/**
Add a new language book
@param {String} language
@param {Book} book
@return {Book}
*/
Book.prototype.addLanguageBook = function(language, book) {
var books = this.getBooks();
books = books.set(language, book);
return this.set('books', books);
};
/**
Change log level
+1 -4
View File
@@ -39,10 +39,7 @@ function parseMultilingualBook(book) {
.then(parseConfig)
.then(parseBookContent)
.then(function(result) {
var books = currentBook.getBooks();
books = books.push(result);
return currentBook.set('books', books);
return currentBook.addLanguageBook(lang, result);
});
}, book);
}