@@ -38,6 +38,21 @@ module.exports = Mn.View.extend({
38
38
console . error ( err ) ;
39
39
} ,
40
40
41
+ showEmpty : function ( ) {
42
+ let manage = App . Cache . User . canManage ( 'redirection_hosts' ) ;
43
+
44
+ this . showChildView ( 'list_region' , new EmptyView ( {
45
+ title : App . i18n ( 'redirection-hosts' , 'empty' ) ,
46
+ subtitle : App . i18n ( 'all-hosts' , 'empty-subtitle' , { manage : manage } ) ,
47
+ link : manage ? App . i18n ( 'redirection-hosts' , 'add' ) : null ,
48
+ btn_color : 'yellow' ,
49
+ permission : 'redirection_hosts' ,
50
+ action : function ( ) {
51
+ App . Controller . showNginxRedirectionForm ( ) ;
52
+ }
53
+ } ) ) ;
54
+ } ,
55
+
41
56
regions : {
42
57
list_region : '@ui.list_region'
43
58
} ,
@@ -78,18 +93,7 @@ module.exports = Mn.View.extend({
78
93
if ( response && response . length ) {
79
94
view . showData ( response ) ;
80
95
} else {
81
- let manage = App . Cache . User . canManage ( 'redirection_hosts' ) ;
82
-
83
- view . showChildView ( 'list_region' , new EmptyView ( {
84
- title : App . i18n ( 'redirection-hosts' , 'empty' ) ,
85
- subtitle : App . i18n ( 'all-hosts' , 'empty-subtitle' , { manage : manage } ) ,
86
- link : manage ? App . i18n ( 'redirection-hosts' , 'add' ) : null ,
87
- btn_color : 'yellow' ,
88
- permission : 'redirection_hosts' ,
89
- action : function ( ) {
90
- App . Controller . showNginxRedirectionForm ( ) ;
91
- }
92
- } ) ) ;
96
+ view . showEmpty ( ) ;
93
97
}
94
98
}
95
99
} )
0 commit comments