Orchard.AuditTrail help

Topics: Writing modules
Mar 20, 2015 at 9:45 PM
Hey - I was just wondering if there were any resources out there that I could use to learn more about the AuditTrail module with Orchard. I have been able to create my event provider and added methods within the handler for my part and for the most part it works fine. When I "update" a content item that action is being written to the audit trail log, and I can see it in the list view for Audit Trail.

However, it is not writing to the Audit Trail log for the specific Content Item - and I am not able to display the text that I want in the main list...

Here is what I have right now:
Provider:
public class DiscardDraftEventProvider : AuditTrailEventProviderBase {
        private readonly IContentManager _contentManager;
        public DiscardDraftEventProvider(IContentManager contentManager) {
            _contentManager = contentManager;
        }
        public const string DiscardDraft = "DiscardDraft";

       public override void Describe(DescribeContext context) {
            context.For("Content", T("Content Items"))
                .Event(this, DiscardDraft, T("Draft Version Discarded"), T("The draft was replaced with the previously published version."), enableByDefault: true, isMandatory: true);
       }
    }
code in Handler:
private void EndUpdateEvent(UpdateContentContext context, ContentPart part) {
            var newVersionNumber = context.UpdatingItemVersionRecord.Number;
            
            _auditTrailManager.CreateRecord<DiscardDraftEventProvider>(
                eventName: DiscardDraftEventProvider.DiscardDraft,
                eventData: new Dictionary<string, object> {
                    {"OldVersion", _oldVersionNumber},
                    {"CurrentVersion", _currentVersionNumber},
                    {"NewVersion", newVersionNumber},
                    {"ContentItem", context.ContentItem}
                },
                user: _wca.GetContext().CurrentUser);
        }
Any help would be most appreciative!

Justin
Developer
Mar 20, 2015 at 10:30 PM
Edited Mar 20, 2015 at 10:30 PM
Did you provide a shape template using the alternate based on event name like is done for the other events in the audit trail module?
Mar 24, 2015 at 8:38 PM
Doh! Thanks Sipke - I realize that I named my template incorrectly.

At least, now it is showing up correctly in the main audit trail list.

Do I need to do anything different to have it show up for the specific Content Item view?