Iframe panel

This commit is contained in:
Kload 2013-10-29 09:16:30 +00:00
parent ce6e099f1b
commit dc00adc86e
3 changed files with 56 additions and 3 deletions

View file

@ -247,7 +247,8 @@ function serve(uri)
rendered = rendered..hige.render(content, data)
content = rendered..hige.render(read_file(script_path.."portal/footer.ms"), data)
elseif ext == "ms" then
content = hige.render(content, {})
local data = get_data_for(file)
content = hige.render(content, data)
end
-- Reset flash messages
@ -303,6 +304,12 @@ function get_data_for(view)
mailalias = mails["mailalias"],
maildrop = mails["maildrop"]
}
elseif view == "panel.ms" then
data = { app = {} }
for url, name in pairs(conf["users"][user]) do
table.insert(data["app"], { url = url, name = name })
end
end
data['flash_fail'] = {flashs["fail"]}

View file

@ -39,3 +39,30 @@ iframe {
#ynhtoggle:hover {
text-decoration: none;
}
.ynhapp {
float: left;
margin: 5px 15px;
padding: 5px;
width: 70px;
height: 100px;
color: white;
text-align: center;
cursor: pointer;
text-decoration: none;
}
.ynhapp.active .ynhappsquare {
border: 1px dotted white;
}
.ynhappcaption {
color: white;
font-size: 13px;
text-decoration: none;
}
.ynhappsquare {
height: 50px;
width: 64px;
padding-top: 14px;
vertical-align: middle;
font-size: 35px;
border: 1px solid white;
}

View file

@ -13,7 +13,7 @@
<script src="assets/js/jquery-1.10.2.min.js"></script>
</head>
<body class="gradient" style="overflow: hidden">
<iframe name="glu" id="glu" width="100%" src="/" style=""></iframe>
<iframe name="glu" id="glu" width="100%" src="https://megusta7.com/webmaaail/" style=""></iframe>
<script>
var ynh = {};
ynh.jquery = jQuery.noConflict();
@ -46,12 +46,21 @@ ynh.jquery = jQuery.noConflict();
}
}
function changeTitle() {
if (top.glu.document.title)
top.document.title = top.glu.document.title;
else
top.document.title = 'Yunohost Apps';
}
var tid = setInterval(changeTitle, 10000);
$( document ).ready(function($) {
h = 107;
$("#glu").load(function() {
setTimeout(function() {
changeTitle();
if ($("#ynhtopbar").length == 0) {
$('body').children().filter(function() {
return $(this).css("position") === 'absolute' || $(this).css("position") === 'fixed';
@ -59,6 +68,9 @@ ynh.jquery = jQuery.noConflict();
return parseFloat(value) + h + 3;
}});
$("body").append('<div id="ynhtopbar"><div id="ynhtoggle" class="ynhopen">YunoHost</div></div>');
{{#app}}
$("#ynhtopbar").append('<div class="ynhapp" data-href="https://{{url}}"><div class="ynhappsquare">R</div><div class="ynhappcaption">{{name}}</div></div>');
{{/app}}
}
$("body").css({marginTop: function(index, value) {
return parseFloat(value) + h + 3;
@ -72,6 +84,13 @@ ynh.jquery = jQuery.noConflict();
checkScroll("bottom");
checkScroll("top");
});
$(".ynhapp").on("click", function(event) {
event.preventDefault();
parent.glu.location.href = $(this).attr('data-href');
$('.ynhapp.active').removeClass('active');
$(this).addClass('active');
});
}, 10);
$(window).resize(function() {