SearchAnalyticsFilter

From $1

    Table of contents
    No headers
    /**
     * Search Analytics Filter
     */
    var uri = $uri;
    var preserve = $params;
    var searchQuery = $query;
    var searchTerm = $term;
    var sinceDays = $since;
    var beforeDays = $before;
    
    // 1 week ago, 30 days ago, 90 days ago, 1 year ago
    var dateOptions = [
        {value: 7, label: wiki.localize("MindTouch.SearchAnalytics.option.weekago")},
        {value: 30, label: wiki.localize("MindTouch.SearchAnalytics.option.daysago-30")},
        {value: 90, label: wiki.localize("MindTouch.SearchAnalytics.option.daysago-90")},
        {value: 365, label: wiki.localize("MindTouch.SearchAnalytics.option.yearago")}
    ];
    
    <form class="mt-search-input" method="get" action=(uri)>
        foreach (var paramName:paramValue in preserve where paramName != "term") {
            <input type="hidden" name=(paramName) value=(paramValue) />
        }
        if (searchQuery) {
            <input type="hidden" name="query" value=(searchQuery) />
    
            // user is on the detailed view, provide a back link
            <span class="back">
                <a href=(uri & preserve & {term: searchTerm})>
                    wiki.localize("MindTouch.SearchAnalytics.detail.back");
                </a>
            </span>
        } else {
            <input class="term" type="hidden" name="term" value=(searchTerm) />    
        }
        <label>wiki.localize("MindTouch.SearchAnalytics.search.filter-queries")</label>
        <select name="since_days">
            foreach (var option in dateOptions) {
                <option value=(option.value) selected=(sinceDays == option.value ? "selected" : _)>
                   option.label;
                </option>
            }
        </select>
        <span class="mt-report-search-to">
            wiki.localize("MindTouch.SearchAnalytics.search.to");
        </span>
        <select name="before_days">
            <option value="0" selected=(beforeDays == 0 ? "selected" : _)>
                wiki.localize("MindTouch.SearchAnalytics.option.today");
            </option>
            foreach (var option in dateOptions) {
                <option value=(option.value) selected=(beforeDays == option.value ? "selected" : _)>
                   option.label;
                </option>
            }
        </select>
        <input class="search" type="submit" value=(wiki.localize("MindTouch.SearchAnalytics.search.button")) />
    </form>
    
    // clear current search
    if (searchTerm || searchQuery) {
        <div class="reset-search">
            <a href=(uri & preserve & {since_weeks: nil, before_weeks: nil})>
                wiki.localize("MindTouch.SearchAnalytics.search.reset");
            </a>
        </div>
    }
    Tags: (Edit tags)
    • No tags
     
    Comments (0)
    You must login to post a comment.

     
    Powered by MindTouch Core

    Disclaimer: Vespa Labs contains information that is VERY likely to wreck your scooter and possibly yourself both intentionally (i.e. gaining more peformance while sacrificing reliability + safety) and unintentionally (i.e. misleading or incorrect information). Vespa Labs is only a wiki and intended as a dumping ground for information and not as a properly reviewed source. The same disclaimers that wikipedia.org use apply to Vespa Labs. The short version is use information at your own risk, both information on the main wiki and in the user areas are intended to be used only as "thought provoking" for someone that knows what they are doing. If you try to implement a "thought" Vespa Labs is not reponsible and if something goes wrong we hope that you live and update the offending information with corrections to warn others.

    Vespa Labs is an international site and therefore may contain information that is not road legal in some countries/states and may also invalidate insurance policies. Treat all information as experimental and for "race use only" (i.e. not for road use - even if it is implied or explicitly stated). Refer to and adhere to your local road and legal rules, as well as the manufacturers recommendations.