Browse Source

Created AbpAutoFocusTagHelper.

pull/301/head
Halil İbrahim Kalkan 8 years ago
parent
commit
b0f915754f
  1. 19
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Utils/AbpAutoFocusTagHelper.cs
  2. 2
      src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Utils/AbpIfTagHelper.cs
  3. 4
      src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore.mvc.ui.theme.shared/bootstrap/dom-event-handlers.js

19
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Utils/AbpAutoFocusTagHelper.cs

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Utils
{
[HtmlTargetElement(Attributes = "abp-auto-focus")]
public class AbpAutoFocusTagHelper : AbpTagHelper
{
[HtmlAttributeName("abp-auto-focus")]
public bool AutoFocus { get; set; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (AutoFocus)
{
output.Attributes.Add("data-auto-focus", "true");
}
}
}
}

2
src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/If/AbpIfTagHelper.cs → src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Utils/AbpIfTagHelper.cs

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.If namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Utils
{ {
[HtmlTargetElement(Attributes = "abp-if")] [HtmlTargetElement(Attributes = "abp-if")]
public class AbpIfTagHelper : AbpTagHelper public class AbpIfTagHelper : AbpTagHelper

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

@ -72,6 +72,8 @@
}); });
$(function () { $(function () {
enableFormFeatures($('form'));
$('[data-toggle="tooltip"]').tooltip({ $('[data-toggle="tooltip"]').tooltip({
container: 'body' container: 'body'
}); });
@ -80,7 +82,7 @@
container: 'body' container: 'body'
}); });
enableFormFeatures($('form')); $('[data-auto-focus="true"]').first().findWithSelf('input').focus();
}); });
})(jQuery); })(jQuery);
Loading…
Cancel
Save