mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 21:43:27 +08:00
Work on Routable parts edition
--HG-- branch : theming
This commit is contained in:
parent
91862c6672
commit
a37b464a14
@ -211,7 +211,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var model = _contentManager.BuildEditorModel(contentItem);
|
||||
return View(Shape.Model(Content: model));
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
||||
@ -227,13 +227,13 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
return View(Shape.Model(Content: model));
|
||||
return View(model);
|
||||
}
|
||||
|
||||
if (!contentItem.Has<IPublishingControlAspect>())
|
||||
_contentManager.Publish(contentItem);
|
||||
|
||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(model.TypeDefinition.DisplayName)
|
||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
||||
? T("Your content has been created.")
|
||||
: T("Your {0} has been created.", contentItem.TypeDefinition.DisplayName));
|
||||
return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } });
|
||||
@ -250,7 +250,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
|
||||
var model = _contentManager.BuildEditorModel(contentItem);
|
||||
|
||||
return View(Shape.Model(Content: model));
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@ -266,14 +266,14 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
var model = _contentManager.UpdateEditorModel(contentItem, this);
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
return View("Edit", Shape.Model(Content: model));
|
||||
return View("Edit", model);
|
||||
}
|
||||
|
||||
//need to go about this differently - to know when to publish (IPlublishableAspect ?)
|
||||
if (!contentItem.Has<IPublishingControlAspect>())
|
||||
_contentManager.Publish(contentItem);
|
||||
|
||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(model.TypeDefinition.DisplayName)
|
||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
||||
? T("Your content has been saved.")
|
||||
: T("Your {0} has been saved.", contentItem.TypeDefinition.DisplayName));
|
||||
return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } });
|
||||
|
@ -1,8 +0,0 @@
|
||||
namespace Orchard.Core.Contents.ViewModels {
|
||||
#if REFACTORING
|
||||
public class CreateItemViewModel {
|
||||
public string Id { get; set; }
|
||||
public ContentItemViewModel Content { get; set; }
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace Orchard.Core.Contents.ViewModels {
|
||||
#if REFACTORING
|
||||
public class EditItemViewModel {
|
||||
public int Id { get; set; }
|
||||
public ContentItemViewModel Content { get; set; }
|
||||
}
|
||||
public class DisplayItemViewModel {
|
||||
public ContentItemViewModel Content { get; set; }
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<CreateItemViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<h1><%:Html.TitleForPage((string.IsNullOrWhiteSpace(Model.Content.Item.TypeDefinition.DisplayName) ? T("Create Content") : T("Create {0}", Model.Content.Item.TypeDefinition.DisplayName)).ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%:Html.ValidationSummary() %>
|
||||
<%:Html.EditorForItem(m=>m.Content) %>
|
||||
<%} %>
|
4
src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml
Normal file
4
src/Orchard.Web/Core/Contents/Views/Admin/Create.cshtml
Normal file
@ -0,0 +1,4 @@
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<EditItemViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<h1><%:Html.TitleForPage((string.IsNullOrWhiteSpace(Model.Content.Item.TypeDefinition.DisplayName) ? T("Edit Content") : T("Edit {0}", Model.Content.Item.TypeDefinition.DisplayName)).ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%:Html.ValidationSummary() %>
|
||||
<%:Html.EditorForItem(m=>m.Content) %>
|
||||
<%} %>
|
4
src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml
Normal file
4
src/Orchard.Web/Core/Contents/Views/Admin/Edit.cshtml
Normal file
@ -0,0 +1,4 @@
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
@Display(Model)
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
content item -> @Model.ContentItem.ContentType
|
||||
|
||||
@Display(Model.primary)
|
||||
|
||||
<fieldset>
|
||||
<input class="button primaryAction" type="submit" name="submit.Save" value="@T("Save")"/>
|
||||
</fieldset>
|
@ -106,7 +106,6 @@
|
||||
<Compile Include="PublishLater\Services\IPublishLaterService.cs" />
|
||||
<Compile Include="PublishLater\ViewModels\PublishLaterViewModel.cs" />
|
||||
<Compile Include="Routable\Services\RoutableHomePageProvider.cs" />
|
||||
<Compile Include="Contents\ViewModels\EditItemViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
|
||||
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
|
||||
<Compile Include="Localization\Services\ILocalizationService.cs" />
|
||||
@ -142,7 +141,6 @@
|
||||
<Compile Include="Common\ViewModels\OwnerEditorViewModel.cs" />
|
||||
<Compile Include="Contents\AdminMenu.cs" />
|
||||
<Compile Include="Contents\Controllers\AdminController.cs" />
|
||||
<Compile Include="Contents\ViewModels\CreateItemViewModel.cs" />
|
||||
<Compile Include="Dashboard\AdminMenu.cs" />
|
||||
<Compile Include="Dashboard\Controllers\AdminController.cs" />
|
||||
<Compile Include="Dashboard\Routes.cs" />
|
||||
@ -269,9 +267,9 @@
|
||||
<None Include="Common\Views\EditorTemplates\Parts\Common.Container.cshtml" />
|
||||
<None Include="Common\Views\EditorTemplates\PlainTextEditor.cshtml" />
|
||||
<Content Include="Contents\Module.txt" />
|
||||
<Content Include="Contents\Views\Admin\Edit.ascx" />
|
||||
<None Include="Contents\Views\Admin\Edit.cshtml" />
|
||||
<Content Include="Contents\Views\Admin\CreatableTypeList.ascx" />
|
||||
<Content Include="Contents\Views\Admin\Create.ascx" />
|
||||
<None Include="Contents\Views\Admin\Create.cshtml" />
|
||||
<None Include="Contents\Views\Admin\List.ascx_" />
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.SummaryAdmin.ascx" />
|
||||
|
@ -12,7 +12,9 @@
|
||||
@Html.EditorFor(m => m.PromoteToHomePage)
|
||||
<label for="@ViewData.TemplateInfo.GetFullHtmlFieldId("PromoteToHomePage")" class="forcheckbox">@T("Set as home page")</label>
|
||||
</fieldset>
|
||||
@using (this.Capture("end-of-page-scripts")) {
|
||||
|
||||
@// todo: (sebros) add this script at the end of the page
|
||||
@/*
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
//pull slug input from tab order
|
||||
@ -24,9 +26,9 @@
|
||||
target:slug,
|
||||
url:"@Url.Action("Slugify","Item",new RouteValueDictionary{{"Area","Routable"}})",
|
||||
contentType:"@Model.ContentType",
|
||||
id:"@Model.Id" @if (Model.ContainerId != null) {,
|
||||
containerId:@Model.ContainerId}
|
||||
id:"@Model.Id" @if (Model.ContainerId != null) { <text>, containerId:@Model.ContainerId</text> }
|
||||
})
|
||||
})
|
||||
})</script>
|
||||
}
|
||||
})
|
||||
</script>
|
||||
*/
|
Loading…
Reference in New Issue
Block a user