@@ -55,6 +55,16 @@ module.exports = function (oAppData) {
5555 }
5656 ;
5757
58+ let contactsViewInstance = null ;
59+
60+ const getContactsViewInstance = ( ) => {
61+ if ( ! contactsViewInstance ) {
62+ const CContactsView = require ( 'modules/%ModuleName%/js/views/CContactsView.js' ) ;
63+ contactsViewInstance = new CContactsView ( ) ;
64+ }
65+ return contactsViewInstance ;
66+ } ;
67+
5868 EnumsDeclarator . init ( oAppData , Settings . ServerModuleName ) ;
5969 Settings . init ( oAppData ) ;
6070
@@ -102,14 +112,26 @@ module.exports = function (oAppData) {
102112 ] ) ;
103113 }
104114 fRegisterMessagePaneControllerOnStart ( ) ;
115+
116+ App . broadcastEvent ( 'RegisterNewItemElement' , {
117+ 'item' : {
118+ 'title' : TextUtils . i18n ( '%MODULENAME%/ACTION_NEW_CONTACT' ) ,
119+ 'handler' : ( ) => {
120+ const contactsViewInstance = getContactsViewInstance ( ) ;
121+ const command = contactsViewInstance . newContactCommand
122+ if ( command . enabled ( ) ) {
123+ command ( ) ;
124+ }
125+ } ,
126+ 'hash' : Settings . HashModuleName
127+ } ,
128+ 'name' : '%ModuleName%_NewContact' ,
129+ 'order' : 3 ,
130+ 'column' : 1
131+ } ) ;
105132 } ,
106133 getScreens : function ( ) {
107- var oScreens = { } ;
108- oScreens [ Settings . HashModuleName ] = function ( ) {
109- var CContactsView = require ( 'modules/%ModuleName%/js/views/CContactsView.js' ) ;
110- return new CContactsView ( ) ;
111- } ;
112- return oScreens ;
134+ return { [ Settings . HashModuleName ] : getContactsViewInstance } ;
113135 } ,
114136 getHeaderItem : function ( ) {
115137 return {
0 commit comments