Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
@model HawksearchWidgets.Mvc.ViewModels.HawksearchBox.SearchBoxViewModel
@using Telerik.Sitefinity.Frontend.Mvc.Helpers;
@using Telerik.Sitefinity.Modules.Pages
@using Telerik.Sitefinity.Services
@using Newtonsoft.Json

@if (Model.Version !== "V2L" || Model.Version == "V3L" || Model.Version == "V4V4L")
{
    <div class="site-search">
        <input type="hidden" value="@Model.Index">
        <input type="hidden" value="@Model.ResultsUrl" data-search-page="@Model.ResultsUrl">

        <div>
            <input class="site-search-input" placeholder="@Html.HtmlSanitize(Html.Resource("ImLookingFor", "HawkWidgetsResources"))" type="text" id="txtSiteSearch">
            <button class="site-search-btn" id="btnSiteSearch">
                <span class="visually-hidden">@Html.HtmlSanitize(Html.Resource("SubmitButtonText"))</span>
                <svg class="icon icon-search-01">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-search-01"></use>
                </svg>
            </button>
        </div>
    </div>

    //string hawkCssUrl = Hawksearch.Helpers.HawksearchApiHelper.GetHawksearchUrl().Replace("http://", "https://") + "/includes/hawksearch.css";
    @*@Html.StyleSheet(hawkCssUrl, "head", false)*@
    @Html.Script(ScriptRef.JQuery, "top", false)

    if (!SystemManager.IsDesignMode)
    {
	        @Html.Script(Url.WidgetContent("Mvc/Scripts/polyfills.js"), "top", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearch-init.js"), "head", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearch.js"), "head", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearch-autosuggest.js"), "bottom", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearchbox.js"), "bottom", false)
    }
}
else {
    // React template

    if (!SystemManager.IsDesignMode)
{
    // ***** {Start React template *******

    @Html.Script(Url.WidgetContent("assets/build/js/vendor.bundle.js"), "bottom", false)
        @Html.Script(Url.WidgetContent("assets/build/js/main.js"), "bottom", false)

    <div    @Html.StyleSheet(Url.WidgetContent("assets/build/css/vendor.css"), "head")data-component="react-search-box"
         data-client-guid="@Model.ClientId"
         @Html.StyleSheet(Url.WidgetContent("assets/build/css/main.css"), "head")data-hawksearch-tracking-api="@Model.TrackingUrl"
         @Html.StyleSheet(Url.WidgetContent("assets/dist/react-hawksearch.css"), "head")data-hawksearch-base-api="@Model.HawksearchBaseAPI"
         @Html.StyleSheet(Url.WidgetContent("assets/dist/reactdata-hawksearch-override.css"), "head")
    }-search-api="@Model.HawksearchSearchingAPI"
        <div data-hawksearch-autocomplete-componentapi="react-search-box-bootstrap@Model.AutocompleteUrl"
         data-clienttracking-guidevents="@Model.ClientIdTrackingEvents"
         data-hawksearchjson-tracking-apiparams="@Model.TrackingUrlData"
         data-hawksearchsearch-base-apipage="@Model.HawksearchBaseAPIResultsUrl"
         data-hawksearchindex-search-apiname="@Model.HawksearchSearchingAPIIndex"
         data-hawksearchcurrent-autocomplete-apiculture="@Model.AutocompleteUrlCurrentCulture">
    </div>

    <script data-json-params="@Model.Data"translations="react-translations" type="application/json">
         data-search-page="@Model.ResultsUrl"{
        "Narrow  data-index-name="@Model.Index"
Results": "@Html.HtmlSanitize(Html.Resource("NarrowResults", "HawkWidgetsResources"))",
        data-current-culture="@Model.CurrentCulture">
    </div>

    <script data-translations="react-translations" type="application/json">
        {
        "Narrow "Search Results": "@Html.HtmlSanitize(Html.Resource("NarrowResultsSearchResults", "HawkWidgetsResources"))",
        "Search Results for": "@Html.HtmlSanitize(Html.Resource("SearchResultsSearchResultsFor", "HawkWidgetsResources"))",
        "SearchSort Results forBy": "@Html.HtmlSanitize(Html.Resource("SearchResultsForSortBy", "HawkWidgetsResources"))",
        "SortEnter By": "@Html.HtmlSanitize(Html.Resource("SortBy", "HawkWidgetsResources"))",
        "Enter a search a search term": "@Html.HtmlSanitize(Html.Resource("EnterKeyword", "HawkWidgetsResources"))",
        "Quick Lookup": "@Html.HtmlSanitize(Html.Resource("QuickLookup", "HawkWidgetsResources"))",
        "Clear All": "@Html.HtmlSanitize(Html.Resource("ClearAll", "HawkWidgetsResources"))",
        "Clear": "@Html.HtmlSanitize(Html.Resource("Clear", "HawkWidgetsResources"))",
        "No Results": "@Html.HtmlSanitize(Html.Resource("NoResults", "HawkWidgetsResources"))",
        "Loading": "@Html.HtmlSanitize(Html.Resource("Loading", "HawkWidgetsResources"))",
        "You've Selected": "@Html.HtmlSanitize(Html.Resource("YouSelected", "HawkWidgetsResources"))"
        }
    </script>

    // ***** End React template *******

    // ***** Start Vue template **********************************************************

    // Vue template

        @* @Html.Script(Url.WidgetContent("assets/build/

    @*@Html.Script(Url.WidgetContent("assets/build/js/vendor.bundle.js"), "bottom", false)
        @Html.Script(Url.WidgetContent("assets/build/js/main.js"), "bottom", false)


         @Html.StyleSheet(Url.WidgetContent("assets/build/css/vendor.css"), "head")<div data-component="vue-app-searchbox"
         @Html.StyleSheet(Url.WidgetContent("assets/build/css/main.css"), "head")    data-client-guid="@Model.ClientId"
    @Html.StyleSheet(Url.WidgetContent("assets/dist/vue-hawksearch.css"), "head")         @Html.StyleSheet(Url.WidgetContent("assets/dist/vue-hawksearch-override.css"), "head")data-hawksearch-tracking-api="@Model.TrackingUrl"
            <div data-hawksearch-base-componentapi="vue-app-searchbox@Model.HawksearchBaseAPI"
             data-hawksearch-clientsearch-guidapi="@Model.ClientIdHawksearchSearchingAPI"
             data-hawksearch-trackingautocomplete-api="@Model.TrackingUrlAutocompleteUrl"
             data-hawksearchtracking-base-apievents="@Model.HawksearchBaseAPITrackingEvents"
             data-hawksearch-search-apipage="@Model.HawksearchSearchingAPIResultsUrl"
             data-hawksearchshow-autocomplete-apisearchbox="@Model.AutocompleteUrlTrue"
             data-searchjson-pageparams="@Model.ResultsUrlData"
             data-show-searchbox="True"
             data-json-params="@Model.Data"
             data-index-name="@Model.Index"
             data-current-culture="@Model.CurrentCulture">

            <div class="hawk">
                <div class="hawk__header">
                    <div data-component="hawksearch-field">
                        <search-box search-page="@Model.ResultsUrl"></search-box>
                    </div>
                </div>
            </div>
        </div>

        <script data-translations="vue-translations" type="application/json">
            {
            "Narrow Results": "@Html.HtmlSanitize(Html.Resource("NarrowResults", "HawkWidgetsResources"))",
            "Search Results": "@Html.HtmlSanitize(Html.Resource("SearchResults", "HawkWidgetsResources"))",
            "Search Results for": "@Html.HtmlSanitize(Html.Resource("SearchResultsFor", "HawkWidgetsResources"))",
            "Sort By": "@Html.HtmlSanitize(Html.Resource("SortBy", "HawkWidgetsResources"))",
            "Enter a search term": "@Html.HtmlSanitize(Html.Resource("EnterKeyword", "HawkWidgetsResources"))",
            "Quick Lookup": "@Html.HtmlSanitize(Html.Resource("QuickLookup", "HawkWidgetsResources"))",
            "Clear All": "@Html.HtmlSanitize(Html.Resource("ClearAll", "HawkWidgetsResources"))",
            "Clear": "@Html.HtmlSanitize(Html.Resource("Clear", "HawkWidgetsResources"))",
            "No Results": "@Html.HtmlSanitize(Html.Resource("NoResults", "HawkWidgetsResources"))",
            "Loading": "@Html.HtmlSanitize(Html.Resource("Loading", "HawkWidgetsResources"))",
            "You've Selected": "@Html.HtmlSanitize(Html.Resource("YouSelected", "HawkWidgetsResources"))",
            "response_error_generic": "An error occurred while searching for your results. Please contact the site administrator."
            }
        </script>*@

    // ***** End Vue template *@*******
}

Hawksearch Results

Code Block
@model HawksearchWidgets.Mvc.ViewModels.Hawksearch.SearchViewModel
@using Telerik.Sitefinity.Frontend.Mvc.Helpers;
@using Telerik.Sitefinity.Services
@using NewtonsoftTelerik.Sitefinity.JsonWeb

@if (Model.Version !== "V4V2L")
 || Model.Version == "V3L" || Model.Version == "V4L")
{
    <div data-role="hawk-results" class="row hs-wrap" style="display: none;">
        <div class="col-md-3 hs-col-3">
            <div id="hawkbannerlefttop"></div>
            <div id="hawkfacets"></div>
            <div id="hawkbannerleftbottom"></div>
            <input type="hidden" name="search-term" value="@Model.Keyword" />
        </div>
        <div role="main" class="col-md-9 hs-col-9" id="main-content">
            <div id="hawktitle"></div>
            <div class="right-bg">
                <div id="hawkbannertop"></div>
                <div id="hawktoptext"></div>
                <div id="hawkrelated"></div>
                <div id="hawktoppager"></div>
                <div id="hawktoptext"></div>

                <div id="hawkitemlist" class="item-list horizontal resource-listing clearfix">
                </div>

                <div id="hawkbottompager"></div>
                <div class="clear">&nbsp;</div>
            </div>
        </div>
    </div>

    if (!SystemManager.IsDesignMode)
    {
        @Html.Script(Url.WidgetContent("Mvc/Scripts/polyfills.js"), "top", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearch-init.js"), "head", false)
        @Html.Script(Url.WidgetContent("Mvc/Scripts/hawksearch.js"), "head", false)
    }
}
else if (!SystemManager.IsDesignMode)
{
    // React template

if (Model.Languages.Length > 1 && Model.IsMultilingualEnabled)
   @*if (!SystemManager.IsDesignMode) {
        {<div>
            @Html<span>@Html.Script(Url.WidgetContent("assets/build/js/vendor.bundle.js"), "bottom", false)Resource("ChangeResultsLanguageLabel", "HawkWidgetsResources") </span>

            @for @Html.Script(Url.WidgetContent("assets/build/js/main.js"), "bottom", false)

   (var i = 0; i < Model.Languages.Length; i++)
        @Html.StyleSheet(Url.WidgetContent("assets/build/css/vendor.css"), "head")   {
         @Html.StyleSheet(Url.WidgetContent("assets/build/css/main.css"), "head")       var language = Model.Languages[i];
     @Html.StyleSheet(Url.WidgetContent("assets/dist/react-hawksearch.css"), "head")          var languageUrl = @Htmlstring.StyleSheet(Url.WidgetContent("assets/dist/react-hawksearch-override.css"), "head")Format("{0}?language={1}", Model.UrlPath, language.Name);

       }         <a <div data-componenthref="react-app-bootstrap"@languageUrl">@language.DisplayName</a>
              data-client-guid="@Model.ClientId"  if (i < Model.Languages.Length - 2)
     data-hawksearch-tracking-api="@Model.TrackingUrl"           {
 data-hawksearch-base-api="@Model.HawksearchBaseAPI"             data-hawksearch-search-api="@Model.HawksearchSearchingAPI"
       <span>, </span>
          data-hawksearch-autocomplete-api="@Model.AutocompleteUrl"      }
      data-tracking-events="@Model.TrackingEvents"          else if  data-index-name="@Model.HawksearchIndexName"(i == Model.Languages.Length - 2)
              data-json-params="@Model.Data"  {
          data-show-searchbox="@Model.ShowSearchBox.ToString()">         </div> <span> @Html.Resource("OrLabel", "HawkWidgetsResources") </span>
     <script data-translations="react-mappings" type="application/json">           }
    {        }
    "Telerik.Sitefinity.Events.Model.Event": "@Html.HtmlSanitize(Html.Resource("EventTypeDisplayName", "HawkWidgetsResources"))",  </div>
    }

    "Telerik.Sitefinity.Libraries.Model.Image": "@Html.HtmlSanitize(Html.Resource("ImageTypeDisplayName", "HawkWidgetsResources"))",
  // ***** Start React template *******

        "Telerik.Sitefinity.Libraries.Model.Video": "@Html.HtmlSanitizeStyleSheet(HtmlUrl.ResourceWidgetContent("VideoTypeDisplayName"assets/dist/react-vanilla.css"), "HawkWidgetsResourceshead"))",
    @Html.Script(Url.WidgetContent("assets/build/js/vendor.bundle.js"), "bottom", false)
     "Telerik.Sitefinity.Libraries.Model.Document": "@Html.HtmlSanitizeScript(HtmlUrl.ResourceWidgetContent("DocumentTypeDisplayName"assets/build/js/main.js"), "HawkWidgetsResourcesbottom"))",, false)

    <div data-component="react-app"
         "Telerik.Sitefinity.News.Model.NewsItem": "@Html.HtmlSanitize(Html.Resource("NewsItemDisplayName", "HawkWidgetsResources"))",data-client-guid="@Model.ClientId"
         data-hawksearch-tracking-api="@Model.TrackingUrl"
    "Telerik.Sitefinity.Blogs.Model.BlogPost": "@Html.HtmlSanitize(Html.Resource("BlogPostDisplayName", "HawkWidgetsResources"))",   data-hawksearch-base-api="@Model.HawksearchBaseAPI"
         "Telerik.Sitefinity.Lists.Model.ListItem": "@Html.HtmlSanitize(Html.Resource("ListItemDisplayName", "HawkWidgetsResources"))",data-hawksearch-search-api="@Model.HawksearchSearchingAPI"
              "Telerik.Sitefinity.Pages.Model.PageNode": "@Html.HtmlSanitize(Html.Resource("PageNodeDisplayName", "HawkWidgetsResources"))"data-hawksearch-autocomplete-api="@Model.AutocompleteUrl"
          data-tracking-events="@Model.TrackingEvents"
 }         </script>data-index-name="@Model.HawksearchIndexName"
          <script data-json-translationsparams="react-translations" type="application/json">@Model.Data"
         data-show-searchbox="@Model.ShowSearchBox.ToString()"
      {   data-current-culture="@Model.CurrentCulture">
    </div>

   "Narrow Results": "@Html.HtmlSanitize(Html.Resource("NarrowResults", "HawkWidgetsResources"))",<script data-translations="react-mappings" type="application/json">
        {
        "Search ResultsTelerik.Sitefinity.Events.Model.Event": "@Html.HtmlSanitize(Html.Resource("SearchResultsEventTypeDisplayName", "HawkWidgetsResources"))",
            "Search Results for"Telerik.Sitefinity.Libraries.Model.Image": "@Html.HtmlSanitize(Html.Resource("SearchResultsForImageTypeDisplayName", "HawkWidgetsResources"))",
   
        "Sort ByTelerik.Sitefinity.Libraries.Model.Video": "@Html.HtmlSanitize(Html.Resource("SortByVideoTypeDisplayName", "HawkWidgetsResources"))",

           "Enter a search term"Telerik.Sitefinity.Libraries.Model.Document": "@Html.HtmlSanitize(Html.Resource("EnterKeywordDocumentTypeDisplayName", "HawkWidgetsResources"))",
 
          "Quick Lookup"Telerik.Sitefinity.News.Model.NewsItem": "@Html.HtmlSanitize(Html.Resource("QuickLookupNewsItemDisplayName", "HawkWidgetsResources"))",
  
         "Clear All"Telerik.Sitefinity.Blogs.Model.BlogPost": "@Html.HtmlSanitize(Html.Resource("ClearAllBlogPostDisplayName", "HawkWidgetsResources"))",
            "Clear"Telerik.Sitefinity.Lists.Model.ListItem": "@Html.HtmlSanitize(Html.Resource("ClearListItemDisplayName", "HawkWidgetsResources"))",
   
        "No ResultsTelerik.Sitefinity.Pages.Model.PageNode": "@Html.HtmlSanitize(Html.Resource("NoResultsPageNodeDisplayName", "HawkWidgetsResources"))",
        }
   "Loading </script>

    <script data-translations="react-translations" type="application/json">
        {
        "Narrow Results": "@Html.HtmlSanitize(Html.Resource("LoadingNarrowResults", "HawkWidgetsResources"))",
  
         "You'veSearch SelectedResults": "@Html.HtmlSanitize(Html.Resource("YouSelectedSearchResults", "HawkWidgetsResources"))",
        "Search    "response_error_genericResults for": "An error occurred while searching for your results. Please contact the site administrator."
  @Html.HtmlSanitize(Html.Resource("SearchResultsFor", "HawkWidgetsResources"))",
        "Sort By": "@Html.HtmlSanitize(Html.Resource("SortBy", "HawkWidgetsResources"))",
        "Enter }a search term": "@Html.HtmlSanitize(Html.Resource("EnterKeyword", "HawkWidgetsResources"))",
    </script>*@    "Quick  // ********************************************************Lookup": "@Html.HtmlSanitize(Html.Resource("QuickLookup", "HawkWidgetsResources"))",
        "Clear All": "@Html.HtmlSanitize(Html.Resource("ClearAll", "HawkWidgetsResources"))",
        "Clear": "@Html.HtmlSanitize(Html.Resource("Clear", "HawkWidgetsResources"))",
        "No Results": "@Html.HtmlSanitize(Html.Resource("NoResults", "HawkWidgetsResources"))",
        "Loading": "@Html.HtmlSanitize(Html.Resource("Loading", "HawkWidgetsResources"))",
        "You've Selected": "@Html.HtmlSanitize(Html.Resource("YouSelected", "HawkWidgetsResources"))",
        "response_error_generic": "An error occurred while searching for your results. Please contact the site administrator."
        }
    </script>

    // ***** End React template *******

    // ***** Start Vue template 
    @Html.Script(Url.WidgetContent("assets/build/js/vendor.bundle.js"), "bottom", false)
    @Html.Script(Url.WidgetContent("assets/build/js/main.js"), "bottom", false)*******


    @* @Html.StyleSheetScript(Url.WidgetContent("assets/build/cssjs/vendor.bundle.cssjs"), "headbottom", false)
    @Html.StyleSheetScript(Url.WidgetContent("assets/build/cssjs/main.cssjs"), "head")
    @Html.StyleSheet(Url.WidgetContent("assets/dist/vue-hawksearch.css"), "head")
    @Html.StyleSheet(Url.WidgetContent("assets/dist/vue-hawksearch-override.css"), "head")
bottom", false)

    <div data-component="vue-app-spa"
            data-client-guid="@Model.ClientId"
            data-hawksearch-tracking-api="@Model.TrackingUrl"
            data-hawksearch-base-api="@Model.HawksearchBaseAPI"
            data-hawksearch-search-api="@Model.HawksearchSearchingAPI"
            data-hawksearch-autocomplete-api="@Model.AutocompleteUrl"
            data-tracking-events="@Model.TrackingEvents"
            data-index-name="@Model.HawksearchIndexName"
            data-json-params="@Model.Data"
         			data-hawksearch-recommendation-api=""
            data-widget-guid=""
            data-show-searchbox="@Model.ShowSearchBox.ToString()"
            data-current-culture="@Model.CurrentCulture">

        <div class="hawk">
            @if (Model.ShowSearchBox)
            {
                <div class="hawk__header">
                    <div data-component="hawksearch-field">
                        <search-box></search-box>
                    </div>
                </div>
            }

            <div class="hawk__body">
                <div data-component="hawksearch-facets">
                    <facet-list></facet-list>
                </div>

                <div data-component="hawksearch-results">
                    <results></results>
                </div>
            </div>
        </div>
    </div>

        <script id="vue-hawksearch-result-item" type="x-template">
            <div class="media-body sf-media-body" v-on:click="onClick">>
                <h3>
                    <template v-if="link">
                        <a :href=link>{{ title }}</a>
                    </template>
                    <template v-else>
                        {{ title }}
                    </template>
                </h3>
                <p>
                    <strong class="sfHighlight">{{ title }}</strong>
                    <span>{{ content }}</span>
                </p>
                <a :href="link">{{ link }}</a>
            </div>
        </script>


    <script data-translations="vue-mappings" type="application/json">
        {
        "Telerik.Sitefinity.Events.Model.Event": "@Html.HtmlSanitize(Html.Resource("EventTypeDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Libraries.Model.Image": "@Html.HtmlSanitize(Html.Resource("ImageTypeDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Libraries.Model.Video": "@Html.HtmlSanitize(Html.Resource("VideoTypeDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Libraries.Model.Document": "@Html.HtmlSanitize(Html.Resource("DocumentTypeDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.News.Model.NewsItem": "@Html.HtmlSanitize(Html.Resource("NewsItemDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Blogs.Model.BlogPost": "@Html.HtmlSanitize(Html.Resource("BlogPostDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Lists.Model.ListItem": "@Html.HtmlSanitize(Html.Resource("ListItemDisplayName", "HawkWidgetsResources"))",
        "Telerik.Sitefinity.Pages.Model.PageNode": "@Html.HtmlSanitize(Html.Resource("PageNodeDisplayName", "HawkWidgetsResources"))"
        }
    </script>

    <script data-translations="vue-translations" type="application/json">
        {
        "Narrow Results": "@Html.HtmlSanitize(Html.Resource("NarrowResults", "HawkWidgetsResources"))",
        "Search Results": "@Html.HtmlSanitize(Html.Resource("SearchResults", "HawkWidgetsResources"))",
        "Search Results for": "@Html.HtmlSanitize(Html.Resource("SearchResultsFor", "HawkWidgetsResources"))",
        "Sort By": "@Html.HtmlSanitize(Html.Resource("SortBy", "HawkWidgetsResources"))",
        "Enter a search term": "@Html.HtmlSanitize(Html.Resource("EnterKeyword", "HawkWidgetsResources"))",
        "Quick Lookup": "@Html.HtmlSanitize(Html.Resource("QuickLookup", "HawkWidgetsResources"))",
        "Clear All": "@Html.HtmlSanitize(Html.Resource("ClearAll", "HawkWidgetsResources"))",
        "Clear": "@Html.HtmlSanitize(Html.Resource("Clear", "HawkWidgetsResources"))",
        "No Results": "@Html.HtmlSanitize(Html.Resource("NoResults", "HawkWidgetsResources"))",
        "Loading": "@Html.HtmlSanitize(Html.Resource("Loading", "HawkWidgetsResources"))",
        "You've Selected": "@Html.HtmlSanitize(Html.Resource("YouSelected", "HawkWidgetsResources"))",
        "response_error_generic": "An error occurred while searching for your results. Please contact the site administrator."
        }
    </script> *@

    // ***** End Vue template *******
}