Skip to content

Commit

Permalink
Update to version 1.3.0:
Browse files Browse the repository at this point in the history
 - Fixed pagination for slide widget zones;
 - fixed table names;
  • Loading branch information
iAlexeyProkhorov committed Feb 24, 2021
1 parent c967197 commit 6944578
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 70 deletions.
5 changes: 4 additions & 1 deletion Content/localization.en-US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<LocaleResource Name="Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.DontForgetToClearSiteCacheToSeeYourSliderChanges">
<Value>ATTENTION! Static cache is switched on. Clear nopCommerce cache to see applied changes.</Value>
</LocaleResource>
<LocaleResource Name="Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.ClearNopCommerceWidgetZoneAfterNewWidgetZoneCreation">
<Value>ATTENTION! Clear nopCommerce cache after new widget zone creation. New widget zone willn't displays without this step.</Value>
</LocaleResource>
<!--CONFIGURATION-->
<LocaleResource Name="Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.Configuration.UseStaticCache">
<Value>Use static cache</Value>
Expand Down Expand Up @@ -356,7 +359,7 @@
<Value>Add widget zone to slide</Value>
</LocaleResource>
<LocaleResource Name="nop.plugin.baroque.widgets.qboslide.admin.slide.youcanaddwidgetzonestothisslideaftersaving">
<Value>You can't add widget zones to slide before saving. Save slide at first and then add widget zones to it.</Value>
<Value>You can't add slide to widget zone before save. Save slide at first and then add it to widget zone.</Value>
</LocaleResource>
<!--ADMIN SLIDE LIST-->
<LocaleResource Name="nop.plugin.baroque.widgets.qboslider.admin.slide.list">
Expand Down
9 changes: 2 additions & 7 deletions Controllers/qBoSlideController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ protected virtual void UpdateStoreMapping(Slide slide, SlideModel model)

protected virtual void SaveCustomerRolesAcl(Slide slide, SlideModel model)
{
slide.SubjectToAcl = model.SelectedCustomerRoleIds.Any();

var existingAclRecords = _aclService.GetAclRecords(slide);
var allCustomerRoles = _customerService.GetAllCustomerRoles(true);
foreach (var customerRole in allCustomerRoles)
Expand Down Expand Up @@ -256,8 +254,7 @@ public virtual IActionResult Create(SlideModel model, bool continueEditing)
EndDateUtc = model.EndDateUtc,
Published = model.Published,
LimitedToStores = model.SelectedStoreIds.Any(),
//1.0.5 all with Alc
SubjectToAcl = model.SelectedCustomerRoleIds.Count > 0
SubjectToAcl = model.SelectedCustomerRoleIds.Any()
};
_slideService.InsertSlide(slide);

Expand Down Expand Up @@ -333,9 +330,7 @@ public virtual IActionResult Edit(SlideModel model, bool continueEditing)
slide.EndDateUtc = model.EndDateUtc;
slide.Published = model.Published;
slide.LimitedToStores = model.SelectedStoreIds.Any();

//1.0.5 all with Alc
slide.SubjectToAcl = model.SelectedCustomerRoleIds.Count > 0;
slide.SubjectToAcl = model.SelectedCustomerRoleIds.Any();

_slideService.UpdateSlide(slide);

Expand Down
14 changes: 4 additions & 10 deletions Controllers/qBoWidgetZoneController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ public qBoWidgetZoneController(IAclService aclService,
/// <param name="widgetZone">Widget zone entity</param>
protected virtual void SaveWidgetZoneAcl(WidgetZoneModel model, WidgetZone widgetZone)
{
//mark entity like subject to ACL
widgetZone.SubjectToAcl = model.SelectedCustomerRoleIds.Any();
_widgetZoneService.UpdateWidgetZone(widgetZone);

var existingAclRecords = _aclService.GetAclRecords(widgetZone);
var allCustomerRoles = _customerService.GetAllCustomerRoles(true);

Expand Down Expand Up @@ -134,10 +130,6 @@ protected virtual void SaveWidgetZoneAcl(WidgetZoneModel model, WidgetZone widge
/// <param name="widgetZone">Widget zone entity</param>
protected virtual void SaveWidgetZoneStoreMappings(WidgetZoneModel model, WidgetZone widgetZone)
{
//mark entity like limited to stores
widgetZone.LimitedToStores = model.SelectedStoreIds.Any();
_widgetZoneService.UpdateWidgetZone(widgetZone);

var existingStoreMappings = _storeMappingService.GetStoreMappings(widgetZone);
var allStores = _storeService.GetAllStores();

Expand Down Expand Up @@ -242,8 +234,8 @@ public virtual IActionResult Create(WidgetZoneModel model, bool continueEditing)
//put widget zone properties
Name = model.Name,
SystemName = model.SystemName,
LimitedToStores = model.LimitedToStores,
SubjectToAcl = model.SubjectToAcl,
LimitedToStores = model.SelectedStoreIds.Any(),
SubjectToAcl = model.SelectedCustomerRoleIds.Any(),
Published = model.Published,
};

Expand Down Expand Up @@ -328,6 +320,8 @@ public virtual IActionResult Edit(WidgetZoneModel model, bool continueEditing)
widgetZone.MaxSlideWidgetZoneWidth = model.MaxSlideWidgetZoneWidth;
widgetZone.SlideDuration = model.SlideDuration;
widgetZone.SlideSpacing = model.SlideSpacing;
widgetZone.SubjectToAcl = model.SelectedCustomerRoleIds.Any();
widgetZone.LimitedToStores = model.SelectedStoreIds.Any();

//update entity
_widgetZoneService.UpdateWidgetZone(widgetZone);
Expand Down
2 changes: 1 addition & 1 deletion Domain/Slide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class Slide : BaseEntity, ILocalizedEntity, IStoreMappingSupporte
{
/// <summary>
/// Gets or sets slide name.
/// Using only for administrator needs
/// Use only for administrator needs
/// </summary>
public string Name { get; set; }

Expand Down
23 changes: 5 additions & 18 deletions Domain/WidgetZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class WidgetZone : BaseEntity, IAclSupported, IStoreMappingSupported
/// </summary>
public string SystemName { get; set; }

/// <summary>
/// Gets or sets widget zone slides transition effects collection
/// </summary>
public string TransitionEffects { get; set; }

/// <summary>
/// Gets or sets interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
/// </summary>
Expand Down Expand Up @@ -73,29 +78,11 @@ public class WidgetZone : BaseEntity, IAclSupported, IStoreMappingSupported
/// </summary>
public int ArrowNavigationDisplayingTypeId { get; set; }

/// <summary>
/// Gets or sets arrow navigation displaying type
/// </summary>
//public NavigationType ArrowNavigationDisplayingType
//{
// get { return (NavigationType)ArrowNavigationDisplayingTypeId; }
// set { ArrowNavigationDisplayingTypeId = (int)value; }
//}

/// <summary>
/// Gets or sets bullet navigation displaying type id
/// </summary>
public int BulletNavigationDisplayingTypeId { get; set; }

/// <summary>
/// Gets or sets bullet navigation displaying type
/// </summary>
//public NavigationType BulletNavigationDisplayingType
//{
// get { return (NavigationType)BulletNavigationDisplayingTypeId; }
// set { BulletNavigationDisplayingTypeId = (int)value; }
//}

/// <summary>
/// Gets or sets slide displaying for current widget zone. 'true' - display slider.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Factories/Admin/SlideWidgetZoneModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public virtual SlideWidgetZoneSearchModel.WidgetZonePagedList PrepareWidgetZoneL
/// <returns>Slide widget zone list</returns>
public virtual AddSlideWidgetZoneModel.WidgetZonePagedList PrepareWidgetZoneList(AddSlideWidgetZoneModel searchModel)
{
var allWidgetZones = _widgetZoneService.GetWidgetZones(searchModel.SearchWidgetZoneName, searchModel.SearchWidgetZoneSystemName);
var allWidgetZones = _widgetZoneService.GetWidgetZones(searchModel.SearchWidgetZoneName, searchModel.SearchWidgetZoneSystemName, true, searchModel.Page - 1, searchModel.PageSize);
var gridModel = new AddSlideWidgetZoneModel.WidgetZonePagedList().PrepareToGrid(searchModel, allWidgetZones, () =>
{
return allWidgetZones.Select(widgetZone =>
Expand Down
2 changes: 0 additions & 2 deletions Factories/Admin/WidgetZoneModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public virtual WidgetZoneModel PrepareWidgetZoneModel(WidgetZoneModel model, Wid
AutoPlayInterval = widgetZone.AutoPlayInterval,
BulletNavigationDisplayingTypeId = widgetZone.BulletNavigationDisplayingTypeId,
AvailableBulletNavigations = NavigationType.Always.ToSelectList().ToList(),
LimitedToStores = widgetZone.LimitedToStores,
Id = widgetZone.Id,
MinDragOffsetToSlide = widgetZone.MinDragOffsetToSlide,
MinSlideWidgetZoneWidth = widgetZone.MinSlideWidgetZoneWidth,
Expand All @@ -121,7 +120,6 @@ public virtual WidgetZoneModel PrepareWidgetZoneModel(WidgetZoneModel model, Wid
Published = widgetZone.Published,
SlideDuration = widgetZone.SlideDuration,
SlideSpacing = widgetZone.SlideSpacing,
SubjectToAcl = widgetZone.SubjectToAcl,
SystemName = widgetZone.SystemName,
};

Expand Down
4 changes: 2 additions & 2 deletions Mapping/qBoSliderNamesCompatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public class qBoSliderNamesCompatibility : INameCompatibility
/// <summary>
/// Gets table name for mapping with the type
/// </summary>
public Dictionary<Type, string> TableNames { get; } = new Dictionary<Type, string>()
public Dictionary<Type, string> TableNames => new Dictionary<Type, string>()
{
{ typeof(WidgetZone), "Baroque_qBoSlider_WidgetZone" },
{ typeof(Slide), "Baroque_qBoSlider_Slide" },
{ typeof(WidgetZoneSlide), "Baroque_qBoSlider_WidgetZoneSlide" }
{ typeof(WidgetZoneSlide), "Baroque_qBoSlider_WidgetZone_Slide_Mapping" }
};

/// <summary>
Expand Down
10 changes: 0 additions & 10 deletions Models/Admin/WidgetZones/WidgetZoneModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ public partial class WidgetZoneModel : BaseNopEntityModel
[NopResourceDisplayName("Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.WidgetZone.Fields.Published")]
public bool Published { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the entity is subject to ACL
/// </summary>
public bool SubjectToAcl { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the entity is limited/restricted to certain stores
/// </summary>
public bool LimitedToStores { get; set; }

/// <summary>
/// Gets or sets selected customer role ids
/// </summary>
Expand Down
3 changes: 1 addition & 2 deletions Nop.Plugin.Widgets.qBoSlider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl>https://github.com/iAlexeyProkhorov/qBoSlider</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<Version>1.2.8</Version>
<Version>1.3.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -33,7 +33,6 @@
<Compile Remove="Infrastructure\EfStartUpTask.cs" />
<Compile Remove="Infrastructure\qBoSliderContext.cs" />
<Compile Remove="Infrastructure\RouteProvider.cs" />
<Compile Remove="Mapping\qBoSliderNamesCompatibility.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions Views/Admin/WidgetZone/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,11 @@
@await Component.InvokeAsync("AdminWidget", new { widgetZone = "qBo_slider_widget_create_buttons" })
</div>
</div>
<div class="content-header clearfix">
<div class="ui-state-highlight ui-corner-all" style="margin-top:0;padding:10px">
<span class="ui-icon ui-icon-info" style="float:left;margin-right:.3em"></span>
@T("Nop.Plugin.Baroque.Widgets.qBoSlider.Admin.ClearNopCommerceWidgetZoneAfterNewWidgetZoneCreation")
</div>
</div>
@await Html.PartialAsync("~/Plugins/Widgets.qBoSlider/Views/Admin/WidgetZone/_CreateOrUpdate.cshtml", Model)
</form>
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Group": "Widgets",
"FriendlyName": "qBoSlider",
"SystemName": "Widgets.qBoSlider",
"Version": "1.2.8",
"Version": "1.3.0",
"SupportedVersions": [ "4.30" ],
"Author": "Baroque team",
"DisplayOrder": 1,
Expand Down
15 changes: 0 additions & 15 deletions qBoSliderSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,5 @@ public class qBoSliderSettings : ISettings
/// Gets or sets value indicating plugin static cache usage
/// </summary>
public bool UseStaticCache { get; set; }

/// <summary>
/// Gets or sets value indicating static cache clearing after saving widget zone parameters.
/// </summary>
public bool ClearCacheAfterWidgetZoneChanging { get; set; }

/// <summary>
/// Gets or sets value indicating about static cache clearing after slide saving.
/// </summary>
public bool ClearCacheAfterSlideChanging { get; set; }

/// <summary>
/// Gets or sets value indicating about static cache clearing after widget zone slide saving.
/// </summary>
public bool ClearCacheAfterWidgetZoneSlideChanging { get; set; }
}
}

0 comments on commit 6944578

Please sign in to comment.