Merge pull request #2637 from rabuzarus/2506_wallmessage_js

frio: Wallmessage - distinguish between own and foreign host
This commit is contained in:
Michael Vogel 2016-06-25 14:09:44 +02:00 committed by GitHub
commit 9f99f37975
2 changed files with 17 additions and 1 deletions

View file

@ -293,3 +293,19 @@ function toggleJotNav (elm) {
$(elm).parent("li").addClass("active"); $(elm).parent("li").addClass("active");
} }
// Wall Message needs a special handling because in some cases
// it redirects you to your own server. In such cases we can't
// load it into a modal
function openWallMessage(url) {
// split the the url in its parts
var parts = parseUrl(url);
// If the host isn't the same we can't load it in a modal.
// So we will go to to the url directly
if( ("host" in parts) && (parts.host !== window.location.host)) {
window.location.href = url;
} else {
// otherwise load the wall message into a modal
addToModal(url);
}
}

View file

@ -61,7 +61,7 @@
{{/if}} {{/if}}
{{if $wallmessage}} {{if $wallmessage}}
<div id="wallmessage-link-botton"> <div id="wallmessage-link-botton">
<a id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="addToModal('{{$wallmessage_link}}')"> <a id="wallmessage-link" class="btn btn-labeled btn-primary btn-sm" onclick="openWallMessage('{{$wallmessage_link}}')">
<span class=""><i class="fa fa-envelope"></i></span> <span class=""><i class="fa fa-envelope"></i></span>
<span class="">{{$wallmessage}}</span> <span class="">{{$wallmessage}}</span>
</a> </a>