Add create bookmark
This commit is contained in:
parent
64b893b778
commit
55625b1be4
19 changed files with 382 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<li>
|
||||
<li class="bookmark">
|
||||
@if (!String.IsNullOrEmpty(this.Model.Notes))
|
||||
{
|
||||
<details>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
@using Fluxor
|
||||
@using Start.Client.Store.State
|
||||
@using Start.Client.Store.Features.DeleteGroup
|
||||
@using Start.Client.Store.Features.CreateBookmark
|
||||
|
||||
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
|
||||
|
||||
|
|
@ -33,7 +34,7 @@
|
|||
</div>
|
||||
<p class="empty-title h6">No Bookmarks</p>
|
||||
<div class="empty-action">
|
||||
<button type="button" class="btn btn-primary">
|
||||
<button type="button" class="btn btn-primary" @onclick="this.OnCreateBookmarkClicked">
|
||||
<i class="icon icon-plus"></i> Create Bookmark
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -89,6 +90,7 @@
|
|||
|
||||
protected void OnCreateBookmarkClicked()
|
||||
{
|
||||
// Placeholder
|
||||
dispatch.Dispatch(new ShowCreateBookmarkFormAction(this.Group.BookmarkGroupId,
|
||||
this.Group.Title));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
91
Start/Client/Components/CreateBookmark.razor
Normal file
91
Start/Client/Components/CreateBookmark.razor
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
@using Start.Client.Store.Features.CreateBookmark
|
||||
@using Fluxor
|
||||
|
||||
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
|
||||
|
||||
@inject IActionSubscriber actionSubscriber
|
||||
@inject IDispatcher dispatch
|
||||
@inject IState<CreateBookmarkState> state
|
||||
|
||||
<Dialog Title="Create Bookmark" Active="this.state.Value.ShowCreateBookmarkForm" OnClose="this.OnDialogClose">
|
||||
<EditForm Model="this.Model" OnValidSubmit="this.OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
@if (this.state.Value.CreateBookmarkErrorMessage != null)
|
||||
{
|
||||
<Alert Type="Alert.AlertType.Error">
|
||||
@this.state.Value.CreateBookmarkErrorMessage
|
||||
</Alert>
|
||||
}
|
||||
|
||||
<ValidationSummary />
|
||||
|
||||
<div class="form-group">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column col-12">
|
||||
<label for="createBookmarkTitle">Title</label>
|
||||
<InputText id="createBookmarkTitle" name="createBookmarkTitle"
|
||||
class="form-input" @bind-Value="this.Model.Title" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column col-12">
|
||||
<label for="createBookmarkUrl">URL</label>
|
||||
<input type="url" name="createBookmarkUrl" class="form-input"
|
||||
@bind-value="this.Model.Url" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column col-12">
|
||||
<label for="createBookmarkNotes">Notes</label>
|
||||
<InputTextArea name="createBookmarkNotes" class="form-input"
|
||||
@bind-Value="this.Model.Notes" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column col-12 text-right">
|
||||
@if (this.state.Value.IsLoadingCreateBookmark)
|
||||
{
|
||||
<button type="submit" disabled class="btn btn-primary loading">
|
||||
<i class="icon icon-plus"></i> Create
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="icon icon-plus"></i> Create
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
</Dialog>
|
||||
|
||||
@code {
|
||||
protected BookmarkDto Model { get; set; } = new BookmarkDto("", "", null, 0);
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
this.Model = new BookmarkDto("", "", null, this.state.Value.GroupId);
|
||||
|
||||
actionSubscriber.SubscribeToAction<ShowCreateBookmarkFormAction>(this,
|
||||
a => this.Model.BookmarkGroupId = a.GroupId);
|
||||
}
|
||||
|
||||
protected void OnSubmit()
|
||||
{
|
||||
dispatch.Dispatch(new SubmitCreateBookmarkAction(this.Model));
|
||||
}
|
||||
|
||||
protected void OnDialogClose()
|
||||
{
|
||||
dispatch.Dispatch(new HideCreateBookmarkFormAction());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue