-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from iAlexeyProkhorov/qBo_for_nopCommerce_4.50.2
Q bo for nop commerce 4.50.2
- Loading branch information
Showing
24 changed files
with
550 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//Copyright 2020 Alexey Prokhorov | ||
|
||
//Licensed under the Apache License, Version 2.0 (the "License"); | ||
//you may not use this file except in compliance with the License. | ||
//You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
//Unless required by applicable law or agreed to in writing, software | ||
//distributed under the License is distributed on an "AS IS" BASIS, | ||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
//See the License for the specific language governing permissions and | ||
//limitations under the License. | ||
|
||
using Nop.Plugin.Widgets.qBoSlider.Models.Admin; | ||
using Nop.Web.Framework.Models; | ||
using System.Threading.Tasks; | ||
|
||
namespace Nop.Plugin.Widgets.qBoSlider.Factories.Admin | ||
{ | ||
/// <summary> | ||
/// Represents search model factory interface. | ||
/// Stores methods which prepares common search box properties | ||
/// </summary> | ||
public interface ISearchModelFactory | ||
{ | ||
/// <summary> | ||
/// Prepares slide search box model | ||
/// </summary> | ||
/// <typeparam name="TModel">Slide search model</typeparam> | ||
/// <param name="searchModel">Search box model instance</param> | ||
/// <returns>Model instance</returns> | ||
Task PrepareSlideSearchModelAsync<TModel>(TModel searchModel) where TModel : BaseSearchModel, ISlideSearchModel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
//Copyright 2020 Alexey Prokhorov | ||
|
||
//Licensed under the Apache License, Version 2.0 (the "License"); | ||
//you may not use this file except in compliance with the License. | ||
//You may obtain a copy of the License at | ||
|
||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
//Unless required by applicable law or agreed to in writing, software | ||
//distributed under the License is distributed on an "AS IS" BASIS, | ||
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
//See the License for the specific language governing permissions and | ||
//limitations under the License. | ||
|
||
using Microsoft.AspNetCore.Mvc.Rendering; | ||
using Nop.Plugin.Widgets.qBoSlider.Models.Admin; | ||
using Nop.Plugin.Widgets.qBoSlider.Service; | ||
using Nop.Services; | ||
using Nop.Services.Localization; | ||
using Nop.Web.Framework.Models; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Nop.Plugin.Widgets.qBoSlider.Factories.Admin | ||
{ | ||
/// <summary> | ||
/// Represents search boxes model factory | ||
/// </summary> | ||
public class SearchModelFactory : ISearchModelFactory | ||
{ | ||
#region Fields | ||
|
||
private readonly ILocalizationService _localizationService; | ||
private readonly IWidgetZoneService _widgetZoneService; | ||
|
||
#endregion | ||
|
||
#region Constructor | ||
|
||
public SearchModelFactory( | ||
ILocalizationService localizationService, | ||
IWidgetZoneService widgetZoneService) | ||
{ | ||
_localizationService = localizationService; | ||
_widgetZoneService = widgetZoneService; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Prepares slide search model | ||
/// </summary> | ||
/// <param name="model">Slide search model</param> | ||
/// <returns>Slide search model</returns> | ||
public virtual async Task PrepareSlideSearchModelAsync<TModel>(TModel model) where TModel : BaseSearchModel, ISlideSearchModel | ||
{ | ||
model.AvailableWidgetZones = _widgetZoneService.GetWidgetZones().Select(x => | ||
{ | ||
return new SelectListItem() | ||
{ | ||
Value = x.Id.ToString(), | ||
Text = $"{x.Name} ({x.SystemName})" | ||
}; | ||
}).ToList(); | ||
model.AvailablePublicationStates = (await PublicationState.All.ToSelectListAsync(useLocalization: true)).ToList(); | ||
model.SetGridPageSize(); | ||
model.AvailableWidgetZones.Insert(0, | ||
new SelectListItem() | ||
{ | ||
Value = "0", | ||
Text = await _localizationService.GetResourceAsync("admin.common.all") | ||
}); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.