<commit_before>﻿@model Blogifier.Core.Data.Models.AdminPostsModel
@using Blogifier.Core.Extensions
@using Blogifier.Core.Common;
@{
    var pgr = Model.Pager;
    var cntFrom = pgr.CurrentPage == 1 ? 1 : (pgr.CurrentPage - 1) * pgr.ItemsPerPage + 1;
    var cntTo = pgr.CurrentPage * pgr.ItemsPerPage < pgr.Total ? pgr.CurrentPage * pgr.ItemsPerPage : pgr.Total;

    string filter = Url.ActionContext.HttpContext.Request.Query["filter"];
    if (filter == null) { filter = ""; }

    var checkDft = filter.Contains("filterDraft") ? "checked" : "";
    var checkPub = filter.Contains("filterPublished") ? "checked" : "";
    var checkAll = checkDft == "" && checkPub == "" ? "checked" : "";
}
<div class="admin-content admin-content-posts container">
    <div class="admin-toolbar clearfix">
        <!-- left side-->
        <a href="~/admin/editor/0" class="btn btn-black btn-main float-left mr-2">New</a>
        <div class="btn-group float-left" role="group" aria-label="Basic example">
            <button type="button" class="btn btn-secondary btn-icon"><i class="fa fa-trash"></i></button>
            <button type="button" class="btn btn-secondary btn-icon"><i class="fa fa-check"></i></button>
            <button type="button" class="btn btn-secondary btn-icon"><i class="fa fa-archive"></i></button>
        </div>
        <!-- right side -->
        <div class="dropdown admin-toolbar-filter float-right ml-2">
            <button class="btn btn-secondary dropdown-toggle btn-icon" type="button" id="filtersDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="fa fa-filter"></i>
            </button>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="filtersDropdown">
                <h5>Filter by status:</h5>
                <label class="custom-control custom-radio d-block">
                    <input id="filterAll" name="filter" type="radio" @checkAll class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">All</span>
                </label>
                <label class="custom-control custom-radio d-block">
                    <input id="filterDraft" name="filter" type="radio" @checkDft class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">Drafts</span>
                </label>
                <label class="custom-control custom-radio d-block">
                    <input id="filterPublished" name="filter" type="radio" @checkPub class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">Published</span>
                </label>
                <hr />
                <h5>Filter by categories:</h5>
                @{
                    foreach (var item in Model.CategoryList)
                    {
                        <label class="custom-control custom-checkbox d-block">
                            <input type="checkbox" id="@item.Value" onclick="filterOnCategories()" class="custom-control-input chk">
                            <span class="custom-control-indicator"></span>
                            <span class="custom-control-description">@item.Text</span>
                        </label>
                    }
                }
            </div>
        </div>
        <!-- if we don't need the form tag, just turn it to div tag -->
        <form action="~/admin" method="get" class="admin-toolbar-search float-right">
            <input type="search" name="search" class="form-control" placeholder="Search..." />
        </form>
    </div>
    <ul class="list-group post-list" aria-label="posts">
        @foreach (var item in Model.BlogPosts)
        {
            var published = item.Published == DateTime.MinValue ? "DRAFT" : item.Published.ToString("MMM dd, yyyy");
            <li class="list-group-item post-list-item">
                <label class="post-item-checkbox custom-control custom-checkbox"><input type="checkbox" class="custom-control-input"><span class="custom-control-indicator"></span></label>
                <a href="~/admin/editor/@item.BlogPostId" class="post-item-link">@item.Title</a>
                <div class="post-item-info">
                    <!-- we don't need these since we are going to have multiple actions -->
                    @*<a data-toggle="tooltip" title="Delete" onclick="return postsController.removePost(@item.BlogPostId)" aria-label="Delete" role="button"><i class="fa fa-trash"></i></a>
                        @if (item.Published == DateTime.MinValue)
                        {
                            <a data-toggle="tooltip" title="Publish" onclick="return postsController.publish(@item.BlogPostId)" aria-label="Publish" role="button"><i class="fa fa-check"></i></a>
                        }
                        else
                        {
                            <a data-toggle="tooltip" title="Unpublish" onclick="return postsController.unpublish(@item.BlogPostId)" aria-label="Unpublish" role="button"><i class="fa fa-archive"></i></a>
                        }*@
                    <a href="/@ApplicationSettings.BlogRoute@item.Slug" data-toggle="tooltip" title="@item.PostViews views" target="_blank" aria-label="View" role="button"><i class="fa fa-eye"></i></a>
                    <a class="pr-2" aria-label="Publish date">@published</a>
                </div>
            </li>
        }
    </ul>
    @if (pgr.ShowNewer || pgr.ShowOlder)
    {
        <ul class="pagination-custom" aria-label="Post navigation">
            @if (pgr.ShowOlder)
            {
                <li><a href="~/admin/@pgr.Older" aria-label="Older posts"><i class="fa fa-long-arrow-left"></i></a></li>
            }
            <li><a class="item-count">@cntFrom-@cntTo out of @pgr.Total</a></li>
            @if (pgr.ShowNewer)
            {
                <li><a href="~/admin/@pgr.Newer" aria-label="Newer posts"><i class="fa fa-long-arrow-right"></i></a></li>
            }
        </ul>
    }
</div>
@section Scripts{
    <script src="~/blogifier/admin/custom/js/postsController.js"></script>
    <script>
        $('input[type=radio]').on('change', function () {
            if ($(this.id)) {
                window.location.href = getUrl("admin?filter=" + this.id);
            }
        });
        var filterOnCategories = function () {
            var boxes = $('.chk:checkbox:checked');
            $('input:checkbox.chk').each(function () {
                var sThisVal = (this.checked ? $(this).val() : "");
            });
        }
    </script>
}<commit_msg>admin / Tooltips in Posts<commit_after>﻿@model Blogifier.Core.Data.Models.AdminPostsModel
@using Blogifier.Core.Extensions
@using Blogifier.Core.Common;
@{
    var pgr = Model.Pager;
    var cntFrom = pgr.CurrentPage == 1 ? 1 : (pgr.CurrentPage - 1) * pgr.ItemsPerPage + 1;
    var cntTo = pgr.CurrentPage * pgr.ItemsPerPage < pgr.Total ? pgr.CurrentPage * pgr.ItemsPerPage : pgr.Total;

    string filter = Url.ActionContext.HttpContext.Request.Query["filter"];
    if (filter == null) { filter = ""; }

    var checkDft = filter.Contains("filterDraft") ? "checked" : "";
    var checkPub = filter.Contains("filterPublished") ? "checked" : "";
    var checkAll = checkDft == "" && checkPub == "" ? "checked" : "";
}
<div class="admin-content admin-content-posts container">
    <div class="admin-toolbar clearfix">
        <a href="~/admin/editor/0" class="btn btn-black btn-main float-left mr-2">New</a>
        <div class="btn-group float-left" role="group" aria-label="Basic example">
            <button type="button" class="btn btn-secondary btn-icon" title="Delete"><i class="fa fa-trash"></i></button>
            <button type="button" class="btn btn-secondary btn-icon" title="Publish"><i class="fa fa-check"></i></button>
            <button type="button" class="btn btn-secondary btn-icon" title="Unpublish"><i class="fa fa-archive"></i></button>
        </div>
        <div class="dropdown admin-toolbar-filter float-right ml-2">
            <button class="btn btn-secondary dropdown-toggle btn-icon" title="Filter" type="button" id="filtersDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="fa fa-filter"></i>
            </button>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="filtersDropdown">
                <h5>Filter by status:</h5>
                <label class="custom-control custom-radio d-block">
                    <input id="filterAll" name="filter" type="radio" @checkAll class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">All</span>
                </label>
                <label class="custom-control custom-radio d-block">
                    <input id="filterDraft" name="filter" type="radio" @checkDft class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">Drafts</span>
                </label>
                <label class="custom-control custom-radio d-block">
                    <input id="filterPublished" name="filter" type="radio" @checkPub class="custom-control-input">
                    <span class="custom-control-indicator"></span>
                    <span class="custom-control-description">Published</span>
                </label>
                <hr />
                <h5>Filter by categories:</h5>
                @{
                    foreach (var item in Model.CategoryList)
                    {
                        <label class="custom-control custom-checkbox d-block">
                            <input type="checkbox" id="@item.Value" onclick="filterOnCategories()" class="custom-control-input chk">
                            <span class="custom-control-indicator"></span>
                            <span class="custom-control-description">@item.Text</span>
                        </label>
                    }
                }
            </div>
        </div>
        <form action="~/admin" method="get" class="admin-toolbar-search float-right">
            <input type="search" name="search" class="form-control" placeholder="Search..." />
        </form>
    </div>
    <ul class="list-group post-list" aria-label="posts">
        @foreach (var item in Model.BlogPosts)
        {
            var published = item.Published == DateTime.MinValue ? "DRAFT" : item.Published.ToString("MMM dd, yyyy");
            <li class="list-group-item post-list-item">
                <label class="post-item-checkbox custom-control custom-checkbox"><input type="checkbox" class="custom-control-input"><span class="custom-control-indicator"></span></label>
                <a href="~/admin/editor/@item.BlogPostId" class="post-item-link">@item.Title</a>
                <div class="post-item-info">
                    <!-- we don't need these since we are going to have multiple actions -->
                    @*<a data-toggle="tooltip" title="Delete" onclick="return postsController.removePost(@item.BlogPostId)" aria-label="Delete" role="button"><i class="fa fa-trash"></i></a>
                        @if (item.Published == DateTime.MinValue)
                        {
                            <a data-toggle="tooltip" title="Publish" onclick="return postsController.publish(@item.BlogPostId)" aria-label="Publish" role="button"><i class="fa fa-check"></i></a>
                        }
                        else
                        {
                            <a data-toggle="tooltip" title="Unpublish" onclick="return postsController.unpublish(@item.BlogPostId)" aria-label="Unpublish" role="button"><i class="fa fa-archive"></i></a>
                        }*@
                    <a href="/@ApplicationSettings.BlogRoute@item.Slug" data-toggle="tooltip" title="@item.PostViews views" target="_blank" aria-label="View" role="button"><i class="fa fa-eye"></i></a>
                    <a class="pr-2" aria-label="Publish date">@published</a>
                </div>
            </li>
        }
    </ul>
    @if (pgr.ShowNewer || pgr.ShowOlder)
    {
        <ul class="pagination-custom" aria-label="Post navigation">
            @if (pgr.ShowOlder)
            {
                <li><a href="~/admin/@pgr.Older" aria-label="Older posts"><i class="fa fa-long-arrow-left"></i></a></li>
            }
            <li><a class="item-count">@cntFrom-@cntTo out of @pgr.Total</a></li>
            @if (pgr.ShowNewer)
            {
                <li><a href="~/admin/@pgr.Newer" aria-label="Newer posts"><i class="fa fa-long-arrow-right"></i></a></li>
            }
        </ul>
    }
</div>
@section Scripts{
    <script src="~/blogifier/admin/custom/js/postsController.js"></script>
    <script>
        $('input[type=radio]').on('change', function () {
            if ($(this.id)) {
                window.location.href = getUrl("admin?filter=" + this.id);
            }
        });
        var filterOnCategories = function () {
            var boxes = $('.chk:checkbox:checked');
            $('input:checkbox.chk').each(function () {
                var sThisVal = (this.checked ? $(this).val() : "");
            });
        }
    </script>
}
{'fraction_non_alphanumeric': 0.16315633343221597, 'fraction_numerical': 0.0017798872738059924, 'mean_word_length': 2.098575367647059, 'pattern_counts': {'":': 0, '<': 244, '<?xml version=': 0, '>': 242, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1886240', 'n_tokens_mistral': 3864, 'n_tokens_neox': 3700, 'n_words': 710}