diff --git a/Oqtane.Client/Themes/Controls/Theme/Search.razor b/Oqtane.Client/Themes/Controls/Theme/Search.razor index 0d8ebb51..b6816a90 100644 --- a/Oqtane.Client/Themes/Controls/Theme/Search.razor +++ b/Oqtane.Client/Themes/Controls/Theme/Search.razor @@ -2,28 +2,39 @@ @using System.Net @using Microsoft.AspNetCore.Http @inherits ThemeControlBase +@inject ISettingService SettingService @inject IStringLocalizer Localizer @inject NavigationManager NavigationManager @if (_searchResultsPage != null) { - + @if (AllowInput) + { + +
+ + + +
+
+ } + else + {
- -
-
+ } } - - @code { private Page _searchResultsPage; private string _keywords = ""; @@ -32,7 +43,10 @@ public string CssClass { get; set; } [Parameter] - public string SearchResultPagePath { get; set; } = "search"; + public bool AllowInput { get; set; } = true; // setting to false will display only the search icon button - not the textbox + + [Parameter] + public string SearchResultPagePath { get; set; } = "search"; // setting to "" will disable search [CascadingParameter] HttpContext HttpContext { get; set; } @@ -42,9 +56,12 @@ protected override void OnInitialized() { - if(!string.IsNullOrEmpty(SearchResultPagePath)) + if (bool.Parse(SettingService.GetSetting(PageState.Site.Settings, "Search_Enabled", "True"))) { - _searchResultsPage = PageState.Pages.FirstOrDefault(i => i.Path == SearchResultPagePath); + if (!string.IsNullOrEmpty(SearchResultPagePath)) + { + _searchResultsPage = PageState.Pages.FirstOrDefault(i => i.Path == SearchResultPagePath); + } } }