Skip to content

Commit

Permalink
Add context menu links to various Pontoon pages, fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
MikkCZ committed Aug 29, 2017
1 parent e02959b commit 44bb377
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/js/RemotePontoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ RemotePontoon.prototype = {
return this._notificationsUrl;
},

getMachineryUrl: function() {
return `${this._baseUrl}/machinery/`;
},

getTeamPageUrl: function() {
return `${this._baseUrl}/${this._team}/`;
},

getTeamBugsUrl: function() {
return `${this._baseUrl}/${this._team}/bugs/`;
},

getTeamProjectUrl: function(projectsUrl) {
return this._baseUrl + projectsUrl.replace('/projects/', `/${this._team}/`);
},
Expand Down
30 changes: 29 additions & 1 deletion src/js/ToolbarButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,38 @@ ToolbarButton.prototype = {
contexts: ['browser_action'],
onclick: this._reload.bind(this),
});
var pontoonPagesMenuId = chrome.contextMenus.create({
title: 'Pontoon pages',
contexts: ['browser_action'],
});
chrome.contextMenus.create({
title: 'Home',
contexts: ['browser_action'],
parentId: pontoonPagesMenuId,
onclick: function() {chrome.tabs.create({url: this._remotePontoon.getBaseUrl()});}.bind(this),
});
chrome.contextMenus.create({
title: 'Team page',
contexts: ['browser_action'],
parentId: pontoonPagesMenuId,
onclick: function() {chrome.tabs.create({url: this._remotePontoon.getTeamPageUrl()});}.bind(this),
});
chrome.contextMenus.create({
title: 'Team bugs',
contexts: ['browser_action'],
parentId: pontoonPagesMenuId,
onclick: function() {chrome.tabs.create({url: this._remotePontoon.getTeamBugsUrl()});}.bind(this),
});
chrome.contextMenus.create({
title: 'Machinery',
contexts: ['browser_action'],
parentId: pontoonPagesMenuId,
onclick: function() {chrome.tabs.create({url: this._remotePontoon.getMachineryUrl()});}.bind(this),
});
chrome.contextMenus.create({
title: 'Pontoon tools options',
contexts: ['browser_action'],
onclick: function() {chrome.runtime.openOptionsPage();},
onclick: function() {chrome.runtime.openOptionsPage();}.bind(this),
});
},

Expand Down

0 comments on commit 44bb377

Please sign in to comment.