protected override PageContent getContent() => new UiPageContent( pageActions: AppTools.User != null && articleRow.AuthorId == AppTools.User.UserId ? new HyperlinkSetup( Editor.GetInfo(ArticleId), "Edit Article", icon: new ActionComponentIcon(new FontAwesomeIcon("fa-pencil"))) .Append <ActionComponentSetup>( new ButtonSetup( "Delete Article", behavior: new PostBackBehavior( postBack: PostBack.CreateFull( id: "delete", modificationMethod: () => { ArticleTagsModification.DeleteRows(new ArticleTagsTableEqualityConditions.ArticleId(ArticleId)); ArticlesModification.DeleteRows(new ArticlesTableEqualityConditions.ArticleId(ArticleId)); }, actionGetter: () => new PostBackAction(Home.GetInfo()))), icon: new ActionComponentIcon(new FontAwesomeIcon("fa-trash")))) .Materialize() : AppStatics.GetFollowAction(articleRow.AuthorId).Append(getFavoriteAction()).Materialize()) .Add(AppStatics.GetAuthorDisplay(articleRow, UsersTableRetrieval.GetRowMatchingId(articleRow.AuthorId))) .Add(new HtmlBlockContainer(Markdown.ToHtml(articleRow.BodyMarkdown))) .Add(AppStatics.GetTagDisplay(ArticleId, ArticleTagsTableRetrieval.GetRowsLinkedToArticle(ArticleId))) .Add(getCommentComponents());
private UsersModification getMod() { if (AppTools.User != null) { return(UsersTableRetrieval.GetRowMatchingId(AppTools.User.UserId).ToModification()); } var mod = UsersModification.CreateForInsert(); mod.ProfilePictureUrl = ""; mod.ShortBio = ""; return(mod); }
public override IReadOnlyCollection <ActionComponentSetup> GetGlobalNavActions() { if (AppTools.User == null) { var signUpPage = User.GetInfo(); return(new[] { new HyperlinkSetup(Home.GetInfo(), "Home"), new HyperlinkSetup(EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement.Pages.LogIn.GetInfo(Home.GetInfo().GetUrl()), "Sign in"), new HyperlinkSetup(signUpPage, signUpPage.ResourceName) }.ToList()); } return(new[] { new HyperlinkSetup(Home.GetInfo(), "Home"), new HyperlinkSetup(Editor.GetInfo(null), "New Article", icon: new ActionComponentIcon(new FontAwesomeIcon("fa-pencil-square-o"))), new HyperlinkSetup(User.GetInfo(), "Settings", icon: new ActionComponentIcon(new FontAwesomeIcon("fa-cog"))), new HyperlinkSetup(Profile.GetInfo(AppTools.User.UserId), UsersTableRetrieval.GetRowMatchingId(AppTools.User.UserId).Username) }.ToList()); }
internal static ActionComponentSetup GetFollowAction(int userId) { var text = "{0} {1} ({2})".FormatWith( AppTools.User == null || FollowsTableRetrieval.GetRowMatchingPk(AppTools.User.UserId, userId, returnNullIfNoMatch: true) == null ? "Follow" : "Unfollow", UsersTableRetrieval.GetRowMatchingId(userId).Username, FollowsTableRetrieval.GetRows(new FollowsTableEqualityConditions.FolloweeId(userId)).Count()); var icon = new ActionComponentIcon(new FontAwesomeIcon("fa-plus")); return(AppTools.User == null ? (ActionComponentSetup) new HyperlinkSetup(User.GetInfo(), text, icon: icon) : new ButtonSetup( text, behavior: new PostBackBehavior( postBack: FollowsTableRetrieval.GetRowMatchingPk(AppTools.User.UserId, userId, returnNullIfNoMatch: true) == null ? PostBack.CreateFull(id: "follow", modificationMethod: () => FollowsModification.InsertRow(AppTools.User.UserId, userId)) : PostBack.CreateFull( id: "unfollow", modificationMethod: () => FollowsModification.DeleteRows( new FollowsTableEqualityConditions.FollowerId(AppTools.User.UserId), new FollowsTableEqualityConditions.FolloweeId(userId)))), icon: icon)); }
FormsAuthCapableUser FormsAuthCapableUserManagementProvider.GetUser(int userId) => getUserObject(UsersTableRetrieval.GetRowMatchingId(userId, returnNullIfNoMatch: true));
protected override void init() { user = UsersTableRetrieval.GetRowMatchingId(UserId); }