barve, shranjevanje
This commit is contained in:
@@ -9,21 +9,28 @@
|
||||
<link rel="stylesheet" href="~/lib/summernote/summernote-bs4.css" asp-append-version="true"/>
|
||||
<link rel="stylesheet" href="~/css/editor/editor-main.css" asp-append-version="true"/>
|
||||
}
|
||||
<div class="fab-container-add">
|
||||
<div class="button iconbutton btn-success" onclick="addNewNote()">
|
||||
<i class="far fa-sticky-note fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fab-container-save">
|
||||
<div class="button iconbutton btn-primary" onclick="saveNotes();">
|
||||
<i class="far fa-save fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body div-main-body">
|
||||
<div class="form-inline div-tools">
|
||||
<label id="lblBoardName" class="control-label"></label>
|
||||
<button class="btn btn-sm btn-primary" onclick="openModalSelectBoard();"><i class="fas fa-mouse-pointer"></i> Izberi oglasno desko</button>
|
||||
</div>
|
||||
<div class="div-pages">
|
||||
<div data-idpage="-100" class="page-active">
|
||||
<h5>Ime page</h5>
|
||||
<small>20 sekund</small>
|
||||
<div class="div-board" onclick="openModalSelectBoard();">
|
||||
<h5>Oglasna deska ni izbrana</h5>
|
||||
<small><i class="fas fa-mouse-pointer"></i> Spremni oglasno desko</small>
|
||||
</div>
|
||||
<div class="add-page" onclick="openModalBoardAddNewPage();">
|
||||
<div class="div-page add-page" onclick="openModalBoardAddNewPage();">
|
||||
<i class="fas fa-plus fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,20 +44,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body div-main-body">
|
||||
<div class="form-inline div-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default btn-sm" onclick="addNewNote()">
|
||||
<i class="far fa-plus"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-primary">Shrani</button>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<input class="input-hidden" id="inpSelectedBoardPageId" />
|
||||
<div id="divPlaceholder">
|
||||
|
||||
</div>
|
||||
@@ -109,7 +103,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="boardAddNewPage();">Shrani</button>
|
||||
<button type="button" class="btn btn-primary" onclick="boardAddNewPageSave();">Shrani</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -127,7 +121,18 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input id="inpModalEditNoteIdNote" class="input-hidden"/>
|
||||
<label class="control-label">Vsebina:</label>
|
||||
<div id="divModalEditNoteSummernote"></div>
|
||||
<label class="control-label">Barva:</label>
|
||||
<div class="div-note-edit-color">
|
||||
<div class="note-color-white active"></div>
|
||||
<div class="note-color-yellow"></div>
|
||||
<div class="note-color-orange"></div>
|
||||
<div class="note-color-light-green"></div>
|
||||
<div class="note-color-blue"></div>
|
||||
<div class="note-color-purple"></div>
|
||||
<div class="note-color-grey"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="saveModalEditNote();">Save changes</button>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using ZpcBulletinBoard.Data;
|
||||
using ZpcBulletinBoard.Models.Editor;
|
||||
using System.Linq;
|
||||
|
||||
namespace ZpcBulletinBoard.Pages.Editor
|
||||
{
|
||||
@@ -43,7 +44,10 @@ namespace ZpcBulletinBoard.Pages.Editor
|
||||
{
|
||||
var page = context.BulletinBoardPage.Include(x => x.Notes)
|
||||
.FirstOrDefault(x => x.IdBulletinBoardPage == id);
|
||||
|
||||
foreach (var note in page.Notes)
|
||||
{
|
||||
note.BulletinBoardPage = null;
|
||||
}
|
||||
return page == null
|
||||
? new JsonResult(new { successful = false, error = $"Page with ID {id} not exists!" })
|
||||
: new JsonResult(new { successful = true, error = $"", page });
|
||||
@@ -55,7 +59,6 @@ namespace ZpcBulletinBoard.Pages.Editor
|
||||
if (page.IdBulletinBoardPage <= 0)
|
||||
{
|
||||
context.BulletinBoardPage.Add(page);
|
||||
context.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -65,11 +68,46 @@ namespace ZpcBulletinBoard.Pages.Editor
|
||||
|
||||
tmpPage.Name = page.Name;
|
||||
tmpPage.Duration = page.Duration;
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
context.SaveChanges();
|
||||
|
||||
return new JsonResult(new { successful = true, error = $"", page });
|
||||
}
|
||||
|
||||
public IActionResult OnPostNotes(int idBulletinBoardPage, List<Note> notes)
|
||||
{
|
||||
//Pobrisem katerih ni vec
|
||||
var notesToDelete = context.Notes.Where(x => x.IdBulletinBoardPage == idBulletinBoardPage
|
||||
&& !notes.Select(y => y.IdNote).Contains(x.IdNote)).ToList();
|
||||
notesToDelete.ForEach(x => context.Notes.Remove(x));
|
||||
|
||||
foreach (var note in notes)
|
||||
{
|
||||
if (note.IdNote <= 0)
|
||||
{
|
||||
note.IdNote = default;
|
||||
context.Notes.Add(note);
|
||||
}
|
||||
else
|
||||
{
|
||||
var tmpNote = context.Notes.FirstOrDefault(x => x.IdNote == note.IdNote);
|
||||
if (tmpNote == null)
|
||||
continue;
|
||||
// return new JsonResult(new { successful = false, error = $"Page with ID {page.IdBulletinBoardPage} not exists!", page });
|
||||
|
||||
tmpNote.X = note.X;
|
||||
tmpNote.Y = note.Y;
|
||||
tmpNote.Width = note.Width;
|
||||
tmpNote.Height = note.Height;
|
||||
tmpNote.Content = note.Content;
|
||||
tmpNote.Zindex = note.Zindex;
|
||||
tmpNote.ColorClass = note.ColorClass;
|
||||
}
|
||||
}
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
return new JsonResult(new { successful = true, error = "" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user