dev
This commit is contained in:
@@ -51,8 +51,8 @@
|
||||
<img class="img-thumbnail rounded" src="/bulletin-board-images/pages/@tmpPage.Image" alt="page image" />
|
||||
<small>@tmpPage.Name</small>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-reply"></i></a>
|
||||
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless"><i class="fas fa-reply-all"></i></a>
|
||||
@* <a href="javascript:;" class="btn btn-xs icon-btn btn-outline-primary borderless"><i class="fas fa-reply"></i></a> *@
|
||||
<a href="javascript:;" class="btn btn-xs icon-btn btn-outline-secondary borderless" onclick="addPageToAllBoards(this)"><i class="fas fa-reply-all"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ZpcBulletinBoard.Pages.BoardsLinks
|
||||
var order = 1;
|
||||
var links = context.BulletinBoardPageLinks.Where(x => x.IdBulletinBoardFk == idBoard).ToList();
|
||||
if (links.Any())
|
||||
order = links.Max(x => x.IdLink) + 1;
|
||||
order = links.Max(x => x.Order) + 1;
|
||||
|
||||
var link = new BulletinBoardPageLink
|
||||
{
|
||||
@@ -68,5 +68,58 @@ namespace ZpcBulletinBoard.Pages.BoardsLinks
|
||||
|
||||
return new JsonResult(new { successful = true, error = $"", link });
|
||||
}
|
||||
|
||||
public IActionResult OnPostSwapLinkOrder(int idLinkStart, int idLinkEnd)
|
||||
{
|
||||
var linkStart = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLinkStart);
|
||||
var linkEnd = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLinkEnd);
|
||||
|
||||
if (linkStart == null)
|
||||
return new JsonResult(new { successful = false, error = $"Link with ID {idLinkStart} not exists!" });
|
||||
|
||||
if (linkEnd == null)
|
||||
return new JsonResult(new { successful = false, error = $"Link with ID {idLinkEnd} not exists!" });
|
||||
|
||||
(linkStart.Order, linkEnd.Order) = (linkEnd.Order, linkStart.Order);
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
return new JsonResult(new { successful = true, error = $"", linkStart, linkEnd });
|
||||
}
|
||||
|
||||
public IActionResult OnPostLinkDuration(int idLink, int duration)
|
||||
{
|
||||
var link = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLink);
|
||||
|
||||
if (link == null)
|
||||
return new JsonResult(new { successful = false, error = $"Link with ID {idLink} not exists!" });
|
||||
|
||||
link.Duration = duration;
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
return new JsonResult(new { successful = true, error = $"", link });
|
||||
}
|
||||
|
||||
//Delete
|
||||
public IActionResult OnDeleteLink(int idLink)
|
||||
{
|
||||
var link = context.BulletinBoardPageLinks.FirstOrDefault(x => x.IdLink == idLink);
|
||||
if (link == null)
|
||||
return new JsonResult(new { successful = false, error = $"Link with ID {idLink} not exists!", link });
|
||||
|
||||
var links = context.BulletinBoardPageLinks
|
||||
.Where(x => x.IdBulletinBoardFk == link.IdBulletinBoardFk && x.Order > link.Order).ToList();
|
||||
foreach (var tmpLink in links)
|
||||
{
|
||||
tmpLink.Order -= 1;
|
||||
}
|
||||
|
||||
context.BulletinBoardPageLinks.Remove(link);
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
return new JsonResult(new { successful = true, error = $"", link });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
<ul class="sidenav-inner">
|
||||
<li class="sidenav-item@(currentPage.StartsWith("/Pages/")? " active" : "")">
|
||||
<a asp-page="/Pages/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Strani</div></a>
|
||||
<a asp-page="/Pages/Index" class="sidenav-link"><i class="sidenav-icon far fa-file"></i><div>Strani</div></a>
|
||||
</li>
|
||||
<li class="sidenav-item@(currentPage.StartsWith("/Boards/") ? " active" : "")">
|
||||
<a asp-page="/Boards/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Oglasne deske</div></a>
|
||||
<a asp-page="/Boards/Index" class="sidenav-link"><i class="sidenav-icon fab fa-flipboard"></i><div>Oglasne deske</div></a>
|
||||
</li>
|
||||
<li class="sidenav-item@(currentPage.StartsWith("/BoardsLinks/") ? " active" : "")">
|
||||
<a asp-page="/BoardsLinks/Index" class="sidenav-link"><i class="sidenav-icon fas fa-home"></i><div>Povezave</div></a>
|
||||
<a asp-page="/BoardsLinks/Index" class="sidenav-link"><i class="sidenav-icon fas fa-link"></i><div>Povezave</div></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -7,19 +7,8 @@
|
||||
}
|
||||
|
||||
@section Styles {
|
||||
|
||||
<style type="text/css">
|
||||
.table > tbody > tr > td:nth-child(2),
|
||||
.table > thead > tr > th:nth-child(2){
|
||||
width: 200px
|
||||
}
|
||||
.table > tbody > tr > td:nth-child(3),
|
||||
.table > thead > tr > th:nth-child(3),
|
||||
.table > tbody > tr > td:nth-child(4),
|
||||
.table > thead > tr > th:nth-child(4) {
|
||||
width: 100px
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="~/css/pages/index.css" asp-append-version="true" />
|
||||
|
||||
}
|
||||
|
||||
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
||||
@@ -29,79 +18,14 @@
|
||||
/</span> Pregled
|
||||
</span>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2 text-right">
|
||||
<form method="get">
|
||||
<div class="btn-group">
|
||||
<input class="form-control" type="text" value="" placeholder="Iskanje..." autocomplete="off">
|
||||
<input id="inpOpenEditorForPage" type="hidden" name="openEditorForPage" asp-for="OpenEditorForPage" />
|
||||
<div class="btn-group" title="Columns">
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-label="Nastavitve" title="Nastavitve">
|
||||
<i class="opacity-75 ion ion-md-apps"></i>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
@* <label class="dropdown-item">
|
||||
<input type="checkbox" name="openProjects" @ViewData["OpenProjects"]> <span>Odprti</span>
|
||||
</label>
|
||||
<label class="dropdown-item">
|
||||
<input type="checkbox" name="inProductionProjects" @ViewData["InProductionProjects"]> <span>V izdelavi</span>
|
||||
</label>
|
||||
<label class="dropdown-item">
|
||||
<input type="checkbox" name="finishedProjects" @ViewData["FinishedProjects"]> <span>Zaključeni projekti</span>
|
||||
</label>
|
||||
<label class="dropdown-item">
|
||||
<input type="checkbox" name="offerProjects" @ViewData["OffersProjects"]> <span>Ponudbe</span>
|
||||
</label> *@
|
||||
</div>
|
||||
</div>
|
||||
<button id="btnRefresh" type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
|
||||
<i class="opacity-75 ion ion-md-refresh"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Seznam strani
|
||||
Strani
|
||||
</h6>
|
||||
<table class="table card-table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Pages[0].Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Pages[0].Type)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Pages[0].Ratio)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.Pages)
|
||||
{
|
||||
<tr data-id="@item.IdBulletinBoardPage">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Type)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Ratio)
|
||||
</td>
|
||||
<td style="text-align:right;">
|
||||
<a class="btn btn-xs icon-btn btn-outline-primary borderless" href="javascript:;" onclick="rowOpenEditor(this);" data-toggle="tooltip" data-placement="top" title="Urejevalnik" data-state="secondary"><i class="far fa-edit"></i></a>
|
||||
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" href="javascript:;" onclick="openModalEditPage(this);" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="div-pages">
|
||||
|
||||
</div>
|
||||
<div class="card-footer py-3 text-right">
|
||||
<a href="javascript:;" onclick="openModalAddPage();" class="btn btn-primary">Dodaj novo</a>
|
||||
</div>
|
||||
|
||||
@@ -16,17 +16,19 @@ namespace ZpcBulletinBoard.Pages.Pages
|
||||
[Authorize]
|
||||
public class IndexModel(ApplicationDbContext context, IWebHostEnvironment webHostEnvironment) : PageModel
|
||||
{
|
||||
public IList<BulletinBoardPage> Pages { get;set; }
|
||||
|
||||
public int OpenEditorForPage = 0;
|
||||
|
||||
public async Task OnGetAsync(int? openEditorForPage = null)
|
||||
public void OnGet()
|
||||
{
|
||||
OpenEditorForPage = openEditorForPage ?? 0;
|
||||
Pages = await context.BulletinBoardPage.ToListAsync();
|
||||
}
|
||||
|
||||
//Get
|
||||
public IActionResult OnGetPages()
|
||||
{
|
||||
var pages = context.BulletinBoardPage.ToList();
|
||||
return new JsonResult(new { successful = true, error = $"", pages });
|
||||
}
|
||||
|
||||
public IActionResult OnGetPage(int id)
|
||||
{
|
||||
var page = context.BulletinBoardPage.Include(x => x.Links)
|
||||
|
||||
Reference in New Issue
Block a user