Archived
Adds placeholder image for events
This commit is contained in:
1 parent
24d498e846
commit
8d72c5e0a5
3 files changed
+20
-5
No files matched your search
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="robots" content="index,follow" />
|
||||
<meta name="x-stylesheet-directory" content="<?php bloginfo( 'stylesheet_directory' ); ?>" />
|
||||
<?php neuf_doctitle(); ?>
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('url'); ?>/feed/" title="Det Norske Studentersamfund (nyheter)" />
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
@@ -12,7 +12,23 @@ var query_params = {
|
||||
custom_fields: custom_fields.join()
|
||||
};
|
||||
|
||||
var list = '<% _.each(posts, function(post) { %> <li><a href="<%= post.url %>"><div><img src="<%= post.thumbnail_images["four-column-thumb"].url %>" /><br/><span class="entry-starttime"><%= moment.unix(post.custom_fields._neuf_events_starttime).utc().format("YYYY-MM-DD HH:mm") %></span><br/> <%= post.title %> (<%= post.custom_fields._neuf_events_price_regular %>/<%= post.custom_fields._neuf_events_price_member %>)</div></a></li> <% }); %>';
|
||||
function format_posts(posts) {
|
||||
var html = '';
|
||||
for(var i=0; i< posts.length; i++) {
|
||||
var post = posts[i];
|
||||
html += '<li><a href="'+ post.url +'"><div>';
|
||||
if(post.thumbnail_images) {
|
||||
html += '<img src="'+ post.thumbnail_images["four-column-thumb"].url +'" /><br/>';
|
||||
} else {
|
||||
var stylesheet_dir = jQuery("meta[name=x-stylesheet-directory]").attr('content');
|
||||
html += '<img src="'+ stylesheet_dir +'/img/placeholder.gif" /><br/>';
|
||||
}
|
||||
html += '<span class="entry-starttime">'+ moment.unix(post.custom_fields._neuf_events_starttime).utc().format("YYYY-MM-DD HH:mm") +'</span><br/>';
|
||||
html += post.title +'('+ post.custom_fields._neuf_events_price_regular +')/'+ post.custom_fields._neuf_events_price_member +')</div></a></li>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
var $ = jQuery;
|
||||
$.getJSON(
|
||||
@@ -20,11 +36,9 @@ jQuery(document).ready(function() {
|
||||
query_params,
|
||||
function(data) {
|
||||
if(data && data.posts) {
|
||||
// render template
|
||||
console.log(data);
|
||||
var html = _.template(list, {
|
||||
posts: data.posts.slice(0, 4)}
|
||||
);
|
||||
// render template
|
||||
var html = format_posts(data.posts.slice(0, 4));
|
||||
$(".program-upcoming ul.program-list").html(html);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user