Skip to content

Commit

Permalink
Fixed buttons not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathanio123 committed Nov 15, 2024
1 parent 3cf91ca commit ceeb44a
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private SendEmailWithTemplateRequest CreateReportMail(string[] recipients, Proje
}
}, new GoToAction()
{
Title = "Go to Access Management",
Title = "Go to access management",
Url = $"{fusionUri}/apps/org-admin/{contextId}/access-control"
})
.AddGrid("Position allocations expiring next 3 months", new List<GridColumn>()
Expand All @@ -282,7 +282,7 @@ private SendEmailWithTemplateRequest CreateReportMail(string[] recipients, Proje
}
}, new GoToAction()
{
Title = "Go to Position Overview",
Title = "Go to position overview",
Url = $"{fusionUri}/apps/org-admin/{contextId}/edit-positions/listing-view"
})
.AddGrid("TBN positions with start date in less than 3 months", new List<GridColumn>()
Expand All @@ -309,24 +309,44 @@ private SendEmailWithTemplateRequest CreateReportMail(string[] recipients, Proje
}
}, new GoToAction()
{
Title = "Go to Position Overview",
Title = "Go to position overview",
Url = $"{fusionUri}/apps/org-admin/{contextId}/edit-positions/listing-view"
})
.Build();

var subject = $"Weekly summary - {project.Name}";

var html = cardHtmlRenderer.RenderCard(card).Html;

TransformActionButtonsToLinks(html);

return new SendEmailWithTemplateRequest()
{
Recipients = recipients,
Subject = subject,
MailBody = new()
{
HtmlContent = cardHtmlRenderer.RenderCard(card).Html.ToString()
HtmlContent = html.ToString()
}
};
}

private static void TransformActionButtonsToLinks(HtmlTag htmlTag)
{
if (htmlTag.Classes.Contains("ac-action-openUrl") && htmlTag.Attributes.Any(a => a.Key == "data-ac-url"))
{
var url = htmlTag.Attributes.First(a => a.Key == "data-ac-url").Value;
htmlTag.Element = "a";
htmlTag.Attributes.Add("href", url);
return;
}

foreach (var child in htmlTag.Children)
{
TransformActionButtonsToLinks(child);
}
}


private class Project
{
Expand Down

0 comments on commit ceeb44a

Please sign in to comment.