Skip to content

Instantly share code, notes, and snippets.

@boghyon
Last active August 21, 2018 17:29
Show Gist options
  • Save boghyon/f02a2e7237aed5a0b08b3944f6cacd48 to your computer and use it in GitHub Desktop.
Save boghyon/f02a2e7237aed5a0b08b3944f6cacd48 to your computer and use it in GitHub Desktop.
UI5 basic template
{
window["sap-ui-config"] = {
libs: "sap.ui.core, sap.m",
preload: "async",
theme: "sap_belize",
compatVersion: "edge",
resourceRoots: {
"demo": "./"
},
"xx-componentPreload": "off",
"xx-waitForTheme": true,
"xx-async": true,
"xx-xml-processing": "sequential",
"xx-supportedLanguages": "",
};
}
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("demo.Component", {
metadata: {
manifest: "json"
},
init: function() {
UIComponent.prototype.init.apply(this, arguments);
this.getRouter().initialize();
},
});
});
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("demo.controller.App", {
onInit: function() {
},
});
});
sap.ui.define([
"sap/ui/core/mvc/Controller",
], function(Controller) {
"use strict";
return Controller.extend("demo.controller.Home", {
onInit: function() {
},
});
});
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo</title>
<script src="bootConfig.js"></script>
<script src="https://openui5nightly.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap"></script>
<script src="init.js"></script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
sap.ui.getCore().attachInit(() => sap.ui.component({
name: "demo", // Without `name`, manifest will be loaded twice.
manifest: true,
}).then(createdComponent => sap.ui.require([
"sap/ui/core/ComponentContainer"
], Container => new Container({
component: createdComponent,
height: '100%',
}).placeAt('content'))));
{
"_version": "1.10.0",
"start_url": "index.html",
"sap.app": {
"id": "demo",
"type": "application",
"title": "Demo",
"description": "Sample Code",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"myDataSource": {
"type": "JSON",
"uri": "localData/demoData.json"
}
}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": [
"sap_belize_hcw",
"sap_belize_hcb",
"sap_belize",
"sap_belize_plus"
]
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.52.0",
"libs": {
"sap.ui.core": {},
"sap.m": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"resources": {
"js": [
],
"css": [
]
},
"models": {
"": {
"dataSource": "myDataSource",
"preload": true
}
},
"rootView": {
"viewName": "demo.view.App",
"id": "rootView",
"type": "XML",
"async": true
},
"routing": {
"routes": [{
"name": "home",
"pattern": "",
"target": "home",
"titleTarget": "home"
}],
"targets": {
"home": {
"viewId": "homeView",
"viewName": "Home",
"transition": "fade",
"viewLevel": 1
},
"notFound": {
"viewName": "Home",
"transition": "slide",
"viewLevel": 98
}
},
"config": {
"async": true,
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "demo.view",
"controlId": "rootApp",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"homeRoute": "home"
}
}
}
}
<mvc:View
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
controllerName="demo.controller.App"
displayBlock="true"
height="100%"
>
<App id="rootApp">
<pages>
<!-- will be added by Router -->
</pages>
</App>
</mvc:View>
<mvc:View
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
controllerName="demo.controller.Home"
>
<Page id="homePage" title="Home">
</Page>
</mvc:View>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment