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:
parent
5c167563fa
commit
34f68856ee
|
@ -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>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
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>
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -41,20 +41,27 @@ define(['jquery','logging','icinga/util/async'],function($,log,async) {
|
||||||
|
|
||||||
if(typeof target === "undefined") {
|
if(typeof target === "undefined") {
|
||||||
if(a.parents("#icinga-detail").length) {
|
if(a.parents("#icinga-detail").length) {
|
||||||
|
log.debug("Parent is detail, loading into detail");
|
||||||
async.loadToTarget("icinga-detail",href);
|
async.loadToTarget("icinga-detail",href);
|
||||||
} else {
|
} else {
|
||||||
|
log.debug("Parent is not detail, loading into main");
|
||||||
async.loadToTarget("icinga-main",href);
|
async.loadToTarget("icinga-main",href);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(target) {
|
switch(target) {
|
||||||
|
case "body":
|
||||||
|
async.loadToTarget("body", href);
|
||||||
|
break;
|
||||||
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:
|
||||||
|
@ -88,7 +95,5 @@ define(['jquery','logging','icinga/util/async'],function($,log,async) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return new MainDetailBehaviour();
|
return new MainDetailBehaviour();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,39 +3,11 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
var asyncMgrInstance = null;
|
var asyncMgrInstance = null;
|
||||||
|
|
||||||
define(['icinga/container','logging','jquery'],function(containerMgr,log,$) {
|
define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) {
|
||||||
|
|
||||||
|
|
||||||
var pending = {
|
var pending = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var getCurrentGETParameters = function() {
|
|
||||||
var currentGET = window.location.search.substring(1).split("&");
|
|
||||||
var params = {};
|
|
||||||
if(currentGET.length > 0) {
|
|
||||||
$.each(currentGET, function(idx, elem) {
|
|
||||||
var keyVal = elem.split("=");
|
|
||||||
params[encodeURIComponent(keyVal[0])] = encodeURIComponent(keyVal[1]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
var pushGet = function(param, value, url) {
|
|
||||||
url = url || (window.location.origin+window.location.pathname);
|
|
||||||
var params = getCurrentGETParameters();
|
|
||||||
params[encodeURIComponent(param)] = encodeURIComponent(value);
|
|
||||||
var search = "?";
|
|
||||||
for (var name in params) {
|
|
||||||
if(search != "?")
|
|
||||||
search += "&";
|
|
||||||
search += name+"="+params[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
return url+search+"#"+window.location.hash;
|
|
||||||
};
|
|
||||||
|
|
||||||
var getDOMForDestination = function(destination) {
|
var getDOMForDestination = function(destination) {
|
||||||
var target = destination;
|
var target = destination;
|
||||||
if(typeof destination === "string") {
|
if(typeof destination === "string") {
|
||||||
|
@ -47,6 +19,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleResponse = function(html) {
|
var handleResponse = function(html) {
|
||||||
|
|
||||||
if(this.destination) {
|
if(this.destination) {
|
||||||
containerMgr.updateContainer(this.destination,html,this);
|
containerMgr.updateContainer(this.destination,html,this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -109,6 +82,7 @@
|
||||||
|
|
||||||
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);
|
||||||
|
@ -119,14 +93,9 @@
|
||||||
});
|
});
|
||||||
req.destination = destination;
|
req.destination = destination;
|
||||||
}
|
}
|
||||||
if (destination == "icinga-main") {
|
|
||||||
History.pushState(data, document.title, url);
|
|
||||||
} else {
|
|
||||||
url = pushGet("c["+destination+"]", url);
|
|
||||||
History.pushState(data, document.title, url);
|
|
||||||
}
|
|
||||||
console.log("New url: ", url);
|
|
||||||
return req;
|
return req;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.loadCSS = function(name) {
|
this.loadCSS = function(name) {
|
||||||
|
@ -135,5 +104,4 @@
|
||||||
};
|
};
|
||||||
return new CallInterface();
|
return new CallInterface();
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue