@@ -31,26 +31,24 @@ public static HtmlString RenderDocTypeGridEditorItem(
31
31
if ( string . IsNullOrWhiteSpace ( previewViewPath ) == false )
32
32
previewViewPath = previewViewPath . EnsureEndsWith ( '/' ) ;
33
33
34
+ var routeValues = new
35
+ {
36
+ dtgeModel = content ,
37
+ dtgeViewPath = viewPath ,
38
+ dtgePreviewViewPath = previewViewPath ,
39
+ dtgePreview = isPreview
40
+ } ;
41
+
34
42
// Try looking for surface controller with action named after the editor alias
35
43
if ( string . IsNullOrWhiteSpace ( editorAlias ) == false && SurfaceControllerHelper . SurfaceControllerExists ( controllerName , editorAlias , true ) )
36
44
{
37
- return helper . Action ( editorAlias , controllerName , new
38
- {
39
- dtgeModel = content ,
40
- dtgeViewPath = viewPath ,
41
- dtgePreviewViewPath = previewViewPath
42
- } ) ;
45
+ return helper . Action ( editorAlias , controllerName , routeValues ) ;
43
46
}
44
47
45
48
// Try looking for surface controller with action named after the doc type alias alias
46
49
if ( SurfaceControllerHelper . SurfaceControllerExists ( controllerName , content . DocumentTypeAlias , true ) )
47
50
{
48
- return helper . Action ( content . DocumentTypeAlias , controllerName , new
49
- {
50
- dtgeModel = content ,
51
- dtgeViewPath = viewPath ,
52
- dtgePreviewViewPath = previewViewPath
53
- } ) ;
51
+ return helper . Action ( content . DocumentTypeAlias , controllerName , routeValues ) ;
54
52
}
55
53
56
54
// See if a default surface controller has been registered
@@ -62,32 +60,17 @@ public static HtmlString RenderDocTypeGridEditorItem(
62
60
// Try looking for an action named after the editor alias
63
61
if ( string . IsNullOrWhiteSpace ( editorAlias ) == false && SurfaceControllerHelper . SurfaceControllerExists ( defaultControllerName , editorAlias , true ) )
64
62
{
65
- return helper . Action ( editorAlias , defaultControllerName , new
66
- {
67
- dtgeModel = content ,
68
- dtgeViewPath = viewPath ,
69
- dtgePreviewViewPath = previewViewPath
70
- } ) ;
63
+ return helper . Action ( editorAlias , defaultControllerName , routeValues ) ;
71
64
}
72
65
73
66
// Try looking for a doc type alias action
74
67
if ( SurfaceControllerHelper . SurfaceControllerExists ( defaultControllerName , content . DocumentTypeAlias , true ) )
75
68
{
76
- return helper . Action ( content . DocumentTypeAlias , defaultControllerName , new
77
- {
78
- dtgeModel = content ,
79
- dtgeViewPath = viewPath ,
80
- dtgePreviewViewPath = previewViewPath
81
- } ) ;
69
+ return helper . Action ( content . DocumentTypeAlias , defaultControllerName , routeValues ) ;
82
70
}
83
71
84
72
// Just go with a default action name
85
- return helper . Action ( "Index" , defaultControllerName , new
86
- {
87
- dtgeModel = content ,
88
- dtgeViewPath = viewPath ,
89
- dtgePreviewViewPath = previewViewPath
90
- } ) ;
73
+ return helper . Action ( "Index" , defaultControllerName , routeValues ) ;
91
74
}
92
75
93
76
// Check for preview view
0 commit comments