fix i18n loading for templates loading on start

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-24 08:11:52 +00:00
parent 0842752179
commit 8ffeff592c
4 changed files with 35 additions and 27 deletions

View File

@ -51,8 +51,8 @@ $.ajax({
urlArgs: ""+appendJsNoCacheUrl(), urlArgs: ""+appendJsNoCacheUrl(),
shim: { shim: {
'sammy':['jquery','jquery.tmpl'], 'sammy':['jquery','jquery.tmpl'],
'archiva.main':['jquery','jquery.ui','sammy','jquery.tmpl'], 'archiva.main':['jquery','jquery.ui','sammy','jquery.tmpl','utils','i18n'],
'utils':['jquery','jquery.tmpl'], 'utils':['jquery','jquery.tmpl','i18n'],
'archiva.templates': ['jquery','jquery.tmpl','utils'], 'archiva.templates': ['jquery','jquery.tmpl','utils'],
'redback.templates': ['jquery','jquery.tmpl','utils'] 'redback.templates': ['jquery','jquery.tmpl','utils']
}, },
@ -97,7 +97,7 @@ $.ajax({
} }
}); });
requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils',"archiva.main",'domReady!'], function (domReady) { requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main'], function () {
loadi18n(function () { loadi18n(function () {
$.ajax({ $.ajax({
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(), url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(),
@ -107,14 +107,14 @@ $.ajax({
window.archivaJavascriptLog=data.javascriptLog; window.archivaJavascriptLog=data.javascriptLog;
window.archivaRuntimeInfo=data; window.archivaRuntimeInfo=data;
require(['sammy','jquery','jquery.tmpl','archiva.main','utils','domReady!'],function () { require(['sammy','jquery','i18n','jquery.tmpl','archiva.main','utils','domReady!'],function () {
startArchivaApplication(); startArchivaApplication();
$("#loadingDiv").hide(); $("#loadingDiv").hide();
drawQuickSearchAutocomplete(); drawQuickSearchAutocomplete();
}) })
} }
}) })
})
}); });
})
} }
}) })

View File

@ -16,15 +16,15 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
require(['jquery',"jquery.tmpl","utils","text!templates/archiva/menu.html", require(['jquery',"jquery.tmpl",'i18n',"utils","text!templates/archiva/menu.html",
"text!templates/archiva/generics.html", "text!templates/archiva/generics.html",
"text!templates/archiva/modal.html", "text!templates/archiva/modal.html",
"text!templates/archiva/repositories.html", "text!templates/archiva/repositories.html",
"text!templates/archiva/search.html", "text!templates/archiva/search.html",
"text!templates/archiva/general-admin.html"], "text!templates/archiva/general-admin.html"],
function(jquery,jqueryTmpl,utils,menu,generics,modal,repositories, function(jquery,jqueryTmpl,i18n,utils,menu,generics,modal,repositories,
search,general_admin) { search,general_admin) {
loadArchivaTemplate=function(){
var htmlFragment=$("#html-fragments"); var htmlFragment=$("#html-fragments");
// template loading // template loading
htmlFragment.append(menu); htmlFragment.append(menu);
@ -35,4 +35,5 @@ require(['jquery',"jquery.tmpl","utils","text!templates/archiva/menu.html",
htmlFragment.append(general_admin); htmlFragment.append(general_admin);
$.log("main-tmpl.js loaded"); $.log("main-tmpl.js loaded");
} }
}
); );

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
define("archiva.main",["jquery","jquery.ui","sammy","jquery.tmpl","jquery.cookie","bootstrap","archiva.search", define("archiva.main",["jquery","jquery.ui","sammy","jquery.tmpl",'i18n',"jquery.cookie","bootstrap","archiva.search",
"jquery.validate","jquery.json","knockout","redback.templates","archiva.templates", "jquery.validate","jquery.json","knockout","redback.templates","archiva.templates",
"redback.roles","redback","archiva.general-admin","archiva.repositories", "redback.roles","redback","archiva.general-admin","archiva.repositories",
"archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management"], "archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management"],
@ -581,6 +581,8 @@ function(jquery,ui,sammy,tmpl) {
startArchivaApplication=function(){ startArchivaApplication=function(){
$.log("startArchivaApplication"); $.log("startArchivaApplication");
loadRedbackTemplate();
loadArchivaTemplate();
$('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl()); $('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl());
$('#sidebar-content').html($("#main_menu_tmpl").tmpl()); $('#sidebar-content').html($("#main_menu_tmpl").tmpl());

View File

@ -16,15 +16,20 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
require(['jquery',"jquery.tmpl","utils","text!templates/redback/user-edit.html", require(['jquery',"jquery.tmpl",'i18n',"utils","text!templates/redback/user-edit.html",
"text!templates/redback/login.html"], "text!templates/redback/login.html"],
function(jquery,jqueryTmpl,utils,useredit, login) { function(jquery,jqueryTmpl,i18n,utils,useredit, login) {
loadRedbackTemplate=function(){
var htmlFragment=$("#html-fragments"); var htmlFragment=$("#html-fragments");
// template loading // template loading
htmlFragment.append(useredit); htmlFragment.append(useredit);
//$.tmpl(useredit).appendTo("#html-fragments");
$.tmpl(login).appendTo("#html-fragments"); $.tmpl(login).appendTo("#html-fragments");
//htmlFragment.append(login);
$.log("redback-tmpl.js loaded"); $.log("redback-tmpl.js loaded");
} }
}
); );