Skip to content

Commit 6018edd

Browse files
authored
docs: cleanup of JS code snippets (#144)
1 parent a422e0d commit 6018edd

File tree

23 files changed

+52
-91
lines changed

23 files changed

+52
-91
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please edit this file as it is the primary description file for your project. Yo
1616

1717
[![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/ui5-typescript-walkthrough)](https://api.reuse.software/info/github.com/SAP-samples/ui5-typescript-walkthrough)
1818

19-
# OpenUI5 TypeScript Walkthrough
19+
# OpenUI5 Walkthrough
2020

2121
In this tutorial we'll introduce you to all major development paradigms of OpenUI5. <details class="ts-only" markdown="1"><summary>This section is relevant for TypeScript only</summary>We'll also demonstrate the use of TypeScript with OpenUI5 and highlight the specific characteristics of this approach.</details>
2222

@@ -52,7 +52,7 @@ The tutorial consists of the following steps. To start, just open the first link
5252
- **[Step 11: Pages and Panels](steps/11/README.md "After all the work on the app structure it’s time to improve the look of our app. We will use two controls from the sap.m library to add a bit more &quot;bling&quot; to our UI. You will also learn about control aggregations in this step.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/11/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-11.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-11-js.zip) </details>)
5353
- **[Step 12: Shell Control as Container](steps/12/README.md "Now we use a shell control as container for our app and use it as our new root element. The shell takes care of visual adaptation of the application to the device’s screen size by introducing a so-called letterbox on desktop screens.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/12/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-12.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-12-js.zip) </details>)
5454
- **[Step 13: Margins and Paddings](steps/13/README.md "Our app content is still glued to the corners of the letterbox. To fine-tune our layout, we can add margins and paddings to the controls that we added in the previous step. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/13/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-13.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-13-js.zip) </details>)
55-
- **[Step 14: Custom CSS and Theme Colors](steps/14/README.md "Sometimes we need to define some more fine-granular layouts and this is when we can use the flexibility of CSS by adding custom style classes to controls and style them as we like. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/14/index-cdn.html) | <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-14.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-14-js.zip)</details>)
55+
- **[Step 14: Custom CSS and Theme Colors](steps/14/README.md "Sometimes we need to define some more fine-granular layouts and this is when we can use the flexibility of CSS by adding custom style classes to controls and style them as we like. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/14/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-14.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-14-js.zip)</details>)
5656
- **[Step 15: Nested Views](steps/15/README.md "Our panel content is getting more and more complex and now it is time to move the panel content to a separate view. With that approach, the application structure is much easier to understand, and the individual parts of the app can be reused.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/15/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-15.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-15-js.zip)</details>)
5757
- **[Step 16: Dialogs and Fragments](steps/16/README.md "In this step, we will take a closer look at another element which can be used to assemble views: the fragment. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/16/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-16.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-16-js.zip)</details>)
5858
- **[Step 17: Fragment Callbacks](steps/17/README.md "Now that we have integrated the dialog, it's time to add some user interaction. The user will definitely want to close the dialog again at some point, so we add a button to close the dialog and assign an event handler.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/17/index-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-17.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-17-js.zip)</details>)
@@ -69,7 +69,7 @@ The tutorial consists of the following steps. To start, just open the first link
6969
- **[Step 28: Integration Test with OPA](steps/28/README.md "If we want to test interaction patterns or more visual features of our app, we can also write an integration test. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/28/test/Test.cdn.qunit.html?testsuite=test-resources/ui5/walkthrough/testsuite.cdn.qunit&test=integration/opaTests) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-28.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-28-js.zip)</details>)
7070
- **[Step 29: Debugging Tools](steps/29/README.md "Even though we have added a basic test coverage in the previous steps, it seems like we accidentally broke our app, because it does not display prices to our invoices anymore. We need to debug the issue and fix it before someone finds out.")** (*code remains unchanged from the previous step*)
7171
- **[Step 30: Routing and Navigation](steps/30/README.md "So far, we have put all app content on one single page. As we add more and more features, we want to split the content and put it on separate pages.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/30/test/mockServer-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-30.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-30-js.zip)</details>)
72-
- **[Step 31: Routing with Parameters](steps/31/README.md "We can now navigate between the overview and the detail page, but the actual item that we selected in the overview is not displayed on the detail page yet. A typical use case for our app is to show additional information for the selected item on the detail page. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/31/test/mockServer-cdn.html) | <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-31.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-31-js.zip)</details>)
72+
- **[Step 31: Routing with Parameters](steps/31/README.md "We can now navigate between the overview and the detail page, but the actual item that we selected in the overview is not displayed on the detail page yet. A typical use case for our app is to show additional information for the selected item on the detail page. ")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/31/test/mockServer-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-31.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-31-js.zip)</details>)
7373
- **[Step 32: Routing Back and History](steps/32/README.md "Now we can navigate to our detail page and display an invoice, but we cannot go back to the overview page yet. We'll add a back button to the detail page and implement a function that shows our overview page again.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/32/test/mockServer-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-32.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-32-js.zip)</details>)
7474
- **[Step 33: Custom Controls](steps/33/README.md "In this step, we are going to extend the functionality of OpenUI5 with a custom control. We want to rate the product shown on the detail page, so we create a composition of multiple standard controls using the OpenUI5 extension mechanism and add some glue code to make them work nicely together. This way, we can reuse the control across the app and keep all related functionality in one module.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/33/test/mockServer-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-33.zip)</details> <details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-33-js.zip)</details>)
7575
- **[Step 34: Responsiveness](steps/34/README.md "In this step, we improve the responsiveness of our app. OpenUI5 applications can be run on phone, tablet, and desktop devices and we can configure the application to make best use of the screen estate for each scenario. Fortunately, OpenUI5 controls like the sap.m.Table already deliver a lot of features that we can use.")** ([🔗 Live Preview](https://sap-samples.github.io/ui5-typescript-walkthrough/build/34/test/mockServer-cdn.html) \| <details class="ts-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-34.zip) </details><details class="js-only"> [📥 Download Solution](https://sap-samples.github.io/ui5-typescript-walkthrough/ui5-typescript-walkthrough-step-34-js.zip)</details>)

steps/05/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
5858
"use strict";
5959

6060
const AppController = Controller.extend("ui5.walkthrough.controller.App", {
61-
onShowHello: function _onShowHello() {
61+
onShowHello() {
6262
// show a native JavaScript alert
6363
alert("Hello World");
6464
}

steps/06/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller"], function (Me
5959
* @name ui5.walkthrough.controller.App
6060
*/
6161
const AppController = Controller.extend("ui5.walkthrough.controller.App", {
62-
onShowHello: function _onShowHello() {
62+
onShowHello() {
6363
MessageToast.show("Hello World");
6464
}
6565
});

steps/07/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller", "sap/ui/model
7474
"use strict";
7575

7676
const AppController = Controller.extend("ui5.walkthrough.controller.App", {
77-
onInit: function _onInit() {
77+
onInit() {
7878
// set data model on view
7979
const data = {
8080
recipient: {
@@ -84,7 +84,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller", "sap/ui/model
8484
const dataModel = new JSONModel(data);
8585
this.getView()?.setModel(dataModel);
8686
},
87-
onShowHello: function _onShowHello() {
87+
onShowHello() {
8888
MessageToast.show("Hello World");
8989
}
9090
});

steps/08/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller", "sap/ui/model
101101
"use strict";
102102

103103
const AppController = Controller.extend("ui5.walkthrough.controller.App", {
104-
onInit: function _onInit() {
104+
onInit() {
105105
// set data model on view
106106
const data = {
107107
recipient: {
@@ -117,7 +117,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller", "sap/ui/model
117117
});
118118
this.getView()?.setModel(i18nModel, "i18n");
119119
},
120-
onShowHello: function _onShowHello() {
120+
onShowHello() {
121121
// read msg from i18n model
122122
const recipient = this.getView()?.getModel()?.getProperty("/recipient/name");
123123
const resourceBundle = this.getView()?.getModel("i18n")?.getResourceBundle();

steps/09/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ sap.ui.define(["sap/ui/core/UIComponent", "sap/ui/core/mvc/XMLView", "sap/ui/mod
101101
metadata: {
102102
"interfaces": ["sap.ui.core.IAsyncContentCreation"]
103103
},
104-
init: function _init() {
104+
init() {
105105
// call the init function of the parent
106106
UIComponent.prototype.init.call(this);
107107
// set data model
@@ -119,7 +119,7 @@ sap.ui.define(["sap/ui/core/UIComponent", "sap/ui/core/mvc/XMLView", "sap/ui/mod
119119
});
120120
this.setModel(i18nModel, "i18n");
121121
},
122-
createContent: function _createContent() {
122+
createContent() {
123123
return XMLView.create({
124124
"viewName": "ui5.walkthrough.view.App",
125125
"id": "app"
@@ -170,7 +170,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/mvc/Controller"], function (Me
170170
* @name ui5.walkthrough.controller.App
171171
*/
172172
const AppController = Controller.extend("ui5.walkthrough.controller.App", {
173-
onShowHello: function _onShowHello() {
173+
onShowHello() {
174174
// read msg from i18n model
175175
// functions with generic return values require casting
176176
const resourceBundle = this.getView()?.getModel("i18n")?.getResourceBundle();

steps/10/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ sap.ui.define(["sap/ui/core/UIComponent", "sap/ui/model/json/JSONModel"], functi
205205
"interfaces": ["sap.ui.core.IAsyncContentCreation"],
206206
"manifest": "json"
207207
},
208-
init: function _init() {
208+
init() {
209209
// call the init function of the parent
210210
UIComponent.prototype.init.call(this);
211211

steps/15/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/m/MessageToast"], function (Co
6666
"use strict";
6767

6868
const HelloPanel = Controller.extend("ui5.walkthrough.controller.HelloPanel", {
69-
onShowHello: function _onShowHello() {
69+
onShowHello() {
7070
// read msg from i18n model
7171
const recipient = this.getView()?.getModel()?.getProperty("/recipient/name");
7272
const resourceBundle = this.getView()?.getModel("i18n")?.getResourceBundle();

steps/16/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/m/MessageToast"], function (Co
9393
"use strict";
9494

9595
const HelloPanel = Controller.extend("ui5.walkthrough.controller.HelloPanel", {
96-
onShowHello: function _onShowHello() {
96+
onShowHello() {
9797
...
9898
},
99-
onOpenDialog: async function _onOpenDialog() {
99+
async onOpenDialog() {
100100
this.dialog ??= await this.loadFragment({
101101
name: "ui5.walkthrough.view.HelloDialog"
102102
});

steps/17/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/m/MessageToast"], function (Co
7373
"use strict";
7474

7575
const HelloPanel = Controller.extend("ui5.walkthrough.controller.HelloPanel", {
76-
onShowHello: function _onShowHello() {
76+
onShowHello() {
7777
// read msg from i18n model
7878
const recipient = this.getView()?.getModel()?.getProperty("/recipient/name");
7979
const resourceBundle = this.getView()?.getModel("i18n")?.getResourceBundle();
8080
const msg = resourceBundle.getText("helloMsg", [recipient]);
8181
// show message
8282
MessageToast.show(msg);
8383
},
84-
onOpenDialog: async function _onOpenDialog() {
84+
async onOpenDialog() {
8585
this.dialog ??= await this.loadFragment({
8686
name: "ui5.walkthrough.view.HelloDialog"
8787
});
8888
this.dialog.open();
8989
},
90-
onCloseDialog: function _onCloseDialog() {
90+
onCloseDialog() {
9191
this.byId("helloDialog")?.close();
9292
}
9393
});

0 commit comments

Comments
 (0)