comparison app/views/Application/index.html @ 2:b216e48fc4a5 draft

add display.html
author e085711
date Thu, 13 Sep 2012 01:40:32 +0900
parents 03e9be886e82
children cb113e610e08
comparison
equal deleted inserted replaced
1:6875b5685dda 2:b216e48fc4a5
1 #{extends 'main.html' /} 1 #{extends 'main.html' /}
2 #{set title:'Home' /} 2 #{set title:'Home' /}
3 3
4 #{ifnot tasks} 4 #{if frontPost}
5 <p> 5 <div class="post">
6 No tasks 6 <h2 class="post-title">
7 </p> 7 <a href="#">${frontPost.title}</a>
8 #{/ifnot} 8 </h2>
9
10 <div clas="post-metadata">
11 <span class="post-author">by ${frontPost.author.fullname}</span>
12 <span class="post-data">by ${frontPost.postedAt.format('MMM dd')}</span>
13 <span class="post-comments">
14 &nbsp;|&nbsp;
15 ${frontPost.comments.size() ?:'no'}
16 comment${frontPost.comments.size().pluralize()}
17 #{if frontPost.comments}
18 ,latest by ${PfrontPost.comments[-1].author}
19
20 #{/if}
21 </span>
22 </div>
23 <div class="post-content">
24 ${frontPost.content.nl2br()}
25 </div>
26 </div>
9 27
10 <ul> 28 #{if olderPosts}
11 #{list items:tasks, as:'task'} 29 <div class="older-posts">
12 <li> 30 <h3>Older posts <span class="from">from this blog</span></h3>
13 <input type="checkbox" id="${task.id}" ${task.done ? 'checked':'' }> 31
14 ${task.title} 32 #{list items:olderPosts, as:'oldPost'}
15 </li> 33 <div class="post">
16 #{/list} 34 <h2 class="post-title">
35 <a href="#">${oldPost.title}</a>
36 </h2>
37 <div class="post-metadata">
38 <span class="post-author">
39 by ${oldPost.author.fullname}
40 </span>
41 <span class="post-date">
42 ${oldPost.postedAt.format('dd MMM yy')}
43 </span>
44 <div class="post-comments">
45 ${oldPost.comments.size() ?:'no'}
46 comment${oldPost.comments.size().pluralize()}
47 #{if oldPost.comments}
48 - latest by ${oldPost.comments[-1].author}
49 #{/if}
50 </div>
51 </div>
52 </div>
53 #{/list}
54 </div>
17 55
18 </ul> 56 #{/if}
19 57
20 <p> 58 #{/if}
21 <a id="createTask" href="#">Create a new task</a>
22 </p>
23 59
24 <script type="text/javascript" charset="utf-8">
25 // Create a task
26 $('#createTask').click(function() {
27 $.post('@{createTask()}', {title: prompt('Task title ?')}, function(task){
28 $('ul').prepend(
29 '<li><input type="checkbox" id="'+task.id+'">'+task.title+'</li>'
30 )}, 'json')
31 })
32 60
33 // change status 61 #{else}
34 $('input').live('click', function() { 62 <div class="empty">
35 $.post('@{changeStatus()}', {id: $(this).attr('id'), done: $(this).val()}) 63 There is currently nothing to read here.
36 }) 64 </div>
37 65 #{/else}
38 66
39 </script> 67
68
69
70
71