예제 #1
0
 protected List2Controller(bool popupEditor, U context)
 {
     _context    = context;
     PopupEditor = popupEditor;
     PageMenu    = new EditorPageMenu();
 }
예제 #2
0
        public static HtmlString PageMenu2Mobile(this IHtmlHelper helper, EditorPageMenu menu)
        {
            if (menu.Items.Count == 0)
            {
                return(new HtmlString(string.Empty));
            }

            var sb = new StringBuilder();

            foreach (var item in menu.Items)
            {
                if (item.Items.Count == 0 && item.SplitItems.Count == 0)
                {
                    if (item.ButtonClass.IsEmpty())
                    {
                        item.ButtonClass = "btn btn-primary btn-sm";
                    }

                    if (item.Id.IsEmpty())
                    {
                        var target = item.Target.IsEmpty() ? "" : $" target='{item.Target}'";
                        sb.AppendLine($@"<a href='{item.Url}' class='{item.ButtonClass}' {target}><i class='{item.IconClass}'></i> <span>{item.Title}</span></a>");
                    }
                    else
                    {
                        var pu = "";
                        if (!item.PostUrl.IsEmpty())
                        {
                            pu = $"data-posturl='{item.PostUrl}'";
                        }
                        var cd = "";
                        if (!item.ConfirmText.IsEmpty())
                        {
                            cd = $"data-confirm='{item.ConfirmText}'";
                        }
                        sb.AppendLine($@"<button id='mitem-{item.Id}' class='{item.ButtonClass}' {pu} {cd}><i class='{item.IconClass}'></i> <span>{item.Title}</span></button>");
                    }
                }
                else if (item.Items.Count > 0)
                {
                    if (item.ButtonClass.IsEmpty())
                    {
                        item.ButtonClass = "btn btn-primary btn-sm";
                    }

                    sb.AppendLine($@"<a class='dropdown-toggle {item.ButtonClass}' href='#' data-toggle='dropdown'>
            <i class='{item.IconClass}'></i>&nbsp;{item.Title}
        </a>
        <div class='dropdown-menu'>");
                    AddMenuSubItem(sb, item.Items);
                    sb.AppendLine("</div>");
                }
                else if (item.SplitItems.Count > 0)
                {
                    if (item.ButtonClass.IsEmpty())
                    {
                        item.ButtonClass = "btn btn-primary btn-sm";
                    }

                    string btnText;
                    if (item.Id.IsEmpty())
                    {
                        var target = item.Target.IsEmpty() ? "" : $" target='{item.Target}'";
                        btnText = $@"<a href='{item.Url}' class='{item.ButtonClass}' {target}><i class='{item.IconClass}'></i> <span>{item.Title}</span></a>";
                    }
                    else
                    {
                        var pu = "";
                        if (!item.PostUrl.IsEmpty())
                        {
                            pu = $"data-posturl='{item.PostUrl}'";
                        }
                        var cd = "";
                        if (!item.ConfirmText.IsEmpty())
                        {
                            cd = $"data-confirm='{item.ConfirmText}'";
                        }
                        btnText = $@"<button id='mitem-{item.Id}' class='{item.ButtonClass}' {pu} {cd}><i class='{item.IconClass}'></i> <span>{item.Title}</span></button>";
                    }

                    sb.AppendLine($@"<div class='btn-group'>
        {btnText}
        <button type='button' class='{item.ButtonClass} dropdown-toggle dropdown-toggle-split' data-toggle='dropdown'>
            <span class='sr-only'>Toggle Dropdown</span>
        </button>
        <div class='dropdown-menu'>");
                    AddMenuSplit(sb, item.SplitItems);
                    sb.AppendLine("</div></div>");
                }
            }
            return(new HtmlString(sb.ToString()));
        }
예제 #3
0
        public static HtmlString PageMenu(this IHtmlHelper helper, EditorPageMenu menu)
        {
            if (menu.Items.Count == 0)
            {
                return(new HtmlString(string.Empty));
            }

            var sb = new StringBuilder();

            sb.AppendLine("<div class='hidden-xs'>");
            foreach (var item in menu.Items)
            {
                if (item.Items.Count == 0)
                {
                    if (item.Id.IsEmpty())
                    {
                        var target = item.Target.IsEmpty() ? "" : $" target='{item.Target}'";
                        sb.AppendLine($@"<a href='{item.Url}' class='{item.ButtonClass}' {target}>
    <i class='{item.IconClass}'></i> <span>{item.Title}</span>
</a>");
                    }
                    else
                    {
                        var pu = "";
                        if (!item.PostUrl.IsEmpty())
                        {
                            pu = $"data-posturl='{item.PostUrl}'";
                        }
                        var cd = "";
                        if (!item.ConfirmText.IsEmpty())
                        {
                            cd = $"data-confirm='{item.ConfirmText}'";
                        }

                        sb.AppendLine($@"<button id='{item.Id}' class='{item.ButtonClass}' {pu} {cd}>
<i class='{item.IconClass}'></i> <span>{item.Title}</span>
</button>");
                    }
                }
                else
                {
                    sb.AppendLine($@"<div class='btn-group'>
<a class='btn btn-default {item.ButtonClass}' href='#' data-toggle='dropdown'>
    <i class='{item.IconClass}'></i> {item.Title} <i class='fa fa-angle-down'></i>
</a>
<ul class='dropdown-menu'>");
                    AddMenu(sb, item.Items);
                    sb.AppendLine("</ul></div>");
                }
            }
            sb.AppendLine("</div>");


            sb.AppendLine("<div class='visible-xs'>");
            sb.AppendLine($@"<div class='btn-group'>
<a class='btn btn-default {""}' href='#' data-toggle='dropdown'>
    <i class='{""}'></i> {"İşlemler"} <i class='fa fa-angle-down'></i>
</a>
<ul class='dropdown-menu'>");
            foreach (var item in menu.Items)
            {
                if (item.Items.Count == 0)
                {
                    if (item.Id.IsEmpty())
                    {
                        var target = item.Target.IsEmpty() ? "" : $" target='{item.Target}'";
                        sb.AppendLine($@"<li><a href='{item.Url}' class='{item.ButtonClass}' {target}>
    <i class='{item.IconClass}'></i> <span>{item.Title}</span>
</a></li>");
                    }
                    else
                    {
                        var pu = "";
                        if (!item.PostUrl.IsEmpty())
                        {
                            pu = $"data-posturl='{item.PostUrl}'";
                        }
                        var cd = "";
                        if (!item.ConfirmText.IsEmpty())
                        {
                            cd = $"data-confirm='{item.ConfirmText}'";
                        }

                        sb.AppendLine($@"<li><button id='{item.Id}' class='btn btn-link {item.ButtonClass}' {pu} {cd}>
<i class='{item.IconClass}'></i> <span>{item.Title}</span>
</button></li>");
                    }
                }
            }
            sb.AppendLine("</ul>");
            sb.AppendLine("</div>");
            sb.AppendLine("</div>");
            return(new HtmlString(sb.ToString()));
        }
        public static HtmlString PageMenu(this IHtmlHelper helper, EditorPageMenu menu)
        {
            var sb = new StringBuilder();

            sb.AppendLine("<div class='hidden-xs'>");
            foreach (var item in menu.Items)
            {
                if (item.Items.Count == 0)
                {
                    if (item.Id.IsEmpty())
                    {
                        sb.AppendLine(string.Format(@"<a href='{0}' class='btn btn-default {3}'>
    <i class='{1}'></i> <span>{2}</span>
</a>", item.Url, item.IconClass, item.Title, item.ButtonClass));
                    }
                    else
                    {
                        sb.AppendLine(string.Format(@"<button id='{0}' class='btn green-haze  {3}'>
<i class='{1}'></i> <span>{2}</span>
</button>",
                                                    item.Id, item.IconClass, item.Title, item.ButtonClass));
                    }
                }
                else
                {
                    sb.AppendLine(string.Format(@"<div class='btn-group'>
<a class='btn btn-default {2}' href='#' data-toggle='dropdown'>
    <i class='{1}'></i> {0} <i class='fa fa-angle-down'></i>
</a>
<ul class='dropdown-menu pull-right'>", item.Title, item.IconClass, item.ButtonClass));
                    AddMenu(sb, item.Items);
                    sb.AppendLine("</ul></div>");
                }
            }
            sb.AppendLine("</div>");

            sb.AppendLine("<div class='visible-xs'>");
            sb.AppendLine(string.Format(@"<div class='btn-group'>
<a class='btn btn-default {2}' href='#' data-toggle='dropdown'>
    <i class='{1}'></i> {0} <i class='fa fa-angle-down'></i>
</a>
<ul class='dropdown-menu pull-right'>", "İşlemler", "", ""));
            foreach (var item in menu.Items)
            {
                if (item.Items.Count == 0)
                {
                    if (item.Id.IsEmpty())
                    {
                        sb.AppendLine(string.Format(@"<li><a href='{0}' class='{3}'>
    <i class='{1}'></i> <span>{2}</span>
</a></li>", item.Url, item.IconClass, item.Title, item.ButtonClass));
                    }
                    else
                    {
                        sb.AppendLine(string.Format(@"<li><button id='{0}' class='btn btn-link {3}'>
<i class='{1}'></i> <span>{2}</span>
</button></li>",
                                                    item.Id, item.IconClass, item.Title, item.ButtonClass));
                    }
                }
            }
            sb.AppendLine("</ul>");
            sb.AppendLine("</div>");
            sb.AppendLine("</div>");
            return(new HtmlString(sb.ToString()));
        }