private async Task <IActionResult> RenderMaster(Page page, IContentVersion versionInfo, bool editable, string toolbarView = null) { var contentTreeId = await _contentManager.GetContentTreeId(page.Id, versionInfo.VersionCode); var contentBindings = new ContentBindings { ContentId = page.Id, ContentType = typeof(Page).FullName, VersionCode = versionInfo.VersionCode, ViewPath = "~/UI/Views/Public/Layouts/" + (page.Layout ?? "Default") + ".cshtml", ViewModel = page, Editable = editable, }; var masterPageSettings = new MasterPageSettings { MasterPageId = page.PageMasterId, }; var windowSettings = new ShellSettings { WindowTitle = page.Title, MetaTags = BuildPageMeta(page) }; if (toolbarView != null) { windowSettings.Toolbar = new ToolbarSettings(toolbarView, page); } return(this.MasterPageView(contentBindings, masterPageSettings, windowSettings)); }
public IActionResult PublicView(string id, [FromQuery] string version = null, [FromQuery] bool preview = false) { var newsPost = _newsManager.GetNewsPost(id, version); if (newsPost.IsPrivate && !_newsSecurity.AuthorizeForRead(newsPost)) { return(Unauthorized()); } var settings = new ShellSettings(newsPost.Title); // show toolbar if user is authorized (unless in preview mode) preview = false; if (_newsSecurity.AuthorizeForEdit(newsPost) && !preview) { settings.Toolbar = new ToolbarSettings("~/UI/Views/Public/NewsPostToolbar.cshtml", newsPost); } var bindings = new ContentBindings { ContentType = NewsManager.CONTENT_TYPE_NEWSPOST, ContentId = newsPost.Id, VersionCode = newsPost.VersionCode, ViewPath = "~/UI/Views/Public/NewsPost.cshtml", ViewModel = newsPost, }; return(this.MasterPageView(bindings, settings)); }
public IActionResult ViewEvent(string id, [FromQuery] string version = null, [FromQuery] bool preview = false) { var model = _calendarQueryService.GetEventById(id); // if (blogPost.IsPrivate && !_blogSecurity.AuthorizeForRead(blogPost)) // return Unauthorized(); var settings = new ShellSettings(model.Title); // show toolbar if user is authorized (unless in preview mode) //preview = false; //if (_blogSecurity.AuthorizeForEdit(blogPost) && !preview) //{ // settings.Toolbar = new ToolbarSettings("~/UI/Views/Public/BlogPostToolbar.cshtml", blogPost); //} var bindings = new ContentBindings { ContentType = typeof(CalendarEvent).Name, ContentId = id, VersionCode = "", ViewPath = "~/Views/Admin/Calendar/ViewEventPublic.cshtml", ViewModel = model, }; return(this.MasterPageView(bindings, settings)); }
private IActionResult RenderMaster(PageMaster masterPage, IContentVersion versionInfo, bool editable, string toolbarView = null) { var masterPageSettings = new MasterPageSettings { MasterPageId = masterPage.Id, VersionCode = versionInfo.VersionCode, Editable = editable }; var contentBindings = ContentBindings.Generic("~/UI/Views/Public/Layouts/Empty.cshtml", null); var windowSettings = new ShellSettings(masterPage.Title); if (toolbarView != null) { windowSettings.Toolbar = new ToolbarSettings(toolbarView, masterPage); } return(this.MasterPageView(contentBindings, masterPageSettings, windowSettings)); }