コード例 #1
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="page">Die zugehörige Seite</param>
        /// <param name="id">Die ID</param>
        public ControlPanelNavbar(IPage page, string id)
            : base(page, id)
        {
            ControlText = new ControlText(Page, "headline")
            {
                Class = "headline", Format = TypesTextFormat.Paragraph
            };
            HamburgerMenu = new ControlHamburgerMenu(Page, "hamburger")
            {
            };

            ToolBar = new ControlToolBar(Page, "toolbar")
            {
                Class = "toolbar"
            };
            NotificationBar = new ControlToolBar(Page, "notificationbar")
            {
                Class = "notificationbar"
            };

            //Content.Add(HamburgerMenu);
            //Content.Add(ToolBar);
            //Content.Add(ControlText);
            //Content.Add(NotificationBar);
            Expand = ExpandTypes.None;
            Fixed  = FixedTypes.None;
        }
コード例 #2
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode ToHtml()
        {
            var classes = new List <string>();

            classes.Add(Class);
            classes.Add("comment");

            var profile = new ControlAvatar(Page)
            {
                User  = User,
                Image = Image
            };

            var timespan = string.Empty;
            var days     = (DateTime.Now - Timestamp).Days;

            if (days == 1)
            {
                timespan = "vor ein Tag";
            }
            else if (days < 1)
            {
                var hours = (DateTime.Now - Timestamp).Hours;
                if (hours == 1)
                {
                    timespan = "vor einer Stunde";
                }
                else if (hours < 1)
                {
                    var minutes = (DateTime.Now - Timestamp).Minutes;

                    if (minutes == 1)
                    {
                        timespan = "vor einer Minute";
                    }
                    else if (minutes < 1)
                    {
                        timespan = "gerade ebend";
                    }
                    else
                    {
                        timespan = "vor " + minutes + " Minuten";
                    }
                }
                else
                {
                    timespan = "vor " + hours + " Stunden";
                }
            }
            else
            {
                timespan = "vor " + days + " Tagen";
            }

            var date = new ControlText(Page)
            {
                Text    = timespan,
                Tooltip = "Am " + Timestamp.ToShortDateString() + " um " + Timestamp.ToShortTimeString() + " Uhr",
                Format  = TypesTextFormat.Span,
                Color   = TypesTextColor.Muted
            };

            var header = new HtmlElementDiv(profile.ToHtml(), date.ToHtml())
            {
                Class = "header"
            };

            var body = new HtmlElementDiv(new HtmlText(Post))
            {
                Class = "post"
            };

            var likeText = "Gefällt mir" + (Likes > 0 ? " (" + Likes + ")" : string.Empty);

            var like = new ControlButtonLink(Page)
            {
                Icon = "fas fa-thumbs-up", Text = likeText, Url = Page.GetUrl(), Size = TypesSize.Small, Layout = TypesLayoutButton.Light, Outline = true, Color = TypesTextColor.Primary
            };

            var option = new HtmlElementDiv(like.ToHtml())
            {
                Class = "options"
            };

            var html = new HtmlElementDiv(header, body, option)
            {
                Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x)))
            };

            return(html);
        }
コード例 #3
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode ToHtml()
        {
            var classes = new List <string>();

            classes.Add(Class);
            classes.Add("post");

            var profile = new ControlAvatar(Page)
            {
                User  = User,
                Image = Image
            };

            var timespan = string.Empty;
            var days     = (DateTime.Now - Timestamp).Days;

            if (days == 1)
            {
                timespan = "vor ein Tag";
            }
            else if (days < 1)
            {
                var hours = (DateTime.Now - Timestamp).Hours;
                if (hours == 1)
                {
                    timespan = "vor einer Stunde";
                }
                else if (hours < 1)
                {
                    var minutes = (DateTime.Now - Timestamp).Minutes;

                    if (minutes == 1)
                    {
                        timespan = "vor einer Minute";
                    }
                    else if (minutes < 1)
                    {
                        timespan = "gerade ebend";
                    }
                    else
                    {
                        timespan = "vor " + minutes + " Minuten";
                    }
                }
                else
                {
                    timespan = "vor " + hours + " Stunden";
                }
            }
            else
            {
                timespan = "vor " + days + " Tagen";
            }

            var date = new ControlText(Page)
            {
                Text    = timespan,
                Tooltip = "Am " + Timestamp.ToShortDateString() + " um " + Timestamp.ToShortTimeString() + " Uhr",
                Format  = TypesTextFormat.Span,
                Color   = TypesTextColor.Muted
            };

            var headerText = new HtmlElementP
                             (
                new ControlText(Page)
            {
                Text = Action, Color = TypesTextColor.Info, Format = TypesTextFormat.Span
            }.ToHtml(),
                date.ToHtml()
                             );

            var setting = new ControlDropdownMenu(Page)
            {
                Icon   = "fas fa-cog",
                Layout = TypesLayoutButton.Light,
                HorizontalAlignment = TypesHorizontalAlignment.Right,
                Size = TypesSize.Small
            };

            setting.Add(new ControlLink(Page)
            {
                Text = "Löschen", Icon = "fas fa-trash-alt", Color = TypesTextColor.Danger, Url = Page.GetUrl()
            });

            var header = new HtmlElementDiv(setting.ToHtml(), profile.ToHtml(), headerText)
            {
                Class = "header"
            };

            var body = new HtmlElementDiv(new HtmlText(Post))
            {
                Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x)))
            };

            var likeText = "Gefällt mir" + (Likes > 0 ? " (" + Likes + ")" : string.Empty);
            var like     = new ControlButtonLink(Page)
            {
                Icon = "fas fa-thumbs-up", Text = likeText, Url = Page.GetUrl(), Size = TypesSize.Small, Layout = TypesLayoutButton.Light, Outline = true, Color = TypesTextColor.Primary
            };
            //var comment = new ControlButtonLink(Page) { Icon = "fas fa-comment", Text = "Antworten", Url = Page.GetUrl(), Size = TypesSize.Small, Layout = TypesLayoutButton.Light, Color = TypesTextColor.Primary };

            var option = new HtmlElementDiv(like.ToHtml())
            {
                Class = "options"
            };

            var html = new HtmlList(header, body, option);

            //if (Comments.Count > 0)
            //{
            //    html.Elements.Add(new HtmlElementHr());
            //}
            html.Elements.AddRange(from x in Comments select x.ToHtml());

            var form = new ControlPanelFormular(Page)
            {
                Name = !string.IsNullOrWhiteSpace(Name)? Name : "form",
                EnableCancelButton = false
            };

            form.SubmitButton.Icon                = "fas fa-paper-plane";
            form.SubmitButton.Text                = "Antworten";
            form.SubmitButton.Outline             = true;
            form.SubmitButton.Size                = TypesSize.Small;
            form.SubmitButton.HorizontalAlignment = TypesHorizontalAlignment.Default;

            form.Add(new ControlFormularItemTextBox(form)
            {
                Format = TypesEditTextFormat.Multiline, Placeholder = "Kommentieren..."
            });

            html.Elements.Add(form.ToHtml());

            return(html);
        }
コード例 #4
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode ToHtml()
        {
            base.Content.Clear();

            if (!string.IsNullOrWhiteSpace(Icon))
            {
                base.Content.Add(new ControlText(Page)
                {
                    Class = Icon, Color = Color, HorizontalAlignment = TypesHorizontalAlignment.Right
                });
            }

            var text = new ControlText(Page)
            {
                Text = Value, Format = TypesTextFormat.H4
            };
            var info = new ControlText(Page)
            {
                Text = Text, Format = TypesTextFormat.Span, Color = TypesTextColor.Muted
            };

            base.Content.Add(new ControlPanel(Page, text, info)
            {
            });

            var color = TypesLayoutProgressBar.Default;

            switch (Color)
            {
            case TypesTextColor.Primary:
                color = TypesLayoutProgressBar.Primary;
                break;

            case TypesTextColor.Success:
                color = TypesLayoutProgressBar.Success;
                break;

            case TypesTextColor.Info:
                color = TypesLayoutProgressBar.Info;
                break;

            case TypesTextColor.Warning:
                color = TypesLayoutProgressBar.Warning;
                break;

            case TypesTextColor.Danger:
                color = TypesLayoutProgressBar.Danger;
                break;

            case TypesTextColor.Light:
                color = TypesLayoutProgressBar.Light;
                break;

            case TypesTextColor.Dark:
                color = TypesLayoutProgressBar.Dark;
                break;
            }

            if (Progress > -1)
            {
                base.Content.Add(new ControlProgressBar(Page)
                {
                    Value = Progress, Format = TypesProgressBarFormat.Striped, Layout = color, Size = TypesSize.Small
                });
            }

            return(base.ToHtml());
        }