@using Dpz.Core.Service.RepositoryService
@model VmBookmark
@inject IBookmarkService BookmarkService


<div class="bookmark">
    <form class="bookmark-form" asp-action="Update" method="post">
        <input type="hidden" asp-for="Id" />
        
        <div class="bookmark-form__header">
            <h2 class="bookmark-form__title">编辑书签</h2>
        </div>

        <div class="bookmark-form__group">
            <label asp-for="Title" class="bookmark-form__label">标题</label>
            <input asp-for="Title" class="bookmark-form__input" placeholder="请输入标题" required />
        </div>

        <div class="bookmark-form__group">
            <label asp-for="Url" class="bookmark-form__label">链接地址</label>
            <input asp-for="Url" class="bookmark-form__input" placeholder="https://" required />
        </div>

        <div class="bookmark-form__group">
            <label asp-for="Icon" class="bookmark-form__label">图标 URL</label>
            <input asp-for="Icon" class="bookmark-form__input" placeholder="可选,图标地址" />
        </div>

        <div class="bookmark-form__group">
            <label asp-for="Image" class="bookmark-form__label">预览图 URL</label>
            <input asp-for="Image" class="bookmark-form__input" placeholder="可选,预览图片地址" />
        </div>

        <div class="bookmark-form__group">
            <label class="bookmark-form__label">分类</label>
            <div class="bookmark-form__categories">
                @foreach (var item in await BookmarkService.GetCategoriesAsync())
                {
                    var isChecked = Model.Categories != null && Model.Categories.Contains(item);
                    <div class="bookmark-form__checkbox-wrapper">
                        <input type="checkbox" name="Categories" id="cat_@item" value="@item" class="bookmark-form__checkbox" @(isChecked ? "checked" : "")>
                        <label for="cat_@item" class="bookmark-form__checkbox-label">@item</label>
                    </div>
                }
            </div>
        </div>

        <div class="bookmark-form__group">
            <label class="bookmark-form__label">补充分类</label>
            <input type="text" name="category" class="bookmark-form__input" placeholder="使用分号 (;) 分隔多个新分类" />
        </div>

        <div class="bookmark-form__actions">
            <button type="submit" class="bookmark-form__submit">保存修改</button>
            <button type="button" class="bookmark-form__delete" data-id="@Model.Id">删除</button>
            <a asp-action="Index" class="bookmark-form__cancel" data-pjax>取消</a>
        </div>
    </form>
</div>
评论加载中...