This repository has been archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_menu.js
87 lines (84 loc) · 3.18 KB
/
_menu.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
return (services, plugin) => new Promise(function(resolve, reject){
const items = [
{
path: "/Student Platform",
actions: {
onclick: () => plugin['breathecode'].openTab('https://student.breatheco.de')
}
},
{
path: "/Browse Assets",
actions: {
onclick: () => plugin['breathecode'].openTab('https://breatheco.de/en/assets/')
}
},
{
path: "/Slack Channel",
actions: {
onclick: () => plugin['breathecode'].openTab('https://4geeksacademy.slack.com/messages')
}
},
{
path: "/~",
type: "divider"
},
{
path: "/Boilerplates",
items: [
{
path: "/vanilla-js",
actions: {
onclick: () => plugin['breathecode'].openTab('https://github.com/4GeeksAcademy/vanillajs-hello')
}
},
{
path: "/react",
actions: {
onclick: () => plugin['breathecode'].openTab('https://github.com/4GeeksAcademy/react-hello')
}
},
{
path: "/react-webapp",
actions: {
onclick: () => plugin['breathecode'].openTab('https://github.com/4GeeksAcademy/react-hello-webapp')
}
},
{
path: "/django-rest",
actions: {
onclick: () => plugin['breathecode'].openTab('https://github.com/4GeeksAcademy/django-rest-hello')
}
},
{
path: "/wordpress",
actions: {
onclick: () => plugin['breathecode'].openTab('https://github.com/4GeeksAcademy/wordpress-hello')
}
}
]
}
];
plugin['breathecode'].log('addMenus');
// Add a custom top-level menu to the menu bar.
// Add commands and dividers to this menu.
var menuCaption = "Breathe Code"; // Menu caption.
var menus = services["menus"]; // Access the menu bar.
menus.remove('Support');
menus.remove('Run');
var MenuItem = services.MenuItem; // Use this to create a menu item.
var Divider = services.Divider; // Use this to create a menu divider.
// Set the top-level menu caption.
menus.setRootMenu(menuCaption, 900, plugin);
//Adding menu options to the root Breathe Code Menu
const addMenuLevel = (parentPath, items) => {
items.forEach((item) => {
plugin['breathecode'].log("addItemByPath", item);
const type = (item.type == 'divider') ? new Divider() : new MenuItem(item.actions || {});
menus.addItemByPath(parentPath + item.path, type, 100, plugin);
if(Array.isArray(item.items) && item.items.length>0)
addMenuLevel(parentPath + item.path, item.items);
});
};
addMenuLevel(menuCaption, items);
resolve();
});