Localization support for menu.

This commit is contained in:
Dannon Baker
2017-03-16 09:40:06 -04:00
parent d7e4e8e162
commit d4462cb321
5 changed files with 41 additions and 41 deletions
+35 -35
View File
@@ -1,5 +1,5 @@
/** Masthead Collection **/
define(['layout/generic-nav-view', 'mvc/webhooks'], function( GenericNav, Webhooks ) {
define(['layout/generic-nav-view', 'mvc/webhooks', 'utils/localization'], function( GenericNav, Webhooks, _l ) {
var Collection = Backbone.Collection.extend({
model: Backbone.Model.extend({
defaults: {
@@ -22,7 +22,7 @@ var Collection = Backbone.Collection.extend({
//
this.add({
id : 'analysis',
title : 'Analyze Data',
title : _l('Analyze Data'),
url : '',
tooltip : 'Analysis home view'
});
@@ -32,7 +32,7 @@ var Collection = Backbone.Collection.extend({
//
this.add({
id : 'workflow',
title : 'Workflow',
title : _l('Workflow'),
url : 'workflow',
tooltip : 'Chain tools into workflows',
disabled : !Galaxy.user.id
@@ -43,23 +43,23 @@ var Collection = Backbone.Collection.extend({
//
this.add({
id : 'shared',
title : 'Shared Data',
title : _l('Shared Data'),
url : 'library/index',
tooltip : 'Access published resources',
menu : [{
title : 'Data Libraries',
title : _l('Data Libraries'),
url : 'library/list'
},{
title : 'Histories',
title : _l('Histories'),
url : 'history/list_published'
},{
title : 'Workflows',
title : _l('Workflows'),
url : 'workflow/list_published'
},{
title : 'Visualizations',
title : _l('Visualizations'),
url : 'visualization/list_published'
},{
title : 'Pages',
title : _l('Pages'),
url : 'page/list_published'
}]
});
@@ -87,20 +87,20 @@ var Collection = Backbone.Collection.extend({
//
this.add({
id : 'visualization',
title : 'Visualization',
title : _l('Visualization'),
url : 'visualization/list',
tooltip : 'Visualize datasets',
disabled : !Galaxy.user.id,
menu : [{
title : 'New Track Browser',
title : _l('New Track Browser'),
url : 'visualization/trackster',
target : '_frame'
},{
title : 'Saved Visualizations',
title : _l('Saved Visualizations'),
url : 'visualization/list',
target : '_frame'
},{
title : 'Interactive Environments',
title : _l('Interactive Environments'),
url : 'visualization/gie_list',
target : 'galaxy_main'
}
@@ -147,7 +147,7 @@ var Collection = Backbone.Collection.extend({
//
Galaxy.user.get( 'is_admin' ) && this.add({
id : 'admin',
title : 'Admin',
title : _l('Admin'),
url : 'admin',
tooltip : 'Administer this Galaxy',
cls : 'admin-only'
@@ -158,34 +158,34 @@ var Collection = Backbone.Collection.extend({
//
var helpTab = {
id : 'help',
title : 'Help',
title : _l('Help'),
tooltip : 'Support, contact, and community',
menu : [{
title : 'Support',
title : _l('Support'),
url : options.support_url,
target : '_blank'
},{
title : 'Search',
title : _l('Search'),
url : options.search_url,
target : '_blank'
},{
title : 'Mailing Lists',
title : _l('Mailing Lists'),
url : options.mailing_lists,
target : '_blank'
},{
title : 'Videos',
title : _l('Videos'),
url : options.screencasts_url,
target : '_blank'
},{
title : 'Wiki',
title : _l('Wiki'),
url : options.wiki_url,
target : '_blank'
},{
title : 'How to Cite Galaxy',
title : _l('How to Cite Galaxy'),
url : options.citation_url,
target : '_blank'
},{
title : 'Interactive Tours',
title : _l('Interactive Tours'),
url : 'tours',
onclick : function(){
if (Galaxy.router){
@@ -198,17 +198,17 @@ var Collection = Backbone.Collection.extend({
}]
};
options.terms_url && helpTab.menu.push({
title : 'Terms and Conditions',
title : _l('Terms and Conditions'),
url : options.terms_url,
target : '_blank'
});
options.biostar_url && helpTab.menu.unshift({
title : 'Ask a question',
title : _l('Ask a question'),
url : 'biostar/biostar_question_redirect',
target : '_blank'
});
options.biostar_url && helpTab.menu.unshift({
title : 'Galaxy Biostar',
title : _l('Galaxy Biostar'),
url : options.biostar_url_redirect,
target : '_blank'
});
@@ -220,7 +220,7 @@ var Collection = Backbone.Collection.extend({
if ( !Galaxy.user.id ){
var userTab = {
id : 'user',
title : 'User',
title : _l('User'),
cls : 'loggedout-only',
tooltip : 'Account registration or login',
menu : [{
@@ -231,7 +231,7 @@ var Collection = Backbone.Collection.extend({
}]
};
options.allow_user_creation && userTab.menu.push({
title : 'Register',
title : _l('Register'),
url : 'user/create',
target : 'galaxy_main',
noscratchbook : true
@@ -240,13 +240,13 @@ var Collection = Backbone.Collection.extend({
} else {
var userTab = {
id : 'user',
title : 'User',
title : _l('User'),
cls : 'loggedin-only',
tooltip : 'Account and saved data',
menu : [{
title : 'Logged in as ' + Galaxy.user.get( 'email' )
title : _l('Logged in as ') + Galaxy.user.get( 'email' )
},{
title : 'Preferences',
title : _l('Preferences'),
url : 'user',
target : 'galaxy_main',
onclick : function() {
@@ -257,24 +257,24 @@ var Collection = Backbone.Collection.extend({
}
}
},{
title : 'Custom Builds',
title : _l('Custom Builds'),
url : 'user/dbkeys',
target : 'galaxy_main'
},{
title : 'Logout',
title : _l('Logout'),
url : 'user/logout',
target : '_top',
divider : true
},{
title : 'Saved Histories',
title : _l('Saved Histories'),
url : 'history/list',
target : 'galaxy_main'
},{
title : 'Saved Datasets',
title : _l('Saved Datasets'),
url : 'dataset/list',
target : 'galaxy_main'
},{
title : 'Saved Pages',
title : _l('Saved Pages'),
url : 'page/list',
target : '_top'
}]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long