Skip to content

Commit

Permalink
#121: source button to play nice with hashes - cont'd
Browse files Browse the repository at this point in the history
  • Loading branch information
amirnissim committed Mar 11, 2014
1 parent b5e5fb2 commit 56672a8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rd_ui/app/scripts/controllers/query_view.js
Expand Up @@ -13,19 +13,23 @@

$scope.isSourceVisible = route.locals.viewSource;

$scope.sourceHref = $scope.isSourceVisible ?
$location.url().replace('src', '') : $location.path() + '/src#' + $location.hash();

$scope.queryExecuting = false;

$scope.newVisualization = undefined;

updateSourceHref();

$window.onbeforeunload = function() {
if ($scope.canEdit && $scope.dirty) {
return leavingPageText;
}
}

function updateSourceHref() {
$scope.sourceHref = $scope.isSourceVisible ?
$location.url().replace('src', '') : $location.path() + '/src#' + $location.hash();
};

Mousetrap.bindGlobal("meta+s", function(e) {
e.preventDefault();

Expand Down Expand Up @@ -56,6 +60,7 @@
return $location.hash()
}, function(hash) {
$scope.selectedTab = hash || DEFAULT_TAB;
updateSourceHref();
});

$scope.lockButton = function(lock) {
Expand Down

0 comments on commit 56672a8

Please sign in to comment.