Added Page Title setting for files + directories
This commit is contained in:
parent
711bb28568
commit
e441279904
2 changed files with 6 additions and 4 deletions
|
@ -58,13 +58,13 @@ const RepoHelper = {
|
||||||
return langs.find(lang => lang.extensions && lang.extensions.indexOf(`.${ext}`) > -1);
|
return langs.find(lang => lang.extensions && lang.extensions.indexOf(`.${ext}`) > -1);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDirectoryOpen(tree) {
|
setDirectoryOpen(tree, title) {
|
||||||
const file = tree;
|
const file = tree;
|
||||||
if (!file) return undefined;
|
if (!file) return undefined;
|
||||||
|
|
||||||
file.opened = true;
|
file.opened = true;
|
||||||
file.icon = 'fa-folder-open';
|
file.icon = 'fa-folder-open';
|
||||||
RepoHelper.updateHistoryEntry(file.url, file.name);
|
RepoHelper.updateHistoryEntry(file.url, title);
|
||||||
return file;
|
return file;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -135,6 +135,8 @@ const RepoHelper = {
|
||||||
return Service.getContent()
|
return Service.getContent()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
|
if (response.headers && response.headers['page-title']) data.pageTitle = response.headers['page-title'];
|
||||||
|
|
||||||
Store.isTree = RepoHelper.isTree(data);
|
Store.isTree = RepoHelper.isTree(data);
|
||||||
if (!Store.isTree) {
|
if (!Store.isTree) {
|
||||||
if (!file) file = data;
|
if (!file) file = data;
|
||||||
|
@ -168,7 +170,7 @@ const RepoHelper = {
|
||||||
} else {
|
} else {
|
||||||
// it's a tree
|
// it's a tree
|
||||||
if (!file) Store.isRoot = RepoHelper.isRoot(Service.url);
|
if (!file) Store.isRoot = RepoHelper.isRoot(Service.url);
|
||||||
file = RepoHelper.setDirectoryOpen(file);
|
file = RepoHelper.setDirectoryOpen(file, data.pageTitle || data.name);
|
||||||
const newDirectory = RepoHelper.dataToListOfFiles(data);
|
const newDirectory = RepoHelper.dataToListOfFiles(data);
|
||||||
Store.addFilesToDirectory(file, Store.files, newDirectory);
|
Store.addFilesToDirectory(file, Store.files, newDirectory);
|
||||||
Store.prevURL = Service.blobURLtoParentTree(Service.url);
|
Store.prevURL = Service.blobURLtoParentTree(Service.url);
|
||||||
|
|
|
@ -84,7 +84,7 @@ const RepoStore = {
|
||||||
}).catch(Helper.loadingError);
|
}).catch(Helper.loadingError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file.loading) Helper.updateHistoryEntry(file.url, file.name);
|
if (!file.loading) Helper.updateHistoryEntry(file.url, file.pageTitle || file.name);
|
||||||
RepoStore.binary = file.binary;
|
RepoStore.binary = file.binary;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue