dev
This commit is contained in:
@@ -35,6 +35,30 @@ namespace ZpcBulletinBoard.Pages.Boards
|
|||||||
return Page();
|
return Page();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GET
|
||||||
|
|
||||||
|
public IActionResult OnGetPages(string guid)
|
||||||
|
{
|
||||||
|
var board = context.BulletinBoards
|
||||||
|
.Include(x => x.Links.OrderBy(x => x.Order))
|
||||||
|
.ThenInclude(x => x.BulletinBoardPage)
|
||||||
|
.FirstOrDefault(x => x.Guid.ToString() == guid);
|
||||||
|
|
||||||
|
var links = new List<BulletinBoardPageLink>();
|
||||||
|
|
||||||
|
if (board is not { Links: not null }) return new JsonResult(new { successful = true, links });
|
||||||
|
|
||||||
|
links.AddRange(board.Links);
|
||||||
|
|
||||||
|
foreach (var link in links)
|
||||||
|
{
|
||||||
|
link.BulletinBoardPage.Links = null;
|
||||||
|
link.BulletinBoard.Links = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResult(new { successful = true, links });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 22 MiB After Width: | Height: | Size: 22 MiB |
@@ -1,3 +1,11 @@
|
|||||||
|
html, body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: hidden !important;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
.div-placeholder{
|
.div-placeholder{
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -10,4 +18,21 @@
|
|||||||
|
|
||||||
.div-no-pages > h2{
|
.div-no-pages > h2{
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div-placeholder > img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div-placeholder > iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
/* width: 100%; */
|
||||||
|
/* height: calc(100% - 25px); */
|
||||||
|
overflow-y: hidden !important;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
let indexLink = 0;
|
||||||
|
let links = [];
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
loadBoard();
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadBoard(){
|
||||||
|
let guid = $('#inpGuidBoard').val();
|
||||||
|
$.blockUI();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/Boards/View/?handler=Pages",
|
||||||
|
data: {
|
||||||
|
guid
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data.successful){
|
||||||
|
indexLink = 0;
|
||||||
|
links = data.links;
|
||||||
|
|
||||||
|
if (links == null || links.length <= 0){
|
||||||
|
$('.div-placeholder').css('display', 'none');
|
||||||
|
$('.div-no-pages').css('display', '');
|
||||||
|
setTryAgainTimer();
|
||||||
|
} else {
|
||||||
|
$('.div-placeholder').css('display', '');
|
||||||
|
$('.div-no-pages').css('display', 'none');
|
||||||
|
showPage(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Swal.fire('Napaka', data.error, 'error');
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
$.unblockUI();
|
||||||
|
},
|
||||||
|
error: function (xhr, ajaxOptions, thrownError) {
|
||||||
|
console.log(xhr);
|
||||||
|
alert(xhr.responseText);
|
||||||
|
$.unblockUI();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTryAgainTimer(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPage(showNext){
|
||||||
|
if (showNext){
|
||||||
|
indexLink += 1;
|
||||||
|
if (indexLink >= links.length){
|
||||||
|
loadBoard();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let link = links[indexLink];
|
||||||
|
$('.div-placeholder').empty();
|
||||||
|
|
||||||
|
let element;
|
||||||
|
if (link.bulletinBoardPage.type == 3){
|
||||||
|
element = ` <iframe src="${link.bulletinBoardPage.externalLink}" title="page iframe" scrolling='no'></iframe> `;
|
||||||
|
} else {
|
||||||
|
let date = new Date();
|
||||||
|
element = `<img class='img-fluid' src="/bulletin-board-images/pages/${link.bulletinBoardPage.image}?${date.getTime()}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.div-placeholder').append(element);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
showPage(true);
|
||||||
|
}, link.duration * 1000);
|
||||||
|
}
|
||||||
@@ -51,11 +51,12 @@ function loadPages(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addPageToDiv(page){
|
function addPageToDiv(page){
|
||||||
|
let date = new Date();
|
||||||
let preview;
|
let preview;
|
||||||
if (page.type == 3){
|
if (page.type == 3){
|
||||||
preview = `<div class='img-link'><i class="fas fa-link fa-5x"></i></div>`;
|
preview = `<div class='img-link'><i class="fas fa-link fa-5x"></i></div>`;
|
||||||
} else {
|
} else {
|
||||||
preview = `<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/${page.image}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`
|
preview = `<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/${page.image}?${date.getTime()}" onerror="this.src='/img/imgNotExists.jpg'" alt="page image" />`
|
||||||
}
|
}
|
||||||
let element = $(`<div class="div-page" data-id="${page.idBulletinBoardPage}">
|
let element = $(`<div class="div-page" data-id="${page.idBulletinBoardPage}">
|
||||||
${preview}
|
${preview}
|
||||||
|
|||||||
Reference in New Issue
Block a user