Browse Source

Replace owl.carousel with Swiper

pull/26005/head
maliming 2 days ago
parent
commit
30cfd3cd4e
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/OwlCarousel/OwlCarouselScriptContributor.cs
  2. 15
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/OwlCarousel/OwlCarouselStyleContributor.cs
  3. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Swiper/SwiperScriptContributor.cs
  4. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Swiper/SwiperStyleContributor.cs
  5. 3
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml
  6. 28
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Scripts/blog.js
  7. 1
      npm/packs/blogging/package.json
  8. 5
      npm/packs/owl.carousel/abp.resourcemapping.js
  9. 0
      npm/packs/swiper/README.md
  10. 6
      npm/packs/swiper/abp.resourcemapping.js
  11. 5
      npm/packs/swiper/package.json

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/OwlCarousel/OwlCarouselScriptContributor.cs

@ -1,15 +0,0 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.OwlCarousel;
[DependsOn(typeof(JQueryScriptContributor))]
public class OwlCarouselScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/owl.carousel/owl.carousel.min.js");
}
}

15
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/OwlCarousel/OwlCarouselStyleContributor.cs

@ -1,15 +0,0 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.OwlCarousel;
public class OwlCarouselStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
//TODO: Theming!
context.Files.AddIfNotContains("/libs/owl.carousel/assets/owl.carousel.min.css");
context.Files.AddIfNotContains("/libs/owl.carousel/assets/owl.theme.default.min.css");
context.Files.AddIfNotContains("/libs/owl.carousel/assets/owl.theme.green.min.css");
}
}

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Swiper/SwiperScriptContributor.cs

@ -0,0 +1,12 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Swiper;
public class SwiperScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/swiper/swiper-bundle.min.js");
}
}

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Swiper/SwiperStyleContributor.cs

@ -0,0 +1,12 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Swiper;
public class SwiperStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/swiper/swiper-bundle.min.css");
}
}

3
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml

@ -1,7 +1,6 @@
@page
@using Microsoft.AspNetCore.Authorization
@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers
@using Volo.Abp.AspNetCore.Mvc.UI.Packages.OwlCarousel
@using Volo.Blogging
@inject IAuthorizationService Authorization
@model IndexModel
@ -19,13 +18,11 @@
@section scripts {
<abp-script-bundle name="@typeof(IndexModel).FullName">
<abp-script src="/client-proxies/blogging-proxy.js" />
<abp-script type="@typeof(OwlCarouselScriptContributor)" />
<abp-script src="/Pages/Blogs/Shared/Scripts/blog.js" />
</abp-script-bundle>
}
@section styles {
<abp-style-bundle name="@typeof(IndexModel).FullName">
<abp-script type="@typeof(OwlCarouselStyleContributor)" />
<abp-style src="/Pages/Blogs/Shared/Styles/blog.css" />
</abp-style-bundle>
}

28
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Scripts/blog.js

@ -18,36 +18,8 @@
//}
}
function handleOwlCarousel() {
$('.hero-section .owl-carousel').owlCarousel({
loop: true,
margin: 0,
nav: false,
dots: false,
//center: true,
autoplay: true,
autoHeight: true,
autoplaySpeed: 1000,
items: 1,
});
$('.card-article-container .owl-carousel').owlCarousel({
loop: true,
margin: 0,
nav: false,
dots: false,
autoplay: true,
autoplaySpeed: 1000,
responsive: {
0: {
items: 1,
},
},
});
}
$(function () {
handleImages();
handleOwlCarousel();
$('.nav-link').on('click', function () {
$(this).parent().parent();

1
npm/packs/blogging/package.json

@ -6,7 +6,6 @@
},
"dependencies": {
"@abp/aspnetcore.mvc.ui.theme.shared": "~10.7.0-rc.2",
"@abp/owl.carousel": "~10.7.0-rc.2",
"@abp/prismjs": "~10.7.0-rc.2",
"@abp/tui-editor": "~10.7.0-rc.2"
},

5
npm/packs/owl.carousel/abp.resourcemapping.js

@ -1,5 +0,0 @@
module.exports = {
mappings: {
"@node_modules/owl.carousel/dist/**/*.*": "@libs/owl.carousel/"
}
}

0
npm/packs/owl.carousel/README.md → npm/packs/swiper/README.md

6
npm/packs/swiper/abp.resourcemapping.js

@ -0,0 +1,6 @@
module.exports = {
mappings: {
"@node_modules/swiper/swiper-bundle.min.js*": "@libs/swiper/",
"@node_modules/swiper/swiper-bundle.min.css": "@libs/swiper/"
}
}

5
npm/packs/owl.carousel/package.json → npm/packs/swiper/package.json

@ -1,12 +1,11 @@
{
"version": "10.7.0-rc.2",
"name": "@abp/owl.carousel",
"name": "@abp/swiper",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@abp/core": "~10.7.0-rc.2",
"owl.carousel": "^2.3.4"
"swiper": "^14.1.0"
},
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431",
"homepage": "https://abp.io",
Loading…
Cancel
Save