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 IReadOnlyCollection <FlowComponent> getNewCommentComponents(UpdateRegionSet createUpdateRegions) { if (AppTools.User == null) { return(new Paragraph( new EwfHyperlink( EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement.Pages.LogIn.GetInfo(Home.GetInfo().GetUrl()), new StandardHyperlinkStyle("Sign in")).Concat(" or ".ToComponents()) .Append(new EwfHyperlink(User.GetInfo(), new StandardHyperlinkStyle("sign up"))) .Concat(" to add comments on this article.".ToComponents()) .Materialize()).ToCollection()); } commentMod = getCommentMod(); return(FormState.ExecuteWithDataModificationsAndDefaultAction( PostBack.CreateIntermediate( createUpdateRegions.ToCollection(), id: "comment", modificationMethod: () => { commentMod.CommentId = MainSequence.GetNextValue(); commentMod.Execute(); }) .ToCollection(), () => new FlowIdContainer( commentMod.GetBodyTextTextControlFormItem( false, label: Enumerable.Empty <PhrasingComponent>().Materialize(), controlSetup: TextControlSetup.Create(numberOfRows: 3, placeholder: "Write a comment..."), value: "") .ToComponentCollection() .Append(new EwfButton(new StandardButtonStyle("Post Comment"))), updateRegionSets: createUpdateRegions.ToCollection()).ToCollection())); }
protected override PageContent getContent() { var mod = getMod(); var password = new DataValue <string> { Value = "" }; Tuple <IReadOnlyCollection <EtherealComponent>, Action <int> > logInHiddenFieldsAndMethod = null; return(FormState.ExecuteWithDataModificationsAndDefaultAction( PostBack.CreateFull( modificationMethod: () => { if (AppTools.User == null) { mod.UserId = MainSequence.GetNextValue(); } if (password.Value.Any()) { var passwordSalter = new Password(password.Value); mod.Salt = passwordSalter.Salt; mod.SaltedPassword = passwordSalter.ComputeSaltedHash(); } mod.Execute(); logInHiddenFieldsAndMethod?.Item2(mod.UserId); }, actionGetter: () => new PostBackAction(logInHiddenFieldsAndMethod != null ? (PageBase)Home.GetInfo() : Profile.GetInfo(AppTools.User.UserId))) .ToCollection(), () => { var content = new UiPageContent(contentFootActions: new ButtonSetup(AppTools.User != null ? "Update Settings" : "Sign up").ToCollection()); if (AppTools.User == null) { content.Add( new EwfHyperlink( EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement.Pages.LogIn.GetInfo(Home.GetInfo().GetUrl()), new StandardHyperlinkStyle("Have an account?"))); } content.Add(getFormItemStack(mod, password)); if (AppTools.User == null) { logInHiddenFieldsAndMethod = FormsAuthStatics.GetLogInHiddenFieldsAndSpecifiedUserLogInMethod(); content.Add(logInHiddenFieldsAndMethod.Item1); } return content; })); }