public static ul GetTreeViewDom(string id_dom_element, string ul_class, string li_class, OptionList ListItems) { ul ret_ul = new ul(); if (!string.IsNullOrEmpty(ul_class)) { ret_ul.AddCSS(ul_class, true); } WriteUl(ref ret_ul.Childs, ListItems.ListItems, li_class); return(ret_ul); }
public override string GetHTML(int deep = 0) { Childs.Clear(); tag_custom_name = typeof(nav).Name; before_coment_block = "pagination"; if (CountAllElements == 0) { goto end; } SetAttribute("aria-label", "Page navigation"); ul ul_block = new ul(); ul_block.AddCSS("pagination"); #region Formatting pagination (aligment + sizing) if (SiziePagination == SizingBootstrap.Lg) { ul_block.AddCSS("pagination-lg"); } else if (SiziePagination == SizingBootstrap.Sm) { ul_block.AddCSS("pagination-sm"); } if (AlignmentPagination == AlignmentEnum.center) { ul_block.AddCSS("justify-content-center"); } else if (AlignmentPagination == AlignmentEnum.right) { ul_block.AddCSS("justify-content-end"); } #endregion ul_block.Childs.Add(PaginationItem(0)); for (int i = 1; CountPages >= i; i++) { if (CountPages > 7) { if (PageNum < 5) { if (i == CountPages - 1) { ul_block.Childs.Add(PaginationItem(-1)); } else if (i <= 5 || i == CountPages) { ul_block.Childs.Add(PaginationItem(i)); } else { continue; } } else if (PageNum > (CountPages - 4)) { if (i == 2) { ul_block.Childs.Add(PaginationItem(-1)); } else if (i == 1 || i >= (CountPages - 4)) { ul_block.Childs.Add(PaginationItem(i)); } else { continue; } } else { if (i == 2 || i == CountPages - 1) { ul_block.Childs.Add(PaginationItem(-1)); } else if ((i == 1 || i == CountPages) || (i == PageNum - 1 || i == PageNum || i == PageNum + 1)) { ul_block.Childs.Add(PaginationItem(i)); } else { continue; } } } else { ul_block.Childs.Add(PaginationItem(i)); } } ul_block.Childs.Add(PaginationItem(CountPages + 1)); Childs.Add(ul_block); end: return(base.GetHTML(deep)); }
/// <summary> /// Получить форму регистрации/авторизации /// </summary> /// <param name="user_login_input_id">html dom id/name - идентификатор/имя input-a ввода логина</param> /// <param name="user_password_input_id">html dom id/name - идентификатор/имя input-a ввода пароля</param> /// <param name="user_password_repeat_input_id">html dom id/name - идентификатор/имя input-a ввода повтора пороля</param> /// <param name="reg_new_user_chekbox_id">html dom id/name - идентификатор/имя chekbox-a для регистрации нового пользователя</param> /// <param name="button_send_login_form_id">html dom id/name - идентификатор/имя button-a </param> /// <param name="re_captcha_key">api - ключ reCaptcha</param> /// <param name="collapse_info_new_user_input_css">css класс - области сворачивания и разворачивания для регистрации</param> /// <returns></returns> public static List <base_dom_root> GetLoginForm( string re_captcha_key = null, string user_password_input_id = "user_password_input_id", string user_password_repeat_input_id = "user_password_repeat_input_id", string user_login_input_id = "user_login_input_id", string reg_new_user_chekbox_id = "reg_new_user_chekbox_id", string button_send_login_form_id = "button_send_login_form_id", string collapse_info_new_user_input_css = "collapse_info_new_user_input") { List <base_dom_root> dom_elements = new List <base_dom_root>(); form html_response = new form() { Id_DOM = "login_form_id", target = TargetsEnum._self, method_form = MethodsFormEnum.POST }; html_response.AddCSS("was-validated"); html_response.SetAttribute("novalidate", null); TextInput textInput = new TextInput("Ваш логин", user_login_input_id) { InputInfoFooter = "Введите логин для входа" }; textInput.Input.placeholder = "Логин"; textInput.Input.required = true; html_response.AddDomNode(textInput); textInput = new TextInput("Ваш пароль", user_password_input_id) { InputInfoFooter = "Пароль для входа" }; textInput.Input.type = InputTypesEnum.password; textInput.Input.placeholder = "Пароль"; html_response.AddDomNode(textInput); textInput = new TextInput("Повторите пароль", user_password_repeat_input_id) { InputInfoFooter = "Повторно введите пароль" }; textInput.Input.type = InputTypesEnum.password; textInput.Input.placeholder = "Повтор"; textInput.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); html_response.AddDomNode(textInput); html_response.Childs[html_response.Childs.Count - 1].AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); html_response.Childs.Add(new CheckboxInput("Зарегистрироваться", reg_new_user_chekbox_id)); p reg_new_user_info = new p(""); reg_new_user_info.AddCSS("clearfix"); using (ul panel_collapse = new ul()) { panel_collapse.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); reg_new_user_info.Childs.Add(panel_collapse); } reg_new_user_info.Childs[0].Childs.Add(new li() { InnerText = "Придумайте/запомните надёжный логин/пароль и входите" }); reg_new_user_info.Childs[0].Childs.Add(new li() { InnerText = "Учётная запись будет создана автоматически" }); html_response.Childs.Add(reg_new_user_info); if (!string.IsNullOrEmpty(re_captcha_key)) { html_response.Childs.Add(new hr()); html_response.Childs.Add(new h4("Пройдите проверку reCAPTCHA")); div sitekey = new div(); sitekey.AddCSS("g-recaptcha"); sitekey.SetAttribute("data-size", "compact"); sitekey.SetAttribute("data-sitekey", re_captcha_key); html_response.Childs.Add(sitekey); } html_response.Childs.Add(GetButton("Войти", button_send_login_form_id, null, VisualBootstrapStylesEnum.primary, SizingBootstrap.Lg, true)); dom_elements.Add(Get_DIV_Bootstrap_Card("Вход/Регистрация", html_response)); return(dom_elements); }