-
Notifications
You must be signed in to change notification settings - Fork 3
/
example1.html
97 lines (85 loc) · 3.4 KB
/
example1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html><head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>openui5-cards</title>
<!--Standard sapui5 init-->
<script id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m,sap.ui.commons"></script>
<!--CSS required by open.m.Card
Needs to be after sapui5 init in order to override styles-->
<link href="openui5-cards.css" type="text/css" rel="stylesheet"/>
<script src="openui5-cards.js"></script>
<script>
//Example of usage of the components in this section
var headerCard = new open.m.Card("initialCard",
{title:"<strong>About</strong>",
subtitle:"Demonstrates simple usage of statically defined cards (through javascript)",})
var card1 = new open.m.Card("card1",
{title:"GoogleNow style cards coming to #OpenUI5",
subtitle:"Thanks for open sourcing SAP",
bodyImage:"http://sap.github.io/openui5/images/icotxt_white_220x72_blue_open.png"});
var card2 = new open.m.Card("card2",
{title:"<strong>4 days</strong> to destination in Palo Alto",
subtitle:"This is the subtitle of my card2",
bodyAddress:"SAP Palo alto",
actions: [new open.m.CardAction("cardaction1",
{actionText:"Navigate",
press:function(){
jQuery.sap.require("sap.m.MessageToast");
sap.m.MessageToast.show("Navigate action clicked");
},
icon:"sap-icon://locate-me"}),
new open.m.CardAction("cardaction2",
{actionText:"View email",
icon:"sap-icon://email"}),
],
menu: new sap.m.ActionSheet("menu1",{
title: "Choose Your Action",
showCancelButton: false,
placement: sap.m.PlacementType.Bottom,
buttons: [
new sap.m.Button({
icon: "sap-icon://decline",
text: "Reject",
press: function(){
jQuery.sap.require("sap.m.MessageToast");
sap.m.MessageToast.show("Not implemented (ie. Left as an exercise for the user)");
}
}),
new sap.m.Button({
icon: "sap-icon://accept",
text: "Accept",
press: function(){
jQuery.sap.require("sap.m.MessageToast");
sap.m.MessageToast.show("Not implemented (ie. Left as an exercise for the user)");
}
}),
]
}),
});
var cardContainer = new open.m.CardContainer("myCardContainer", {
searchLiveChange:function(oEvent){
//strange. why do we need two getParameters?
$.sap.log.error("Search field live change:" +oEvent.getParameters().getParameters().newValue);
},
headerCard:headerCard,
cards:[card1,card2]
});
var app = new sap.m.App({initialPage:"openui5-cards"});
app.placeAt("content");
var pageContent = new sap.m.Page("openui5-cards",{title:"OpenUI5-Cards", showHeader:false, showFooter:false});
pageContent.addContent(cardContainer);
app.addPage(pageContent);
//ugly hack to get voice search
//Believe I need to create my own subclass of sap.m.Input to avoid it
$(document).ready(function() {
$(".cardSearch > input").attr("x-webkit-speech", "");
})
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>