Skip to content

Commit d077849

Browse files
committed
Added everything for Step 9: Formatting Values
1 parent 554f7ad commit d077849

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

webapp/i18n/i18n.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ address=Address
1212
# Screen titles
1313
panel1HeaderText=Data Binding Basics
1414
panel2HeaderText=Address Details
15+
16+
# E-mail
17+
sendEmail=Send Mail
18+
mailSubject=Hi {0}!
19+
mailBody=How are you?

webapp/i18n/i18n_de.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ enabled=Aktiviert
99

1010
# Screen titles
1111
panel1HeaderText=Data Binding Grundlagen
12-
panel2HeaderText=Adressdetails
12+
panel2HeaderText=Adressdetails
13+
14+
# E-mail
15+
sendEmail=E-mail versenden
16+
mailSubject=Hallo {0}!
17+
mailBody=Wie geht es dir?

webapp/i18n/i18n_en.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ address=Address
1111

1212
# Screen titles
1313
panel1HeaderText=Data Binding Basics
14-
panel2HeaderText=Address Details
14+
panel2HeaderText=Address Details
15+
16+
# E-mail
17+
sendEmail=Send Mail
18+
mailSubject=Hi {0}!
19+
mailBody=How are you?

webapp/model/formatter.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
sap.ui.define([], function () {
1+
sap.ui.define([
2+
"sap/m/library"
3+
], function (mobileLibrary) {
24
"use strict";
3-
return {};
5+
return {
6+
formatMail: function(sFirstName, sLastName) {
7+
var oBundle = this.getOwnerComponent().getModel("i18n").getResourceBundle();
8+
return mobileLibrary.URLHelper.normalizeEmail(
9+
sFirstName + "." + sLastName + "@example.com",
10+
oBundle.getText("mailSubject", [sFirstName]),
11+
oBundle.getText("mailBody"));
12+
}
13+
};
414
});

webapp/view/Home.view.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
<l:VerticalLayout>
1818
<Label class="sapUiSmallMargin" text="{i18n>address}:"/>
1919
<FormattedText class="sapUiSmallMarginBegin sapUiSmallMarginBottom" htmlText="{/address/street}&lt;br&gt;{/address/zip} {/address/city}&lt;br&gt;{/address/country}" width="200px"/>
20+
<Link class="sapUiSmallMarginBegin"
21+
href="{
22+
parts: [
23+
'/firstName',
24+
'/lastName'
25+
],
26+
formatter: '.formatter.formatMail'
27+
}"
28+
text="{i18n>sendEmail}"/>
2029
</l:VerticalLayout>
2130
</content>
2231
</Panel>

0 commit comments

Comments
 (0)