Browse Source

Added script contributors.

pull/301/head
Halil ibrahim Kalkan 8 years ago
parent
commit
cc2d1fbfa3
  1. 29
      src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs
  2. 6
      src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs
  3. 24
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/BundleContributorCollection.cs
  4. 1
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/BundleManager.cs
  5. 4
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapScriptContributor.cs
  6. 2
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapStyleContributor.cs
  7. 14
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNet/DatatablesNetScriptContributor.cs
  8. 16
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNetBs4/DatatablesNetBs4ScriptContributor.cs
  9. 4
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNetBs4/DatatablesNetBs4StyleContributor.cs
  10. 2
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/FontAwesome/BootstrapStyleBundleContributor.cs
  11. 2
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQuery/JQueryScriptContributor.cs
  12. 14
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryForm/JQueryValidationScriptContributor.cs
  13. 14
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryValidation/JQueryValidationScriptContributor.cs
  14. 14
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryValidationUnobtrusive/JQueryValidationUnobtrusiveScriptContributor.cs
  15. 10
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/SweetAlert/SweetalertScriptContributor.cs
  16. 14
      src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Toastr/ToastrScriptBundleContributor.cs

29
src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalScriptContributor.cs

@ -1,29 +1,40 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNet;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNetBs4;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryForm;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryValidation;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryValidationUnobtrusive;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.SweetAlert;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Toastr;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling
{
[DependsOn(
typeof(BootstrapScriptBundleContributor)
typeof(JQueryScriptContributor),
typeof(BootstrapScriptContributor),
typeof(JQueryValidationScriptContributor),
typeof(JQueryValidationUnobtrusiveScriptContributor),
typeof(JQueryFormScriptContributor),
typeof(DatatablesNetScriptContributor),
typeof(DatatablesNetBs4ScriptContributor),
typeof(SweetalertScriptContributor),
typeof(ToastrScriptBundleContributor)
)]
public class SharedThemeGlobalScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddRange(new[]
{ //TODO: Create seperated contributors!
"/libs/jquery-validation/jquery.validate.js",
"/libs/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"/libs/jquery-form/jquery.form.min.js",
"/libs/datatables.net/js/jquery.dataTables.js",
"/libs/datatables.net-bs4/js/dataTables.bootstrap4.js",
"/libs/sweetalert/sweetalert.min.js",
"/libs/toastr/toastr.min.js",
{
//TODO: Move to their own contributors, but first consider to change abp.js a bit
"/libs/abp/core/abp.js",
"/libs/abp/jquery/abp.dom.js",
"/libs/abp/jquery/abp.ajax.js",
"/libs/abp/jquery/abp.resource-loader.js",
"/libs/abp/aspnetcore.mvc.ui.theme.shared/jquery/jquery-extensions.js",
"/libs/abp/aspnetcore.mvc.ui.theme.shared/jquery-form/jquery-form-extensions.js",
"/libs/abp/aspnetcore.mvc.ui.theme.shared/bootstrap/dom-event-handlers.js",

6
src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Bundling/SharedThemeGlobalStyleContributor.cs

@ -8,10 +8,10 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling
{
[DependsOn(
typeof(BootstrapStyleBundleContributor),
typeof(FontAwesomeStyleBundleContributor),
typeof(BootstrapStyleContributor),
typeof(FontAwesomeStyleContributor),
typeof(ToastrStyleBundleContributor),
typeof(DatatablesNetBs4StyleBundleContributor)
typeof(DatatablesNetBs4StyleContributor)
)]
public class SharedThemeGlobalStyleContributor : BundleContributor
{

24
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/BundleContributorCollection.cs

@ -30,15 +30,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
public void Add([NotNull] Type contributorType)
{
Check.NotNull(contributorType, nameof(contributorType));
if (!typeof(IBundleContributor).IsAssignableFrom(contributorType))
{
throw new AbpException($"Given {nameof(contributorType)} ({contributorType.AssemblyQualifiedName}) should implement the {typeof(IBundleContributor).AssemblyQualifiedName} interface!");
}
if (IsAlreadyAdded(contributorType))
{
throw new AbpException($"Given {nameof(contributorType)} ({contributorType.AssemblyQualifiedName}) is already added before! If you want to ensure that a contributor is added, create your own contributor and depend on the contributor you want to ensure that it's added.");
}
AddWithDependencies(contributorType);
}
@ -55,6 +46,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
private void AddWithDependencies(Type contributorType)
{
if (IsAlreadyAdded(contributorType))
{
return;
}
var dependsOnAttributes = contributorType
.GetCustomAttributes(true)
.OfType<IDependedTypesProvider>()
@ -65,11 +61,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
foreach (var dependedType in dependsOnAttribute.GetDependedTypes())
{
AddWithDependencies(dependedType); //Recursive call
if (!IsAlreadyAdded(dependedType))
{
AddInstanceToContributors(dependedType);
}
}
}
@ -78,6 +69,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
private void AddInstanceToContributors(Type contributorType)
{
if (!typeof(IBundleContributor).IsAssignableFrom(contributorType))
{
throw new AbpException($"Given {nameof(contributorType)} ({contributorType.AssemblyQualifiedName}) should implement the {typeof(IBundleContributor).AssemblyQualifiedName} interface!");
}
try
{
_contributors.Add((IBundleContributor)Activator.CreateInstance(contributorType));

1
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/BundleManager.cs

@ -62,7 +62,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
using (var scope = _serviceProvider.CreateScope())
{
var context = new BundleConfigurationContext(
new List<string>(),
_themeManager.CurrentTheme,

4
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapScriptBundleContributor.cs → src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapScriptContributor.cs

@ -3,8 +3,8 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Bootstrap
{
[DependsOn(typeof(JQueryScriptBundleContributor))]
public class BootstrapScriptBundleContributor : BundleContributor
[DependsOn(typeof(JQueryScriptContributor))]
public class BootstrapScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{

2
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapStyleBundleContributor.cs → src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Bootstrap/BootstrapStyleContributor.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Bootstrap
{
public class BootstrapStyleBundleContributor : BundleContributor
public class BootstrapStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{

14
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNet/DatatablesNetScriptContributor.cs

@ -0,0 +1,14 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNet
{
[DependsOn(typeof(JQueryScriptContributor))]
public class DatatablesNetScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/datatables.net/js/jquery.dataTables.js");
}
}
}

16
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNetBs4/DatatablesNetBs4ScriptContributor.cs

@ -0,0 +1,16 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNet;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNetBs4
{
[DependsOn(typeof(DatatablesNetScriptContributor))]
[DependsOn(typeof(BootstrapScriptContributor))]
public class DatatablesNetBs4ScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/datatables.net-bs4/js/dataTables.bootstrap4.js");
}
}
}

4
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNetBs4/DatatablesNetBs4StyleBundleContributor.cs → src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/DatatablesNetBs4/DatatablesNetBs4StyleContributor.cs

@ -3,8 +3,8 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.DatatablesNetBs4
{
[DependsOn(typeof(BootstrapStyleBundleContributor))]
public class DatatablesNetBs4StyleBundleContributor : BundleContributor
[DependsOn(typeof(BootstrapStyleContributor))]
public class DatatablesNetBs4StyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{

2
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/FontAwesome/BootstrapStyleBundleContributor.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.FontAwesome
{
public class FontAwesomeStyleBundleContributor : BundleContributor
public class FontAwesomeStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{

2
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQuery/JQueryScriptBundleContributor.cs → src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQuery/JQueryScriptContributor.cs

@ -1,6 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery
{
public class JQueryScriptBundleContributor : BundleContributor
public class JQueryScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{

14
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryForm/JQueryValidationScriptContributor.cs

@ -0,0 +1,14 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryForm
{
[DependsOn(typeof(JQueryScriptContributor))]
public class JQueryFormScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/jquery-form/jquery.form.min.js");
}
}
}

14
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryValidation/JQueryValidationScriptContributor.cs

@ -0,0 +1,14 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryValidation
{
[DependsOn(typeof(JQueryScriptContributor))]
public class JQueryValidationScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/jquery-validation/jquery.validate.js");
}
}
}

14
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/JQueryValidationUnobtrusive/JQueryValidationUnobtrusiveScriptContributor.cs

@ -0,0 +1,14 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryValidation;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQueryValidationUnobtrusive
{
[DependsOn(typeof(JQueryValidationScriptContributor))]
public class JQueryValidationUnobtrusiveScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js");
}
}
}

10
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/SweetAlert/SweetalertScriptContributor.cs

@ -0,0 +1,10 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.SweetAlert
{
public class SweetalertScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/sweetalert/sweetalert.min.js");
}
}
}

14
src/Volo.Abp.AspNetCore.Mvc.UI/UI/Bundling/Libraries/Toastr/ToastrScriptBundleContributor.cs

@ -0,0 +1,14 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.JQuery;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Libraries.Toastr
{
[DependsOn(typeof(JQueryScriptContributor))]
public class ToastrScriptBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.Add("/libs/toastr/toastr.min.js");
}
}
}
Loading…
Cancel
Save