Skip to content

Commit 0623e9a

Browse files
author
hpseitz
committed
v0.7.0 - remove Shell, Component, fully mobile
1 parent c807ee3 commit 0623e9a

11 files changed

+78
-34
lines changed

app/Component.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,8 @@ sap.ui.core.UIComponent.extend("app.Component", {
66

77
createContent: function() {
88

9-
//App View
10-
var oView = sap.ui.jsview("app", "view.App");
9+
// since v0.7.0 the Component is not needed anymore
10+
// we keep it for your project specific usage
1111

12-
// set i18n model
13-
var i18nModel = new sap.ui.model.resource.ResourceModel({
14-
bundleUrl: "i18n/i18n.properties"
15-
});
16-
oView.setModel(i18nModel, "i18n");
17-
18-
return oView;
1912
}
2013
});

img/[email protected]

8.89 KB
Loading

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
55
<meta charset="UTF-8">
66

7-
<title>UI5 SplitApp Boilerplate</title>
7+
<title>UI5 Boilerplate SplitApp</title>
88

99
<!-- UI5 Bootstrap with OpenUI5 -->
1010
<script id="sap-ui-bootstrap" type="text/javascript"
@@ -25,7 +25,7 @@
2525
src="resources/sap-ui-core.js"
2626
2727
//serve locally with Node.js
28-
src="http://localhost:8888/sapui5/1.16.7/resources/sap-ui-core.js"
28+
src="http://localhost:8888/sapui5/1.18.11/resources/sap-ui-core.js"
2929
-->
3030

3131
<!-- Custom Styles -->

js/app.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
sap.ui.localResources("view");
22
sap.ui.localResources("model");
3-
sap.ui.localResources("app");
3+
jQuery.sap.registerModulePath('app', 'app');
44

5+
/*
56
jQuery.sap.require("app.Component");
67
78
//create app Component and place at dom element with id = root
89
new sap.ui.core.ComponentContainer({
910
name: "app"
10-
}).placeAt('root');
11+
}).placeAt('root');
12+
*/
13+
14+
sap.ui.jsview("RootView", "view.App").placeAt('root');

view/App.view.js

+38-14
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,46 @@ sap.ui.jsview("view.App", {
66

77
createContent: function(oController) {
88

9+
// set i18n model
10+
var oI18nModel = new sap.ui.model.resource.ResourceModel({
11+
bundleUrl: "i18n/i18n.properties"
12+
});
13+
sap.ui.getCore().setModel(oI18nModel, "i18n");
14+
this.setModel(oI18nModel, "i18n");
15+
16+
// set device model
17+
var oDeviceModel = new sap.ui.model.json.JSONModel({
18+
isTouch: sap.ui.Device.support.touch,
19+
isNoTouch: !sap.ui.Device.support.touch,
20+
isPhone: sap.ui.Device.system.phone,
21+
isNoPhone: !sap.ui.Device.system.phone,
22+
listMode: (sap.ui.Device.system.phone) ? "None" : "SingleSelectMaster",
23+
listItemType: (sap.ui.Device.system.phone) ? "Active" : "Inactive"
24+
});
25+
oDeviceModel.setDefaultBindingMode("OneWay");
26+
sap.ui.getCore().setModel(oDeviceModel, "device");
27+
this.setModel(oDeviceModel, "device");
28+
929
// to avoid scrollbars on desktop the root view must be set to block display
1030
this.setDisplayBlock(true);
1131

12-
this.app = new sap.m.SplitApp();
32+
this.app = new sap.m.SplitApp({
33+
afterDetailNavigate: function() {
34+
jQuery.sap.log.error("afterDetailNavigate");
35+
if (sap.ui.Device.system.phone) {
36+
jQuery.sap.log.error("afterDetailNavigate hideMaster");
37+
this.hideMaster();
38+
}
39+
},
40+
homeIcon: {
41+
'phone': 'img/57_iPhone_Desktop_Launch.png',
42+
'phone@2': 'img/114_iPhone-Retina_Web_Clip.png',
43+
'tablet': 'img/72_iPad_Desktop_Launch.png',
44+
'tablet@2': 'img/144_iPad_Retina_Web_Clip.png',
45+
'favicon': 'img/favicon.ico',
46+
'precomposed': false
47+
}
48+
});
1349

1450
this.app.addMasterPage(sap.ui.jsview("Menu", "view.Menu"));
1551

@@ -22,18 +58,6 @@ sap.ui.jsview("view.App", {
2258
this.app.toDetail("CoffeeList");
2359
this.app.toMaster("Menu");
2460

25-
return new sap.m.Shell("Shell", {
26-
title: "",
27-
showLogout: false,
28-
app: this.app,
29-
homeIcon: {
30-
'phone': 'img/57_iPhone_Desktop_Launch.png',
31-
'phone@2': 'img/114_iPhone-Retina_Web_Clip.png',
32-
'tablet': 'img/72_iPad_Desktop_Launch.png',
33-
'tablet@2': 'img/144_iPad_Retina_Web_Clip.png',
34-
'favicon': 'img/favicon.ico',
35-
'precomposed': false
36-
}
37-
});
61+
return this.app;
3862
}
3963
});

view/CoffeeList.controller.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ sap.ui.controller("view.CoffeeList", {
22

33
onInit: function() {
44
this.getView().setModel(new sap.ui.model.json.JSONModel("model/coffee.json"));
5-
}
5+
this.bus = sap.ui.getCore().getEventBus();
6+
},
7+
8+
doNavBack: function(event) {
9+
this.bus.publish("nav", "back");
10+
}
611

712
});

view/CoffeeList.view.js

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ sap.ui.jsview("view.CoffeeList", {
2020

2121
return new sap.m.Page({
2222
title: "Coffee Menu",
23+
showNavButton: "{device>/isPhone}",
24+
navButtonPress: [oController.doNavBack, oController],
2325
content: [oList],
2426
headerContent: [],
2527
footer: new sap.m.Bar({})

view/Info.controller.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
sap.ui.controller("view.Info", {
22

3+
onInit: function() {
4+
this.bus = sap.ui.getCore().getEventBus();
5+
},
6+
7+
doNavBack: function(event) {
8+
this.bus.publish("nav", "back");
9+
}
310
});

view/Info.view.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
xmlns:core="sap.ui.core" >
55
<Page
66
title="{i18n>WELCOME_TITLE}"
7-
enableScrolling="false">
7+
enableScrolling="true"
8+
showNavButton="{device>/isPhone}"
9+
navButtonPress="doNavBack" >
810
<footer>
911
<Bar>
1012
</Bar>
@@ -20,7 +22,11 @@
2022
<Link
2123
text="http://blog.mypro.de"
2224
href="http://blog.mypro.de/tag/ui5boilerplate/" >
23-
</Link>
25+
</Link>
26+
<Link
27+
text="UI5 Boilerplate Wiki Page"
28+
href="https://www.6of5.com/6of5/go/show/1001/UI5/displaypage.htm?PAGE=UI5Boilerplate" >
29+
</Link>
2430
<Text
2531
text="UI5 SplitApp Boilerplate on GitHub:"
2632
class="welcomeText" >

view/Menu.controller.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ sap.ui.controller("view.Menu", {
44

55
onInit: function() {
66
this.getView().setModel(new sap.ui.model.json.JSONModel("model/menu.json"));
7+
this.bus = sap.ui.getCore().getEventBus();
78
},
89

910
doNavOnSelect: function(event) {
10-
var bus = sap.ui.getCore().getEventBus();
11-
bus.publish("nav", "to", {
11+
if (sap.ui.Device.system.phone) {
12+
event.getParameter("listItem").setSelected(false);
13+
}
14+
this.bus.publish("nav", "to", {
1215
id: event.getParameter('listItem').getCustomData()[0].getValue()
1316
});
1417
}

view/Menu.view.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ sap.ui.jsview("view.Menu", {
1818
});
1919

2020
var oList = new sap.m.List({
21-
selectionChange: oController.doNavOnSelect,
21+
selectionChange: [oController.doNavOnSelect, oController],
2222
mode: sap.m.ListMode.SingleSelectMaster
2323
});
2424
oList.bindAggregation("items", "/Menu", oListTemplate);
@@ -38,7 +38,7 @@ sap.ui.jsview("view.Menu", {
3838
content: [oList],
3939
footer: new sap.m.Bar({
4040
contentMiddle: [new sap.m.Link("myproLink", {
41-
text: "v0.6.1",
41+
text: "v0.7.0",
4242
href: "http://blog.mypro.de/tag/ui5boilerplate/"
4343
})]
4444
})

0 commit comments

Comments
 (0)