diff --git a/Template/Website/Controllers/Api/ApiController.cs b/Template/Website/Controllers/Api/ApiController.cs index bb8f772..0a02dbb 100644 --- a/Template/Website/Controllers/Api/ApiController.cs +++ b/Template/Website/Controllers/Api/ApiController.cs @@ -1,12 +1,106 @@ using Domain; +using Microsoft.AspNetCore.Mvc; +using Olive.GlobalSearch; using Olive.Mvc; using Olive.Security; using Olive.Web; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Linq; namespace Controllers { [JwtAuthenticate] public class ApiController : BaseController { + [Route("Api/Q1")] + public async Task Q1(string searcher, string SortExpression, int StartIndex, int Size) + { + var datalist = new List { + new SearchResult() { Title = "ITEM Q1 1", Description ="this is test data for ajax q1" , Url=@"https://www.geeks.ltd.uk/", IconUrl= @"http://www.freelogovectors.net/wp-content/uploads/2015/06/Seo-Tags-Icon.png" } + , new SearchResult() { Title = "ITEM Q1 2", Description ="this is test data for ajax q1" , Url=@"https://www.geeks.ltd.uk/", IconUrl= @"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSmpgcjmXSJhXMYJEb1aX5OBxpzvAvPcWm7ikL8uzUoKWFV_b8d" } + , new SearchResult() { Title = "ITEM Q1 3", Description ="this is test data for ajax q1" , Url=@"https://www.geeks.ltd.uk/", IconUrl= @"https://3.imimg.com/data3/GK/IB/MY-5681630/logo-design-service-250x250.png" } + }; + var tempquery = datalist.Where(p => p.Title.ToLower().Contains(searcher.Trim().ToLower())); + + return new SearchResultList() + { + TotalCount = tempquery.Count(), + SortExpression = SortExpression, + StartIndex = StartIndex, + Size = Size, + Data = tempquery.Skip(StartIndex).Take(Size).ToList() + }; + } + + [Route("Api/Q2")] + public async Task Q2(string searcher, string SortExpression, int StartIndex, int Size) + { + var datalist = new List { + new SearchResult() { Title = "ITEM Q2 1", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 2", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 3", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 4", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 5", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 6", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 7", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 8", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 9", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 10", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 11", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 12", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 13", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 14", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 15", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 16", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 17", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 18", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 19", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 20", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 21", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 22", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + , new SearchResult() { Title = "ITEM Q2 23", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_3_0_3_RC1/branding/logo/lucene-net-icon-256x256.png" } + , new SearchResult() { Title = "ITEM Q2 24", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"http://icons.iconarchive.com/icons/graphicloads/colorful-long-shadow/256/Home-icon.png" } + , new SearchResult() { Title = "ITEM Q2 25", Description ="this is test data for ajax q2", Url=@"/admin/",IconUrl= @"https://dumielauxepices.net/sites/default/files/heart-icons-colorful-636035-3581300.png" } + }; + var tempquery = datalist.Where(p => p.Title.ToLower().Contains(searcher.Trim().ToLower())); + + return new SearchResultList() + { + TotalCount = tempquery.Count(), + SortExpression = SortExpression, + StartIndex = StartIndex, + Size = Size, + Data = tempquery.Skip(StartIndex).Take(Size).ToList() + }; + } + + [Route("Api/Q3")] + public async Task> Q3(string searcher) + { + throw new Exception("INVALID"); + } + + [Route("Api/Q4")] + public async Task Q4(string searcher, string SortExpression, int StartIndex, int Size) + { + return "WRONG OBJECT FORMAT"; + } + + [Route("Api/Q5")] + public async Task Q5(string searcher, string SortExpression, int StartIndex, int Size) + { + return new SearchResultList() { Data = new List() }; + } + } + + public class SearchResultList + { + public List Data { set; get; } + public long TotalCount { set; get; } + public string SortExpression { set; get; } + public long StartIndex { set; get; } + public long Size { set; get; } } } \ No newline at end of file diff --git a/Template/Website/Views/Layouts/FrontEnd.cshtml b/Template/Website/Views/Layouts/FrontEnd.cshtml index fb360e8..e4f21d4 100644 --- a/Template/Website/Views/Layouts/FrontEnd.cshtml +++ b/Template/Website/Views/Layouts/FrontEnd.cshtml @@ -11,7 +11,7 @@ } diff --git a/Template/Website/Website.csproj b/Template/Website/Website.csproj index 8151018..72d683f 100644 --- a/Template/Website/Website.csproj +++ b/Template/Website/Website.csproj @@ -3,7 +3,7 @@ netcoreapp2.1 true false - 2.8 + 3.1 true true diff --git a/Template/Website/wwwroot/scripts/appPage.js b/Template/Website/wwwroot/scripts/appPage.js index 80fb8c5..09cdfb4 100644 --- a/Template/Website/wwwroot/scripts/appPage.js +++ b/Template/Website/wwwroot/scripts/appPage.js @@ -23,6 +23,7 @@ define(["require", "exports", "olive/olivePage"], function (require, exports, ol _super.prototype.initialize.call(this); // This function is called upon every Ajax update as well as the initial page load. // Any custom initiation goes here. + //Override the 'enableCustomCheckbox' and 'enableCustomRadio' with empty methods to use the original controls. }; return AppPage; }(olivePage_1.default)); diff --git a/Template/Website/wwwroot/styles/FrontEnd.scss b/Template/Website/wwwroot/styles/FrontEnd.scss index 18ac61a..f31bc34 100644 --- a/Template/Website/wwwroot/styles/FrontEnd.scss +++ b/Template/Website/wwwroot/styles/FrontEnd.scss @@ -4,6 +4,7 @@ @import "imports/bootstrap-social"; @import "imports/print"; @import "controls/controls"; +@import "controls/globalsearch.scss"; $footer-height: 90px; $footer-top-margin: 30px; diff --git a/Template/Website/wwwroot/styles/controls/globalsearch.scss b/Template/Website/wwwroot/styles/controls/globalsearch.scss new file mode 100644 index 0000000..f67e95c --- /dev/null +++ b/Template/Website/wwwroot/styles/controls/globalsearch.scss @@ -0,0 +1,92 @@ +/* Global Search Styles */ +.global-search-panel { + padding: 0.5rem 1rem; +} + +.global-search-result-panel { + position: absolute; + z-index: 99; + background-color: white; + width: 600px; + border-radius: 0 0 5px 5px; + border: solid thin #ddd; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); +} + +.global-search-result-panel ul { + list-style-type: none; + margin: 0; + padding: 10px; + overflow-y: scroll; +} + +.global-search-result-panel li { + margin-top: 10px; +} + +.global-search-result-panel li:hover { + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); + background-color: #f7f7f7; +} + +.global-search-result-panel a { + color: black; + text-decoration: none; +} + +.global-search-result-panel a:hover { + text-decoration: none; +} + +.global-search-result-panel .item-div { + display: flex; +} + +.global-search-result-panel .item-icon { + float: left; +} + +.global-search-result-panel img { + width: 64px; +} + +.global-search-result-panel .item-title-wrapper { + float: left; + margin: 0 0 0 10px; +} + +.global-search-result-panel .item-title { + color: #333; +} + +.global-search-result-panel .item-description { + color: #777; +} + +.global-search-result-panel p { + text-wrap: normal; +} + +.global-search-result-panel .summary { + color: #6b6b6b; + margin: auto; + background-color: #f5f5f5; + padding-left: 10px; +} + +.global-search-result-panel .summary-element.success { + font-weight: lighter; + font-size: x-small; +} + +.global-search-result-panel .summary-element.warning { + font-weight: lighter; + font-size: x-small; + color: #e38001; +} + +.global-search-result-panel .summary-element.failed { + font-weight: lighter; + font-size: x-small; + color: #ad3535; +}