mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Setting up "Add to home page" for page create
--HG-- branch : dev
This commit is contained in:
@@ -142,6 +142,9 @@ namespace Orchard.Pages.Controllers {
|
||||
case "PublishNow":
|
||||
_pageService.Publish(model.Page.Item);
|
||||
Services.Notifier.Information(T("Page has been published"));
|
||||
if (model.PromoteToHomePage) {
|
||||
CurrentSite.HomePage = "PageHomePageProvider;" + model.Page.Item.Id;
|
||||
}
|
||||
break;
|
||||
case "PublishLater":
|
||||
_pageService.Publish(model.Page.Item, model.Page.Item.ScheduledPublishUtc.Value);
|
||||
@@ -164,7 +167,8 @@ namespace Orchard.Pages.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var model = new PageEditViewModel {
|
||||
Page = Services.ContentManager.BuildEditorModel(page)
|
||||
Page = Services.ContentManager.BuildEditorModel(page),
|
||||
PromoteToHomePage = CurrentSite.HomePage == "PageHomePageProvider;" + page.Id
|
||||
};
|
||||
|
||||
return View(model);
|
||||
|
@@ -4,5 +4,6 @@ using Orchard.Pages.Models;
|
||||
namespace Orchard.Pages.ViewModels {
|
||||
public class PageCreateViewModel : BaseViewModel {
|
||||
public ContentItemViewModel<Page> Page { get; set; }
|
||||
public bool PromoteToHomePage { get; set; }
|
||||
}
|
||||
}
|
@@ -4,5 +4,9 @@
|
||||
<h1><%=Html.TitleForPage(T("Add Page").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%=Html.ValidationSummary() %>
|
||||
<%=Html.EditorForItem(m => m.Page) %><%
|
||||
<%=Html.EditorForItem(m => m.Page) %>
|
||||
<fieldset>
|
||||
<%=Html.EditorFor(m => m.PromoteToHomePage) %>
|
||||
<label for="PromoteToHomePage" class="forcheckbox"><%=_Encoded("Set as home page") %></label>
|
||||
</fieldset><%
|
||||
} %>
|
@@ -5,7 +5,8 @@
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%=Html.ValidationSummary() %>
|
||||
<%=Html.EditorForItem(m => m.Page) %>
|
||||
<fieldset>
|
||||
<%=Html.EditorFor(m => m.PromoteToHomePage) %>
|
||||
<label for="PromoteToHomePage" class="forcheckbox"><%=_Encoded("Set as home page") %></label>
|
||||
<%
|
||||
</fieldset><%
|
||||
} %>
|
Reference in New Issue
Block a user