Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
fixes bug 1060481 - Can't edit url of Tag Editor pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Aug 29, 2014
1 parent 9d48143 commit 46dba82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions airmozilla/manage/static/manage/js/tagmanager.js
Expand Up @@ -26,9 +26,9 @@ app.filter('startFrom', function() {
});


TagManagerController.$inject = ['$scope', '$http'];
TagManagerController.$inject = ['$scope', '$http', '$timeout'];

function TagManagerController($scope, $http) {
function TagManagerController($scope, $http, $timeout) {
'use strict';

$scope.sort_by = 'name';
Expand Down Expand Up @@ -69,8 +69,23 @@ function TagManagerController($scope, $http) {
if (window.localStorage) {
window.localStorage.setItem('pageSize', value);
}
$scope.currentPage = 0;
});

$scope.$watch('currentPage', function(value) {
if (value) {
window.location.hash = '#' + (++value);
}
});

$timeout(function() {
var hash_page_regex = new RegExp(/#(\d+)/);
if (hash_page_regex.test(window.location.hash)) {
var page = +window.location.hash.match(hash_page_regex)[1];
$scope.currentPage = --page;
}
}, 100);

$scope.numberOfPages = function(items){
if (typeof items === 'undefined') return 0;
return Math.ceil(items.length / $scope.pageSize);
Expand Down
1 change: 1 addition & 0 deletions airmozilla/manage/templates/manage/tags.html
Expand Up @@ -78,5 +78,6 @@
</label>
</div>
{% endraw %}
</div>

{% endblock %}

0 comments on commit 46dba82

Please sign in to comment.