added paginator to the token page
parent
17b4f12103
commit
c620917d53
|
@ -304,7 +304,7 @@ var ClientListView = Backbone.View.extend({
|
||||||
"click .refresh-table":"refreshTable",
|
"click .refresh-table":"refreshTable",
|
||||||
'keyup .search-query':'searchTable',
|
'keyup .search-query':'searchTable',
|
||||||
'click .form-search button':'clearSearch',
|
'click .form-search button':'clearSearch',
|
||||||
'page #paginator':'changePage'
|
'page .paginator':'changePage'
|
||||||
},
|
},
|
||||||
|
|
||||||
newClient:function (e) {
|
newClient:function (e) {
|
||||||
|
@ -328,13 +328,13 @@ var ClientListView = Backbone.View.extend({
|
||||||
// set up pagination
|
// set up pagination
|
||||||
var numPages = Math.ceil(this.filteredModel.length / 10);
|
var numPages = Math.ceil(this.filteredModel.length / 10);
|
||||||
if (numPages > 1) {
|
if (numPages > 1) {
|
||||||
$('#paginator').show();
|
$('.paginator', this.el).show();
|
||||||
$('#paginator', this.el).bootpag({
|
$('.paginator', this.el).bootpag({
|
||||||
total: numPages,
|
total: numPages,
|
||||||
page: 1
|
page: 1
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('#paginator', this.el).hide();
|
$('.paginator', this.el).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// render the rows
|
// render the rows
|
||||||
|
@ -377,9 +377,7 @@ var ClientListView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
changePage:function(event, num) {
|
changePage:function(event, num) {
|
||||||
this.page = num;
|
|
||||||
$('#client-table tbody tr', this.el).each(function(index, element) {
|
$('#client-table tbody tr', this.el).each(function(index, element) {
|
||||||
console.log([num, index]);
|
|
||||||
if (Math.ceil((index + 1) / 10) != num) {
|
if (Math.ceil((index + 1) / 10) != num) {
|
||||||
$(element).hide();
|
$(element).hide();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -290,10 +290,12 @@ var RefreshTokenView = Backbone.View.extend({
|
||||||
// hide it
|
// hide it
|
||||||
$('.moreInformation', this.el).hide('fast');
|
$('.moreInformation', this.el).hide('fast');
|
||||||
$('.toggleMoreInformation i', this.el).attr('class', 'icon-chevron-right');
|
$('.toggleMoreInformation i', this.el).attr('class', 'icon-chevron-right');
|
||||||
|
$('.moreInformationContainer', this.el).removeClass('alert').removeClass('alert-info').addClass('muted');
|
||||||
} else {
|
} else {
|
||||||
// show it
|
// show it
|
||||||
$('.moreInformation', this.el).show('fast');
|
$('.moreInformation', this.el).show('fast');
|
||||||
$('.toggleMoreInformation i', this.el).attr('class', 'icon-chevron-down');
|
$('.toggleMoreInformation i', this.el).attr('class', 'icon-chevron-down');
|
||||||
|
$('.moreInformationContainer', this.el).addClass('alert').addClass('alert-info').removeClass('muted');
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -314,7 +316,9 @@ var TokenListView = Backbone.View.extend({
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
|
|
||||||
events:{
|
events:{
|
||||||
"click .refresh-table":"refreshTable"
|
"click .refresh-table":"refreshTable",
|
||||||
|
'page .paginator-access':'changePageAccess',
|
||||||
|
'page .paginator-refresh':'changePageRefresh'
|
||||||
},
|
},
|
||||||
|
|
||||||
load:function(callback) {
|
load:function(callback) {
|
||||||
|
@ -344,6 +348,28 @@ var TokenListView = Backbone.View.extend({
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changePageAccess:function(event, num) {
|
||||||
|
$('.paginator-access', this.el).bootpag({page: num});
|
||||||
|
$('#access-token-table tbody tr', this.el).each(function(index, element) {
|
||||||
|
if (Math.ceil((index + 1) / 10) != num) {
|
||||||
|
$(element).hide();
|
||||||
|
} else {
|
||||||
|
$(element).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
changePageRefresh:function(event, num) {
|
||||||
|
$('.paginator-refresh', this.el).bootpag({page: num});
|
||||||
|
$('#refresh-token-table tbody tr', this.el).each(function(index, element) {
|
||||||
|
if (Math.ceil((index + 1) / 10) != num) {
|
||||||
|
$(element).hide();
|
||||||
|
} else {
|
||||||
|
$(element).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
refreshTable:function(e) {
|
refreshTable:function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('#loadingbox').sheet('show');
|
$('#loadingbox').sheet('show');
|
||||||
|
@ -387,19 +413,49 @@ var TokenListView = Backbone.View.extend({
|
||||||
|
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
_.each(this.model.access.models, function (token) {
|
// set up pagination
|
||||||
|
var numPagesAccess = Math.ceil(this.model.access.length / 10);
|
||||||
|
if (numPagesAccess > 1) {
|
||||||
|
$('.paginator-access', this.el).show();
|
||||||
|
$('.paginator-access', this.el).bootpag({
|
||||||
|
total: numPagesAccess,
|
||||||
|
page: 1
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('.paginator-access', this.el).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(this.model.access.models, function (token, index) {
|
||||||
// look up client
|
// look up client
|
||||||
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
||||||
|
var element = new AccessTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList}).render().el;
|
||||||
$('#access-token-table', _self.el).append(new AccessTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList}).render().el);
|
$('#access-token-table', _self.el).append(element);
|
||||||
|
if (Math.ceil((index + 1) / 10) != 1) {
|
||||||
|
$(element).hide();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_.each(this.model.refresh.models, function (token) {
|
// set up pagination
|
||||||
|
var numPagesRefresh = Math.ceil(this.model.refresh.length / 10);
|
||||||
|
if (numPagesRefresh > 1) {
|
||||||
|
$('.paginator-refresh', this.el).show();
|
||||||
|
$('.paginator-refresh', this.el).bootpag({
|
||||||
|
total: numPagesRefresh,
|
||||||
|
page: 1
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('.paginator-refresh', this.el).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
_.each(this.model.refresh.models, function (token, index) {
|
||||||
// look up client
|
// look up client
|
||||||
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
var client = _self.options.clientList.getByClientId(token.get('clientId'));
|
||||||
|
var element = new RefreshTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList}).render().el;
|
||||||
$('#refresh-token-table', _self.el).append(new RefreshTokenView({model: token, client: client, systemScopeList: _self.options.systemScopeList}).render().el);
|
$('#refresh-token-table', _self.el).append(element);
|
||||||
|
if (Math.ceil((index + 1) / 10) != 1) {
|
||||||
|
$(element).hide();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -54,12 +54,12 @@
|
||||||
<script type="text/html" id="tmpl-client-more-info-block">
|
<script type="text/html" id="tmpl-client-more-info-block">
|
||||||
<% if (client.clientDescription || client.clientUri || client.policyUri || client.tosUri || client.contacts != null && client.contacts.length > 0) { %>
|
<% if (client.clientDescription || client.clientUri || client.policyUri || client.tosUri || client.contacts != null && client.contacts.length > 0) { %>
|
||||||
<div class="muted moreInformationContainer">
|
<div class="muted moreInformationContainer">
|
||||||
<%=client.clientDescription%>
|
|
||||||
<% if (client.clientUri || client.policyUri || client.tosUri || client.contacts) { %>
|
<% if (client.clientUri || client.policyUri || client.tosUri || client.contacts) { %>
|
||||||
<div class="toggleMoreInformation" style="cursor: pointer;">
|
<div class="toggleMoreInformation" style="cursor: pointer;">
|
||||||
<i class="icon-chevron-right"></i> <small>more information</small>
|
<i class="icon-chevron-right"></i> <small>more information</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="moreInformation hide">
|
<div class="moreInformation hide">
|
||||||
|
<%=client.clientDescription%>
|
||||||
<ul>
|
<ul>
|
||||||
<% if (client.clientUri) { %>
|
<% if (client.clientUri) { %>
|
||||||
<li>Home page: <a href="<%= client.clientUri %>"><%= client.clientUri %></a></li>
|
<li>Home page: <a href="<%= client.clientUri %>"><%= client.clientUri %></a></li>
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div id="paginator" class="pagination"> </div>
|
<div class="pagination paginator"></div>
|
||||||
|
|
||||||
<div class="well well-small">
|
<div class="well well-small">
|
||||||
<button class="btn btn-small refresh-table"><i class="icon-refresh"></i> Refresh</button>
|
<button class="btn btn-small refresh-table"><i class="icon-refresh"></i> Refresh</button>
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
There are no active access tokens.
|
There are no active access tokens.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination paginator-access"></div>
|
||||||
|
|
||||||
<table id="access-token-table" class="table table-hover table-striped">
|
<table id="access-token-table" class="table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -41,6 +43,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="pagination paginator-access"></div>
|
||||||
|
|
||||||
<h2>Refresh Tokens</h2>
|
<h2>Refresh Tokens</h2>
|
||||||
|
|
||||||
<div><p>Refresh tokens are usually long-lived and provide clients with the ability to get new access tokens without end-user involvement.</p></div>
|
<div><p>Refresh tokens are usually long-lived and provide clients with the ability to get new access tokens without end-user involvement.</p></div>
|
||||||
|
@ -49,6 +53,8 @@
|
||||||
There are no active refresh tokens.
|
There are no active refresh tokens.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination paginator-refresh"></div>
|
||||||
|
|
||||||
<table id="refresh-token-table" class="table table-hover table-striped">
|
<table id="refresh-token-table" class="table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -62,6 +68,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="pagination paginator-refresh"></div>
|
||||||
|
|
||||||
<div class="well well-small">
|
<div class="well well-small">
|
||||||
<button class="btn btn-small refresh-table"><i class="icon-refresh"></i> Refresh</button>
|
<button class="btn btn-small refresh-table"><i class="icon-refresh"></i> Refresh</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue