This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
index.html
86 lines (79 loc) · 4.18 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<!-- Importing Google Polymer framework -->
<script src="dependencies/webcomponentsjs/webcomponents-lite.min.js"></script>
<!-- Include cordova script. Will be available when we create SDK project -->
<script src="cordova.js"></script>
<!-- START_MOCK: Scripts for local testing with mock cordova plugins -->
<script src="dependencies/mobilesdk-shared/test/MockCordova.js"></script>
<script src="dependencies/mobilesdk-shared/libs/cordova.force.js"></script>
<script src="dependencies/mobilesdk-shared/test/MockSmartStore.js"></script>
<!-- End of mock scripts :END_MOCK -->
<!-- Place your HTML imports here -->
<link rel="import" href="elements/mobile-ui-elements.html">
<link rel="import" href="dependencies/iron-icons/iron-icons.html">
<!-- Font-face imports. Bug in chrome -->
<link rel="stylesheet" href="elements/css/ratcheticons.css">
</head>
<body touch-action="auto">
<dom-module id="mobile-app">
<template>
<force-signin consumerkey="3MVG9QDx8IX8nP5TwrwtRg53zXgW0xeFBfLMzPRJ4aNy8z7MsSSDjNj.NLu4pSY4B8V3sbYSLrhAMJWxs39jB" callbackurl="http://localhost:9000" proxyurl="[[proxy]]" auto></force-signin>
<force-ui-app id="force_app" multipage>
<h1 class="title">Accounts</h1>
<force-ui-list id="force_ui_list" sobject="[[sobject]]" selected="{{recordid}}" class="page content" on-iron-activate="showDetail"></force-ui-list>
<force-ui-detail flex id="force_ui_detail" sobject="[[sobject]]" recordid="[[recordid]]" class="page content">
<force-sobject-relatedlists id="force_relatedlists" sobject="[[sobject]]" recordid="[[recordid]]" related-lists="{{relatedLists}}"></force-sobject-relatedlists>
<template is="dom-repeat" items="[[relatedLists]]">
<force-ui-relatedlist related="[[item]]"></force-ui-relatedlist>
</template>
</force-ui-detail>
</force-ui-app>
<iron-icon id="network_icon" icon="{{cloudicon}}" class="bottomright" style="position: fixed; bottom: 0; right: 0; margin: 10px; zoom: 2; fill: green; -webkit-tap-highlight-color: rgba(0,0,0,0);" on-tap="toggleStatus"></iron-icon>
</template>
<script type="text/javascript">
window.addEventListener('WebComponentsReady', function() {
Polymer({
is: 'mobile-app',
_onlineStatus: true,
properties: {
sobject: String,
recordid: String,
cloudicon: {
type: String,
value: 'cloud-done',
notify: true
},
proxy: {
type: String,
value: function() { return (location.protocol === 'file:') ? null : location.origin; },
notify: true
}
},
showDetail: function(e) {
this.$.force_app.navigateTo('#force_ui_detail');
},
get onlineStatus() {
return this._onlineStatus;
},
set onlineStatus(status) {
SFDC.isOnline = function() { return status };
this._onlineStatus = status;
this.$.force_ui_list.querytype = (status ? "mru" : "cache");
this.cloudicon = status ? "cloud-done" : "cloud-off";
this.$.network_icon.style.fill = status ? 'green' : 'red';
},
toggleStatus: function() {
this.onlineStatus = !this.onlineStatus;
},
});
});
</script>
</dom-module>
<mobile-app sobject="Account"></mobile-app>
</body>
</html>