-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create for v4.20 and tested on current branch for 4.30
- Loading branch information
1 parent
e726f82
commit af582e7
Showing
41 changed files
with
2,895 additions
and
0 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
Nop.Plugin.Widgets.NivoSlider/Components/WidgetsNivoSliderViewComponent.cs
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,108 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Nop.Core; | ||
using Nop.Core.Caching; | ||
using Nop.Plugin.Widgets.NivoSlider.Infrastructure.Cache; | ||
using Nop.Plugin.Widgets.NivoSlider.Models; | ||
using Nop.Services.Configuration; | ||
using Nop.Services.Localization; | ||
using Nop.Services.Media; | ||
using Nop.Web.Framework.Components; | ||
|
||
namespace Nop.Plugin.Widgets.NivoSlider.Components | ||
{ | ||
[ViewComponent(Name = "WidgetsNivoSlider")] | ||
public class WidgetsNivoSliderViewComponent : NopViewComponent | ||
{ | ||
private readonly IStoreContext _storeContext; | ||
private readonly IStaticCacheManager _cacheManager; | ||
private readonly ISettingService _settingService; | ||
private readonly IPictureService _pictureService; | ||
private readonly IWebHelper _webHelper; | ||
private readonly NivoSliderSettings _nivoSliderSettings; | ||
private readonly IWorkContext _workContext; | ||
private readonly ILocalizationService _localizationService; | ||
|
||
public WidgetsNivoSliderViewComponent(IStoreContext storeContext, | ||
IStaticCacheManager cacheManager, | ||
ISettingService settingService, | ||
IPictureService pictureService, | ||
IWebHelper webHelper, | ||
NivoSliderSettings nivoSliderSettings, | ||
IWorkContext workContext, | ||
ILocalizationService localizationService) | ||
{ | ||
_storeContext = storeContext; | ||
_cacheManager = cacheManager; | ||
_settingService = settingService; | ||
_pictureService = pictureService; | ||
_webHelper = webHelper; | ||
_nivoSliderSettings = nivoSliderSettings; | ||
_workContext = workContext; | ||
_localizationService = localizationService; | ||
} | ||
|
||
public IViewComponentResult Invoke(string widgetZone, object additionalData) | ||
{ | ||
var storeId = _storeContext.CurrentStore.Id; | ||
var languageId = _workContext.WorkingLanguage.Id; | ||
var nivoSliderSettings = _settingService.LoadSetting<NivoSliderSettings>(storeId); | ||
|
||
var picture1Id = nivoSliderSettings.Picture1Id == "" ? 0 : int.Parse(_localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Picture1Id, languageId, storeId, true, true)); | ||
var picture2Id = nivoSliderSettings.Picture2Id == "" ? 0 : int.Parse(_localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Picture2Id, languageId, storeId, true, true)); | ||
var picture3Id = nivoSliderSettings.Picture3Id == "" ? 0 : int.Parse(_localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Picture3Id, languageId, storeId, true, true)); | ||
var picture4Id = nivoSliderSettings.Picture4Id == "" ? 0 : int.Parse(_localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Picture4Id, languageId, storeId, true, true)); | ||
var picture5Id = nivoSliderSettings.Picture5Id == "" ? 0 : int.Parse(_localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Picture5Id, languageId, storeId, true, true)); | ||
|
||
|
||
var model = new PublicInfoModel | ||
{ | ||
Picture1Url = GetPictureUrl(picture1Id), | ||
Text1 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Text1, languageId, storeId, true, true), | ||
Link1 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Link1, languageId, storeId, true, true), | ||
AltText1 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.AltText1, languageId, storeId, true, true), | ||
|
||
Picture2Url = GetPictureUrl(picture2Id), | ||
Text2 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Text2, languageId, storeId, true, true), | ||
Link2 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Link2, languageId, storeId, true, true), | ||
AltText2 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.AltText2, languageId, storeId, true, true), | ||
|
||
Picture3Url = GetPictureUrl(picture3Id), | ||
Text3 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Text3, languageId, storeId, true, true), | ||
Link3 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Link3, languageId, storeId, true, true), | ||
AltText3 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.AltText3, languageId, storeId, true, true), | ||
|
||
Picture4Url = GetPictureUrl(picture4Id), | ||
Text4 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Text4, languageId, storeId, true, true), | ||
Link4 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Link4, languageId, storeId, true, true), | ||
AltText4 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.AltText4, languageId, storeId, true, true), | ||
|
||
Picture5Url = GetPictureUrl(picture5Id), | ||
Text5 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Text5, languageId, storeId, true, true), | ||
Link5 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.Link5, languageId, storeId, true, true), | ||
AltText5 = _localizationService.GetLocalizedSetting(nivoSliderSettings, (NivoSliderSettings x) => x.AltText5, languageId, storeId, true, true), | ||
}; | ||
|
||
if (string.IsNullOrEmpty(model.Picture1Url) && string.IsNullOrEmpty(model.Picture2Url) && | ||
string.IsNullOrEmpty(model.Picture3Url) && string.IsNullOrEmpty(model.Picture4Url) && | ||
string.IsNullOrEmpty(model.Picture5Url)) | ||
//no pictures uploaded | ||
return Content(""); | ||
|
||
return View("~/Plugins/Widgets.NivoSlider/Views/PublicInfo.cshtml", model); | ||
} | ||
|
||
protected string GetPictureUrl(int pictureId) | ||
{ | ||
var cacheKey = string.Format(ModelCacheEventConsumer.PICTURE_URL_MODEL_KEY, | ||
pictureId, _webHelper.IsCurrentConnectionSecured() ? Uri.UriSchemeHttps : Uri.UriSchemeHttp); | ||
|
||
return _cacheManager.Get(cacheKey, () => | ||
{ | ||
//little hack here. nulls aren't cacheable so set it to "" | ||
var url = _pictureService.GetPictureUrl(pictureId, showDefaultPicture: false) ?? ""; | ||
return url; | ||
}); | ||
} | ||
} | ||
} |
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 @@ | ||
Nivo Slider is "The Most Awesome jQuery Image Slider". See http://nivo.dev7studios.com for more info. |
22 changes: 22 additions & 0 deletions
22
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/license.txt
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,22 @@ | ||
Copyright (c) 2010-2012 Dev7studios | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
114 changes: 114 additions & 0 deletions
114
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/nivo-slider.css
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,114 @@ | ||
/* | ||
* jQuery Nivo Slider v3.2 | ||
* http://nivo.dev7studios.com | ||
* | ||
* Copyright 2012, Dev7studios | ||
* Free to use and abuse under the MIT license. | ||
* http://www.opensource.org/licenses/mit-license.php | ||
*/ | ||
|
||
/* The Nivo Slider styles */ | ||
.nivoSlider { | ||
position:relative; | ||
width:100%; | ||
height:auto; | ||
overflow: hidden; | ||
} | ||
.nivoSlider img { | ||
position:absolute; | ||
top:0px; | ||
left:0px; | ||
max-width: none; | ||
} | ||
.nivo-main-image { | ||
display: block !important; | ||
position: relative !important; | ||
width: 100% !important; | ||
height: auto; | ||
} | ||
|
||
/* If an image is wrapped in a link */ | ||
.nivoSlider a.nivo-imageLink { | ||
position:absolute; | ||
top:0px; | ||
left:0px; | ||
width:100%; | ||
height:100%; | ||
border:0; | ||
padding:0; | ||
margin:0; | ||
z-index:6; | ||
display:none; | ||
background:white; | ||
filter:alpha(opacity=0); | ||
opacity:0; | ||
} | ||
/* The slices and boxes in the Slider */ | ||
.nivo-slice { | ||
display:block; | ||
position:absolute; | ||
z-index:5; | ||
height:100%; | ||
top:0; | ||
} | ||
.nivo-box { | ||
display:block; | ||
position:absolute; | ||
z-index:5; | ||
overflow:hidden; | ||
} | ||
.nivo-box img { display:block; } | ||
|
||
/* Caption styles */ | ||
.nivo-caption { | ||
position:absolute; | ||
left:0px; | ||
bottom:0px; | ||
background:#000; | ||
color:#fff; | ||
width:100%; | ||
z-index:8; | ||
padding: 5px 10px; | ||
opacity: 0.8; | ||
overflow: hidden; | ||
display: none; | ||
-moz-opacity: 0.8; | ||
filter:alpha(opacity=8); | ||
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ | ||
-moz-box-sizing: border-box; /* Firefox, other Gecko */ | ||
box-sizing: border-box; /* Opera/IE 8+ */ | ||
} | ||
.nivo-caption p { | ||
padding:5px; | ||
margin:0; | ||
} | ||
.nivo-caption a { | ||
display:inline !important; | ||
} | ||
.nivo-html-caption { | ||
display:none; | ||
} | ||
/* Direction nav styles (e.g. Next & Prev) */ | ||
.nivo-directionNav a { | ||
position:absolute; | ||
top:45%; | ||
z-index:8; | ||
cursor:pointer; | ||
} | ||
.nivo-prevNav { | ||
left:0px; | ||
} | ||
.nivo-nextNav { | ||
right:0px; | ||
} | ||
/* Control nav styles (e.g. 1,2,3...) */ | ||
.nivo-controlNav { | ||
text-align:center; | ||
padding: 15px 0; | ||
} | ||
.nivo-controlNav a { | ||
cursor:pointer; | ||
} | ||
.nivo-controlNav a.active { | ||
font-weight:bold; | ||
} |
Binary file added
BIN
+61.2 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/sample-images/banner1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.5 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/sample-images/banner2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+824 Bytes
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/bar/arrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 132 additions & 0 deletions
132
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/bar/bar.css
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,132 @@ | ||
/* | ||
Skin Name: Nivo Slider Bar Theme | ||
Skin URI: http://nivo.dev7studios.com | ||
Description: The bottom bar skin for the Nivo Slider. | ||
Version: 1.0 | ||
Author: Gilbert Pellegrom | ||
Author URI: http://dev7studios.com | ||
Supports Thumbs: false | ||
*/ | ||
|
||
.theme-bar.slider-wrapper { | ||
position: relative; | ||
border: 1px solid #333; | ||
overflow: hidden; | ||
} | ||
.theme-bar .nivoSlider { | ||
position:relative; | ||
background:#fff url(loading.gif) no-repeat 50% 50%; | ||
} | ||
.theme-bar .nivoSlider img { | ||
position:absolute; | ||
top:0px; | ||
left:0px; | ||
display:none; | ||
} | ||
.theme-bar .nivoSlider a { | ||
border:0; | ||
display:block; | ||
} | ||
|
||
.theme-bar .nivo-controlNav { | ||
position: absolute; | ||
left: 0; | ||
bottom: -41px; | ||
z-index: 10; | ||
width: 100%; | ||
height: 30px; | ||
text-align: center; | ||
padding: 5px 0; | ||
border-top: 1px solid #333; | ||
background: #333; | ||
background: -moz-linear-gradient(top, #565656 0%, #333333 100%); /* FF3.6+ */ | ||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#565656), color-stop(100%,#333333)); /* Chrome,Safari4+ */ | ||
background: -webkit-linear-gradient(top, #565656 0%,#333333 100%); /* Chrome10+,Safari5.1+ */ | ||
background: -o-linear-gradient(top, #565656 0%,#333333 100%); /* Opera 11.10+ */ | ||
background: -ms-linear-gradient(top, #565656 0%,#333333 100%); /* IE10+ */ | ||
background: linear-gradient(to bottom, #565656 0%,#333333 100%); /* W3C */ | ||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#565656', endColorstr='#333333',GradientType=0 ); /* IE6-9 */ | ||
opacity: 0.5; | ||
-webkit-transition: all 200ms ease-in-out; | ||
-moz-transition: all 200ms ease-in-out; | ||
-o-transition: all 200ms ease-in-out; | ||
transition: all 200ms ease-in-out; | ||
} | ||
.theme-bar:hover .nivo-controlNav { | ||
bottom: 0; | ||
opacity: 1; | ||
} | ||
.theme-bar .nivo-controlNav a { | ||
display:inline-block; | ||
width:22px; | ||
height:22px; | ||
background:url(bullets.png) no-repeat; | ||
text-indent:-9999px; | ||
border:0; | ||
margin: 5px 2px 0 2px; | ||
} | ||
.theme-bar .nivo-controlNav a.active { | ||
background-position:0 -22px; | ||
} | ||
|
||
.theme-bar .nivo-directionNav a { | ||
display:block; | ||
border:0; | ||
color: #fff; | ||
text-transform: uppercase; | ||
top: auto; | ||
bottom: 10px; | ||
z-index: 11; | ||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
font-size: 13px; | ||
line-height: 20px; | ||
opacity: 0.5; | ||
-webkit-transition: all 200ms ease-in-out; | ||
-moz-transition: all 200ms ease-in-out; | ||
-o-transition: all 200ms ease-in-out; | ||
transition: all 200ms ease-in-out; | ||
} | ||
.theme-bar a.nivo-nextNav { right: -50px; } | ||
.theme-bar a.nivo-prevNav { left: -50px; } | ||
.theme-bar:hover a.nivo-nextNav { | ||
right: 15px; | ||
opacity: 1; | ||
} | ||
.theme-bar:hover a.nivo-prevNav { | ||
left: 15px; | ||
opacity: 1; | ||
} | ||
.theme-bar .nivo-directionNav a:hover { color: #ddd; } | ||
|
||
.theme-bar .nivo-caption { | ||
font-family: Helvetica, Arial, sans-serif; | ||
-webkit-transition: all 200ms ease-in-out; | ||
-moz-transition: all 200ms ease-in-out; | ||
-o-transition: all 200ms ease-in-out; | ||
transition: all 200ms ease-in-out; | ||
} | ||
.theme-bar:hover .nivo-caption { | ||
bottom: 41px; | ||
} | ||
.theme-bar .nivo-caption a { | ||
color:#fff; | ||
border-bottom:1px dotted #fff; | ||
} | ||
.theme-bar .nivo-caption a:hover { | ||
color:#fff; | ||
} | ||
|
||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled { | ||
width: 100%; | ||
} | ||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled a { | ||
width: auto; | ||
height: auto; | ||
background: none; | ||
margin-bottom: 5px; | ||
} | ||
.theme-bar .nivo-controlNav.nivo-thumbs-enabled img { | ||
display: block; | ||
width: 120px; | ||
height: auto; | ||
} |
Binary file added
BIN
+1.25 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/bar/bullets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.7 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/bar/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.35 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/custom/arrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.25 KB
Nop.Plugin.Widgets.NivoSlider/Content/nivoslider/themes/custom/bullets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.