Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions webapp/controller/BaseController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"sap/ui/core/mvc/Controller",
"sap/ui/core/UIComponent"
], function (Controller, UIComponent) {
"use strict";

return Controller.extend("ui5.challenge.controller.BaseController", {
Expand All @@ -9,9 +10,6 @@ sap.ui.define([
},
getRouter: function () {
return UIComponent.getRouterFor(this);
},
onPress: function () {

}
});
});
16 changes: 16 additions & 0 deletions webapp/controller/Detail.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sap.ui.define([
"./BaseController",
"sap/m/Dialog"
], function (BaseController, Dialog) {
"use strict";

return BaseController.extend("ui5.challenge.controller.Detail", {
onDialog: function () {
if (!this._dialog) {
this._dialog = new Dialog({ id: 'myDialog' })
this.getView().addDependent(this._dialog)
}
this._dialog.open()
}
});
});
11 changes: 11 additions & 0 deletions webapp/controller/Main.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sap.ui.define([
"./BaseController"
], function (BaseController) {
"use strict";

return BaseController.extend("ui5.challenge.controller.Main", {
onNavigate: function () {
this.getRouter().navTo('detail')
}
});
});
4 changes: 4 additions & 0 deletions webapp/i18n/i18n.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
appTitle=ui5-challenge
appDescription=ui5-challenge
mainTitleText=wdi5 rocks
detailTitleText=and ui5 too !
2 changes: 1 addition & 1 deletion webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>title</title>
<title>ui5-challenge</title>

<script
id="sap-ui-bootstrap"
Expand Down
35 changes: 33 additions & 2 deletions webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,34 @@
"controlId": "app",
"clearControlAggregation": false
},
"routes": [],
"targets": {}
"routes": [
{
"pattern": "",
"name": "main",
"target": [
"main"
]
},
{
"pattern": "RouteDetail",
"name": "detail",
"target": [
"detail"
]
}
],
"targets": {
"main": {
"viewName": "Main",
"viewId": "main",
"viewLevel": 1
},
"detail": {
"viewName": "Detail",
"viewId": "detail",
"viewLevel": 2
}
}
},
"rootView": {
"viewName": "ui5.challenge.view.App",
Expand All @@ -62,6 +88,11 @@
"settings": {
"bundleName": "ui5.challenge.i18n.i18n"
}
},
"data": {
"type": "sap.ui.model.json.JSONModel",
"uri": "model/data.json",
"preload": true
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions webapp/model/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"buttonText": "Hello World !",
"items": [
{
"title": "first",
"counter": 1
},
{
"title": "second",
"counter": 2
},
{
"title": "third",
"counter": 3
}
]
}
7 changes: 7 additions & 0 deletions webapp/view/Detail.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<mvc:View xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m" controllerName="ui5.challenge.controller.Detail">
<VBox>
<Title id="title" text="{i18n>detailTitleText}" />
<Button id="navButton" text="🔙" />
<Button id="dialogButton" text="🗔" press="onDialog" />
</VBox>
</mvc:View>
16 changes: 16 additions & 0 deletions webapp/view/Main.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<mvc:View xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m" controllerName="ui5.challenge.controller.Main">
<VBox>
<Title id="title" text="{i18n>mainTitleText}" />
<Button id="mainButton" text="{data>/buttonText}" />
<Button id="myControl" text="🔍" press="onNavigate" />
<List
items="{
path: 'data>/items'
}" >
<StandardListItem
title="{data>title}"
counter="{data>counter}"
/>
</List>
</VBox>
</mvc:View>