mmir.env.view.StubViewEngine
Stub for view/rendering engine:
mocks the function calls and invokes the hooks on the controllers without actually rendering anything.
Example
mmir.present.render('theController', 'theView');
Methods
-
doRenderView(_ctrlName, viewName, view, ctrl, data){Promise}
-
Actually renders the View.
Fetches the layout for the controller, then fills the layout-template with the view content, while incorporating partials and contents that helper methods have provided. Then Dialogs are created and the pageContainer id is updated. At last all the content is localized usingmmir.LanguageManager#translateHTML, and appended to the HTML document of the application, while the old one is removed.
At the end the on_page_load action is performed.Name Type Description _ctrlNameString Name of the controller viewNameString Name of the view to render viewObject View object that is to be rendered ctrlObject Controller object of the view to render dataObject optional optional data for the view. Returns:
Type Description Promise a Promise that gets resolved when rendering is finished -
hideCurrentDialog()
-
Closes a modal window / dialog.
* -
hideWaitDialog()
-
Hides / closes the "wait" dialog.
-
render(_ctrlName, viewName, view, ctrl, data){Promise}
-
Actually renders the View.
Fetches the layout for the controller, then fills the layout-template with the view content, while incorporating partials and contents that helper methods have provided. Then Dialogs are created and the pageContainer id is updated. At last all the content is localized usingmmir.LanguageManager#translateHTML, and appended to the HTML document of the application, while the old one is removed.
At the end the on_page_load action is performed.Name Type Description _ctrlNameString Name of the controller viewNameString Name of the view to render viewObject View object that is to be rendered ctrlObject Controller object of the view to render dataObject optional optional data for the view. Returns:
Type Description Promise a Promise that gets resolved when rendering is finished -
showDialog(_ctrlName, _dialogId, _data){Object}
-
Opens the requested dialog.
Name Type Description _ctrlNameString Name of the controller _dialogIdString Id of the dialog _dataObject Optionally data - not used Returns:
Type Description Object the instance of the current dialog that was opened -
showWaitDialog(_text, _theme)
-
Shows a "wait" dialog, i.e. "work in progress" notification.
Name Type Description _textString optional OPTIONAL the text that should be displayed. If omitted the language setting for loadingTextwill be used instead (from dictionary.json)_themeString optional OPTIONAL set the jQuery Mobile theme to be used for the wait-dialog (e.g. "a" or "b"). NOTE: if this argument is used, then the textmust also be supplied.