mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Implementing Media Part Driver
--HG-- branch : 1.x
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Localization;
|
||||
using Orchard.MediaLibrary.Models;
|
||||
|
||||
namespace Orchard.MediaLibrary.Drivers {
|
||||
public class MediaPartDriver : ContentPartDriver<MediaPart> {
|
||||
|
||||
protected override string Prefix {
|
||||
get { return "MediaPart"; }
|
||||
}
|
||||
|
||||
public MediaPartDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
protected override DriverResult Display(MediaPart part, string displayType, dynamic shapeHelper) {
|
||||
return Combined(
|
||||
ContentShape("Parts_Media_SummaryAdmin", () => shapeHelper.Parts_Media_SummaryAdmin()),
|
||||
@@ -15,6 +26,11 @@ namespace Orchard.MediaLibrary.Drivers {
|
||||
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MediaPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
updater.TryUpdateModel(part, Prefix, new[] {"Caption", "AlternateText"}, null);
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(MediaPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Media_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts.Media.Edit", Model: part, Prefix: Prefix));
|
||||
}
|
||||
|
Reference in New Issue
Block a user