|
1 | | -//using WebExpress.WebCore.Internationalization; |
2 | | -//using WebExpress.WebCore.WebHtml; |
3 | | -//using WebExpress.WebCore.WebPage; |
4 | | -//using WebExpress.WebUI.WebControl; |
5 | | - |
6 | | -//namespace WebExpress.WebApp.WebControl |
7 | | -//{ |
8 | | -// public class ControlModalFormConfirmDelete : ControlModalFormConfirm |
9 | | -// { |
10 | | -// /// <summary> |
11 | | -// /// Initializes a new instance of the class. |
12 | | -// /// </summary> |
13 | | -// /// <param name="id">The control id.</param> |
14 | | -// public ControlModalFormConfirmDelete(string id = null) |
15 | | -// : this(id, null) |
16 | | -// { |
17 | | - |
18 | | -// } |
19 | | - |
20 | | -// /// <summary> |
21 | | -// /// Initializes a new instance of the class. |
22 | | -// /// </summary> |
23 | | -// /// <param name="id">The control id.</param> |
24 | | -// /// <param name="content">The form controls.</param> |
25 | | -// public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) |
26 | | -// : base(id, content) |
27 | | -// { |
28 | | -// } |
29 | | - |
30 | | -// /// <summary> |
31 | | -// /// Convert to html. |
32 | | -// /// </summary> |
33 | | -// /// <param name="context">The context in which the control is rendered.</param> |
34 | | -// /// <returns>The control as html.</returns> |
35 | | -// public override IHtmlNode Render(RenderContext context) |
36 | | -// { |
37 | | -// if (string.IsNullOrWhiteSpace(Header)) |
38 | | -// { |
39 | | -// Header = context.Page.I18N("webexpress.webapp", "delete.header"); |
40 | | -// } |
41 | | - |
42 | | -// if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) |
43 | | -// { |
44 | | -// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); |
45 | | -// } |
46 | | - |
47 | | -// if (Content == null) |
48 | | -// { |
49 | | -// Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "delete.description") }; |
50 | | -// } |
51 | | - |
52 | | -// if (SubmitButtonIcon == null) |
53 | | -// { |
54 | | -// SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); |
55 | | -// } |
56 | | - |
57 | | -// if (SubmitButtonColor == null) |
58 | | -// { |
59 | | -// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); |
60 | | -// } |
61 | | - |
62 | | -// return base.Render(context); |
63 | | -// } |
64 | | -// } |
65 | | -//} |
| 1 | +using WebExpress.WebCore.Internationalization; |
| 2 | +using WebExpress.WebCore.WebHtml; |
| 3 | +using WebExpress.WebUI.WebControl; |
| 4 | +using WebExpress.WebUI.WebIcon; |
| 5 | +using WebExpress.WebUI.WebPage; |
| 6 | + |
| 7 | +namespace WebExpress.WebApp.WebControl |
| 8 | +{ |
| 9 | + /// <summary> |
| 10 | + /// Represents a modal confirmation form specifically for delete actions. |
| 11 | + /// </summary> |
| 12 | + public class ControlModalFormConfirmDelete : ControlModalFormConfirm |
| 13 | + { |
| 14 | + /// <summary> |
| 15 | + /// Initializes a new instance of the class. |
| 16 | + /// </summary> |
| 17 | + /// <param name="id">The control id.</param> |
| 18 | + public ControlModalFormConfirmDelete(string id = null) |
| 19 | + : this(id, null) |
| 20 | + { |
| 21 | + |
| 22 | + } |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Initializes a new instance of the class. |
| 26 | + /// </summary> |
| 27 | + /// <param name="id">The control id.</param> |
| 28 | + /// <param name="content">The form controls.</param> |
| 29 | + public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) |
| 30 | + : base(id, content) |
| 31 | + { |
| 32 | + SubmitButtonIcon = new IconTrash(); |
| 33 | + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); |
| 34 | + } |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Converts the control to an HTML representation. |
| 38 | + /// </summary> |
| 39 | + /// <param name="renderContext">The context in which the control is rendered.</param> |
| 40 | + /// <param name="visualTree">The visual tree representing the control's structure.</param> |
| 41 | + /// <returns>An HTML node representing the rendered control.</returns> |
| 42 | + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) |
| 43 | + { |
| 44 | + if (string.IsNullOrWhiteSpace(Header)) |
| 45 | + { |
| 46 | + Header = I18N.Translate(renderContext, "webexpress.webapp:delete.header"); |
| 47 | + } |
| 48 | + |
| 49 | + SubmitButtonLabel ??= I18N.Translate(renderContext, "webexpress.webapp:delete.label"); |
| 50 | + Content ??= new ControlFormItemStaticText() { Text = I18N.Translate(renderContext, "webexpress.webapp:delete.description") }; |
| 51 | + |
| 52 | + return base.Render(renderContext, visualTree); |
| 53 | + } |
| 54 | + } |
| 55 | +} |
0 commit comments