aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-10-19 12:28:08 +0000
committerOlivier Lamy <olamy@apache.org>2012-10-19 12:28:08 +0000
commitb85e828155806dda23b6aa84aefd9815758dcb32 (patch)
treed1fd68b75bb9852ff7496a1fff987bcfb6df36e7
parent3bc49a521fb78d5042e8b68e291530531a71c8ce (diff)
downloadarchiva-b85e828155806dda23b6aa84aefd9815758dcb32.tar.gz
archiva-b85e828155806dda23b6aa84aefd9815758dcb32.zip
make menu entries observableArray as maybe in the future with plugins stuff that will be dynamic
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1400069 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
index c61b018a9..62c959b67 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
@@ -168,13 +168,13 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
MainMenuViewModel=function() {
var self = this;
- this.artifactMenuItems = [
+ this.artifactMenuItems = ko.observableArray([
{ text : $.i18n.prop('menu.artifacts') , id: null},
{ text : $.i18n.prop('menu.artifacts.search') , id: "menu-find-search-a", href: "#search" , func: function(){displaySearch(this)}},
{ text : $.i18n.prop('menu.artifacts.browse') , id: "menu-find-browse-a", href: "#browse" , func: function(){displayBrowse(true)}},
{ text : $.i18n.prop('menu.artifacts.upload') , id: "menu-find-upload-a", href: "#upload" , redback: "{permissions: ['archiva-upload-repository']}", func: function(){displayUploadArtifact(true)}}
- ];
- this.administrationMenuItems = [
+ ]);
+ this.administrationMenuItems = ko.observableArray([
{ text : $.i18n.prop('menu.administration') , id: null},
{ text : $.i18n.prop('menu.repository.groups') , id: "menu-repository-groups-list-a" , href: "#repositorygroup" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryGroups()}},
{ text : $.i18n.prop('menu.repositories') , id: "menu-repositories-list-a" , href: "#repositorylist" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoriesGrid()}},
@@ -188,19 +188,19 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
{ text : $.i18n.prop('menu.appearance-configuration') , id: "menu-appearance-list-a" , href: "#appearance" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayAppearanceConfiguration()}},
{ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}},
{ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}
- ];
+ ]);
- this.usersMenuItems = [
+ this.usersMenuItems = ko.observableArray([
{ text : $.i18n.prop('menu.users') , id: null},
{ text : $.i18n.prop('menu.users.manage') , id: "menu-users-list-a", href: "#users" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayUsersGrid()}},
{ text : $.i18n.prop('menu.users.roles') , id: "menu-roles-list-a", href: "#roles" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayRolesGrid()}}
- ];
+ ]);
- this.docsMenuItems = [
+ this.docsMenuItems = ko.observableArray([
{ text : $.i18n.prop('menu.docs') , id: null},
{ text : $.i18n.prop('menu.docs.rest') , id: "menu-docs-rest-list-a", href: "#docs-rest", target: "", func: function(){displayRestDocs()}},
{ text : $.i18n.prop('menu.docs.users') , id: "menu-docs-users-list-a", href: "http://archiva.apache.org/docs/"+window.archivaRuntimeInfo.version, target: "_blank", func: function(){displayUsersDocs()}}
- ];
+ ]);
this.activeMenuId = ko.observable();
@@ -637,8 +637,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
this.get('#:folder', function () {
var folder = this.params.folder;
self.activeMenuId(folder);
- var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
- ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems,self.docsMenuItems), function(p) {
+ var baseItems = self.artifactMenuItems()?self.artifactMenuItems():[];
+ ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems(), self.administrationMenuItems(),self.docsMenuItems()), function(p) {
if ( p.href == "#"+self.activeMenuId()) {
screenChange();
p.func();