Skip to content

Commit 246fc04

Browse files
committed
asdasd
2 parents a639593 + 823c0b2 commit 246fc04

File tree

5 files changed

+90
-15
lines changed

5 files changed

+90
-15
lines changed

OddJobb/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# android
2+
/platforms/

OddJobb/www/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<a href="#" class="item-link list-button">Submit a new post</a>
5353
</li>
5454
<li>
55-
<a href="#" class="item-link list-button">View current posts</a>
55+
<a href="postList.html" class="item-link list-button close-panel">View current posts</a>
5656
</li>
5757
<li>
5858
<a href="messages.html" class="item-link list-button">Messages</a>

OddJobb/www/js/my-app.js

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var mainView = myApp.addView('.view-main', {
1212
});
1313

1414
// Handle Cordova Device Ready Event
15-
$$(document).on('deviceready', function() {
15+
$$(document).on('deviceready', function () {
1616
console.log("Device is ready!");
1717
});
1818

@@ -22,30 +22,56 @@ $$(document).on('deviceready', function() {
2222
// Option 1. Using page callback for page (for "about" page in this case) (recommended way):
2323
myApp.onPageInit('about', function (page) {
2424
// Do something here for "about" page
25-
25+
myApp.alert('Here comes About page');
2626
})
2727

2828
//Messages Page
2929
myApp.onPageInit('messages', function (page) {
3030
messagesMain();
31+
})
3132

33+
myApp.onPageInit('post', function (page) {
34+
console.log(page.query);
35+
/*
36+
1. Do AJAX call to get post based on postID
37+
2. Generate post data!
38+
*/
3239

3340
})
3441

42+
myApp.onPageInit('postList', function (page) {
43+
console.log('posted!');
3544

36-
// Option 2. Using one 'pageInit' event handler for all pages:
37-
$$(document).on('pageInit', function (e) {
38-
// Get page data from event data
39-
var page = e.detail.page;
45+
/*
46+
1. Do AJAX call
47+
2. Put data into Array
48+
3. Set array
49+
*/
50+
const posts = [
51+
/*
52+
{
53+
title: 'Need people to show shovel for me tomorrow!',
54+
text: 'House is not too large, so should not be an issue!',
55+
price: '5',
56+
postalCode: '5'
57+
58+
}*/
59+
];
4060

41-
if (page.name === 'about') {
42-
// Following code will be executed for page with data-page attribute equal to "about"
43-
myApp.alert('Here comes About page');
61+
for (var i = 0; i < 50; i++) {
62+
posts.push({
63+
item: i
64+
});
4465
}
45-
})
4666

47-
// Option 2. Using live 'pageInit' event handlers for each page
48-
$$(document).on('pageInit', '.page[data-page="about"]', function (e) {
49-
// Following code will be executed for page with data-page attribute equal to "about"
50-
myApp.alert('Here comes About page');
67+
const myList = myApp.virtualList('.list-block.virtual-list', {
68+
items: posts,
69+
template:
70+
'<li>' +
71+
'<a href="post.html?postID={{item}}" class="item-link item-content">' +
72+
'<div>{{item}}</div>' +
73+
'</a>' +
74+
'</div>' +
75+
'</li>'
76+
});
5177
})

OddJobb/www/post.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!-- Top Navbar-->
2+
<div class="navbar">
3+
<div class="navbar-inner">
4+
<div class="left">
5+
<a href="#" class="back link">
6+
<i class="icon icon-back"></i>
7+
<span>Back</span>
8+
</a>
9+
</div>
10+
<div class="center sliding">Posts</div>
11+
<div class="right">
12+
<a href="#" class="link icon-only open-panel"><i class="icon icon-bars"></i></a>
13+
</div>
14+
</div>
15+
</div>
16+
17+
<div class="pages">
18+
<div data-page="post" class="page">
19+
<div class="page-content">
20+
</div>
21+
</div>
22+
</div>

OddJobb/www/postList.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!-- Top Navbar-->
2+
<div class="navbar">
3+
<div class="navbar-inner">
4+
<div class="left">
5+
<a href="#" class="back link">
6+
<i class="icon icon-back"></i>
7+
<span>Back</span>
8+
</a>
9+
</div>
10+
<div class="center sliding">Posts</div>
11+
<div class="right">
12+
<a href="#" class="link icon-only open-panel"><i class="icon icon-bars"></i></a>
13+
</div>
14+
</div>
15+
</div>
16+
17+
<div class="pages">
18+
<div data-page="postList" class="page">
19+
<div class="page-content">
20+
<div class="test list-block virtual-list">
21+
<!-- keep it empty -->
22+
</div>
23+
</div>
24+
</div>
25+
</div>

0 commit comments

Comments
 (0)