From 5575389e76c948f8af242f331018f15a906e3e89 Mon Sep 17 00:00:00 2001 From: Andrei Kurosh Date: Sat, 16 Dec 2023 21:43:40 +0100 Subject: [PATCH] Added support for social profiles in facts list. Closes #250. --- .../Facts/SocialProfilesFactModel.cshtml | 11 ++++ .../Facts/SocialProfilesFactModel.cshtml | 36 +++++++++++++ .../Styles/Components/front/infoblock.scss | 10 ++++ .../Page/Facts/SocialProfilesFactModel.cshtml | 34 ++++++++++++ .../Code/DomainModel/Facts/FactDefinitions.cs | 6 +++ .../Facts/Models/SocialProfilesFactModel.cs | 54 +++++++++++++++++++ 6 files changed, 151 insertions(+) create mode 100644 src/Bonsai/Areas/Admin/Views/Changesets/Facts/SocialProfilesFactModel.cshtml create mode 100644 src/Bonsai/Areas/Admin/Views/Pages/Facts/SocialProfilesFactModel.cshtml create mode 100644 src/Bonsai/Areas/Front/Views/Page/Facts/SocialProfilesFactModel.cshtml create mode 100644 src/Bonsai/Code/DomainModel/Facts/Models/SocialProfilesFactModel.cs diff --git a/src/Bonsai/Areas/Admin/Views/Changesets/Facts/SocialProfilesFactModel.cshtml b/src/Bonsai/Areas/Admin/Views/Changesets/Facts/SocialProfilesFactModel.cshtml new file mode 100644 index 00000000..5a82870a --- /dev/null +++ b/src/Bonsai/Areas/Admin/Views/Changesets/Facts/SocialProfilesFactModel.cshtml @@ -0,0 +1,11 @@ +@using Bonsai.Code.DomainModel.Facts.Models +@using Impworks.Utils.Format +@model SocialProfilesFactModel + +@Model.ShortTitle: + \ No newline at end of file diff --git a/src/Bonsai/Areas/Admin/Views/Pages/Facts/SocialProfilesFactModel.cshtml b/src/Bonsai/Areas/Admin/Views/Pages/Facts/SocialProfilesFactModel.cshtml new file mode 100644 index 00000000..fa3347f6 --- /dev/null +++ b/src/Bonsai/Areas/Admin/Views/Pages/Facts/SocialProfilesFactModel.cshtml @@ -0,0 +1,36 @@ +@using Bonsai.Code.DomainModel.Facts.Models +@using Impworks.Utils.Format + \ No newline at end of file diff --git a/src/Bonsai/Areas/Common/Styles/Components/front/infoblock.scss b/src/Bonsai/Areas/Common/Styles/Components/front/infoblock.scss index 39d9e91b..17a94dd3 100644 --- a/src/Bonsai/Areas/Common/Styles/Components/front/infoblock.scss +++ b/src/Bonsai/Areas/Common/Styles/Components/front/infoblock.scss @@ -94,5 +94,15 @@ .fact-item { margin-bottom: 0.3rem; } + + .big-icons { + font-size: 32px; + line-height: 32px; + + .big-icon { + display: inline-block; + margin-right: 0.5rem; + } + } } } \ No newline at end of file diff --git a/src/Bonsai/Areas/Front/Views/Page/Facts/SocialProfilesFactModel.cshtml b/src/Bonsai/Areas/Front/Views/Page/Facts/SocialProfilesFactModel.cshtml new file mode 100644 index 00000000..93c852b5 --- /dev/null +++ b/src/Bonsai/Areas/Front/Views/Page/Facts/SocialProfilesFactModel.cshtml @@ -0,0 +1,34 @@ +@using Bonsai.Code.DomainModel.Facts.Models +@using Impworks.Utils.Format +@model SocialProfilesFactModel + + + @Model.ShortTitle + + + + @foreach (var item in Model.Values) + { + + + + } + + + +@functions { + string GetIcon(SocialProfileType type) + { + return type switch + { + SocialProfileType.Facebook => "fa-facebook-square", + SocialProfileType.Twitter => "fa-twitter-square", + SocialProfileType.Github => "fa-github", + SocialProfileType.Youtube => "fa-youtube-play", + SocialProfileType.Telegram => "fa-telegram", + SocialProfileType.Odnoklassniki => "fa-odnoklassniki-square", + SocialProfileType.Vkontakte => "fa-vk", + _ => null + }; + } +} diff --git a/src/Bonsai/Code/DomainModel/Facts/FactDefinitions.cs b/src/Bonsai/Code/DomainModel/Facts/FactDefinitions.cs index dbd1b644..5c3d0689 100644 --- a/src/Bonsai/Code/DomainModel/Facts/FactDefinitions.cs +++ b/src/Bonsai/Code/DomainModel/Facts/FactDefinitions.cs @@ -55,6 +55,12 @@ static FactDefinitions() new FactDefinition("Skill", "Хобби"), new FactDefinition("Profession", "Профессия", "Профессия|Профессии"), new FactDefinition("Religion", "Религия", "Религия|Религии") + ), + new FactDefinitionGroup( + "Meta", + "Прочее", + false, + new FactDefinition("SocialProfiles", "Соцсети") ) }, diff --git a/src/Bonsai/Code/DomainModel/Facts/Models/SocialProfilesFactModel.cs b/src/Bonsai/Code/DomainModel/Facts/Models/SocialProfilesFactModel.cs new file mode 100644 index 00000000..b729f20f --- /dev/null +++ b/src/Bonsai/Code/DomainModel/Facts/Models/SocialProfilesFactModel.cs @@ -0,0 +1,54 @@ +using System.ComponentModel; + +namespace Bonsai.Code.DomainModel.Facts.Models +{ + /// + /// Template for specifying known social profile links. + /// + public class SocialProfilesFactModel: FactListModelBase + { + } + + /// + /// Single social profile link. + /// + public class SocialProfileFactItem + { + /// + /// Type of the profile. + /// + public SocialProfileType Type { get; set; } + + /// + /// Link to the profile. + /// + public string Value { get; set; } + } + + /// + /// Known social profile links (to display icons properly). + /// + public enum SocialProfileType + { + [Description("Facebook")] + Facebook, + + [Description("Twitter")] + Twitter, + + [Description("Одноклассники")] + Odnoklassniki, + + [Description("Вконтакте")] + Vkontakte, + + [Description("Telegram")] + Telegram, + + [Description("Youtube")] + Youtube, + + [Description("Github")] + Github, + } +}