Add rule for 'body' container and QLink property 'target'

QLinks can now define the target for their link. Additionally, the
targte 'body' is now always the <body> tag. This allows the
modulemanager to reload the whole page (with the navigation bar).

refs #4092
This commit is contained in:
Jannis Moßhammer 2013-06-20 14:02:58 +02:00 committed by Marius Hein
parent 0f8648dcb1
commit 81e27689bb
6 changed files with 49 additions and 50 deletions

View File

@ -12,14 +12,6 @@
</div> </div>
<div id="icinga-detail" class="icinga-container " container-id="icinga-detail"> <div id="icinga-detail" class="icinga-container " container-id="icinga-detail">
<div class="container-controls">
<a class="container-expand-link" title="expand" target="_self" href="/develop/monitoring/list/services">
<i class="icon-fullscreen"></i>
</a>
<a class="container-detach-link" title="detach" target="popup" href="/develop/develop/monitoring/list/services">
<i class="icon-share"></i>
</a>
</div>
</div> </div>
</div> </div>

View File

@ -21,12 +21,12 @@
ICINGA_DEBUG = true; ICINGA_DEBUG = true;
</script> </script>
<script src="<?php echo $this->baseUrl('js/vendor/modernizr-2.6.2.min.js') ?>"></script> <script src="<?php echo $this->baseUrl('js/vendor/modernizr-2.6.2.min.js') ?>"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl('css/icinga.css') ?>"> <link rel="stylesheet" href="<?php echo $this->baseUrl('css.php') ?>">
<link rel="stylesheet" href="<?php echo $this->baseUrl('css/vendor/bootstrap-responsive.min.css') ?>"> <link rel="stylesheet" href="<?php echo $this->baseUrl('css/vendor/bootstrap-responsive.min.css') ?>">
<script data-main="<?php echo $this->baseUrl('js/main.js')?>" src="<?php echo $this->baseUrl('js/vendor/require.js') ?>"></script> <script data-main="<?php echo $this->baseUrl('js/main.js')?>" src="<?php echo $this->baseUrl('js/vendor/require.js') ?>"></script>
</head> </head>
<body class="cranberry"> <body class="cranberry">
<?php echo $this->render('parts/topbar.phtml') ?> <?php echo $this->render('parts/topbar.phtml') ?>
<div class="main"> <div class="main">
<div class="tabbable tabs-left" style="height:100%;"> <div class="tabbable tabs-left" style="height:100%;">

View File

@ -5,7 +5,8 @@
$item = $this->navigation->listAll("menu"); $item = $this->navigation->listAll("menu");
?> ?>
<?php if ($this->auth()->isAuthenticated()): ?> <?php if (true || $this->auth()->isAuthenticated()): ?>
<ul class="nav nav-tabs icinga-navigation" > <ul class="nav nav-tabs icinga-navigation" >
<?php <?php
$activeSet = false; $activeSet = false;

View File

@ -36,6 +36,9 @@ class Zend_View_Helper_Qlink extends Zend_View_Helper_Abstract
$quote = $val; $quote = $val;
continue; continue;
} }
if ($key === 'target') {
$attibutes[] = 'target="'.$val.'"';
}
if ($key === 'style' && is_array($val)) { if ($key === 'style' && is_array($val)) {
if (empty($val)) { if (empty($val)) {
continue; continue;
@ -93,4 +96,4 @@ class Zend_View_Helper_Qlink extends Zend_View_Helper_Abstract
return is_null($baseUrl) ? $this->view->baseUrl($url) : $baseUrl . $url; return is_null($baseUrl) ? $this->view->baseUrl($url) : $baseUrl . $url;
} }
} }
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd

View File

@ -16,45 +16,52 @@ define(['jquery','logging','icinga/util/async'],function($,log,async) {
href = a.attr("href"); href = a.attr("href");
ev.stopImmediatePropagation(); ev.stopImmediatePropagation();
collapseDetailView(); collapseDetailView();
async.loadToTarget("icinga-main",href);
return false;
};
var onLinkTagClick = function(ev) {
var a = $(ev.currentTarget),
target = a.attr("target"),
href = a.attr("href");
// check for protocol://
if(/^[A-Z]{2,10}\:\/\//i.test(href)) {
window.open(href);
ev.stopImmediatePropagation();
return false;
}
// check for link in table header
if(a.parents('th').length > 0) {
ev.stopImmediatePropagation();
return false;
}
if(typeof target === "undefined") {
if(a.parents("#icinga-detail").length) {
log.debug("Parent is detail, loading into detail");
async.loadToTarget("icinga-detail",href);
} else {
log.debug("Parent is not detail, loading into main");
async.loadToTarget("icinga-main",href); async.loadToTarget("icinga-main",href);
return false; }
}; } else {
switch(target) {
var onLinkTagClick = function(ev) { case "body":
async.loadToTarget("body", href);
var a = $(ev.currentTarget), break;
target = a.attr("target"),
href = a.attr("href");
// check for protocol://
if(/^[A-Z]{2,10}\:\/\//i.test(href)) {
window.open(href);
ev.stopImmediatePropagation();
return false;
}
// check for link in table header
if(a.parents('th').length > 0) {
ev.stopImmediatePropagation();
return false;
}
if(typeof target === "undefined") {
if(a.parents("#icinga-detail").length) {
async.loadToTarget("icinga-detail",href);
} else {
async.loadToTarget("icinga-main",href);
}
} else {
switch(target) {
case "main": case "main":
async.loadToTarget("icinga-main",href); async.loadToTarget("icinga-main",href);
collapseDetailView(); collapseDetailView();
break; break;
case "detail": case "detail":
log.debug("Target: detail");
async.loadToTarget("icinga-detail",href); async.loadToTarget("icinga-detail",href);
break; break;
case "popup": case "popup":
log.debug("No target");
async.loadToTarget(null,href); async.loadToTarget(null,href);
break; break;
default: default:
@ -67,7 +74,7 @@ define(['jquery','logging','icinga/util/async'],function($,log,async) {
var expandDetailView = function() { var expandDetailView = function() {
$("#icinga-detail").parents(".collapsed").removeClass('collapsed'); $("#icinga-detail").parents(".collapsed").removeClass('collapsed');
}; };
var collapseDetailView = function(elementInDetailView) { var collapseDetailView = function(elementInDetailView) {
$("#icinga-detail").parents(".layout-main-detail").addClass('collapsed'); $("#icinga-detail").parents(".layout-main-detail").addClass('collapsed');
@ -88,7 +95,5 @@ define(['jquery','logging','icinga/util/async'],function($,log,async) {
} }
}; };
}; };
return new MainDetailBehaviour(); return new MainDetailBehaviour();
}); });

View File

@ -5,11 +5,9 @@
define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) { define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) {
var pending = { var pending = {
}; };
var getDOMForDestination = function(destination) { var getDOMForDestination = function(destination) {
var target = destination; var target = destination;
if(typeof destination === "string") { if(typeof destination === "string") {
@ -84,13 +82,14 @@
this.loadToTarget = function(destination,url,data) { this.loadToTarget = function(destination,url,data) {
if(destination) { if(destination) {
log.debug("Laoding to container", destination, url);
this.clearPendingRequestsFor(destination); this.clearPendingRequestsFor(destination);
} }
var req = this.createRequest(url,data); var req = this.createRequest(url,data);
if(destination) { if(destination) {
pending.push({ pending.push({
request: req, request: req,
DOM: getDOMForDestination(destination) DOM: getDOMForDestination(destination)
}); });
req.destination = destination; req.destination = destination;
} }
@ -105,5 +104,4 @@
}; };
return new CallInterface(); return new CallInterface();
}); });
})();
})();