diff --git a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/HomeController.cs b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/HomeController.cs index 5fadc83..ea02047 100644 --- a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/HomeController.cs +++ b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Controllers/HomeController.cs @@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Controllers; using System.Text.RegularExpressions; +using System.IO; +using System.Text.Json; namespace Telerik.Examples.Mvc.Controllers { @@ -24,9 +26,8 @@ public HomeController(ILogger logger, IActionDescriptorCollectio } public IActionResult Index() - { - - var demoEndpoints = this._actionDescriptorCollectionProvider.ActionDescriptors.Items + { + var list = this._actionDescriptorCollectionProvider.ActionDescriptors.Items .OfType() .Where(w => w.ControllerName.Replace("Controller",String.Empty) == w.ActionName) .Select(s => new Demo @@ -35,10 +36,11 @@ public IActionResult Index() ControllerName = s.ControllerName, ActionName = s.ActionName }) - .GroupBy(g => g.ComponentName) .ToList(); + + System.IO.File.WriteAllBytes(Directory.GetCurrentDirectory() + "/wwwroot/files/ExamplesEndpoints.txt", JsonSerializer.SerializeToUtf8Bytes(list)); - return View(demoEndpoints); + return View(); } public IActionResult Privacy() diff --git a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Home/Index.cshtml b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Home/Index.cshtml index 53d135b..27f9f7c 100644 --- a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Home/Index.cshtml +++ b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Home/Index.cshtml @@ -1,60 +1,9 @@ @{ - ViewData["Title"] = "Home Page"; + ViewBag.Title = "Home Page"; } -@model IEnumerable> - -

Navigate to an example of your choice

-

The Telerik.Examples.Mvc project is comprised of a number of pages that aim to depict a certain functionality or behavior of the different Telerik UI components.

- - +
+ + + + + + + + + + @(Html.Kendo().PanelBar() + .Name("panelbar") + .Events(e => e.Select("gridSelect")) + .ExpandMode(PanelBarExpandMode.Single) + .Items(panelbar => + { + foreach (var example in (List)JsonSerializer.Deserialize>(File.ReadAllBytes(Directory.GetCurrentDirectory() + "/wwwroot/files/ExamplesEndpoints.txt"))) + { + panelbar.Add().Text(example.ComponentName + " " + System.Text.RegularExpressions.Regex.Replace(example.ActionName, "(\\B[A-Z])", " $1")); + } + })) +
-
- @RenderBody() -
+

@(System.Text.RegularExpressions.Regex.Replace(ViewContext.HttpContext.Request.Path.Value.Split('/')[1], "(\\B[A-Z])", " $1"))

+ @{ + RenderBody(); + var controllerPath = ViewContext.View.Path.Replace("Views","Controllers").Replace(".cshtml", "")+"Controller.cs"; + } + @(Html.Kendo().TabStrip() + .Name("tabstrip-images") + .Items(tabstrip => + { + tabstrip.Add().Text("Sample") + .Selected(true) + .Content(@ +
+ @RenderBody() +
+
); + if (!ViewContext.View.Path.Contains("/Home/")){ + tabstrip.Add().Text(ViewContext.View.Path.Split("/")[3]) + .Content(@ + @{ + string line; + System.IO.StreamReader file = new System.IO.StreamReader(Directory.GetCurrentDirectory() + ViewContext.View.Path); + var fileLines = new List(); + while ((line = file.ReadLine()) != null) + { +
@line
+ } + } +
); + } + + if (File.Exists(Directory.GetCurrentDirectory()+ViewContext.View.Path.Replace("Views", "Controllers").Replace(".cshtml", "") + "Controller.cs")) + { + tabstrip.Add().Text(ViewContext.View.Path.Split("/")[3].Replace(".cshtml","")+"Controller.cs") + .Content(@ + @{ + string line; + System.IO.StreamReader file = new System.IO.StreamReader(Directory.GetCurrentDirectory()+ + ViewContext.View.Path.Replace("Views","Controllers").Replace(".cshtml", "")+"Controller.cs"); + var fileLines = new List(); + while ((line = file.ReadLine()) != null) + { +
@line
+ } + } +
); + } + }))
- © @DateTime.Now.Year Telerik.Examples.Mvc +

Copyright © @DateTime.Now.Year Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.

diff --git a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/css/site.css b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/css/site.css index e679a8e..4841268 100644 --- a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/css/site.css +++ b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/css/site.css @@ -1,71 +1,218 @@ /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification for details on configuring this project to bundle and minify static web assets. */ +/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification +for details on configuring this project to bundle and minify static web assets. */ + +/*#region Layout styles*/ +.toc { + float: left; + display: inline; + margin-left: 50px; +} + +.k-panelbar-item, +.k-panelbar, +.k-link { + cursor: pointer !important; +} + +.toc > ul { + width: 90%; + overflow-y: scroll; + height: 650px; +} + +.container { + margin: auto; +} + +html { + position: relative; + min-height: 100%; +} + +body { + margin-bottom: 80px; +} + +.k-panelbar-item-icon { + width: 25px; + margin-right: 5px; +} + +pre { + margin: 0; + color: darkblue; +} + +.k-searchbox { + margin-bottom: 15px; + font-weight: bold; + width: 90%; +} + a.navbar-brand { - white-space: normal; - text-align: center; - word-break: break-all; + white-space: normal; + text-align: center; + word-break: break-all; +} + +.index-container { + vertical-align: middle; + text-align: center; + width: 1180px; + background-color: aliceblue; + height: 820px; +} + +.title-container { + margin-bottom: 16px; +} + +.k-tabstrip-content.k-active { + height: 855px; + width: 1215px; + margin-bottom: 100px; + overflow: hidden !important; + text-align: left; } /* Provide sufficient contrast against white background */ a { - color: #0366d6; + color: #0366d6; } .btn-primary { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; } .nav-pills .nav-link.active, .nav-pills .show > .nav-link { - color: #fff; - background-color: #1b6ec2; - border-color: #1861ac; + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; } /* Sticky footer styles -------------------------------------------------- */ html { - font-size: 14px; + font-size: 14px; } + @media (min-width: 768px) { - html { - font-size: 16px; - } + html { + font-size: 16px; + } } .border-top { - border-top: 1px solid #e5e5e5; + border-top: 1px solid #e5e5e5; } + .border-bottom { - border-bottom: 1px solid #e5e5e5; + border-bottom: 1px solid #e5e5e5; } .box-shadow { - box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); } button.accept-policy { - font-size: 1rem; - line-height: inherit; + font-size: 1rem; + line-height: inherit; } /* Sticky footer styles -------------------------------------------------- */ html { - position: relative; - min-height: 100%; + position: relative; + min-height: 100%; } body { - /* Margin bottom by footer height */ - margin-bottom: 60px; + /* Margin bottom by footer height */ + margin-bottom: 60px; } + +.footer { + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + line-height: 60px; /* Vertically center the text there */ + margin-bottom: -50px; +} + +a.navbar-brand { + white-space: normal; + text-align: center; + word-break: break-all; +} + +/* Provide sufficient contrast against white background */ +a { + color: #0366d6; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.nav-pills .nav-link.active, .nav-pills .show > .nav-link { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + font-size: 14px; +} + +@media (min-width: 768px) { + html { + font-size: 16px; + } +} + +.border-top { + border-top: 1px solid #e5e5e5; +} + +.border-bottom { + border-bottom: 1px solid #e5e5e5; +} + +.box-shadow { + box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); +} + +button.accept-policy { + font-size: 1rem; + line-height: inherit; +} + +/* Sticky footer styles +-------------------------------------------------- */ +html { + position: relative; + min-height: 100%; +} + +body { + /* Margin bottom by footer height */ + margin-bottom: 60px; +} + .footer { - position: absolute; - bottom: 0; - width: 100%; - white-space: nowrap; - line-height: 60px; /* Vertically center the text there */ + position: absolute; + bottom: 0; + width: 100%; + white-space: nowrap; + line-height: 60px; /* Vertically center the text there */ } diff --git a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/files/ExamplesEndpoints.txt b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/files/ExamplesEndpoints.txt new file mode 100644 index 0000000..7f19cba --- /dev/null +++ b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/files/ExamplesEndpoints.txt @@ -0,0 +1 @@ +[{"ComponentName":"TreeList","ActionName":"TreeListODataBinding","ControllerName":"TreeListODataBinding"},{"ComponentName":"StylesAndLayout","ActionName":"ClientThemeChange","ControllerName":"ClientThemeChange"},{"ComponentName":"Spreadsheet","ActionName":"Spreadsheet_Load_Xlsx_From_Server","ControllerName":"Spreadsheet_Load_Xlsx_From_Server"},{"ComponentName":"Scheduler","ActionName":"SchedulerCustomEdit","ControllerName":"SchedulerCustomEdit"},{"ComponentName":"Scheduler","ActionName":"SchedulerGoogleCalendar","ControllerName":"SchedulerGoogleCalendar"},{"ComponentName":"Scheduler","ActionName":"SchedulerServerFiltering","ControllerName":"SchedulerServerFiltering"},{"ComponentName":"Scheduler","ActionName":"SchedulerSignalR","ControllerName":"SchedulerSignalR"},{"ComponentName":"Scheduler","ActionName":"SchedulerSqlServerBinding","ControllerName":"SchedulerSqlServerBinding"},{"ComponentName":"MultiSelect","ActionName":"Cascading_MultiSelect","ControllerName":"Cascading_MultiSelect"},{"ComponentName":"MultiSelect","ActionName":"MultiSelectPost","ControllerName":"MultiSelectPost"},{"ComponentName":"MultiSelect","ActionName":"MultiSelectPost","ControllerName":"MultiSelectPost"},{"ComponentName":"Menu","ActionName":"SecurityTrimming","ControllerName":"SecurityTrimming"},{"ComponentName":"ListBox","ActionName":"RemoteBinding","ControllerName":"RemoteBinding"},{"ComponentName":"ImageEditor","ActionName":"ImageEditorSave","ControllerName":"ImageEditorSave"},{"ComponentName":"ImageEditor","ActionName":"ImageEditorSave","ControllerName":"ImageEditorSave"},{"ComponentName":"Grid","ActionName":"AjaxBinding","ControllerName":"AjaxBinding"},{"ComponentName":"Grid","ActionName":"AjaxEditing","ControllerName":"AjaxEditing"},{"ComponentName":"Grid","ActionName":"AlternatingRows","ControllerName":"AlternatingRows"},{"ComponentName":"Grid","ActionName":"AsynchronousBindingWithCancellationToken","ControllerName":"AsynchronousBindingWithCancellationToken"},{"ComponentName":"Grid","ActionName":"AudioColumn","ControllerName":"AudioColumn"},{"ComponentName":"Grid","ActionName":"AutocompleteEditorAllowSettingNewValues","ControllerName":"AutocompleteEditorAllowSettingNewValues"},{"ComponentName":"Grid","ActionName":"CustomDataSource","ControllerName":"CustomDataSource"},{"ComponentName":"Grid","ActionName":"CustomPopUpEditor","ControllerName":"CustomPopUpEditor"},{"ComponentName":"Grid","ActionName":"CustomPopUpEditorTagHelper","ControllerName":"CustomPopUpEditorTagHelper"},{"ComponentName":"Grid","ActionName":"DefiningColumnFormat","ControllerName":"DefiningColumnFormat"},{"ComponentName":"Grid","ActionName":"DragAndDropBetweenGrids","ControllerName":"DragAndDropBetweenGrids"},{"ComponentName":"Grid","ActionName":"DynamicBatchEditing","ControllerName":"DynamicBatchEditing"},{"ComponentName":"Grid","ActionName":"Dynamic","ControllerName":"Dynamic"},{"ComponentName":"Grid","ActionName":"DynamicPopupEditing","ControllerName":"DynamicPopupEditing"},{"ComponentName":"Grid","ActionName":"EditingWithCascadingDropDownLists","ControllerName":"EditingWithCascadingDropDownLists"},{"ComponentName":"Grid","ActionName":"EnableOperationsForObjectColumn","ControllerName":"EnableOperationsForObjectColumn"},{"ComponentName":"Grid","ActionName":"EncodedForeignKeyValues","ControllerName":"EncodedForeignKeyValues"},{"ComponentName":"Grid","ActionName":"GridInlineEditingWithNullableBoolean","ControllerName":"GridInlineEditingWithNullableBoolean"},{"ComponentName":"Grid","ActionName":"GridODataBinding","ControllerName":"GridODataBinding"},{"ComponentName":"Grid","ActionName":"Grid_SignalR","ControllerName":"Grid_SignalR"},{"ComponentName":"Grid","ActionName":"HierarchyCrud","ControllerName":"HierarchyCrud"},{"ComponentName":"Grid","ActionName":"HierarchySignalR","ControllerName":"HierarchySignalR"},{"ComponentName":"Grid","ActionName":"Hierarchy_Persist_Expanded_Children","ControllerName":"Hierarchy_Persist_Expanded_Children"},{"ComponentName":"Grid","ActionName":"ListBoxAsEditor","ControllerName":"ListBoxAsEditor"},{"ComponentName":"Grid","ActionName":"MinimalAPI","ControllerName":"MinimalAPI"},{"ComponentName":"Grid","ActionName":"MultiSelectAsEditor","ControllerName":"MultiSelectAsEditor"},{"ComponentName":"Grid","ActionName":"ToggleEditMode","ControllerName":"ToggleEditMode"},{"ComponentName":"Grid","ActionName":"ViewComponent","ControllerName":"ViewComponent"},{"ComponentName":"FormIndex","ActionName":"FormIndex","ControllerName":"FormIndex"},{"ComponentName":"Editor","ActionName":"EditorContent","ControllerName":"EditorContent"},{"ComponentName":"Editor","ActionName":"Editor_Header_And_Footer_Simulation","ControllerName":"Editor_Header_And_Footer_Simulation"},{"ComponentName":"DropDownList","ActionName":"AddItem","ControllerName":"AddItem"},{"ComponentName":"DateTimeOffset","ActionName":"DateTimeOffset","ControllerName":"DateTimeOffset"},{"ComponentName":"Chat","ActionName":"ChatPeerToPeer","ControllerName":"ChatPeerToPeer"},{"ComponentName":"Captcha","ActionName":"CaptchaOverview","ControllerName":"CaptchaOverview"}] \ No newline at end of file diff --git a/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/images/logo.png b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/images/logo.png new file mode 100644 index 0000000..6e93210 Binary files /dev/null and b/Telerik.Examples.Mvc/Telerik.Examples.Mvc/wwwroot/images/logo.png differ