Skip to content

Commit

Permalink
Admin area adds target to urls to prevent angular from taking over
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinslow committed Jan 6, 2013
1 parent 2183b72 commit ef123f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions events/init/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

elgg_extend_view('page/elements/foot', 'requirejs/config/admin');
elgg_extend_view('css/admin', 'css/admin/ajaxify');
elgg_extend_view('output/url', 'ajaxify/url', 1);

global $AJAXIFY;

Expand Down
13 changes: 13 additions & 0 deletions views/default/ajaxify/url.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$prefix = elgg_normalize_url('/admin');

$href = elgg_normalize_url($vars['href']);

$isAdminUrl = strpos($href, $prefix) === 0;

// Forces angular
if (!$isAdminUrl && elgg_in_context('admin') && !isset($vars['target']) ) {
$vars['target'] = '_self';
}

0 comments on commit ef123f5

Please sign in to comment.