public static div GetBootstrapSelectList(string label, select select_body, string Tooltip = null, string wrap_class = "input-group mb-4 col-auto")
        {
            div ret_dom = new div();

            ret_dom.AddCSS(wrap_class, true);
            if (!string.IsNullOrEmpty(label))
            {
                using (div input_group_prepend = new div())
                {
                    input_group_prepend.AddCSS("input-group-prepend");
                    ret_dom.AddDomNode(input_group_prepend);
                }
                //ret_dom.Childs[0].Childs.Add(new label(label, select_body.Id_DOM) { css_class = "input-group-text" });
            }
            select_body.AddCSS("custom-select");

            if (!string.IsNullOrEmpty(Tooltip))
            {
                ret_dom.title = Tooltip;
            }

            ret_dom.SetAttribute("data-toggle", "tooltip");
            ret_dom.AddDomNode(select_body);
            return(ret_dom);
        }
Esempio n. 2
0
        /// <summary>
        /// Добавить вложеную группу, как dropdown menus
        /// </summary>
        /// <param name="nesting">Набор вложеной группы кнопок</param>
        /// <param name="id_node">Уникальный идентификатор вложеного узла. Если IsNullOrEmpty => будет сгенерирован guid</param>
        public void AddNestingDropdownGroup(List <DataParticleItem> nesting, string title_node, string id_node = null)
        {
            if (string.IsNullOrEmpty(id_node))
            {
                id_node = Guid.NewGuid().ToString().Replace("-", "");
            }

            GroupElements nested_group = new GroupElements()
            {
                aria_label = "nested group - " + id_node
            };
            button node_button = new button(title_node)
            {
                Id_DOM = id_node
            };

            node_button.AddCSS("btn btn-" + default_style.ToString() + " dropdown-toggle", true);
            node_button.SetAttribute("data-toggle", "dropdown");
            node_button.SetAttribute("aria-haspopup", "true");
            node_button.SetAttribute("aria-expanded", "false");
            nested_group.Childs.Add(node_button);

            div dropdown_node = new div();

            dropdown_node.AddCSS("dropdown-menu");
            dropdown_node.SetAttribute("aria-labelledby", id_node);
            foreach (DataParticleItem item in nesting)
            {
                using (a a_item = new a()
                {
                    href = item.Value, InnerText = item.Title
                })
                {
                    a_item.AddCSS("dropdown-item");
                    dropdown_node.AddDomNode(a_item);
                }
            }
            Childs.Add(nested_group);
        }
        /// <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);
        }