barve, shranjevanje
This commit is contained in:
401
ZpcBulletinBoard/Migrations/20240228165943_4.Designer.cs
generated
Normal file
401
ZpcBulletinBoard/Migrations/20240228165943_4.Designer.cs
generated
Normal file
@@ -0,0 +1,401 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ZpcBulletinBoard.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ZpcBulletinBoard.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20240228165943_4")]
|
||||
partial class _4
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
|
||||
{
|
||||
b.Property<int>("IdBulletinBoard")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("Guid")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Ratio")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdBulletinBoard");
|
||||
|
||||
b.ToTable("BulletinBoards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.Property<int>("IdBulletinBoardPage")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Duration")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IdBulletinBoard")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("IdBulletinBoardPage");
|
||||
|
||||
b.HasIndex("IdBulletinBoard");
|
||||
|
||||
b.ToTable("BulletinBoardPage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
|
||||
{
|
||||
b.Property<int>("IdNote")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IdBulletinBoardPage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("X")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Y")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdNote");
|
||||
|
||||
b.HasIndex("IdBulletinBoardPage");
|
||||
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationRole", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DateValidUntil")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
|
||||
.WithMany("Pages")
|
||||
.HasForeignKey("IdBulletinBoard")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BulletinBoard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
|
||||
.WithMany("Notes")
|
||||
.HasForeignKey("IdBulletinBoardPage")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BulletinBoardPage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
|
||||
{
|
||||
b.Navigation("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.Navigation("Notes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
29
ZpcBulletinBoard/Migrations/20240228165943_4.cs
Normal file
29
ZpcBulletinBoard/Migrations/20240228165943_4.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ZpcBulletinBoard.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _4 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Title",
|
||||
table: "Notes");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Title",
|
||||
table: "Notes",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
408
ZpcBulletinBoard/Migrations/20240228173917_5.Designer.cs
generated
Normal file
408
ZpcBulletinBoard/Migrations/20240228173917_5.Designer.cs
generated
Normal file
@@ -0,0 +1,408 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using ZpcBulletinBoard.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ZpcBulletinBoard.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20240228173917_5")]
|
||||
partial class _5
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
|
||||
{
|
||||
b.Property<int>("IdBulletinBoard")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("Guid")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Ratio")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdBulletinBoard");
|
||||
|
||||
b.ToTable("BulletinBoards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.Property<int>("IdBulletinBoardPage")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Duration")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IdBulletinBoard")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("IdBulletinBoardPage");
|
||||
|
||||
b.HasIndex("IdBulletinBoard");
|
||||
|
||||
b.ToTable("BulletinBoardPage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
|
||||
{
|
||||
b.Property<int>("IdNote")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ColorClass")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("IdBulletinBoardPage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("X")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Y")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Zindex")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdNote");
|
||||
|
||||
b.HasIndex("IdBulletinBoardPage");
|
||||
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationRole", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.IdentityApplicationUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("DateValidUntil")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.IdentityApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoard", "BulletinBoard")
|
||||
.WithMany("Pages")
|
||||
.HasForeignKey("IdBulletinBoard")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BulletinBoard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.Note", b =>
|
||||
{
|
||||
b.HasOne("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", "BulletinBoardPage")
|
||||
.WithMany("Notes")
|
||||
.HasForeignKey("IdBulletinBoardPage")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BulletinBoardPage");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoard", b =>
|
||||
{
|
||||
b.Navigation("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZpcBulletinBoard.Models.Editor.BulletinBoardPage", b =>
|
||||
{
|
||||
b.Navigation("Notes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
40
ZpcBulletinBoard/Migrations/20240228173917_5.cs
Normal file
40
ZpcBulletinBoard/Migrations/20240228173917_5.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ZpcBulletinBoard.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _5 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ColorClass",
|
||||
table: "Notes",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Zindex",
|
||||
table: "Notes",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ColorClass",
|
||||
table: "Notes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Zindex",
|
||||
table: "Notes");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,6 +168,10 @@ namespace ZpcBulletinBoard.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ColorClass")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@@ -178,10 +182,6 @@ namespace ZpcBulletinBoard.Migrations
|
||||
b.Property<int>("IdBulletinBoardPage")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -191,6 +191,9 @@ namespace ZpcBulletinBoard.Migrations
|
||||
b.Property<int>("Y")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Zindex")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdNote");
|
||||
|
||||
b.HasIndex("IdBulletinBoardPage");
|
||||
|
||||
@@ -25,10 +25,13 @@ namespace ZpcBulletinBoard.Models.Editor
|
||||
public int Height { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Title { get; set; }
|
||||
public string Content { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Content { get; set; }
|
||||
public int Zindex { get; set; }
|
||||
|
||||
[Required]
|
||||
public string ColorClass { get; set; }
|
||||
|
||||
// ForeignKey
|
||||
public BulletinBoardPage BulletinBoardPage { get; set; }
|
||||
|
||||
@@ -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 = "" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.div-main-body > hr {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.div-tools {
|
||||
margin: 5px;
|
||||
width: 100%;
|
||||
@@ -43,6 +39,26 @@
|
||||
cursor: nwse-resize;
|
||||
}
|
||||
|
||||
.div-board{
|
||||
float: left;
|
||||
text-align: center;
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
border: 1px solid rgba(24, 28, 33, 0.06);
|
||||
border-radius: 0.25rem;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.div-board > h5 {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.div-board:hover {
|
||||
cursor: pointer;
|
||||
background-color: rgba(24, 28, 33, 0.06);
|
||||
}
|
||||
|
||||
.div-note {
|
||||
position: absolute !important;
|
||||
float: left;
|
||||
@@ -55,19 +71,21 @@
|
||||
.div-pages {
|
||||
margin: 5px;
|
||||
height: 50px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.div-pages > div {
|
||||
.div-page {
|
||||
float: left;
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
border:1px solid rgba(24, 28, 33, 0.06);
|
||||
border: 1px solid rgba(24, 28, 33, 0.06);
|
||||
border-radius: 0.25rem;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.div-pages > div:hover {
|
||||
.div-page:hover {
|
||||
cursor: pointer;
|
||||
background-color: rgba(24, 28, 33, 0.06);
|
||||
}
|
||||
@@ -76,11 +94,116 @@
|
||||
background-color: rgba(128, 171, 226, 0.5);
|
||||
}
|
||||
|
||||
.div-pages > div > h5 {
|
||||
.div-page > h5 {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.div-pages > div > i {
|
||||
.div-page > i {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#lblBoardPageName {
|
||||
margin-right: 5px;;
|
||||
}
|
||||
|
||||
.div-note-edit-color {
|
||||
margin: 5px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.div-note-edit-color > div {
|
||||
float: left;
|
||||
text-align: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border:1px solid rgba(24, 28, 33, 0.06);
|
||||
border-radius: 0.25rem;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.div-note-edit-color > div:hover {
|
||||
cursor: pointer;
|
||||
border: 2px solid rgba(1, 103, 228, 0.418);
|
||||
}
|
||||
|
||||
.div-note-edit-color > div.active {
|
||||
cursor: pointer;
|
||||
border: 2px solid rgba(1, 103, 228, 0.719);
|
||||
}
|
||||
|
||||
/* Barve listkov */
|
||||
.note-color-white {
|
||||
background-color: #fff;
|
||||
border-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.note-color-yellow {
|
||||
background-color: #fff8b8;
|
||||
border-color: #fff8b8;
|
||||
}
|
||||
|
||||
.note-color-orange {
|
||||
background-color: #f39f76;
|
||||
border-color: #f39f76;
|
||||
}
|
||||
|
||||
.note-color-light-green {
|
||||
background-color: #e2f6d3;
|
||||
border-color: #e2f6d3;
|
||||
}
|
||||
|
||||
.note-color-blue {
|
||||
background-color: #d4e4ed;
|
||||
border-color: #d4e4ed;
|
||||
}
|
||||
|
||||
.note-color-purple {
|
||||
background-color: #d3bfdb;
|
||||
border-color: #d3bfdb;
|
||||
}
|
||||
|
||||
.note-color-grey {
|
||||
background-color: #efeff1;
|
||||
border-color: #efeff1;
|
||||
}
|
||||
|
||||
|
||||
/* button */
|
||||
.fab-container-add {
|
||||
position: fixed;
|
||||
bottom: 80px;
|
||||
right: 115px;
|
||||
cursor: pointer;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.fab-container-save {
|
||||
position: fixed;
|
||||
bottom: 80px;
|
||||
right: 50px;
|
||||
cursor: pointer;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.iconbutton {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 100%;
|
||||
box-shadow: 10px 10px 5px #aaaaaa;
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.iconbutton i {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
$(function () {
|
||||
$('.div-note-edit-color>div').on('click', function(){
|
||||
$('.div-note-edit-color>div').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,28 +11,24 @@ let canWidth;
|
||||
let canHeight;
|
||||
let notes = [];
|
||||
|
||||
|
||||
function loadNotes(){
|
||||
let note = new Note(1, divCanvas, 200, 0, 400, 240, '<h3>Naslov</h3><hr/><p>Test</p>' );
|
||||
|
||||
notes.push(note);
|
||||
|
||||
let note2 = new Note(2, divCanvas, 0, 0, 400, 240);
|
||||
notes.push(note2);
|
||||
|
||||
notes.forEach(note => {
|
||||
note.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
function addNewNote(){
|
||||
let idPage = parseInt($('#inpSelectedBoardPageId').val());
|
||||
if (isNaN(idPage) || idPage <= 0){
|
||||
Swal.fire('Stran ni izbrana', '', 'warning');
|
||||
return;
|
||||
}
|
||||
let tmpId = -1;
|
||||
let tmpZindex = 1;
|
||||
notes.forEach(note => {
|
||||
if (note.id <= tmpId){
|
||||
tmpId = note.id -1;
|
||||
}
|
||||
|
||||
if (note.zindex >= tmpZindex){
|
||||
tmpZindex = note.zindex + 1;
|
||||
}
|
||||
});
|
||||
let note = new Note(tmpId, divCanvas, 0, 0, 400, 240, 'Vnesi besedilo');
|
||||
let note = new Note(tmpId, divCanvas, 0, 0, 400, 240, 'Vnesi besedilo', 'note-color-white', tmpZindex);
|
||||
notes.push(note);
|
||||
note.refresh();
|
||||
}
|
||||
@@ -41,12 +41,15 @@ function openModalEditNote(id){
|
||||
$('#divModalEditNoteSummernote').summernote('destroy');
|
||||
$('#divModalEditNoteSummernote').html(note.content);
|
||||
$('#divModalEditNoteSummernote').summernote({height: 400,});
|
||||
$('.div-note-edit-color>div').removeClass('active');
|
||||
$('.div-note-edit-color>.' + note.colorClass).addClass('active');
|
||||
}
|
||||
|
||||
function saveModalEditNote(){
|
||||
let idNote = parseInt($('#inpModalEditNoteIdNote').val());
|
||||
note = getNote(idNote);
|
||||
note.content = $('#divModalEditNoteSummernote').summernote('code');
|
||||
note.colorClass = $('.div-note-edit-color>.active').attr('class').replace(' active', '');
|
||||
note.refresh();
|
||||
$('#divModalEditNote').modal('hide');
|
||||
}
|
||||
@@ -66,6 +69,7 @@ function svgTest(){
|
||||
|
||||
htmlToImage.toSvg(node)
|
||||
.then(function (dataUrl) {
|
||||
console.log(dataUrl);
|
||||
var link = document.createElement('a');
|
||||
link.href = dataUrl;
|
||||
link.download = 'Download.jpg';
|
||||
@@ -128,11 +132,10 @@ function loadBoard(id){
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.successful){
|
||||
$('#lblBoardName').text(data.board.name);
|
||||
$('#lblBoardName').attr('data-idboard', data.board.idBulletinBoard);
|
||||
$('.div-board>h5').text(data.board.name);
|
||||
$('.div-board').attr('data-idboard', data.board.idBulletinBoard);
|
||||
let placeholder = $('#divPlaceholder');
|
||||
placeholder.empty();
|
||||
console.log(data);
|
||||
let tmpSplit = data.board.ratioString.split(':');
|
||||
canWidth = placeholder.width();
|
||||
canHeight = canWidth / (parseFloat(tmpSplit[0]) / parseFloat(tmpSplit[1]));
|
||||
@@ -151,8 +154,8 @@ function loadBoard(id){
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Swal.fire('Napaka', data.error, 'error');
|
||||
console.log(data);
|
||||
alert(data); //TODO swal
|
||||
}
|
||||
$.unblockUI();
|
||||
},
|
||||
@@ -165,6 +168,12 @@ function loadBoard(id){
|
||||
}
|
||||
|
||||
function openModalBoardAddNewPage(){
|
||||
let idBulletinBoard = parseInt($('.div-board').attr('data-idboard'));
|
||||
if (isNaN(idBulletinBoard) || idBulletinBoard <= 0){
|
||||
Swal.fire('Oglasna deska ni izbrana', '', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#titleModalAddEditPage').html('Dodaj list');
|
||||
$('#inpModalAddEditPageName').val('');
|
||||
$('#inpModalAddEditPageId').val(0);
|
||||
@@ -189,8 +198,8 @@ function openModalBoardEditPage(id){
|
||||
$('#divModalAddEditPage').modal('show');
|
||||
|
||||
} else {
|
||||
Swal.fire('Napaka', data.error, 'error');
|
||||
console.log(data);
|
||||
alert(data); //TODO swal
|
||||
}
|
||||
$.unblockUI();
|
||||
},
|
||||
@@ -202,22 +211,28 @@ function openModalBoardEditPage(id){
|
||||
});
|
||||
}
|
||||
|
||||
function boardAddNewPage(){
|
||||
function boardAddNewPageSave(){
|
||||
let idBulletinBoardPage = parseInt($('#inpModalAddEditPageId').val());
|
||||
let name = $('#inpModalAddEditPageName').val();
|
||||
let duration = parseInt($('#inpModalAddEditPageDuration').val());
|
||||
let idBulletinBoard = parseInt($('#lblBoardName').attr('data-idboard'));
|
||||
let idBulletinBoard = parseInt($('.div-board').attr('data-idboard'));
|
||||
if (name === ''){
|
||||
//TODO Swall
|
||||
Swal.fire('Ime ni vneseno', '', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNaN(duration)){
|
||||
//TODO swall
|
||||
Swal.fire('Trajanje ni vneseno', '', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNaN(idBulletinBoard)){
|
||||
if (duration < 1 || duration > 2147483640){
|
||||
Swal.fire('Trajanje mora biti med 1 in 2147483640', '', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNaN(idBulletinBoard) || idBulletinBoard <= 0){
|
||||
Swal.fire('Oglasna deska ni izbrana', '', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,12 +252,19 @@ function boardAddNewPage(){
|
||||
} },
|
||||
success: function(data) {
|
||||
if (data.successful){
|
||||
boardAddPage(data.page);
|
||||
if (idBulletinBoardPage <= 0){
|
||||
boardAddPage(data.page);
|
||||
} else {
|
||||
let currentPage = $('[data-idpage="' + idBulletinBoardPage + '"]');
|
||||
let elAfter = currentPage.next();
|
||||
currentPage.remove();
|
||||
boardAddPage(data.page, elAfter);
|
||||
}
|
||||
selectPage(data.page.idBulletinBoardPage);
|
||||
$('#divModalAddEditPage').modal('hide');
|
||||
} else {
|
||||
alert(data.error);
|
||||
//TODO swall
|
||||
Swal.fire('Napaka', data.error, 'error');
|
||||
console.log(data);
|
||||
}
|
||||
$.unblockUI();
|
||||
},
|
||||
@@ -253,12 +275,16 @@ function boardAddNewPage(){
|
||||
});
|
||||
}
|
||||
|
||||
function boardAddPage(page){
|
||||
let element = $(`<div data-idpage='${page.idBulletinBoardPage}'>
|
||||
function boardAddPage(page, elAfter){
|
||||
let element = $(`<div class='div-page' data-idpage='${page.idBulletinBoardPage}'>
|
||||
<h5>${page.name}</h5>
|
||||
<small>${page.duration} sekund</small>
|
||||
</div>`);
|
||||
element.insertBefore(".add-page");
|
||||
if (elAfter){
|
||||
element.insertBefore(elAfter);
|
||||
} else {
|
||||
element.insertBefore(".add-page");
|
||||
}
|
||||
element.on('click', function (){
|
||||
let id = parseInt($(this).attr('data-idpage'));
|
||||
selectPage(id);
|
||||
@@ -270,8 +296,89 @@ function boardAddPage(page){
|
||||
}
|
||||
|
||||
function selectPage(id){
|
||||
$('[data-idpage]').removeClass('page-active');
|
||||
$('[data-idpage="' + id + '"]').addClass('page-active');
|
||||
$.blockUI();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/Editor/EditMain/?handler=Page",
|
||||
data: {
|
||||
id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.successful){
|
||||
$('[data-idpage]').removeClass('page-active');
|
||||
$('[data-idpage="' + id + '"]').addClass('page-active');
|
||||
$('#inpSelectedBoardPageId').val(id);
|
||||
notes = [];
|
||||
$('.div-note').remove();
|
||||
if (data.page.notes){
|
||||
data.page.notes.forEach(el => {
|
||||
let note = new Note(el.idNote, divCanvas, el.x, el.y, el.width, el.height, el.content, el.colorClass, el.zindex);
|
||||
notes.push(note);
|
||||
note.refresh();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Swal.fire('Napaka', data.error, 'error');
|
||||
console.log(data);
|
||||
}
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
console.log(xhr);
|
||||
alert(xhr.responseText);
|
||||
$.unblockUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveNotes(){
|
||||
let idBulletinBoardPage = parseInt($('#inpSelectedBoardPageId').val());
|
||||
if (isNaN(idBulletinBoardPage) || idBulletinBoardPage <= 0){
|
||||
Swal.fire('Stran ni izbrana', '', 'warning');
|
||||
return;
|
||||
}
|
||||
let array = [];
|
||||
|
||||
notes.forEach(note => {
|
||||
array.push({
|
||||
idNote: note.id,
|
||||
idBulletinBoardPage,
|
||||
x: note.x,
|
||||
y: note.y,
|
||||
width: note.width,
|
||||
height: note.height,
|
||||
content: note.content,
|
||||
colorClass: note.colorClass,
|
||||
zindex: note.zindex
|
||||
})
|
||||
});
|
||||
|
||||
$.blockUI();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
beforeSend: function(xhr) {
|
||||
xhr.setRequestHeader("XSRF-TOKEN",
|
||||
$('input:hidden[name="__RequestVerificationToken"]').val());
|
||||
},
|
||||
url: "EditMain/?handler=Notes",
|
||||
data: {
|
||||
idBulletinBoardPage,
|
||||
notes: array
|
||||
},
|
||||
success: function(data) {
|
||||
if (data.successful){
|
||||
selectPage(idBulletinBoardPage);
|
||||
} else {
|
||||
Swal.fire('Napaka', data.error, 'error');
|
||||
console.log(data);
|
||||
}
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
alert(xhr.responseText);
|
||||
$.unblockUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Note{
|
||||
constructor(id, divCanvas, x, y, width, height, content) {
|
||||
constructor(id, divCanvas, x, y, width, height, content, colorClass, zindex) {
|
||||
this.id = id;
|
||||
this.divCanvas = divCanvas;
|
||||
this.x = x;
|
||||
@@ -8,6 +8,8 @@ class Note{
|
||||
this.height = height;
|
||||
this.element = null;
|
||||
this.content = content;
|
||||
this.colorClass = colorClass;
|
||||
this.zindex = zindex;
|
||||
}
|
||||
|
||||
refresh(){
|
||||
@@ -16,7 +18,7 @@ class Note{
|
||||
}
|
||||
|
||||
this.element = $(`
|
||||
<div class="card div-note" data-id="${this.id}">
|
||||
<div class="card div-note ${this.colorClass}" data-id="${this.id}">
|
||||
<div class="card-body">
|
||||
${this.content}
|
||||
</div>
|
||||
@@ -40,7 +42,8 @@ class Note{
|
||||
this.element.css({
|
||||
'width': this.width + 'px',
|
||||
'height': this.height + 'px',
|
||||
'position': 'relative'
|
||||
'position': 'relative',
|
||||
'z-index': this.zindex
|
||||
});
|
||||
this.element.on( "dblclick", function() {
|
||||
openModalEditNote(parseInt($(this).attr('data-id')));
|
||||
|
||||
Reference in New Issue
Block a user