diff --git a/static/src/js/app/admin/admin.js b/static/src/js/app/admin/admin.js index b44f575..4145a45 100644 --- a/static/src/js/app/admin/admin.js +++ b/static/src/js/app/admin/admin.js @@ -7,24 +7,11 @@ define("admin", ["jquery", "avalon"], function($, avalon){ $(".list-group-item").attr("class", "list-group-item"); } - var hash = window.location.hash.substring(1); - - if(hash){ - li_active("#li-" + hash); - }else { - li_active("#li-index"); + function show_template(url){ + $("#loading-gif").show(); + vm.template_url = url; } - window.onhashchange = function() { - var hash = window.location.hash.substring(1); - if(hash){ - li_inactive(".list-group-item"); - li_active("#li-" + hash); - $("#loading-gif").show(); - vm.template_url = "template/index/" + hash + ".html"; - } - }; - var vm = avalon.define({ $id: "admin", template_url: "template/index/index.html", @@ -32,4 +19,24 @@ define("admin", ["jquery", "avalon"], function($, avalon){ $("#loading-gif").hide(); } }); + + var hash = window.location.hash.substring(1); + + if(hash){ + li_active("#li-" + hash.replace("/", "-")); + show_template("template/" + hash + ".html"); + }else { + li_active("#li-index-index"); + } + + window.onhashchange = function() { + var hash = window.location.hash.substring(1); + if(hash){ + li_inactive(".list-group-item"); + li_active("#li-" + hash.replace("/", "-")); + show_template("template/" + hash + ".html"); + } + }; + + }); \ No newline at end of file diff --git a/template/admin/admin.html b/template/admin/admin.html index 6ec5a4e..2fbf58d 100644 --- a/template/admin/admin.html +++ b/template/admin/admin.html @@ -67,17 +67,17 @@ -
+