Skip to content

Commit

Permalink
3.3.1: fix chapter numbers + ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Oct 14, 2017
1 parent d1ee1e6 commit 2c4c501
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
15 changes: 6 additions & 9 deletions book/static/js/es6_modules/books/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,15 @@ export class BookActions {

jQuery(document).on('click', '#add-chapter', () => {
jQuery('#book-document-list td.checked').each(function () {
let documentId = parseInt(jQuery(this).attr(
'data-id')),
lastChapterNumber = Math.max(
book.chapters.map(chapter => chapter.number)
)
if (isNaN(lastChapterNumber)) {
lastChapterNumber = 0
}
let documentId = parseInt(jQuery(this).attr('data-id')),
chapNums = book.chapters.map(chapter => chapter.number),
number = chapNums.length ?
Math.max.apply(Math, chapNums) + 1:
1
book.chapters.push({
text: documentId,
title: jQuery.trim(this.textContent),
number: lastChapterNumber + 1,
number,
part: ''
})
})
Expand Down
6 changes: 3 additions & 3 deletions book/static/js/es6_modules/books/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,10 @@ export let bookChapterListTemplate = ({book, documentList}) => {
}
${
index + 1 === array.length ?
'<td width="10"></td>' :
`<td width="10" class="book-sort-down" data-id="${chapter.text}">
<i class="fa fa-sort-dsc fw-link-text"></i>
</td>` :
'<td width="10"></td>'
<i class="fa fa-sort-desc"></i>
</td>`
}
<td width="50" align="center">
<span class="delete-chapter fw-inline" data-id="${chapter.text}">
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='fiduswriter-books',
version='3.3.0',
version='3.3.1',
packages=find_packages(),
include_package_data=True,
license='AGPL License',
Expand Down

0 comments on commit 2c4c501

Please sign in to comment.