Skip to content

Commit

Permalink
GH-69 :: refactoring and renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
kentico-matthews committed Aug 29, 2024
1 parent 7892623 commit 58a0713
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public partial class GeneralArticle : IContentItemFieldsSource, IArticleSchema


/// <summary>
/// ArticleSchemaTaxonomy.
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaTaxonomy { get; set; }
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public partial class Interview : IContentItemFieldsSource, IArticleSchema


/// <summary>
/// IntervieweeName.
/// InterviewRespondantName.
/// </summary>
public string IntervieweeName { get; set; }
public string InterviewRespondantName { get; set; }


/// <summary>
Expand Down Expand Up @@ -71,8 +71,8 @@ public partial class Interview : IContentItemFieldsSource, IArticleSchema


/// <summary>
/// ArticleSchemaTaxonomy.
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaTaxonomy { get; set; }
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public interface IArticleSchema


/// <summary>
/// ArticleSchemaTaxonomy.
/// ArticleSchemaCategory.
/// </summary>
public IEnumerable<TagReference> ArticleSchemaTaxonomy { get; set; }
public IEnumerable<TagReference> ArticleSchemaCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
<SelectionType>contentTypes</SelectionType>
</settings>
</field>
<field allowempty="true" column="ArticleSchemaTaxonomy" columnprecision="0" columntype="taxonomy" enabled="true" guid="7a10c083-cc91-4cf0-88af-66f580c90aa3" visible="true">
<field allowempty="true" column="ArticleSchemaCategory" columnprecision="0" columntype="taxonomy" enabled="true" guid="7a10c083-cc91-4cf0-88af-66f580c90aa3" visible="true">
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>Tags</fieldcaption>
<fieldcaption>Categories</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
<kxp_schema_identifier>c3b4896f-ba7c-4b75-9cd4-47afa7489ff1</kxp_schema_identifier>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions .../aboutconifers-ioz7lmio@6cc03949c4/[email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.contentitemcommondata>
<ArticleSchemaSummary>Information about coniferous trees</ArticleSchemaSummary>
<ArticleSchemaTaxonomy>
<ArticleSchemaCategory>
<![CDATA[[{"Identifier":"34ebdcf5-20d6-4ecc-90e6-fc150dd5b36f"}]]]>
</ArticleSchemaTaxonomy>
</ArticleSchemaCategory>
<ArticleSchemaSummary>Information about coniferous trees</ArticleSchemaSummary>
<ArticleSchemaTeaser>
<![CDATA[[{"Identifier":"0886d8a4-9c55-44a4-90f2-6346c878beed"}]]]>
</ArticleSchemaTeaser>
Expand Down
6 changes: 3 additions & 3 deletions ...ata/aboutfrogs-fgk2dl5o@6f58670996/[email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.contentitemcommondata>
<ArticleSchemaSummary>Learn some facts about frogs</ArticleSchemaSummary>
<ArticleSchemaTaxonomy>
<ArticleSchemaCategory>
<![CDATA[[{"Identifier":"04ab8b7e-f25b-4d3e-9e78-bf319a5f9140"}]]]>
</ArticleSchemaTaxonomy>
</ArticleSchemaCategory>
<ArticleSchemaSummary>Learn some facts about frogs</ArticleSchemaSummary>
<ArticleSchemaTeaser>
<![CDATA[[{"Identifier":"e1f1110e-93f1-4fec-94c8-571f6fbd2e26"}]]]>
</ArticleSchemaTeaser>
Expand Down
6 changes: 3 additions & 3 deletions ...dry..jacktrott-52rzr7c8@a9141e9f85/[email protected]
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.contentitemcommondata>
<ArticleSchemaCategory>
<![CDATA[[{"Identifier":"34ebdcf5-20d6-4ecc-90e6-fc150dd5b36f"}]]]>
</ArticleSchemaCategory>
<ArticleSchemaSummary>
<![CDATA[Exclusive interview with Jack Trott, a well-known figure in the world of bean plant husbandry.]]>
</ArticleSchemaSummary>
<ArticleSchemaTaxonomy>
<![CDATA[[{"Identifier":"34ebdcf5-20d6-4ecc-90e6-fc150dd5b36f"}]]]>
</ArticleSchemaTaxonomy>
<ArticleSchemaTeaser>
<![CDATA[[{"Identifier":"e97fb6c2-06cf-4b82-bc92-ff4cf3dcd37c"}]]]>
</ArticleSchemaTeaser>
Expand Down
6 changes: 3 additions & 3 deletions ...erv..lebo-peep-igkjtmw8@1140809b72/[email protected]
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.contentitemcommondata>
<ArticleSchemaCategory>
<![CDATA[[{"Identifier":"04ab8b7e-f25b-4d3e-9e78-bf319a5f9140"}]]]>
</ArticleSchemaCategory>
<ArticleSchemaSummary>
<![CDATA[Exclusive interview with Little Bo-Peep, a renowned shepherdess known for her unique approach to sheep care.]]>
</ArticleSchemaSummary>
<ArticleSchemaTaxonomy>
<![CDATA[[{"Identifier":"04ab8b7e-f25b-4d3e-9e78-bf319a5f9140"}]]]>
</ArticleSchemaTaxonomy>
<ArticleSchemaTeaser>
<![CDATA[[{"Identifier":"4e50366d-a316-4ec0-8909-c97868aa7597"}]]]>
</ArticleSchemaTeaser>
Expand Down
2 changes: 1 addition & 1 deletion ...ommondata/home-ciuaqx9l@e720e8f8d0/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ContentItemCommonDataContentLanguageID>
<ContentItemCommonDataGUID>bae62ea1-c2f8-43c6-852f-680cb2645724</ContentItemCommonDataGUID>
<ContentItemCommonDataIsLatest>True</ContentItemCommonDataIsLatest>
<ContentItemCommonDataLastPublishedWhen>2024-03-14 03:15:55Z</ContentItemCommonDataLastPublishedWhen>
<ContentItemCommonDataLastPublishedWhen>2024-08-29 17:25:10Z</ContentItemCommonDataLastPublishedWhen>
<ContentItemCommonDataPageBuilderWidgets>
<![CDATA[{"editableAreas":[{"identifier":"areaMain","sections":[{"identifier":"b23942e8-ea2f-4754-9c81-b221abee820c","type":"TrainingGuides.SingleColumnSection","properties":{"sectionAnchor":null},"zones":[{"identifier":"d8798668-95ef-4ef4-b4fb-ed7480c4a161","widgets":[{"identifier":"3ffd6e80-6eda-4eb2-ac26-55f8d5dcba61","type":"Kentico.Widget.RichText","variants":[{"identifier":"24ca3365-1c4b-468d-8515-389ad1400aca","properties":{"content":"<p>Hello world!</p>"},"fieldIdentifiers":{"content":"cc1f8cc3-c9bf-4042-aeda-45d63e955f84"}}]}]}],"fieldIdentifiers":{"sectionAnchor":"6a4bb2cf-9e6c-4d16-b9e8-6c33ca63a9ae"}}]}]}]]>
</ContentItemCommonDataPageBuilderWidgets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.ComponentModel;
using Kentico.PageBuilder.Web.Mvc;
using Kentico.Xperience.Admin.Base.FormAnnotations;
using Kentico.Xperience.Admin.Websites.FormAnnotations;
Expand All @@ -12,7 +11,7 @@ public class ArticleListWidgetProperties : IWidgetProperties
MaximumPages = 1,
Sortable = true,
Order = 10)]
public IEnumerable<WebPageRelatedItem>? ContentTreeSection { get; set; }
public IEnumerable<WebPageRelatedItem> ContentTreeSection { get; set; } = Enumerable.Empty<WebPageRelatedItem>();

[NumberInputComponent(
Label = "Number of articles to display",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

@model TrainingGuides.Web.Features.Articles.Widgets.FeaturedArticle.FeaturedArticleWidgetViewModel?

@if (Model is null || Model.IsMisconfigured)
@if (Model is null || Model.IsMisconfigured || Model.Article is null )
{
<tg-page-builder-content>
<div class="c-card md bg-1 u-border-02 text-center">
<tg-configure-widget-instructions/>
<h3>Featured article</h3>
<p>No valid article selected</p>
</div>
</tg-page-builder-content>

return;
}

@if (Model is {Article: not null })
else
{
<div class="c-card md bg-1 u-border-02 text-center mt-4">
@if (Model.Article.TeaserImage != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class FeaturedArticleWidgetProperties : IWidgetProperties
MaximumPages = 1,
Sortable = true,
Order = 10)]
public IEnumerable<WebPageRelatedItem> Article { get; set; } = null!;
public IEnumerable<WebPageRelatedItem> Article { get; set; } = Enumerable.Empty<WebPageRelatedItem>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using TrainingGuides.Web.Features.Articles.Services;

[assembly:
RegisterWidget(FeaturedArticleWidgetViewComponent.IDENTIFIER, typeof(FeaturedArticleWidgetViewComponent), "Featured news",
typeof(FeaturedArticleWidgetProperties), Description = "Displays the featured news.", IconClass = "icon-ribbon")]
RegisterWidget(FeaturedArticleWidgetViewComponent.IDENTIFIER, typeof(FeaturedArticleWidgetViewComponent), "Featured article",
typeof(FeaturedArticleWidgetProperties), Description = "Displays a featured article of your choosing.", IconClass = "icon-ribbon")]

namespace TrainingGuides.Web.Features.Articles.Widgets.FeaturedArticle;

Expand All @@ -34,14 +34,14 @@ public async Task<ViewViewComponentResult> InvokeAsync(FeaturedArticleWidgetProp
guid.Value,
ArticlePage.CONTENT_TYPE_NAME,
3)
: null;
: new ArticlePage();

var model = articlePage != null
? new FeaturedArticleWidgetViewModel()
{
Article = await articlePageService.GetArticlePageViewModel(articlePage)
}
: null;
: new FeaturedArticleWidgetViewModel();

return View("~/Features/Articles/Widgets/FeaturedArticle/FeaturedArticleWidget.cshtml", model);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using TrainingGuides.Web.Features.Shared.Models;

namespace TrainingGuides.Web.Features.Articles.Widgets.FeaturedArticle;

public class FeaturedArticleWidgetViewModel : WidgetViewModel
{
public ArticlePageViewModel Article { get; set; } = new ArticlePageViewModel();

public override bool IsMisconfigured => string.IsNullOrWhiteSpace(Article.Title)
|| string.IsNullOrWhiteSpace(Article.Summary.ToString())
|| Article.TeaserImage == null
|| string.IsNullOrWhiteSpace(Article.Url);
}

0 comments on commit 58a0713

Please sign in to comment.