|
28 | 28 | </p> |
29 | 29 | @if (type == "ResourceType") |
30 | 30 | { |
31 | | - if (Convert.ToBoolean(config.ResourceTypeEditingAllowed)) |
| 31 | + if (Convert.ToBoolean(config.ResourceTypeEditingAllowed) && !isDangerAlertDismissed) |
32 | 32 | { |
33 | 33 | <div class="alert alert-danger alert-dismissible fade show" style="margin-bottom: 1rem;" role="alert"> |
34 | 34 | <h4>ATTENTION</h4> |
|
41 | 41 | </p> |
42 | 42 | </div> |
43 | 43 | <div> |
44 | | - <button type="button" class="close btn btn-light" data-bs-dismiss="alert" aria-label="Dismiss"> |
| 44 | + <button type="button" class="close btn btn-light" @onclick="DismissDangerAlert" aria-label="Dismiss"> |
45 | 45 | <span aria-hidden="true">Dismiss</span> |
46 | 46 | </button> |
47 | 47 | </div> |
48 | 48 | </div> |
49 | 49 | } |
50 | | - else |
| 50 | + else if (!isWarningAlertDismissed) |
51 | 51 | { |
52 | 52 | <div class="alert alert-warning alert-dismissible fade show" style="margin-bottom: 1rem;" role="alert"> |
53 | 53 | <h4>NOTE</h4> |
54 | 54 | <div style="margin-bottom: 1rem;"> |
55 | 55 | Resource Type settings are disabled by default. You can allow the editing of these values by enabling the "Resource Type Editing" setting in the Admin section. |
56 | 56 | </div> |
57 | 57 | <div> |
58 | | - <button type="button" class="close btn btn-light" data-bs-dismiss="alert" aria-label="Dismiss"> |
| 58 | + <button type="button" class="close btn btn-light" @onclick="DismissWarningAlert" aria-label="Dismiss"> |
59 | 59 | <span aria-hidden="true">Dismiss</span> |
60 | 60 | </button> |
61 | 61 | </div> |
|
230 | 230 | </div> |
231 | 231 | </div> |
232 | 232 | <div id="typemetdadatacontainer" class="modern-card" style="margin-bottom: 1rem;"> |
233 | | - <div class="modern-card-header"> |
234 | | - <a id="typemetdadatalink" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#typemetdadata" role="button" aria-expanded="false" aria-controls="typemetdadata"> |
235 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Resoure Type Metadata |
236 | | - </a> |
| 233 | + <div class="modern-card-header collapsible @(GetCollapseClass("typemetdadata"))" @onclick="@(() => ToggleCollapse("typemetdadata"))"> |
| 234 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Resource Type Metadata |
237 | 235 | </div> |
238 | | - <div class="collapse modern-card-body" id="typemetdadata"> |
| 236 | + <div class="modern-card-body @(GetCollapseClass("typemetdadata"))" id="typemetdadata"> |
239 | 237 | <div style="margin-bottom: 1rem;"> |
240 | 238 | <p> |
241 | 239 | This section allows you to edit the Resouce Type metadata. |
|
348 | 346 | </div> |
349 | 347 | </div> |
350 | 348 | <div id="typemetdadatadisabledcontainer" class="modern-card" style="margin-bottom: 1rem;"> |
351 | | - <div class="modern-card-header"> |
352 | | - <a id="typemetdadatadisabledlink" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#typemetdadatadisabled" role="button" aria-expanded="false" aria-controls="typemetdadatadisabled"> |
353 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Resoure Type Metadata |
354 | | - </a> |
| 349 | + <div class="modern-card-header collapsible @(GetCollapseClass("typemetdadatadisabled"))" @onclick="@(() => ToggleCollapse("typemetdadatadisabled"))"> |
| 350 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Resource Type Metadata |
355 | 351 | </div> |
356 | | - <div class="collapse modern-card-body" id="typemetdadatadisabled"> |
| 352 | + <div class="modern-card-body @(GetCollapseClass("typemetdadatadisabled"))" id="typemetdadatadisabled"> |
357 | 353 | <div style="margin-bottom: 1rem;"> |
358 | 354 | This section allows you to view the Resouce Type metadata. |
359 | 355 | </div> |
|
442 | 438 | @if (type == "ResourceComponent") |
443 | 439 | { |
444 | 440 | <div id="globallyoptionalcontainer" class="modern-card" style="margin-bottom: 1rem;"> |
445 | | - <div class="modern-card-header"> |
446 | | - <a id="OptionalComponents" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#globallyoptional" role="button" aria-expanded="false" aria-controls="globallyoptional"> |
447 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Globally Optional Configuration |
448 | | - </a> |
| 441 | + <div class="modern-card-header collapsible @(GetCollapseClass("globallyoptional"))" @onclick="@(() => ToggleCollapse("globallyoptional"))"> |
| 442 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Globally Optional Configuration |
449 | 443 | </div> |
450 | | - <div class="collapse modern-card-body" id="globallyoptional"> |
| 444 | + <div class="modern-card-body @(GetCollapseClass("globallyoptional"))" id="globallyoptional"> |
451 | 445 | <div style="margin-bottom: 1rem;"> |
452 | 446 | This section allows you to add/remove the component as OPTIONAL for all resource types. |
453 | 447 | </div> |
|
458 | 452 | This option will ADD the component as OPTIONAL for all resource types. |
459 | 453 | </td> |
460 | 454 | <td> |
461 | | - <button type="button" class="modern-btn-success w-100" @onclick="@(e => FormAction("ResourceComponent","optional-add"))" style="min-width:42px;" title="Add as OPTIONAL for all resoure types"> |
| 455 | + <button type="button" class="modern-btn-success w-100" @onclick="@(e => FormAction("ResourceComponent","optional-add"))" style="min-width:42px;" title="Add as OPTIONAL for all Resource types"> |
462 | 456 | ADD |
463 | 457 | </button> |
464 | 458 | </td> |
|
468 | 462 | This option will REMOVE the component from OPTIONAL for all resource types. |
469 | 463 | </td> |
470 | 464 | <td> |
471 | | - <button type="button" class="modern-btn-danger w-100" @onclick="@(e => FormAction("ResourceComponent","optional-remove"))" style="min-width:42px;" title="Remove as OPTIONAL for all resoure types"> |
| 465 | + <button type="button" class="modern-btn-danger w-100" @onclick="@(e => FormAction("ResourceComponent","optional-remove"))" style="min-width:42px;" title="Remove as OPTIONAL for all Resource types"> |
472 | 466 | REMOVE |
473 | 467 | </button> |
474 | 468 | </td> |
|
478 | 472 | </div> |
479 | 473 | </div> |
480 | 474 | <div id="globallyexcludecontainer" class="modern-card" style="margin-bottom: 1rem;"> |
481 | | - <div class="modern-card-header"> |
482 | | - <a id="OptionalComponents" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#globallyexclude" role="button" aria-expanded="false" aria-controls="globallyexclude"> |
483 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Globally Exclude Configuration |
484 | | - </a> |
| 475 | + <div class="modern-card-header collapsible @(GetCollapseClass("globallyexclude"))" @onclick="@(() => ToggleCollapse("globallyexclude"))"> |
| 476 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Globally Exclude Configuration |
485 | 477 | </div> |
486 | | - <div class="collapse modern-card-body" id="globallyexclude"> |
| 478 | + <div class="modern-card-body @(GetCollapseClass("globallyexclude"))" id="globallyexclude"> |
487 | 479 | <div style="margin-bottom: 1rem;"> |
488 | 480 | This section allows you to add/remove the component as EXCLUDE for all resource types. |
489 | 481 | </div> |
|
494 | 486 | This option will ADD the component as EXCLUDE for all resource types. |
495 | 487 | </td> |
496 | 488 | <td> |
497 | | - <button type="button" class="modern-btn-success w-100" @onclick="@(e => FormAction("ResourceComponent","exclude-add"))" style="min-width:42px;" title="Add as EXCLUDE for all resoure types"> |
| 489 | + <button type="button" class="modern-btn-success w-100" @onclick="@(e => FormAction("ResourceComponent","exclude-add"))" style="min-width:42px;" title="Add as EXCLUDE for all Resource types"> |
498 | 490 | ADD |
499 | 491 | </button> |
500 | 492 | </td> |
|
504 | 496 | This option will REMOVE the component from EXCLUDE for all resource types. |
505 | 497 | </td> |
506 | 498 | <td> |
507 | | - <button type="button" class="modern-btn-danger w-100" @onclick="@(e => FormAction("ResourceComponent","exclude-remove"))" style="min-width:42px;" title="Remove as EXCLUDE for all resoure types"> |
| 499 | + <button type="button" class="modern-btn-danger w-100" @onclick="@(e => FormAction("ResourceComponent","exclude-remove"))" style="min-width:42px;" title="Remove as EXCLUDE for all Resource types"> |
508 | 500 | REMOVE |
509 | 501 | </button> |
510 | 502 | </td> |
|
517 | 509 | @if ((type == "ResourceType") && (GeneralHelper.IsNotNull(resourceComponents))) |
518 | 510 | { |
519 | 511 | <div id="optional" class="modern-card" style="margin-bottom: 1rem;"> |
520 | | - <div class="modern-card-header"> |
521 | | - <a id="OptionalComponents" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#optionalcomponents" role="button" aria-expanded="false" aria-controls="optionalcomponents"> |
522 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Optional Components |
523 | | - </a> |
| 512 | + <div class="modern-card-header collapsible @(GetCollapseClass("optionalcomponents"))" @onclick="@(() => ToggleCollapse("optionalcomponents"))"> |
| 513 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Optional Components |
524 | 514 | </div> |
525 | | - <div class="collapse modern-card-body" id="optionalcomponents"> |
| 515 | + <div class="modern-card-body @(GetCollapseClass("optionalcomponents"))" id="optionalcomponents"> |
526 | 516 | @foreach (ResourceComponent resourceComponent in resourceComponents) |
527 | 517 | { |
528 | 518 | if (resourceComponent.Name != "ResourceType") |
|
549 | 539 | </div> |
550 | 540 |
|
551 | 541 | <div id="excluded" class="modern-card" style="margin-bottom: 1rem;"> |
552 | | - <div class="modern-card-header"> |
553 | | - <a id="ExcludedComponents" class="link-dark text-decoration-none" data-bs-toggle="collapse" href="#excludedcomponents" role="button" aria-expanded="false" aria-controls="excludedcomponents"> |
554 | | - <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Excluded Components |
555 | | - </a> |
| 542 | + <div class="modern-card-header collapsible @(GetCollapseClass("excludedcomponents"))" @onclick="@(() => ToggleCollapse("excludedcomponents"))"> |
| 543 | + <span class="oi oi-chevron-bottom" aria-hidden="true"></span> Excluded Components |
556 | 544 | </div> |
557 | | - <div class="collapse modern-card-body" id="excludedcomponents"> |
| 545 | + <div class="modern-card-body @(GetCollapseClass("excludedcomponents"))" id="excludedcomponents"> |
558 | 546 | @foreach (ResourceComponent resourceComponent in resourceComponents) |
559 | 547 | { |
560 | 548 | //@if (resourceComponent.Name != "ResourceType") |
|
645 | 633 | public IAdminLogService? AdminLogService { get; set; } |
646 | 634 |
|
647 | 635 | private ServiceResponse serviceResponse = new(); |
| 636 | + private bool isDangerAlertDismissed = false; |
| 637 | + private bool isWarningAlertDismissed = false; |
648 | 638 | private string itemName = String.Empty; |
649 | 639 | private string itemDisplayName = String.Empty; |
650 | 640 | private string itemShortName = String.Empty; |
|
1183 | 1173 |
|
1184 | 1174 |
|
1185 | 1175 | async Task Cancel() => await ModalInstance.CancelAsync(); |
1186 | | -} |
| 1176 | + |
| 1177 | + // Collapse management for sections |
| 1178 | + private HashSet<string> collapsedSections = new HashSet<string> |
| 1179 | + { |
| 1180 | + "typemetdadata", |
| 1181 | + "typemetdadatadisabled", |
| 1182 | + "globallyoptional", |
| 1183 | + "globallyexclude", |
| 1184 | + "optionalcomponents", |
| 1185 | + "excludedcomponents" |
| 1186 | + }; |
| 1187 | + |
| 1188 | + private void ToggleCollapse(string section) |
| 1189 | + { |
| 1190 | + if (collapsedSections.Contains(section)) |
| 1191 | + { |
| 1192 | + collapsedSections.Remove(section); |
| 1193 | + } |
| 1194 | + else |
| 1195 | + { |
| 1196 | + collapsedSections.Add(section); |
| 1197 | + } |
| 1198 | + } |
1187 | 1199 |
|
| 1200 | + private string GetCollapseClass(string section) |
| 1201 | + { |
| 1202 | + return collapsedSections.Contains(section) ? "collapsed" : ""; |
| 1203 | + } |
1188 | 1204 |
|
| 1205 | + private void DismissDangerAlert() |
| 1206 | + { |
| 1207 | + isDangerAlertDismissed = true; |
| 1208 | + } |
1189 | 1209 |
|
| 1210 | + private void DismissWarningAlert() |
| 1211 | + { |
| 1212 | + isWarningAlertDismissed = true; |
| 1213 | + } |
| 1214 | +} |
0 commit comments