From 8bc694fe631def96680cc7fa93241b1b4b491027 Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Mon, 16 Mar 2020 15:06:59 -0400 Subject: [PATCH] Label component for field level help --- Oqtane.Client/Modules/Admin/Roles/Edit.razor | 16 ++--- Oqtane.Client/Modules/Controls/Label.razor | 42 +++++++++++ Oqtane.Client/wwwroot/css/app.css | 65 ++++++++++++++++++ Oqtane.Client/wwwroot/images/help.png | Bin 0 -> 801 bytes .../Infrastructure/InstallationManager.cs | 16 ++++- Oqtane.Server/Repository/JobRepository.cs | 3 + Oqtane.Server/wwwroot/css/app.css | 65 ++++++++++++++++++ Oqtane.Server/wwwroot/images/help.png | Bin 0 -> 801 bytes 8 files changed, 196 insertions(+), 11 deletions(-) create mode 100644 Oqtane.Client/Modules/Controls/Label.razor create mode 100644 Oqtane.Client/wwwroot/images/help.png create mode 100644 Oqtane.Server/wwwroot/images/help.png diff --git a/Oqtane.Client/Modules/Admin/Roles/Edit.razor b/Oqtane.Client/Modules/Admin/Roles/Edit.razor index 71bc826a..ebbd5907 100644 --- a/Oqtane.Client/Modules/Admin/Roles/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Roles/Edit.razor @@ -6,26 +6,26 @@
- + - +
- + - +
- + - @@ -33,10 +33,10 @@
- + - diff --git a/Oqtane.Client/Modules/Controls/Label.razor b/Oqtane.Client/Modules/Controls/Label.razor new file mode 100644 index 00000000..6152baa1 --- /dev/null +++ b/Oqtane.Client/Modules/Controls/Label.razor @@ -0,0 +1,42 @@ +@namespace Oqtane.Modules.Controls +@inherits ModuleBase + +@if (!string.IsNullOrEmpty(HelpText)) +{ + @((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel) +} +else +{ + @((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel) +} + +@code { + string _openLabel = ""; + string _closeLabel = ""; + + [Parameter] + public RenderFragment ChildContent { get; set; } // required - the title of the label + + [Parameter] + public string For { get; set; } // optional - the id of the associated input control for accessibility + + [Parameter] + public string Class { get; set; } // optional - the class for the label ( ie. control-label ) + + [Parameter] + public string HelpText { get; set; } // optional - tooltip for this label + + protected override void OnParametersSet() + { + _openLabel = "Px#1ZP1_K>z@;j|==^1poj532;bRa{vG&=KugC=K=Jss|El70=7v+K~y+TV`M-A zCDjcauU@|LU}R*h`S9_R@vmRMz~XFdtPFwz0%!mJ{oBIJ%d=zJgzg_;2_S$Q(A?Rp zcJ|zbn%}?w#QyvD4=RcZn3$Lt1O)|7OG!#3b+y!A0f~VP0BOE{|U_1sNIt z0~LPx@%_irZ{NSa7ZBk0|M>Bf=Kufy!RooWxt>c)OF2yJYQ4n>a`v4&cW3?l`70JA z$;!&gAR#W=J!?vT8Hf)9X*oqvkDol92xN+Y_(0bz77-RoV*>dZ2F- z$y^3Tp=E1*)mo7FnR6HHe*E|$2v!6HKyNTWJcI?Xv$Nln5ErvwvvmIZkmy8SU?A@P z@#E(lkS1in#LUbLWuk-sKiN4r99p~k1Azgv0vH1>Pzg9-VPRol5)u?V3+1B#V9e+} zc<^ZPeIWk+R#=>f)8 z3zM*r;0~Zkr=j9-08I1Gv(l12f-o>9c0q;VK!BhBw2X}O4(8J*j{OM?4ml1?6oJ4P z;f2aG{QU7#&euOsN?u8g@6FqH*+3xyhzukttE(!9v^Um1gJ-7tmJXe}_a4l9_x^(^ zdPu_n$k`y9C8Z>idRiM0nF$8sQ?ogM0p`KU!BGP=$QbBHusA5Rftl;<*RNk&6crVA f05wCiGXnzviHabpJT*b900000NkvXXu0mjfSXFW4 literal 0 HcmV?d00001 diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs index 26457c53..3825d454 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -8,6 +8,7 @@ using Oqtane.Shared; using System; using System.Diagnostics; using Oqtane.Infrastructure.Interfaces; +using Microsoft.Extensions.Caching.Memory; namespace Oqtane.Infrastructure { @@ -15,11 +16,13 @@ namespace Oqtane.Infrastructure { private readonly IHostApplicationLifetime _hostApplicationLifetime; private readonly IWebHostEnvironment _environment; + private readonly IMemoryCache _cache; - public InstallationManager(IHostApplicationLifetime hostApplicationLifetime, IWebHostEnvironment environment) + public InstallationManager(IHostApplicationLifetime hostApplicationLifetime, IWebHostEnvironment environment, IMemoryCache cache) { _hostApplicationLifetime = hostApplicationLifetime; _environment = environment; + _cache = cache; } public void InstallPackages(string folders, bool restart) @@ -107,8 +110,15 @@ namespace Oqtane.Infrastructure if (install && restart) { - // restart application - RestartApplication(); + if (restart) + { + RestartApplication(); + } + else + { + _cache.Remove("moduledefinitions"); + _cache.Remove("jobs"); + } } } diff --git a/Oqtane.Server/Repository/JobRepository.cs b/Oqtane.Server/Repository/JobRepository.cs index 2ea8b7d1..cbe51c19 100644 --- a/Oqtane.Server/Repository/JobRepository.cs +++ b/Oqtane.Server/Repository/JobRepository.cs @@ -31,6 +31,7 @@ namespace Oqtane.Repository { _db.Job.Add(job); _db.SaveChanges(); + _cache.Remove("jobs"); return job; } @@ -38,6 +39,7 @@ namespace Oqtane.Repository { _db.Entry(job).State = EntityState.Modified; _db.SaveChanges(); + _cache.Remove("jobs"); return job; } @@ -51,6 +53,7 @@ namespace Oqtane.Repository Job job = _db.Job.Find(jobId); _db.Job.Remove(job); _db.SaveChanges(); + _cache.Remove("jobs"); } } } diff --git a/Oqtane.Server/wwwroot/css/app.css b/Oqtane.Server/wwwroot/css/app.css index e4253c17..99f6e73e 100644 --- a/Oqtane.Server/wwwroot/css/app.css +++ b/Oqtane.Server/wwwroot/css/app.css @@ -110,3 +110,68 @@ app { padding: inherit; vertical-align: inherit; } + +/* Tooltips */ +.app-tooltip { + cursor: help; + position: relative; +} + + .app-tooltip::before, + .app-tooltip::after { + left: 50%; + opacity: 0; + position: absolute; + z-index: -100; + } + + .app-tooltip:hover::before, + .app-tooltip:focus::before, + .app-tooltip:hover::after, + .app-tooltip:focus::after { + opacity: 1; + transform: scale(1) translateY(0); + z-index: 100; + } + + .app-tooltip::before { + border-style: solid; + border-width: 1em 0.75em 0 0.75em; + border-color: #3E474F transparent transparent transparent; + bottom: 100%; + content: ""; + margin-left: -0.5em; + transition: all .65s cubic-bezier(.84,-0.18,.31,1.26), opacity .65s .5s; + transform: scale(.6) translateY(-90%); + } + + .app-tooltip:hover::before, + .app-tooltip:focus::before { + transition: all .65s cubic-bezier(.84,-0.18,.31,1.26) .2s; + } + + .app-tooltip::after { + background: #3E474F; + border-radius: .25em; + bottom: 180%; + color: #EDEFF0; + content: attr(data-tip); + margin-left: -8.75em; + padding: 1em; + transition: all .65s cubic-bezier(.84,-0.18,.31,1.26) .2s; + transform: scale(.6) translateY(50%); + width: 17.5em; + } + + .app-tooltip:hover::after, + .app-tooltip:focus::after { + transition: all .65s cubic-bezier(.84,-0.18,.31,1.26); + } + +@media (max-width: 760px) { + .app-tooltip::after { + font-size: .75em; + margin-left: -5em; + width: 10em; + } +} \ No newline at end of file diff --git a/Oqtane.Server/wwwroot/images/help.png b/Oqtane.Server/wwwroot/images/help.png new file mode 100644 index 0000000000000000000000000000000000000000..f380be588a5c9285328484aeabd729734626286e GIT binary patch literal 801 zcmV++1K#|JP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vG&=KugC=K=Jss|El70=7v+K~y+TV`M-A zCDjcauU@|LU}R*h`S9_R@vmRMz~XFdtPFwz0%!mJ{oBIJ%d=zJgzg_;2_S$Q(A?Rp zcJ|zbn%}?w#QyvD4=RcZn3$Lt1O)|7OG!#3b+y!A0f~VP0BOE{|U_1sNIt z0~LPx@%_irZ{NSa7ZBk0|M>Bf=Kufy!RooWxt>c)OF2yJYQ4n>a`v4&cW3?l`70JA z$;!&gAR#W=J!?vT8Hf)9X*oqvkDol92xN+Y_(0bz77-RoV*>dZ2F- z$y^3Tp=E1*)mo7FnR6HHe*E|$2v!6HKyNTWJcI?Xv$Nln5ErvwvvmIZkmy8SU?A@P z@#E(lkS1in#LUbLWuk-sKiN4r99p~k1Azgv0vH1>Pzg9-VPRol5)u?V3+1B#V9e+} zc<^ZPeIWk+R#=>f)8 z3zM*r;0~Zkr=j9-08I1Gv(l12f-o>9c0q;VK!BhBw2X}O4(8J*j{OM?4ml1?6oJ4P z;f2aG{QU7#&euOsN?u8g@6FqH*+3xyhzukttE(!9v^Um1gJ-7tmJXe}_a4l9_x^(^ zdPu_n$k`y9C8Z>idRiM0nF$8sQ?ogM0p`KU!BGP=$QbBHusA5Rftl;<*RNk&6crVA f05wCiGXnzviHabpJT*b900000NkvXXu0mjfSXFW4 literal 0 HcmV?d00001