qol: interpolated strings
This commit is contained in:
@@ -22,12 +22,12 @@ namespace Disco.Web.Extensions
|
||||
{
|
||||
var selectItems = default(List<SelectListItem>);
|
||||
if (!SelectedId.HasValue)
|
||||
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = string.Format("{0} ({1})", wpd.Name, wpd.ShortName) }).ToList();
|
||||
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = $"{wpd.Name} ({wpd.ShortName})" }).ToList();
|
||||
else
|
||||
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = string.Format("{0} ({1})", wpd.Name, wpd.ShortName), Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
||||
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = $"{wpd.Name} ({wpd.ShortName})", Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
||||
|
||||
if (IncludeInstructionFirst)
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = String.Format("<{0}>", InstructionMessage), Selected = !SelectedId.HasValue });
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = !SelectedId.HasValue });
|
||||
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Disco.Web.Extensions
|
||||
var selectItems = items.OrderBy(i => i.Text).ToList();
|
||||
|
||||
if (IncludeInstructionFirst)
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = String.Format("<{0}>", InstructionMessage), Selected = (selectedIds?.Count ?? 0) != 0 });
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = (selectedIds?.Count ?? 0) != 0 });
|
||||
|
||||
return selectItems;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ namespace Disco.Web.Extensions
|
||||
selectItems = PluginDefinitions.Select(wpd => new SelectListItem { Value = wpd.Id, Text = wpd.Name, Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
||||
|
||||
if (IncludeInstructionFirst)
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = String.Format("<{0}>", InstructionMessage), Selected = String.IsNullOrEmpty(SelectedId) });
|
||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = String.IsNullOrEmpty(SelectedId) });
|
||||
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Disco.Web.Extensions
|
||||
{
|
||||
public static string ToJavascriptDate(this DateTime d)
|
||||
{
|
||||
return string.Format("new Date({0}, {1}, {2}, {3}, {4}, {5})", d.Year, d.Month - 1, d.Day, d.Hour, d.Minute, d.Second);
|
||||
return $"new Date({d.Year}, {d.Month - 1}, {d.Day}, {d.Hour}, {d.Minute}, {d.Second})";
|
||||
}
|
||||
public static string ToJavascriptDate(this DateTime? d, DateTime? DefaultDate = null)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Disco.Web.Extensions
|
||||
List<string> selectedIds = default(List<string>);
|
||||
|
||||
if (SelectedItems != null)
|
||||
selectedIds = SelectedItems.Select(i => string.Format("{0}_{1}", i.JobTypeId, i.Id)).ToList();
|
||||
selectedIds = SelectedItems.Select(i => $"{i.JobTypeId}_{i.Id}").ToList();
|
||||
|
||||
return jobSubTypes.ToSelectListItems(selectedIds);
|
||||
}
|
||||
@@ -20,9 +20,9 @@ namespace Disco.Web.Extensions
|
||||
public static List<SelectListItem> ToSelectListItems(this IEnumerable<JobSubType> jobSubTypes, List<string> SelectedIds = null, bool IncludeQueueIcons = false)
|
||||
{
|
||||
if (SelectedIds == null)
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description }).ToList();
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = $"{jst.JobTypeId}_{jst.Id}", Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description }).ToList();
|
||||
else
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = string.Format("{0}_{1}", jst.JobTypeId, jst.Id), Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description, Selected = (SelectedIds.Contains(string.Format("{0}_{1}", jst.JobTypeId, jst.Id))) }).ToList();
|
||||
return jobSubTypes.Select(jst => new SelectListItem { Value = $"{jst.JobTypeId}_{jst.Id}", Text = IncludeQueueIcons ? jst.DescriptionWithIcons() : jst.Description, Selected = (SelectedIds.Contains($"{jst.JobTypeId}_{jst.Id}")) }).ToList();
|
||||
}
|
||||
|
||||
public static string DescriptionWithIcons(this JobSubType jst)
|
||||
@@ -32,7 +32,7 @@ namespace Disco.Web.Extensions
|
||||
var sb = new System.Text.StringBuilder(System.Web.HttpUtility.HtmlEncode(jst.Description));
|
||||
|
||||
foreach (var jq in jst.JobQueues)
|
||||
sb.AppendFormat(" <i class=\"queue fa fa-{0} fa-fw d-{1}\" title=\"{2}\"></i>", jq.Icon, jq.IconColour, jq.Name);
|
||||
sb.AppendFormat($" <i class=\"queue fa fa-{jq.Icon} fa-fw d-{jq.IconColour}\" title=\"{jq.Name}\"></i>");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user