Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Types in Razor files #14324

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</span>
}

if (!String.IsNullOrEmpty(contentItem.Author))
if (!string.IsNullOrEmpty(contentItem.Author))
{
<span class="badge ta-badge font-weight-normal" data-bs-toggle="tooltip" title="@T["Author"]">
<i class="fa-solid fa-user text-secondary me-1" aria-hidden="true"></i>@contentItem.Author
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="card h-100 @String.Join(" ", Model.Classes.ToArray())">
<div class="card h-100 @string.Join(" ", Model.Classes.ToArray())">
@if (Model.Header != null || Model.Leading != null || Model.ActionsMenu != null)
{
<div class="card-header">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="@String.Join(" ", Model.Classes.ToArray())">
<div class="@string.Join(" ", Model.Classes.ToArray())">
@if (Model.Header != null || Model.Meta != null)
{
<div class="widget-header">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="@String.Join(" ", Model.Classes.ToArray())">
<div class="@string.Join(" ", Model.Classes.ToArray())">
@if (Model.Header != null || Model.Meta != null)
{
<div class="widget-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<span asp-validation-for="Alias"></span>
<span class="hint">
@T["The alias of the content item."]
@if (!String.IsNullOrWhiteSpace(Model.Settings.Pattern))
@if (!string.IsNullOrWhiteSpace(Model.Settings.Pattern))
{
@T["Leave empty to re-generate it."]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" id="filter-dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa-solid fa-filter" title="@T["Filters"]" aria-hidden="true"></i>
</button>
<ul class="@String.Join(' ', dropdownClassList)" aria-labelledby="filter-dropdown">
<ul class="@string.Join(' ', dropdownClassList)" aria-labelledby="filter-dropdown">
@foreach (var category in categories)
{
<li><a class="dropdown-item" href="?q=category:@category.Name">@category.LocalizedName(Context.RequestServices)</a></li>
Expand Down Expand Up @@ -136,7 +136,7 @@
<div class="card">
<div class="card-body">
<h4>@T["Current filter"]</h4>
@if (!String.IsNullOrEmpty(Model.FilterResult.ToString()))
@if (!string.IsNullOrEmpty(Model.FilterResult.ToString()))
{
<pre>@Model.FilterResult.ToString()</pre>
<pre class="d-inline">@Model.FilterResult.ToNormalizedString()</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</span>


@if (!String.IsNullOrEmpty(Model.AuditTrailEvent.ClientIpAddress))
@if (!string.IsNullOrEmpty(Model.AuditTrailEvent.ClientIpAddress))
{
<span class="badge ta-badge font-weight-normal" data-bs-toggle="tooltip" title="@T["Client IP Address"]">
<i class="fa-solid fa-wifi text-secondary me-1" aria-hidden="true"></i>@Model.AuditTrailEvent.ClientIpAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
</div>
}

<div class="autoroute-disabled" style="@(Model.Disabled ? "display: none" : String.Empty)">
<div class="autoroute-disabled" style="@(Model.Disabled ? "display: none" : string.Empty)">
<div class="@Orchard.GetWrapperCssClasses()" asp-validation-class-for="Path">
<label asp-for="Path" class="@Orchard.GetLabelCssClasses()">@T["Permalink"]</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="input-group">
@if (!String.IsNullOrWhiteSpace(site.BaseUrl))
@if (!string.IsNullOrWhiteSpace(site.BaseUrl))
{
<div class="input-group-text">@site.BaseUrl</div>
}
Expand All @@ -42,7 +42,7 @@
}
<span asp-validation-for="Path"></span>
</div>
@if (!String.IsNullOrWhiteSpace(Model.Settings.Pattern) && Model.Settings.AllowCustomPath)
@if (!string.IsNullOrWhiteSpace(Model.Settings.Pattern) && Model.Settings.AllowCustomPath)
{
<span class="hint">@T["The url of the content item. Leave empty to auto-generate it."]</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</div>
</div>

@if (!String.IsNullOrWhiteSpace(task.Description))
@if (!string.IsNullOrWhiteSpace(task.Description))
{
<div class="row">
<div class="col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="@Orchard.GetEndCssClasses(true)">
<div class="form-check form-switch">
<input asp-for="Value" type="checkbox" class="form-check-input content-preview-select" checked="@Model.Value" />
<label asp-for="Value" class="form-check-label">@(String.IsNullOrEmpty(settings.Label) ? Model.PartFieldDefinition.DisplayName() : settings.Label)</label>
@if (!String.IsNullOrEmpty(settings.Hint))
<label asp-for="Value" class="form-check-label">@(string.IsNullOrEmpty(settings.Label) ? Model.PartFieldDefinition.DisplayName() : settings.Label)</label>
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint dashed">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<input asp-for="Value" type="checkbox" class="form-check-input content-preview-select" checked="@Model.Value" />
<label class="form-check-label" asp-for="Value">
@(string.IsNullOrEmpty(settings.Label) ? Model.PartFieldDefinition.DisplayName() : settings.Label)
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint dashed">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
@T["No result found"]
</template>
</vue-multiselect>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<input asp-for="Value" type="text" class="form-control content-preview-select datepicker" required="@settings.Required" />
</div>
</div>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<input asp-for="Value" type="date" class="form-control content-preview-select" required="@settings.Required" />
</div>
</div>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</div>

@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@await DisplayAsync(await New.ShortcodeModal())
<div id="@Html.IdFor(x => x.Html)_editor" asp-for="Text" style="min-height: 400px;" class="form-control" dir="@culture.GetLanguageDirection()"></div>
<textarea asp-for="Html" hidden>@Html.Raw(Model.Html)</textarea>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="@Orchard.GetEndCssClasses()">
@await DisplayAsync(await New.ShortcodeModal())
<textarea asp-for="Html" rows="5" class="form-control content-preview-text shortcode-modal-input" dir="@culture.GetLanguageDirection()"></textarea>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else
<textarea asp-for="Html"></textarea>
}

@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<textarea asp-for="Html"></textarea>
}

@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="@Orchard.GetEndCssClasses()">
@await DisplayAsync(await New.ShortcodeModal())
<textarea asp-for="Html" rows="5" class="form-control content-preview-text" dir="@culture.GetLanguageDirection()"></textarea>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@
@using OrchardCore.Mvc.Utilities
@{
var settings = Model.PartFieldDefinition.GetSettings<LinkFieldSettings>();
var isRequired = settings.Required && String.IsNullOrWhiteSpace(settings.DefaultUrl);
var isTextRequired = settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(settings.DefaultText);
var isRequired = settings.Required && string.IsNullOrWhiteSpace(settings.DefaultUrl);
var isTextRequired = settings.LinkTextMode == LinkTextMode.Required && string.IsNullOrWhiteSpace(settings.DefaultText);
var urlClass = settings.Required ? "required" : null;
var textClass = settings.LinkTextMode == LinkTextMode.Required ? "required" : null;
var uniqueName = $"{Model.PartFieldDefinition.PartDefinition.Name}-{Model.PartFieldDefinition.Name}";
var useFormFloating = String.IsNullOrWhiteSpace(settings.UrlPlaceholder) || String.IsNullOrWhiteSpace(settings.TextPlaceholder);
var useFormFloating = string.IsNullOrWhiteSpace(settings.UrlPlaceholder) || string.IsNullOrWhiteSpace(settings.TextPlaceholder);
}

<div class="@Orchard.GetWrapperCssClasses("field-wrapper", $"field-wrapper-{uniqueName.HtmlClassify()}")" id="@Html.IdFor(x => x.Text)_FieldWrapper">
<label asp-for="Url" class="@Orchard.GetLabelCssClasses()">@Model.PartFieldDefinition.DisplayName()</label>
<div class="@Orchard.GetEndCssClasses()">
<div class="row">
<div class="col-md-6" asp-validation-class-for="Url">
<div class="@(useFormFloating ? "form-floating" : String.Empty)">
<div class="@(useFormFloating ? "form-floating" : string.Empty)">
<input asp-for="Url" class="form-control content-preview-text" placeholder="@settings.UrlPlaceholder" required="@isRequired" />
@if (useFormFloating)
{
<label asp-for="Url" class="@urlClass">@T["Url"]</label>
}
</div>

@if (!String.IsNullOrWhiteSpace(settings.Hint))
@if (!string.IsNullOrWhiteSpace(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
</div>
@if (settings.LinkTextMode == LinkTextMode.Optional || settings.LinkTextMode == LinkTextMode.Required)
{
<div class="col-md-6" asp-validation-class-for="Text">
<div class="@(useFormFloating ? "form-floating" : String.Empty)">
<div class="@(useFormFloating ? "form-floating" : string.Empty)">
<input asp-for="Text" type="text" class="form-control content-preview-text" placeholder="@settings.TextPlaceholder" required="@isTextRequired" />
@if (useFormFloating)
{
<label asp-for="Text" class="@textClass">@T["Link text"]</label>
}
</div>

@if (!String.IsNullOrWhiteSpace(settings.HintLinkText))
@if (!string.IsNullOrWhiteSpace(settings.HintLinkText))
{
<span class="hint">@settings.HintLinkText</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
switch (settings.LinkTextMode)
{
case LinkTextMode.Static:
if (!String.IsNullOrWhiteSpace(settings.DefaultText))
if (!string.IsNullOrWhiteSpace(settings.DefaultText))
{
text = settings.DefaultText;
}
Expand All @@ -25,7 +25,7 @@
text = Model.Url;
break;
case LinkTextMode.Optional:
if (String.IsNullOrWhiteSpace(text))
if (string.IsNullOrWhiteSpace(text))
{
text = Model.Url;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@T["No result found"]
</template>
</vue-multiselect>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentEditor = Model.Editor;
}
<option value="" selected="@String.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentEditor)">@T["Standard"]</option>
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
{
var option = options[i];
<div class="form-check">
<input type="checkbox" id="@(Html.IdFor(m => m.Values) + "_" + i)" name="@(Html.NameFor(m => m.Values))" class="form-check-input" value="@option.Value" @(option.Selected ? "checked='checked'" : String.Empty) />
<input type="checkbox" id="@(Html.IdFor(m => m.Values) + "_" + i)" name="@(Html.NameFor(m => m.Values))" class="form-check-input" value="@option.Value" @(option.Selected ? "checked='checked'" : string.Empty) />
<label class="form-check-label" for="@(Html.IdFor(m => m.Values) + "_" + i)">@option.Text</label>
</div>
}

@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</template>
</vue-multiselect>
</div>
@if (!String.IsNullOrEmpty(settings.Hint))
@if (!string.IsNullOrEmpty(settings.Hint))
{
<span class="hint">@settings.Hint</span>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
string currentDisplayMode = Model.DisplayMode;
}
<option value="" selected="@String.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
<option value="" selected="@string.IsNullOrEmpty(currentDisplayMode)">@T["Standard"]</option>
Loading