public void Describing(ImpulseDescribeContext context) {
            context.Impulse("EditItem", T("Edit"), T("Edit this item")).ForPermissions(Orchard.Core.Contents.Permissions.EditContent).OnDisplaying((displaying) => {
                
                var metadata = displaying.Content.ContentItem.ContentManager.GetItemMetadata(displaying.Content);
                var routeValues = metadata.EditorRouteValues;

                // Return URL for detail view (i.e. front end)
                /*
                if (displaying.DisplayType == "Detail") {
                    var IncludeReturnUrl = true;
                }
                if (IncludeReturnUrl)
                {
                    metadata.EditorRouteValues["returnUrl"] = html.ViewContext.HttpContext.Request.RawUrl;
                }
                 */
                displaying.HrefRoute = routeValues;
            });

            context.Impulse("DeleteConnector", T("X"), T("Remove this relationship"))
                .ForPermissions(Orchard.Core.Contents.Permissions.DeleteContent)
                .ForPart<ConnectorPart>(null,(a,c)=> {
                    c.LeftContent.Sockets[c.ContentItem.ContentType].Connectors.Remove(c);
                });

        }
示例#2
0
 public Dictionary<String,ImpulseDescriptor> GetDescriptors() {
     if (_impulseDescriptors == null) {
         var describe = new ImpulseDescribeContext();
         foreach (var p in _impulseGenerators) {
             p.Describing(describe);
         }
         _impulseDescriptors = describe.Impulses;
     }
     return _impulseDescriptors;
 }
示例#3
0
 public Dictionary <String, ImpulseDescriptor> GetDescriptors()
 {
     if (_impulseDescriptors == null)
     {
         var describe = new ImpulseDescribeContext();
         foreach (var p in _impulseGenerators)
         {
             p.Describing(describe);
         }
         _impulseDescriptors = describe.Impulses;
     }
     return(_impulseDescriptors);
 }
 public void Described(ImpulseDescribeContext context) {
 }