Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended functionality of Card, FileUploader, Input and some bug fixes #71

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,5 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

.idea/
43 changes: 28 additions & 15 deletions src/Blazor.AdminLte.Site.Shared/Pages/Layout/GridSystem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,35 @@
<Card>
<Title><CardTitle>Mix and match</CardTitle></Title>
<Body>
Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.
Stack the columns on mobile by making one full-width and the other half-width
<Row>
<Column Classes="col._12.col.md._8"><Card><Title>@col._12.col.md._8</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
</Row>
Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop
<Row>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
</Row>
Columns are always 50% wide, on mobile and desktop
Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.
Stack the columns on mobile by making one full-width and the other half-width
<Row>
<Column Classes="col._12.col.md._8"><Card><Title>@col._12.col.md._8</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
</Row>
Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop
<Row>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
<Column Classes="col._6.col.md._4"><Card><Title>@col._6.col.md._4</Title></Card></Column>
</Row>
Columns are always 50% wide, on mobile and desktop
<Row>
<Column Classes="col._6"><Card><Title>@col._6</Title></Card></Column>
<Column Classes="col._6"><Card><Title>@col._6</Title></Card></Column>
</Row>
</Body>
</Card>
<Card>
<Title><CardTitle>Column with no title</CardTitle></Title>
<Body>
<Row>
<Column Classes="col._6"><Card><Title>@col._6</Title></Card></Column>
<Column Classes="col._6"><Card><Title>@col._6</Title></Card></Column>
<Column Classes="col._12.col.md._8">
<Card><Title>@col._12.col.md._8</Title></Card>
</Column>
<Column Classes="col._6.col.md._4">
<Card><Body>No Title</Body></Card>
</Column>
</Row>
</Body>
</Card>
Expand Down
59 changes: 40 additions & 19 deletions src/Blazor.AdminLte.Site.Shared/Pages/User/Login.razor
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
@page "/login"
@using Blazor.AdminLte.Security.Abstractions.Helpers
<!-- note: using styles, not css, we will target Isolated CSS for this component when we upgrade to .NET5 -->
<Overlay>
<div style=" margin: 0 auto; margin-top: 10%; max-width: 400px;">
<div style="margin: 0 auto; margin-top: 10%; max-width: 400px;">
<div class="login-box">
<div class="login-logo">
<a href="./"><b>Admin</b>LTE</a>
</div>
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">Sign in to start your session</p>
@* <form action="../../index3.html" method="post">
*@
<Input @bind-Value="email" />
<Input @bind-Value="password" />
@code {
CustomCheckboxState rememberMe = new CustomCheckboxState() { Identifier = "customCheckbox1", Value = "option1", Label = "Custom Checkbox" };
}
<div class="row">
<div class="col-8">
<CustomCheckbox @bind-Value="rememberMe" />
</div>
<div class="col-4">
<Button Color="Color.Primary">Sign In</Button>
</div>

<Input @bind-Value="_email" />
<Input @bind-Value="_password" />
<div class="row">
<div class="col-8">
<CustomCheckbox @bind-Value="_rememberMe" />
</div>
<div class="col-4">
<Button Color="Color.Primary" @onclick="SignInAsync">Sign In</Button>
</div>
@* </form>*@

</div>
<div class="social-auth-links text-center mb-3">
<p>- OR -</p>
<a href="#" class="btn btn-block btn-primary">
Expand All @@ -46,7 +41,33 @@
</div>
</div>
</Overlay>

@code {
InputState email = new InputState() { Identifier = "email", Placeholder = "Enter email", Type = "email", Icon = "fas fa-envelope" };
InputState password = new InputState() { Identifier = "password", Placeholder = "Enter password", Type = "password", Icon = "fas fa-lock" };
InputState _email = new() { Identifier = "email", Placeholder = "Enter email", Type = "email", Icon = "fas fa-envelope" };
InputState _password = new() { Identifier = "password", Placeholder = "Enter password", Type = "password", Icon = "fas fa-lock" };
CustomCheckboxState _rememberMe = new() { Identifier = "customCheckbox1", Value = "option1", Label = "Remember me?" };

private async Task SignInAsync()
{
if (!Validate())
{
return;
}

// TODO: Login here

_password.ErrorMessage = "Incorrect email or password";
}

private bool Validate()
{
var isValid = _email.Validate(EmailValidator.Validate, "Invalid email address");

if (!_password.Validate(string.IsNullOrEmpty, "Missing password"))
{
isValid = false;
}

return isValid;
}
}
4 changes: 2 additions & 2 deletions src/Blazor.AdminLte.Site/FilesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public FilesController()


[HttpPost("UploadFileChunk")]
public Task<bool> UploadFileChunk([FromBody] ChunkedDataRequestDto chunkedDataRequestDto)
public Task<bool> UploadFileChunkAsync([FromBody] ChunkedDataRequestDto chunkedDataRequestDto)
{
try
{
Expand Down Expand Up @@ -46,7 +46,7 @@ public Task<bool> UploadFileChunk([FromBody] ChunkedDataRequestDto chunkedDataRe


[HttpGet("GetFiles")]
public Task<List<string>> GetFileNames()
public Task<List<string>> GetFileNamesAsync()
{
var result = new List<string>();
var files = Directory.GetFiles(Environment.CurrentDirectory + "\\StaticFiles", "*.*");
Expand Down
2 changes: 1 addition & 1 deletion src/Blazor.AdminLte.Site/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="rect4"></div>
<div class="rect5"></div>
</div>*@
<component type="typeof(App)" render-mode="Server" //>
<component type="typeof(App)" render-mode="Server" />
</app>
<div id="blazor-error-ui">
<environment include="Staging,Production">
Expand Down
4 changes: 2 additions & 2 deletions src/Blazor.AdminLte.Wasm/WasmFilesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public WasmFilesManager(HttpClient http)
} //FilesManager


public async Task<bool> UploadFileChunk(ChunkedDataRequestDto fileChunkDto)
public async Task<bool> UploadFileChunkAsync(ChunkedDataRequestDto fileChunkDto)
{
try
{
Expand All @@ -32,7 +32,7 @@ public async Task<bool> UploadFileChunk(ChunkedDataRequestDto fileChunkDto)
} //UploadFileChunk


public async Task<List<string>> GetFileNames()
public async Task<List<string>> GetFileNamesAsync()
{
try
{
Expand Down
17 changes: 11 additions & 6 deletions src/Blazor.AdminLte/Card/Card.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,25 @@ private IDictionary<string, object> GetAttributes()
private IDictionary<string, object> GetHeaderAttributes()
{
var attributes = new Dictionary<string, object>();
if (Title == null)
{
return attributes;
}

attributes["class"] = "card-header";
if (IsTabs)
{
attributes["class"] = $"{attributes["class"]} p-0";
if (!Styles.ToList().Contains(CardStyle.OutlineTabs))
{
attributes["class"] = $"{attributes["class"]} pt-1";
}
if (Styles.ToList().Contains(CardStyle.Outline))
{
attributes["class"] = $"{attributes["class"]} border-bottom-0";
}
}

if (Styles.ToList().Contains(CardStyle.Outline))
{
attributes["class"] = $"{attributes["class"]} border-bottom-0";
}
}

return attributes;
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/Blazor.AdminLte/Files/FileChunkDto.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
namespace Blazor.AdminLte
using System;

namespace Blazor.AdminLte
{
public class ChunkedDataRequestDto
{
public string FileName { get; set; } = "";
public long Offset { get; set; }
public byte[]? Data { get; set; }
public byte[] Data { get; set; }
public bool FirstChunk = false;
public Guid Uid { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/Blazor.AdminLte/Files/FileUploader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
</div>

@if (filesQueue.Count > 0) {
@if (_filesQueue.Count > 0) {
<div class="card mb-4">
<div class="card-header">Upload queue</div>
<div class="card-body">
Expand All @@ -39,7 +39,7 @@
</tr>
</thead>
<tbody>
@foreach (var file in filesQueue.OrderByDescending(x => x.FileId))
@foreach (var file in _filesQueue.OrderByDescending(x => x.FileId))
{
var size = Math.Round((file.Size / 1024.00));
var percentage = Math.Round(file.UploadedPercentage);
Expand Down
Loading