<commit_before>﻿@page "{status?}"

@model PostsModel
@{
    ViewData["Title"] = "Posts";
}

<blog-posts inline-template>
    <v-container fluid fill-height>
        <v-layout justify-center>
            <v-flex xs10>
                <v-tabs v-model="active" style="margin-bottom: 18px" class="elevation-1">
                    <v-tab @@click="getPosts('published')" key="1">
                        Published <v-chip v-if="publishedCount > 0" small>{{ publishedCount }}</v-chip>
                    </v-tab>
                    <v-tab @@click="getPosts('draft')" key="0">
                        Draft <v-chip v-if="draftCount > 0" small>{{ draftCount }}</v-chip>
                    </v-tab>
                </v-tabs>
                <v-data-table :items="posts"
                              :pagination.sync="pagination"
                              :total-items="totalPosts"
                              :loading="loading"
                              :rows-per-page-items="rowsPerPageItems"
                              rows-per-page-text=""
                              hide-headers
                              class="elevation-1">
                    <template slot="items" slot-scope="props">
                        <td style="padding: 8px 20px">
                            <h3 v-if="props.item.title" v-html="props.item.title"></h3>
                            <h3 v-else style="font-style:italic;color:gray">Untitled</h3>
                            <span>{{ props.item.date }} by {{ props.item.author }}</span>
                        </td>
                        <td class="right layout px-0" style="padding: 8px 20px">
                            <v-btn icon class="mx-0" :href="props.item.editLink">
                                <v-icon color="blue">edit</v-icon>
                            </v-btn>
                            <v-btn icon class="mx-1" target="_blank" :href="props.item.postLink">
                                <v-icon color="teal">remove_red_eye</v-icon>
                            </v-btn>
                            <v-btn icon class="mx-3" @@click="deletePost(props.item)">
                                <v-icon color="pink">delete</v-icon>
                            </v-btn>
                        </td>
                    </template>
                    <template slot="no-data">
                        <div>You have no posts.</div>
                    </template>
                </v-data-table>
            </v-flex>
        </v-layout>
    </v-container>
</blog-posts>

<v-btn fab
       bottom
       right
       color="pink"
       dark
       fixed
       href="/admin/compose">
    <v-icon>add</v-icon>
</v-btn>

@section ComponentScripts {
    <script>
        let blogPostsMixin = {
            data: function () {
                return {
                    activeStatus: '@Model.ActiveStatus',
                    posts: @Html.Raw(Model.Data.JsonPosts),
                    totalPosts: @Model.Data.TotalPosts,
                    publishedCount: @Model.Data.PublishedCount,
                    draftCount: @Model.Data.DraftCount,
                    rowsPerPageItems: @PostsModel.DEFAULT_ROW_PER_PAGE_ITEMS,
                }
            }
        }
    </script>
    <script src="~/admin/js/blog-posts.js" asp-append-version="true"></script>
}<commit_msg>styles: Clean up table from layout tag and put buttons in a menu #113<commit_after>﻿@page "{status?}"

@model PostsModel
@{
    ViewData["Title"] = "Posts";
}

<blog-posts inline-template>
    <v-container>
        <v-tabs v-model="active" style="margin-bottom: 18px" class="elevation-1">
            <v-tab @@click="getPosts('published')" key="1">
                Published <v-chip v-if="publishedCount > 0" small>{{ publishedCount }}</v-chip>
            </v-tab>
            <v-tab @@click="getPosts('draft')" key="0">
                Draft <v-chip v-if="draftCount > 0" small>{{ draftCount }}</v-chip>
            </v-tab>
        </v-tabs>
        <v-data-table :items="posts"
                      :pagination.sync="pagination"
                      :total-items="totalPosts"
                      :loading="loading"
                      :rows-per-page-items="rowsPerPageItems"
                      rows-per-page-text=""
                      hide-headers
                      class="elevation-1">
            <template slot="items" slot-scope="props">
                <td style="padding: 8px 20px">
                    <h3 v-if="props.item.title" v-html="props.item.title"></h3>
                    <h3 v-else style="font-style:italic;color:gray">Untitled</h3>
                    <span>{{ props.item.date }} by {{ props.item.author }}</span>
                </td>
                <td class="right layout px-0" style="padding: 8px 20px">
                    <v-menu bottom left @@click.native.stop>
                        <v-btn slot="activator"
                               icon>
                            <v-icon>more_vert</v-icon>
                        </v-btn>
                        <v-list dense>
                            <v-list-tile :href="props.item.editLink">
                                <v-icon class="cat-action-icon">edit</v-icon>
                                <v-list-tile-title>Edit</v-list-tile-title>
                            </v-list-tile>
                            <v-list-tile :href="props.item.postLink">
                                <v-icon class="cat-action-icon">visibility</v-icon>
                                <v-list-tile-title>View Post</v-list-tile-title>
                            </v-list-tile>
                            <v-list-tile @@click="deletePost(props.item)">
                                <v-icon class="cat-action-icon">delete</v-icon>
                                <v-list-tile-title>Delete</v-list-tile-title>
                            </v-list-tile>
                        </v-list>
                    </v-menu>
                </td>
            </template>
            <template slot="no-data">
                <div>You have no posts.</div>
            </template>
        </v-data-table>
    </v-container>
</blog-posts>

<v-btn fab
       bottom
       right
       color="pink"
       dark
       fixed
       v-once
       href="/admin/compose">
    <v-icon>add</v-icon>
</v-btn>

@section ComponentScripts {
    <script>
        let blogPostsMixin = {
            data: function () {
                return {
                    activeStatus: '@Model.ActiveStatus',
                    posts: @Html.Raw(Model.Data.JsonPosts),
                    totalPosts: @Model.Data.TotalPosts,
                    publishedCount: @Model.Data.PublishedCount,
                    draftCount: @Model.Data.DraftCount,
                    rowsPerPageItems: @PostsModel.DEFAULT_ROW_PER_PAGE_ITEMS,
                }
            }
        }
    </script>
    <script src="~/admin/js/blog-posts.js" asp-append-version="true"></script>
}
{'fraction_non_alphanumeric': 0.14049229883402908, 'fraction_numerical': 0.0066215632647185834, 'mean_word_length': 1.1876574307304786, 'pattern_counts': {'":': 0, '<': 125, '<?xml version=': 0, '>': 129, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4321453', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1881, 'n_words': 312}