cleanly applied pushstate changes, new URL structure

pull/263/head
Justin Richer 12 years ago
parent 56dcb33d35
commit 33f11cb98f

@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/
@Controller
@RequestMapping("/")
@PreAuthorize("hasRole('ROLE_USER')") // TODO: this probably shouldn't be here
public class ManagerController {
@ -46,8 +45,9 @@ public class ManagerController {
return "home";
}
@RequestMapping("admin/manage")
@RequestMapping("manage/**")
public String showClientManager() {
// TODO: move view
return "admin/manage";
}

@ -8,6 +8,7 @@
<script type="text/javascript" src="resources/js/underscore-min.js"></script>
<script type="text/javascript" src="resources/js/backbone-min.js"></script>
<script type="text/javascript" src="resources/js/backbone.validations.js"></script>
<script type="text/javascript" src="resources/js/purl.js"></script>
<c:if test="${js != null || js != ''}">
<script type="text/javascript" src="${js}"></script>
</c:if>

@ -5,14 +5,14 @@
<ul class="nav nav-list">
<security:authorize ifAnyGranted="ROLE_ADMIN">
<li class="nav-header">Administrative</li>
<li><a href="admin/manage/#clients">Manage Clients</a></li>
<li><a href="admin/manage/#white_list">White Lists</a></li>
<li><a href="#">Black Lists</a></li>
<li><a href="manage/#admin/clients">Manage Clients</a></li>
<li><a href="manage/#admin/white_list">White Lists</a></li>
<li><a href="manage/#admin/black_list">Black Lists</a></li>
</security:authorize>
<li class="nav-header">Personal</li>
<li><a href="#">Manage Sites</a></li>
<li><a href="#">Manage Active Tokens</a></li>
<li><a href="#">Manage Profiles</a></li>
<li><a href="manage/#user/grants">Manage Sites</a></li>
<li><a href="manage/#user/tokens">Manage Active Tokens</a></li>
<li><a href="manage/#user/profile">Manage Profiles</a></li>
</ul>
</div><!--/.well -->
</div><!--/span-->

@ -8,20 +8,20 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" style="padding-left: 35px" href="#">OpenID Connect Server</a>
<a class="brand" style="padding-left: 35px" href="">OpenID Connect Server</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Statistics</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="about">About</a></li>
<li><a href="stats">Statistics</a></li>
<li><a href="contact">Contact</a></li>
</ul>
<p class="navbar-text pull-right">
<security:authentication property="authorities" var="roles"/>
<security:authorize access="hasRole('ROLE_USER')">
Logged in as <a href="#">${ userInfo.preferredUsername }</a>
Logged in as <a href="home">${ userInfo.preferredUsername }</a>
</security:authorize>
</p>
</div><!--/.nav-collapse -->

@ -90,7 +90,7 @@
model = new URIModel({item:input_value});
} else {
model = new Backbone.Model({item:input_value});
model.validate = function() { if(!this.get("item")) return "value can't be null" };
model.validate = function() { if(!this.get("item")) return "value can't be null"; };
}
// if it's valid and doesn't already exist
@ -558,10 +558,10 @@
var AppRouter = Backbone.Router.extend({
routes:{
"clients":"listClients",
"client/new":"newClient",
"client/:id":"editClient",
"white_list":"whiteList",
"admin/clients":"listClients",
"admin/client/new":"newClient",
"admin/client/:id":"editClient",
"admin/white_list":"whiteList",
'*path': 'listClients'
},
@ -584,10 +584,13 @@
startAfter:function (collections) {
// Start history when required collections are loaded
var start = _.after(collections.length, _.once(function () {
Backbone.history.start()
var baseUrl = $.url($('base').attr('href'));
Backbone.history.start({pushState: true, root: baseUrl.attr('relative') + 'manage/'});
}));
_.each(collections, function (collection) {
collection.bind('reset', start, Backbone.history)
collection.bind('reset', start, Backbone.history);
});
},
@ -595,8 +598,8 @@
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:"Home", href:"/"},
{text:"Manage Clients", href:"admin/manage/#clients"}
{text:"Home", href:""},
{text:"Manage Clients", href:"manage/#admin/clients"}
]);
$('#content').html(this.clientListView.render().el);
@ -608,9 +611,9 @@
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:"Home", href:"/"},
{text:"Manage Clients", href:"admin/manage/#clients"},
{text:"New", href:"#"}
{text:"Home", href:""},
{text:"Manage Clients", href:"manage/#admin/clients"},
{text:"New", href:""}
]);
var client = new ClientModel();
@ -631,9 +634,9 @@
this.breadCrumbView.collection.reset();
this.breadCrumbView.collection.add([
{text:"Home", href:"/"},
{text:"Manage Clients", href:"admin/manage/#clients"},
{text:"Edit", href:"#"}
{text:"Home", href:""},
{text:"Manage Clients", href:"manage/#admin/clients"},
{text:"Edit", href:"manage/#admin/client/" + id}
]);
var client = this.clientList.get(id);
@ -681,6 +684,11 @@
app = new AppRouter();
$('a[href*="#"').on('click', function(event) {
event.preventDefault();
app.navigate(this.hash.slice(1), {trigger: true});
});
});

Loading…
Cancel
Save