minor edits

This commit is contained in:
Dimitar Byalkov
2023-06-09 05:39:06 +02:00
parent d81450ed21
commit f90e73d544
9 changed files with 88 additions and 30 deletions

View File

@@ -19,12 +19,12 @@
<input type="hidden" name="handler" value="filter" />
<input type="text" name="s" />
<div class="form-check form-check-inline">
<label class="form-check-label" for="asc">Sort by ascending order</label>
<label class="form-check-label" for="true">Sort by ascending order</label>
<input class="form-check-input" type="radio" name="asc" value="true" />
</div>
<div class="form-check form-check-inline">
<label class="form-check-label" for="des">Sort by descending order</label>
<input class="form-check-input" type="radio" name="des" value="true" />
<label class="form-check-label" for="false">Sort by descending order</label>
<input class="form-check-input" type="radio" name="asc" value="false" />
</div>
<div class="form-check form-check-inline">
<label class="form-check-label" for="imp">Only important</label>

View File

@@ -34,7 +34,7 @@ namespace WebApp.Pages
ViewData.Add("count", c);
ViewData.Add("allCount", AnnouncementManager.GetAllAnnouncements().Count);
}
public void OnGetFilter(string s, bool asc, bool des, bool imp) // search, ascending, descending order, isImportant
public void OnGetFilter(string s, bool asc, bool imp) // search, ascending/descending order, isImportant
{
AnnouncementManager = new AnnouncementManager(_announcementRepository);
List<Announcement> announcements = new List<Announcement>();
@@ -46,15 +46,17 @@ namespace WebApp.Pages
{
announcements = AnnouncementManager.GetAllAnnouncements();
}
if (imp)
{
announcements = announcements.Where(x => x.IsImportant).ToList();
}
if (asc)
{
announcements = announcements.OrderBy(x => x.PublishDate).ToList();
}
else if (des)
else
{
announcements = announcements.OrderByDescending(x => x.PublishDate).ToList();
}

View File

@@ -0,0 +1,13 @@
@page
@model WebApp.Pages.Error.UnexpectedModel
@{
ViewData["Title"] = "Unexpected error";
}
<div class="text-center">
<h1 class="display-4">Uh oh! An unexpected error has occured.</h1>
<img src="https://images.pexels.com/photos/96938/pexels-photo-96938.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" />
<p>
Contact your system admistrator if this cat appears too often on your screen.
</p>
</div>
<p>Photo: <a href="https://pexels.com">pexels.com</a></p>

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WebApp.Pages.Error
{
public class UnexpectedModel : PageModel
{
public void OnGet()
{
}
}
}

View File

@@ -7,7 +7,7 @@
<div class="bg-image text-white shadow-1-strong p-5 text-center bg-body-tertiary rounded-3" style="background: url(https://images.pexels.com/photos/1036804/pexels-photo-1036804.jpeg?h=800) no-repeat center center; background-size: 100%;">
<h1 class="text-body-emphasis">Student House Dashboard</h1>
<p class="lead">
The student square for housemates! This site is currently under construction.
Welcome to the student square for housemates!
</p>
@if (!User.Identity.IsAuthenticated)
{
@@ -16,6 +16,14 @@
else
{
<a class="btn btn-primary" asp-page="Announcements">Announcements</a>
<a class="btn btn-primary" asp-page="Complaints">Complaints</a>
}
</div>
<a>Image: pexels.com</a>
<a>Image: pexels.com</a>
<div class="card mt-3 text-center">
<h3>Newest update</h3>
<p>Now you can search for announcements on a specific date using the search bar and the keyword "date:"</p>
<p>Example: <b>date:2023-05-13</b></p>
</div>