Skip to content

Commit

Permalink
Merge branch 'main' into ma/static-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Jun 7, 2024
2 parents 4f61f40 + 0bf6bd3 commit 63325fe
Show file tree
Hide file tree
Showing 61 changed files with 360 additions and 137 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,15 @@
"contributions": [
"code"
]
},
{
"login": "vsezima",
"name": "Václav Sezima",
"avatar_url": "https://avatars.githubusercontent.com/u/15254338?v=4",
"profile": "https://github.com/vsezima",
"contributions": [
"code"
]
}
],
"skipCi": true,
Expand Down
10 changes: 7 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a bug report to help us improve
title: ''
labels: 'bug :bug:'
assignees: ''
Expand All @@ -10,6 +10,10 @@ assignees: ''

### Describe the bug

### Orchard Core version

Add the version of the Orchard Core NuGet packages you use, or the commit hash if you can reproduce this with the source code.

### To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
Expand All @@ -20,5 +24,5 @@ Steps to reproduce the behavior:
### Expected behavior
A clear and concise description of what you expected to happen.

### Screenshots
If applicable, add screenshots to help explain your problem.
### Logs and screenshots
If applicable, add log files, browser console logs, and screenshots (or screen recording videos) to help explain your problem.
8 changes: 4 additions & 4 deletions .github/workflows/close_stale_prs_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
Closing this pull request because it has been stale for very long. If you think this is still relevant,
feel free to reopen it.
stale-issue-message: >
It seems that this issue didn't really move for quite a while. Is this something you'd like to revisit
any time soon or should we close? Please reply.
It seems that this issue didn't really move for quite a while despite us asking the author for further
feedback. Is this something you'd like to revisit any time soon or should we close? Please reply.
stale-issue-label: stale
days-before-issue-stale: 15
days-before-issue-close: 7
only-issue-labels: needs author feedback
close-issue-message: >
Closing this issue because it has been stale for very long. If you think this is still relevant,
feel free to reopen it.
Closing this issue because it didn't receive further feedback from the author for very long. If you think
this is still relevant, feel free to reopen it with the requested details.
3 changes: 2 additions & 1 deletion .github/workflows/comment_issue_on_triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
runs-on: ubuntu-latest
permissions:
issues: write
if: github.event.issue.state == 'open'
# Despite the trigger being called "issues", this would still run for setting the milestone of PRs too.
if: github.event.issue.pull_request == null && github.event.issue.state == 'open'
steps:
- name: Add Comment
run: gh issue comment "$NUMBER" --body "$BODY"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/community_metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,20 @@ jobs:
shell: pwsh
run: |
Get-Content ./community_metrics.md >> $env:GITHUB_STEP_SUMMARY
- name: Close Previous Issue
shell: pwsh
run: |
# Without the --repo switch, the GH CLI will try to look it up from the current clone, which doesn't exist
# because we don't otherwise need checkout.
$issues = gh issue list --repo '${{ github.repository }}' --label 'community metrics' --state open --json number --jq '.[].number'
foreach ($issue in $issues)
{
gh issue close $issue --repo '${{ github.repository }}' --comment 'Closing this issue as newer community metrics are available.'
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Issue
# v5.0.0
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Build/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<PackageManagement Include="JsonPath.Net" Version="1.1.0" />
<PackageManagement Include="HtmlSanitizer" Version="8.1.860-beta" />
<PackageManagement Include="Irony" Version="1.5.1" />
<PackageManagement Include="libphonenumber-csharp" Version="8.13.37" />
<PackageManagement Include="libphonenumber-csharp" Version="8.13.38" />
<PackageManagement Include="Lorem.Universal.NET" Version="4.0.80" />
<PackageManagement Include="Lucene.Net" Version="4.8.0-beta00016" />
<PackageManagement Include="Lucene.Net.Analysis.Common" Version="4.8.0-beta00016" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public override IDisplayResult Edit(LinkAdminNode treeNode)
model.LinkText = treeNode.LinkText;
model.LinkUrl = treeNode.LinkUrl;
model.IconClass = treeNode.IconClass;
model.Target = treeNode.Target;
var permissions = await _adminMenuPermissionService.GetPermissionsAsync();
Expand All @@ -56,10 +57,11 @@ public override IDisplayResult Edit(LinkAdminNode treeNode)
public override async Task<IDisplayResult> UpdateAsync(LinkAdminNode treeNode, IUpdateModel updater)
{
var model = new LinkAdminNodeViewModel();
await updater.TryUpdateModelAsync(model, Prefix, x => x.LinkUrl, x => x.LinkText, x => x.IconClass, x => x.SelectedPermissionNames);
await updater.TryUpdateModelAsync(model, Prefix, x => x.LinkUrl, x => x.LinkText, x => x.Target, x => x.IconClass, x => x.SelectedPermissionNames);

treeNode.LinkText = model.LinkText;
treeNode.LinkUrl = model.LinkUrl;
treeNode.Target = model.Target;
treeNode.IconClass = model.IconClass;

var selectedPermissions = (model.SelectedPermissionNames == null ? [] : model.SelectedPermissionNames.Split(',', StringSplitOptions.RemoveEmptyEntries));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Task BuildNavigationAsync(MenuItem menuItem, NavigationBuilder builder, I
// Add the actual link.
itemBuilder.Url(nodeLinkUrl);
itemBuilder.Target(node.Target);
itemBuilder.Priority(node.Priority);
itemBuilder.Position(node.Position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class LinkAdminNodeViewModel
[Required]
public string LinkUrl { get; set; }

public string Target { get; set; }

public string IconClass { get; set; }

public string SelectedPermissionNames { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
<span class="hint">@T["The url of the link. A link will be shown only if it or one of their children have a url. The url will be relative to the root of the admin site"]</span>
</div>

<div class="mb-3">
<label asp-for="Target" class="form-label">@T["Target"]</label>
<input asp-for="Target" list="targetOptions" class="form-control" />
<datalist id="targetOptions">
<option value="_self">@T["Opens the linked document in the same frame as it was clicked (this is default)."]</option>
<option value="_blank">@T["Opens the linked document in a new window or tab."]</option>
<option value="_parent">@T["Opens the linked document in the parent frame."]</option>
<option value="_top">@T["Opens the linked document in the full body of the window."]</option>
</datalist>
<span class="hint">@T["The target attribute of the A tag, see more:"] <a class="seedoc" target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target">target</a></span>
</div>

<div class="mb-3">
<label asp-for="IconClass" class="form-label">@T["Icon"]</label>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ var corsApp = new Vue({
allowedHeaders: [],
allowAnyHeader: true,
allowCredentials: true,
isDefaultPolicy: false
isDefaultPolicy: false,
exposedHeaders: []
};
},
editPolicy: function (policy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public async Task<ActionResult> Index()
AllowAnyOrigin = policySetting.AllowAnyOrigin,
AllowedOrigins = policySetting.AllowedOrigins,
AllowCredentials = policySetting.AllowCredentials,
IsDefaultPolicy = policySetting.IsDefaultPolicy
IsDefaultPolicy = policySetting.IsDefaultPolicy,
ExposedHeaders = policySetting.ExposedHeaders,
};

list.Add(policyViewModel);
Expand Down Expand Up @@ -113,7 +114,8 @@ public async Task<ActionResult> IndexPOST()
AllowedHeaders = settingViewModel.AllowedHeaders,
AllowedMethods = settingViewModel.AllowedMethods,
AllowedOrigins = settingViewModel.AllowedOrigins,
IsDefaultPolicy = settingViewModel.IsDefaultPolicy
IsDefaultPolicy = settingViewModel.IsDefaultPolicy,
ExposedHeaders = settingViewModel.ExposedHeaders,
});

if (settingViewModel.AllowAnyOrigin && settingViewModel.AllowCredentials)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public void Configure(CorsOptions options)
{
configurePolicy.DisallowCredentials();
}
if (corsPolicy.ExposedHeaders?.Length > 0)
{
configurePolicy.WithExposedHeaders(corsPolicy.ExposedHeaders);
}
});

if (corsPolicy.IsDefaultPolicy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public class CorsPolicySetting
public bool AllowCredentials { get; set; }

public bool IsDefaultPolicy { get; set; }

public string[] ExposedHeaders { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public class CorsPolicyViewModel
public bool AllowCredentials { get; set; }

public bool IsDefaultPolicy { get; set; }

public string[] ExposedHeaders { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Cors/Views/Admin/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">@T["Exposed headers"]
<span class="hint dashed">@T["Configure which headers should be exposed."]</span>
</h5>

<div>
<span class="hint">@T["Sets response header 'Access-Control-Expose-Headers'."]</span>
<options-list v-bind:options="policy.exposedHeaders" optionType="@T["Header"]" title="@T["Exposed headers"]" subTitle="" />
</div>
</div>
</div>
<div class="mb-3">
<button type="button" class="btn btn-primary" v-on:click="$emit('ok', policy, $event)">@T["Save"]</button>
<button type="button" class="btn btn-secondary" v-on:click="$emit('back')">@T["Cancel"]</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ var corsApp = new Vue({
allowedHeaders: [],
allowAnyHeader: true,
allowCredentials: true,
isDefaultPolicy: false
isDefaultPolicy: false,
exposedHeaders: []
};
},
editPolicy: function editPolicy(policy) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public override IDisplayResult Edit(HtmlMenuItemPart part)
{
model.Name = part.ContentItem.DisplayText;
model.Url = part.Url;
model.Target = part.Target;
model.Html = part.Html;
model.MenuItemPart = part;
});
Expand All @@ -81,6 +82,7 @@ public override async Task<IDisplayResult> UpdateAsync(HtmlMenuItemPart part, IU
part.ContentItem.DisplayText = model.Name;
part.Html = settings.SanitizeHtml ? _htmlSanitizerService.Sanitize(model.Html) : model.Html;
part.Url = model.Url;
part.Target = model.Target;

var urlToValidate = part.Url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public override IDisplayResult Edit(LinkMenuItemPart part)
{
model.Name = part.ContentItem.DisplayText;
model.Url = part.Url;
model.Target = part.Target;
model.MenuItemPart = part;
});
}
Expand All @@ -70,6 +71,7 @@ public override async Task<IDisplayResult> UpdateAsync(LinkMenuItemPart part, IU
await updater.TryUpdateModelAsync(model, Prefix);

part.Url = model.Url;
part.Target = model.Target;
part.ContentItem.DisplayText = model.Name;

var urlToValidate = part.Url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public HtmlMenuItemQueryObjectType()
Name = "HtmlMenuItemPart";

Field(x => x.Url, nullable: true);
Field(x => x.Target, nullable: true);
Field(x => x.Html, nullable: true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ public class HtmlMenuItemPart : ContentPart
/// </summary>
public string Url { get; set; }

/// <summary>
/// The target of the link to create.
/// </summary>
public string Target { get; set; }

/// <summary>
/// The raw html to display for this link.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ public class LinkMenuItemPart : ContentPart
/// The url of the link to create.
/// </summary>
public string Url { get; set; }

/// <summary>
/// The target of the link to create.
/// </summary>
public string Target { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class HtmlMenuItemPartEditViewModel

public string Url { get; set; }

public string Target { get; set; }

public string Html { get; set; }

[BindNever]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class LinkMenuItemPartEditViewModel

public string Url { get; set; }

public string Target { get; set; }

[BindNever]
public LinkMenuItemPart MenuItemPart { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
</div>
</div>

<div class="@Orchard.GetWrapperClasses()">
<label asp-for="Target" class="@Orchard.GetLabelClasses()">@T["Target"]</label>
<div class="@Orchard.GetEndClasses()">
<input asp-for="Target" list="targetOptions" class="form-control" />
<datalist id="targetOptions">
<option value="_self">@T["Opens the linked document in the same frame as it was clicked (this is default)."]</option>
<option value="_blank">@T["Opens the linked document in a new window or tab."]</option>
<option value="_parent">@T["Opens the linked document in the parent frame."]</option>
<option value="_top">@T["Opens the linked document in the full body of the window."]</option>
</datalist>
<span class="hint">@T["The target attribute of the A tag, see more:"] <a class="seedoc" target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target">target</a></span>
</div>
</div>

<div class="@Orchard.GetWrapperClasses()">
<label asp-for="Html" class="@Orchard.GetLabelClasses()">@T["Html"]</label>
<div class="@Orchard.GetEndClasses()">
Expand Down
Loading

0 comments on commit 63325fe

Please sign in to comment.