Browse Source

Localize timeago and auto handle .timeago class.

pull/3734/head
Halil İbrahim Kalkan 7 years ago
parent
commit
3cc25365a2
  1. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Timeago/TimeagoScriptContributor.cs
  2. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/Timeago/TimeagoScriptContributor.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Globalization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery;
using Volo.Abp.Modularity;
@ -12,5 +13,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.Timeago
{
context.Files.AddIfNotContains("/libs/timeago/jquery.timeago.js");
}
public override void ConfigureDynamicResources(BundleConfigurationContext context)
{
var cultureName = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
var cultureFileName = $"/libs/timeago/locales/jquery.timeago.{cultureName}.js";
if (context.FileProvider.GetFileInfo(cultureFileName).Exists)
{
context.Files.Add(cultureFileName);
}
}
}
}

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js

@ -60,6 +60,8 @@
container: 'body'
});
args.$el.findWithSelf('.timeago').timeago();
enableFormFeatures(args.$el.findWithSelf('form'), true);
initializeScript(args.$el);
@ -82,6 +84,8 @@
container: 'body'
});
$('.timeago').timeago();
$('[data-auto-focus="true"]').first().findWithSelf('input,select').focus();
});

Loading…
Cancel
Save