Skip to content

Commit

Permalink
Adding extra case for when both class params are populated.
Browse files Browse the repository at this point in the history
  • Loading branch information
royhyde-dd committed Mar 18, 2019
1 parent 784ab03 commit 8f63031
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/DeloitteDigital.Atlas/Mvc/MvcLink.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using DeloitteDigital.Atlas.FieldRendering;

Expand Down Expand Up @@ -31,7 +32,15 @@ public MvcLink(ViewContext viewContext, ILinkFieldRenderingString linkField, str
if (!string.IsNullOrWhiteSpace(linkField.Description))
this.tagBuilder.Attributes.Add("title", linkField.Description);

if (!string.IsNullOrWhiteSpace(linkField.Class))
if (!string.IsNullOrWhiteSpace(linkField.Class) && !string.IsNullOrWhiteSpace(linkTagClass))
{
var classes = new HashSet<string>();
foreach (var linkClass in linkField.Class.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
classes.Add(linkClass);
foreach (var tagClass in linkTagClass.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
classes.Add(tagClass);
this.tagBuilder.Attributes.Add("class", string.Join(" ", classes));
} else if (!string.IsNullOrWhiteSpace(linkField.Class))
this.tagBuilder.Attributes.Add("class", linkField.Class);
else if (!string.IsNullOrWhiteSpace(linkTagClass))
this.tagBuilder.Attributes.Add("class", linkTagClass);
Expand Down

0 comments on commit 8f63031

Please sign in to comment.