-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode.js
40 lines (31 loc) · 1.29 KB
/
Code.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Runs when the add-on is installed.
*
* @param {object} e The event parameter for a simple onInstall trigger. To
* determine which authorization mode (ScriptApp.AuthMode) the trigger is
* running in, inspect e.authMode. (In practice, onInstall triggers always
* run in AuthMode.FULL, but onOpen triggers may be AuthMode.LIMITED or
* AuthMode.NONE).
*/
function onInstall(e) {
onOpen()
}
function onOpen(e) {
}
function buildIconUrl(name) {
return 'https://cdn.rawgit.com/webdog/octicons-png/bd02e5bc/' + name + '.svg.png';
}
function buildCommonHomePage(){
return BillyApp.buildInstancesView()
}
function buildSheetsHomePage(){
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const parentFolder = DriveApp.getFileById(spreadsheet.getId()).getParents().next()
Logger.log(spreadsheet.getName())
if(BillyApp.isFolderAnInstance(parentFolder.getName()) == false)
return BillyApp.buildInstancesView();
const moduleKey = BillyApp.getModuleKeyFromSpreadsheetName(spreadsheet.getName())
if(moduleKey == false || Object.keys(BillyApp.modules).includes(moduleKey) == false)
return BillyApp.buildInstanceView({id: parentFolder.getId(), name: BillyApp.getInstanceNameFromFolder(parentFolder.getName())})
return BillyApp.modules[moduleKey].buildCard();
}