Skip to content

Commit

Permalink
More refactoring work
Browse files Browse the repository at this point in the history
- Bump cordova-plugin-file to v8.1.3
- Remove extra project/chapter lookup in Browse/search view (only call fetch on chapterlist if empty in onShow())
  • Loading branch information
eb1 committed Jan 28, 2025
1 parent 08c010f commit 6c9686e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"cordova-plugin-customurlscheme": "^5.0.2",
"cordova-plugin-device": "github:apache/cordova-plugin-device",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^8.0.0",
"cordova-plugin-file": "^8.1.3",
"cordova-plugin-filepath": "github:adapt-it/cordova-plugin-filepath",
"cordova-plugin-keyboard": "github:sinn1/cordova-plugin-keyboard",
"cordova-plugin-network-information": "github:apache/cordova-plugin-network-information",
Expand Down Expand Up @@ -83,12 +83,12 @@
"cordova-plugin-keyboard": {},
"cordova-clipboard": {},
"cordova-sqlite-evcore-extbuild-free": {},
"cordova-plugin-file": {
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
},
"cordova-plugin-chooser": {},
"cordova-plugin-save-dialog": {},
"cordova-plugin-filepath": {}
"cordova-plugin-filepath": {},
"cordova-plugin-file": {
"ANDROIDX_WEBKIT_VERSION": "1.4.0"
}
},
"platforms": [
"android",
Expand Down
20 changes: 8 additions & 12 deletions www/js/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,20 +675,16 @@ define(function (require) {
window.Application.main.show(exportDocView);
}
},
// Search / browse chapter view
// Search / browse chapter view -- all books/chapters in current project
lookupChapter: function (id) {
console.log("lookupChapter");
$.when(window.Application.ProjectList.fetch({reset: true, data: {name: ""}})).done(function () {
$.when(window.Application.ChapterList.fetch({reset: true, data: {name: ""}})).done(function () {
var proj = window.Application.ProjectList.where({projectid: id});
if (proj !== null) {
lookupView = new SearchViews.LookupView({model: proj[0]});
window.Application.main.show(lookupView);
} else {
console.log("no project defined");
}
});
});
var proj = window.Application.ProjectList.where({projectid: id});
if (proj !== null) {
lookupView = new SearchViews.LookupView({model: proj[0]});
window.Application.main.show(lookupView);
} else {
console.log("no project defined");
}
},
// Adapt View (the reason we're here)
adaptChapter: function (id) {
Expand Down
1 change: 1 addition & 0 deletions www/js/views/AdaptViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define(function (require) {
Handlebars = require('handlebars'),
Backbone = require('backbone'),
Marionette = require('marionette'),
hammerjs = require('hammerjs'), // dependency for featherlight gallery
featherlightGallery = require('featherlightGallery'),
i18next = require('i18n'),
hopscotch = require('hopscotch'),
Expand Down
10 changes: 8 additions & 2 deletions www/js/views/SearchViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,14 @@ define(function (require) {

onShow: function () {
var lstBooks = "";
this.bookList.fetch({reset: true, data: {projectid: this.model.get('projectid')}});
this.chapterList.fetch({reset: true, data: {projectid: this.model.get('projectid')}});
// _should_ always have books listed when first displaying (from homeView available actions)
// check the chapterList and optionally fetch
if (window.Application.ChapterList.length === 0) {
console.log("SearchViews:onShow() - need to refresh the chapter list");
window.Application.ChapterList.fetch({reset: true, data: {projectid: window.Application.currentProject.get("projectid")}});
}
this.bookList = window.Application.BookList;
this.chapterList = window.Application.ChapterList;
// initial sort - name
this.bookList.comparator = 'name';
this.bookList.sort();
Expand Down

0 comments on commit 6c9686e

Please sign in to comment.