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

Added support for Video file resource #287

Merged
merged 8 commits into from
Sep 29, 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 @@ -29,6 +29,7 @@ public class EntityResolverTests
[TestCase("roleList", typeof(RoleList))]
[TestCase("sideMenu", typeof(SideMenu))]
[TestCase("textBlock", typeof(TextBlock))]
[TestCase("videoResource", typeof(VideoResource))]
public void Resolves_Correctly(string contentTypeId, Type expectedType)
{
var resolver = new EntityResolver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public partial class PartialsFactoryTests
new object[] { new RoleList(), "_RoleList" },
new object[] { new SideMenu(), "_SideMenu" },
new object[] { new TextBlock(), "_TextBlock" },
new object[] { new VideoResource(), "_VideoResource" },
};

[TestCaseSource(nameof(Successful_Resolves))]
Expand Down
1 change: 1 addition & 0 deletions Childrens-Social-Care-CPD/Contentful/EntityResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Type Resolve(string contentTypeId)
"roleList" => typeof(RoleList),
"sideMenu" => typeof(SideMenu),
"textBlock" => typeof(TextBlock),
"videoResource" => typeof(VideoResource),
_ => null
};
}
Expand Down
10 changes: 10 additions & 0 deletions Childrens-Social-Care-CPD/Contentful/Models/VideoResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Contentful.Core.Models;

namespace Childrens_Social_Care_CPD.Contentful.Models;

public class VideoResource : IContent
{
public string Id { get; set; }
public Asset Video { get; set; }
public Document Transcript { get; set; }
}
1 change: 1 addition & 0 deletions Childrens-Social-Care-CPD/Contentful/PartialsFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static string GetPartialFor(IContent item)
RoleList => "_RoleList",
SideMenu => "_SideMenu",
TextBlock => "_TextBlock",
VideoResource => "_VideoResource",
_ => "_UnknownContentWarning",
};
}
Expand Down
17 changes: 17 additions & 0 deletions Childrens-Social-Care-CPD/Views/Shared/_VideoResource.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@using Childrens_Social_Care_CPD.Contentful.Models;

@model VideoResource

<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<iframe id="player" title="video" type="text/html" class="iframe-border-width" width="640" height="390" allowfullscreen src="@Model.Video.File.Url"></iframe>
<details class="govuk-details govuk-!-margin-top-3" data-module="govuk-details">
<summary class="govuk-details__summary"> <span class="govuk-details__summary-text">View transcript </span></summary>
<div class="govuk-details__text">
@{
await Html.RenderPartialAsync("_RichText", Model.Transcript);
}
</div>
</details>
</div>
</div>
4 changes: 4 additions & 0 deletions Childrens-Social-Care-CPD/styles/scss/overrides/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@

.image-card h2 {
@extend .govuk-heading-m
}

.iframe-border-width {
border-width: 0px;
}
4 changes: 4 additions & 0 deletions Childrens-Social-Care-CPD/wwwroot/css/application.css

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

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Childrens-Social-Care-CPD/wwwroot/css/application.min.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading