Beispiel #1
0
        public HtmlDocument get_events()
        {
            var model = new SSEClientModel{
                Url = _urls.UrlFor<SimpleFlowController>(x => x.get_events_simple(null))
            };

            _document.Model = model;

            _document.Title = "Server Sent Events Test Harness";

            _document.Add(x => x.WriteAssetTagsImmediately(MimeType.Javascript, "jquery", "sse/serverSideEventPage.js"));

            _document.Add("h1").Text("Server Sent Events");
            _document.Add(new HiddenTag().Id("url").Value(model.Url));

            var tag = new LiteralTag(@"
            <table>
            <tr>
            <td>Last message</td>
            <td id='last-message'></td>
            </tr>
            <tr>
            <td>All Messages</td>
            <td><ul id='all-messages'></ul></td>
            </tr>

            </table>

            ".Replace("'", "\""));

            _document.Add(tag);

            return _document;
        }
Beispiel #2
0
        public static HtmlTag PrependGlyph(this HtmlTag tag, string glyphName)
        {
            var glyph = new HtmlTag("i").AddClass(glyphName);
            var literal = new LiteralTag(" ");

            tag.InsertFirst(literal);
            tag.InsertFirst(glyph);

            return tag;
        }