From 5cc7f15909c5c1299959afa9e4a81cad19109959 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Wed, 15 Nov 2017 23:48:12 -0600 Subject: [PATCH] Add /shared-button url --- .../AspNetCoreMvc/Controllers/SamplesController.cs | 10 ++++++++-- Samples/ButtonSample.cs | 5 ++++- Samples/TodoSample.cs | 14 +++++--------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs b/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs index 8fdb508..cf4aa7a 100644 --- a/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs +++ b/PlatformSamples/AspNetCoreMvc/Controllers/SamplesController.cs @@ -50,12 +50,12 @@ namespace AspNetCoreMvc.Controllers public static List Samples => lazySamples.Value; - [Route("/Samples/Run/{name}")] + [Route ("/Samples/Run/{name}")] public IActionResult Run (string name, bool shared) { if (string.IsNullOrWhiteSpace (name) || name.Length > 32) return BadRequest (); - + var s = Samples.FirstOrDefault (x => x.Title == name); if (s == null) return NotFound (); @@ -73,5 +73,11 @@ namespace AspNetCoreMvc.Controllers sharedSamples[s.Title] = e; return e; } + + [Route ("/shared-button")] + public IActionResult SharedButton () + { + return Run ("Button Counter", true); + } } } diff --git a/Samples/ButtonSample.cs b/Samples/ButtonSample.cs index 455499a..7d8a08f 100644 --- a/Samples/ButtonSample.cs +++ b/Samples/ButtonSample.cs @@ -9,7 +9,10 @@ namespace Samples Button MakeButton () { - var button = new Button ("Click me!"); + var button = new Button ("Click me!") { + ClassName = "btn btn-primary", // Some bootstrap styling + }; + button.Style.MarginTop = "2em"; var count = 0; button.Clicked += (s, e) => { count++; diff --git a/Samples/TodoSample.cs b/Samples/TodoSample.cs index 42e1faa..839c8ab 100644 --- a/Samples/TodoSample.cs +++ b/Samples/TodoSample.cs @@ -9,15 +9,6 @@ namespace Samples { public string Title => "Todo List"; - List items = new List () { - ClassName = "list-group", - }; - - public TodoSample () - { - items.Style.MarginTop = "1em"; - } - class Item : ListItem { Element label = new Div (); @@ -48,6 +39,11 @@ namespace Samples Element MakeTodo () { + List items = new List () { + ClassName = "list-group", + }; + items.Style.MarginTop = "1em"; + var heading = new Heading ("Todo List"); var subtitle = new Paragraph ("This is the shared todo list of the world."); var inputForm = new Form {