<commit_before>﻿@using StockportWebapp.ViewModels;
@using StockportWebapp.FeatureToggling
@inject FeatureToggles FeatureToggles
@model EventCalendar
@{
    var hasSearched = !string.IsNullOrWhiteSpace(Model.Category) || Model.DateFrom != null || Model.DateTo != null;
    var hideOnMobile = hasSearched ? "hide-on-mobile" : string.Empty;
    var showOnMobile = hasSearched ? "hide-on-desktop hide-on-tablet" : "hide-on-mobile hide-on-desktop hide-on-tablet";
    var nowShowing = string.Concat(string.IsNullOrWhiteSpace(Model.Category) ? "Showing events " : $"Showing <b>{Model.Category}</b> events ",
                        Model.DateFrom == null || Model.DateTo == null || Model.DateFrom != Model.DateTo ? string.Empty : $"for <b>{((DateTime)Model.DateFrom).ToString("dd/MM/yy")}</b> ",
                        Model.DateFrom == Model.DateTo || Model.DateFrom == null ? string.Empty : $"from <b>{((DateTime)Model.DateFrom).ToString("dd/MM/yy")}</b> ",
                        Model.DateFrom == Model.DateTo || Model.DateTo == null ? string.Empty : $"to <b>{((DateTime)Model.DateTo).ToString("dd/MM/yy")}</b>");
}
<form action="/events" method="get">
    <input type="hidden" asp-for="@Model.FromSearch" value="true" />
    <div class="full-width-title" id="events-filter-bar">
        <div class="grid-container grid-parent grid-100">
            <div class="grid-100 tablet-grid-100 mobile-grid-100 @hideOnMobile">
                <h2>Find something to do in Stockport</h2>
            </div>
            <div class="grid-100 tablet-grid-100 mobile-grid-100 @showOnMobile">
                <h2>@Html.Raw(nowShowing)</h2>
            </div>
            <div class="grid-100 tablet-grid-100 mobile-grid-100 grid-parent form-section open">
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.DateFrom"></label></div>
                    <div><input type="date" asp-for="@Model.DateFrom" placeholder="All dates" class="form-control datepicker" /></div>
                </div>
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.DateTo"></label></div>
                    <div><input type="date" asp-for="@Model.DateTo" placeholder="All dates" class="form-control datepicker" /></div>
                </div>
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.Category"></label></div>
                    @if (FeatureToggles.DisplayNewEventPageFeatures)
                    {
                        <div><select asp-for="@Model.Category" asp-items="@Model.EventCategoryOptions()" placeholder="All categories" class="form-control"></select></div>
                    }
                    else
                    {
                        <div><select asp-for="@Model.Category" asp-items="@Model.CategoryOptions()" placeholder="All categories" class="form-control"></select></div>
                    }
                </div>
                <div class="grid-25 tablet-grid-100 mobile-grid-100" class="form-field">
                    <div class="invisible hide-on-tablet hide-on-mobile"><label>Hide me</label></div>
                    <div class="button-container"><stock-button class="button-outline-white-transparent">Find what's on</stock-button></div>
                </div>
            </div>
            @if (Model.FromSearch)
            {
            <div class="hide-on-tablet hide-on-desktop mobile-grid-100">
                <div class="edit-search">
                    <a href="javascript:toggleSearch();" id="edit-search-link" class="closed">Edit search</a>
                </div> 
            </div>
            }
        </div>
    </div>
</form>

<script type="text/javascript">

    function toggleSearch() {
        var container = $('.form-section', '#events-filter-bar');
        var button = $('#edit-search-link');

        if ($(button).hasClass('open')) {
            $(button).removeClass('open');
            $(container).removeClass('closed');
        } else {
            $(button).addClass('open');
            $(container).addClass('closed');
        }
    }

</script><commit_msg>Nick / Stephen - 2 small issues on events filter bar<commit_after>﻿@using StockportWebapp.ViewModels;
@using StockportWebapp.FeatureToggling
@inject FeatureToggles FeatureToggles
@model EventCalendar
@{
    var hasSearched = !string.IsNullOrWhiteSpace(Model.Category) || Model.DateFrom != null || Model.DateTo != null;
    var hideOnMobile = hasSearched ? "hide-on-mobile" : string.Empty;
    var showOnMobile = hasSearched ? "hide-on-desktop hide-on-tablet" : "hide-on-mobile hide-on-desktop hide-on-tablet";
    var nowShowing = string.Concat(string.IsNullOrWhiteSpace(Model.Category) ? "Showing events " : $"Showing <b>{Model.Category}</b> events ",
                        Model.DateFrom == null || Model.DateTo == null || Model.DateFrom != Model.DateTo ? string.Empty : $"for <b>{((DateTime)Model.DateFrom).ToString("dd/MM/yy")}</b> ",
                        Model.DateFrom == Model.DateTo || Model.DateFrom == null ? string.Empty : $"from <b>{((DateTime)Model.DateFrom).ToString("dd/MM/yy")}</b> ",
                        Model.DateFrom == Model.DateTo || Model.DateTo == null ? string.Empty : $"to <b>{((DateTime)Model.DateTo).ToString("dd/MM/yy")}</b>");
}
<form action="/events" method="get">
    <input type="hidden" asp-for="@Model.FromSearch" value="true" />
    <div class="full-width-title" id="events-filter-bar">
        <div class="grid-container grid-parent grid-100">
            <div class="grid-100 tablet-grid-100 mobile-grid-100 @hideOnMobile">
                <label>Find something to do in Stockport</label>
            </div>
            <div class="grid-100 tablet-grid-100 mobile-grid-100 @showOnMobile">
                <h2>@Html.Raw(nowShowing)</h2>
            </div>
            <div class="grid-100 tablet-grid-100 mobile-grid-100 grid-parent form-section closed">
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.DateFrom"></label></div>
                    <div><input type="date" asp-for="@Model.DateFrom" placeholder="All dates" class="form-control datepicker" /></div>
                </div>
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.DateTo"></label></div>
                    <div><input type="date" asp-for="@Model.DateTo" placeholder="All dates" class="form-control datepicker" /></div>
                </div>
                <div class="grid-25 tablet-grid-33 mobile-grid-100" class="form-field">
                    <div><label asp-for="@Model.Category"></label></div>
                    @if (FeatureToggles.DisplayNewEventPageFeatures)
                    {
                        <div><select asp-for="@Model.Category" asp-items="@Model.EventCategoryOptions()" placeholder="All categories" class="form-control"></select></div>
                    }
                    else
                    {
                        <div><select asp-for="@Model.Category" asp-items="@Model.CategoryOptions()" placeholder="All categories" class="form-control"></select></div>
                    }
                </div>
                <div class="grid-25 tablet-grid-100 mobile-grid-100" class="form-field">
                    <div class="invisible hide-on-tablet hide-on-mobile"><label>Hide me</label></div>
                    <div class="button-container"><stock-button class="button-outline-white-transparent">Find what's on</stock-button></div>
                </div>
            </div>
            @if (Model.FromSearch)
            {
            <div class="hide-on-tablet hide-on-desktop mobile-grid-100">
                <div class="edit-search">
                    <a href="javascript:toggleSearch();" id="edit-search-link" class="open">Edit search</a>
                </div> 
            </div>
            }
        </div>
    </div>
</form>

<script type="text/javascript">

    function toggleSearch() {
        var container = $('.form-section', '#events-filter-bar');
        var button = $('#edit-search-link');

        if ($(button).hasClass('open')) {
            $(button).removeClass('open');
            $(container).removeClass('closed');
        } else {
            $(button).addClass('open');
            $(container).addClass('closed');
        }
    }

</script>
{'fraction_non_alphanumeric': 0.1664917803427772, 'fraction_numerical': 0.015273405619680542, 'mean_word_length': 2.226024821361414, 'pattern_counts': {'":': 0, '<': 153, '<?xml version=': 0, '>': 153, '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': '3438869', 'n_tokens_mistral': 2558, 'n_tokens_neox': 2379, 'n_words': 425}