1 function list_action ()
3 // Handles action for displaying the children of a page
4 res.handlers["User"] = User();
5 res.data.title = this.uri + " - list";
6 res.data.body = this.listBody();
15 var orderedByDate = this.getOrderedView("time desc");
16 var collection = orderedByDate.list();
21 body = "<p>No children exist for this page</p>\n";
25 function fixUrl(param)
28 if (param.search("http://") == -1 && param.search("https://") == -1)
29 param = "http://" + param;
33 if (collection[0].render_skin == "project")
34 body += "<table id='projects'>\n";
35 if (collection[0].render_skin == "cape")
37 body += "<table id='capes' border='1'>\n";
38 body += "<tr><th>Entry</th><th>Description</th>";
39 body += "<th>Youtube Video</th></tr>\n";
43 for (var i in collection)
45 if (collection[i].render_skin == "project")
48 '<tr><td><a href="' + collection[i].href() + '">'
52 if (("" + collection[i].homepage) != "")
56 + fixUrl(collection[i].homepage)
57 + '" target="_blank">homepage</a>] '
60 if (("" + collection[i].rssfeed) != "")
64 + fixUrl(collection[i].rssfeed)
65 + '" target="_blank">rss</a>]'
68 body += '</small></td>';
69 body += '<td><div class="wants-g-plusone" data-href="'
70 + 'http://beagleboard.org' + collection[i].href()
71 + '" data-size="small">'
74 + encode(collection[i].shortdesc)
75 + '</small></td><td><small>Registered by: '
76 + collection[i].registrant
79 + '</small></td></tr>\n'
82 else if (collection[i].render_skin == "cape")
86 ' <td><a href="' + collection[i].href() + '">'
91 + '<br /><br /><div class="fb-like" data-send="false" data-width="40" data-layout="button_count" data-show-faces="false" href="'
92 + 'http://beagleboard.org' + collection[i].href()
95 + '<br /><br /><div class="wants-g-plusone" data-href="'
96 + 'http://beagleboard.org' + collection[i].href()
97 + '" data-size="small">'
101 body += ' <td width="300">' + collection[i].body + '</td>\n';
102 if (collection[i].youtube_url)
104 var embed = ('' + collection[i].youtube_url).match(/(youtu.be|youtube.com)\/(.*)$/);
105 if (embed && embed.length == 3)
107 body += ' <td><iframe width="412" height="240" ';
108 body += 'src="http://www.youtube.com/embed/'
110 body += '" frameborder="0" allowfullscreen></iframe></td>\n';
115 else if (collection[i].render_skin == "rss")
118 '<li class="rss"><a href="' + collection[i].href() + '">'
128 '<li><a href="' + collection[i].href() + '">'
130 + '</a> <small>Last updated by: '
135 if (collection[0].render_skin == "project")
136 body += "</table>\n";
137 else if (collection[0].render_skin == "cape")
138 body += "</table>\n";