Skip to content

Commit

Permalink
Add setting Show Blog Posts in Search Autocomplete results
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykPorabik committed Oct 28, 2020
1 parent 9423bd6 commit d0e78dc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
6 changes: 6 additions & 0 deletions Grand.Web/App_Data/Localization/defaultResources.grandres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6204,6 +6204,12 @@
<LocaleResource Name="Admin.Configuration.Settings.Blog.ShowBlogOnHomePage.Hint">
<Value>Check to display your blog posts on your store home page.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Blog.ShowBlogPostsInSearchAutoComplete">
<Value>Show blog posts in search autocomplete</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Blog.ShowBlogPostsInSearchAutoComplete.Hint">
<Value>Check this box if you want to show blog posts in search autocomplete</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Blog.ShowHeaderRSSUrl">
<Value>Display blog RSS feed link in the browser address bar</Value>
</LocaleResource>
Expand Down
2 changes: 2 additions & 0 deletions Grand.Web/Areas/Admin/Controllers/SettingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public async Task<IActionResult> Blog()
model.ShowBlogOnHomePage_OverrideForStore = _settingService.SettingExists(blogSettings, x => x.ShowBlogOnHomePage, storeScope);
model.HomePageBlogCount_OverrideForStore = _settingService.SettingExists(blogSettings, x => x.HomePageBlogCount, storeScope);
model.MaxTextSizeHomePage_OverrideForStore = _settingService.SettingExists(blogSettings, x => x.MaxTextSizeHomePage, storeScope);
model.ShowBlogPostsInSearchAutoComplete_OverrideForStore = _settingService.SettingExists(blogSettings, x => x.ShowBlogPostsInSearchAutoComplete, storeScope);
}

return View(model);
Expand All @@ -219,6 +220,7 @@ public async Task<IActionResult> Blog(BlogSettingsModel model)
await UpdateOverrideForStore(storeScope, model.ShowBlogOnHomePage_OverrideForStore, blogSettings, x => x.ShowBlogOnHomePage);
await UpdateOverrideForStore(storeScope, model.HomePageBlogCount_OverrideForStore, blogSettings, x => x.HomePageBlogCount);
await UpdateOverrideForStore(storeScope, model.MaxTextSizeHomePage_OverrideForStore, blogSettings, x => x.MaxTextSizeHomePage);
await UpdateOverrideForStore(storeScope, model.ShowBlogPostsInSearchAutoComplete_OverrideForStore, blogSettings, x => x.ShowBlogPostsInSearchAutoComplete);

//now clear cache
await ClearCache();
Expand Down
4 changes: 4 additions & 0 deletions Grand.Web/Areas/Admin/Models/Settings/BlogSettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@ public partial class BlogSettingsModel : BaseModel
[GrandResourceDisplayName("Admin.Configuration.Settings.Blog.MaxTextSizeHomePage")]
public int MaxTextSizeHomePage { get; set; }
public bool MaxTextSizeHomePage_OverrideForStore { get; set; }

[GrandResourceDisplayName("Admin.Configuration.Settings.Blog.ShowBlogPostsInSearchAutoComplete")]
public bool ShowBlogPostsInSearchAutoComplete { get; set; }
public bool ShowBlogPostsInSearchAutoComplete_OverrideForStore { get; set; }
}
}
23 changes: 18 additions & 5 deletions Grand.Web/Areas/Admin/Views/Setting/Blog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="Enabled" />
<div class="control__indicator"></div>
<div class="control__indicator"></div>
</label>
<span asp-validation-for="Enabled"></span>
</div>
Expand All @@ -63,7 +63,7 @@
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="AllowNotRegisteredUsersToLeaveComments" />
<div class="control__indicator"></div>
<div class="control__indicator"></div>
</label>
<span asp-validation-for="AllowNotRegisteredUsersToLeaveComments"></span>
</div>
Expand All @@ -76,7 +76,7 @@
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="NotifyAboutNewBlogComments" />
<div class="control__indicator"></div>
<div class="control__indicator"></div>
</label>
<span asp-validation-for="NotifyAboutNewBlogComments"></span>
</div>
Expand All @@ -99,7 +99,7 @@
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="ShowHeaderRssUrl" />
<div class="control__indicator"></div>
<div class="control__indicator"></div>
</label>
<span asp-validation-for="ShowHeaderRssUrl"></span>
</div>
Expand All @@ -112,7 +112,7 @@
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="ShowBlogOnHomePage" />
<div class="control__indicator"></div>
<div class="control__indicator"></div>
</label>
<span asp-validation-for="ShowBlogOnHomePage"></span>
</div>
Expand All @@ -137,6 +137,19 @@
<span asp-validation-for="MaxTextSizeHomePage"></span>
</div>
</div>
<div class="form-group">
<div class="col-8 col-md-4 col-sm-4 text-right">
@Html.OverrideStoreCheckboxFor(model => model.ShowBlogPostsInSearchAutoComplete_OverrideForStore, model => model.ShowBlogPostsInSearchAutoComplete, Model.ActiveStoreScopeConfiguration)
<admin-label asp-for="ShowBlogPostsInSearchAutoComplete" class="control-label" />
</div>
<div class="col-4 col-md-8 col-sm-8">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox">
<admin-input asp-for="ShowBlogPostsInSearchAutoComplete" />
<div class="control__indicator"></div>
</label>
<span asp-validation-for="ShowBlogPostsInSearchAutoComplete"></span>
</div>
</div>
</div>
</div>
<vc:admin-widget widget-zone="blog_settings_bottom" additional-data="null" />
Expand Down

0 comments on commit d0e78dc

Please sign in to comment.