Skip to content

Commit

Permalink
blog theme sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmuz committed Dec 26, 2014
1 parent 886500b commit 638f4fc
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
38 changes: 38 additions & 0 deletions wa-apps/blog/themes/sidebar/post.album.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{* display all photos of the attached photo album *}

{if $post.album.photos}
<div class="photo-album-attachment">
{foreach $post.album.photos as $p}
<figure itemscope itemtype ="http://schema.org/Photograph" class="photo">
{if $p.description}
{if $p.description|strstr:'<p>'}
<div itemprop="description">{$p.description}</div>
{else}
<p itemprop="description">{$p.description}</p>
{/if}
{/if}
<a name="photo{$p.id}"></a>
<img src="{$p.thumb_big.url}" class="retinify" alt="{$p.name|escape}">
</figure>
{/foreach}
</div>

{if blogPhotosBridge::is2xEnabled()}
<script>$(function() { "use strict";
if ($.Retina) {
retinify();
} else {
$.ajax({ // Load JS script, making sure it WILL get cached in non-debug mode
dataType: "script",
url: "{$wa_url}wa-content/js/jquery-plugins/jquery.retina.min.js?{$wa->version(true)}",
cache: true
}).done(retinify);
}

function retinify() {
$.Retina && $('img.retinify').retina();
}
});</script>
{/if}
{/if}

4 changes: 4 additions & 0 deletions wa-apps/blog/themes/sidebar/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ <h1 itemprop="name">
{$post.text}
</div>

{if $post.album_id && $post.album.id && $post.album.photos}
{include 'post.album.html' album=$post.album inline}
{/if}

{* @event prepare_posts_frontend.%plugin_id%.after *}
{if !empty($post.plugins.after)}
<div class="text_after">
Expand Down
12 changes: 12 additions & 0 deletions wa-apps/blog/themes/sidebar/sidebar.blog.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
.credentials .date { margin: 0 3px; }
.post .credentials { margin-bottom: 20px;}

.photo-album-attachment ul.thumbs { padding-left: 0; }
.photo-album-attachment ul.thumbs li { list-style: none; display: inline-block; margin: 0 20px 20px 0; }
.photo-album-attachment .photo { margin-bottom: 20px; }
.photo-album-attachment .photo img { margin-top: -10px; }
.post .photo-album-attachment { padding-top: 10px; }

.comment-form { padding: 0; margin-top: 30px; }
.comment-form h4 { margin: 0 0 20px; font-weight: normal; }
.comment-form-fields p { margin: 0 0 10px; }
Expand Down Expand Up @@ -78,6 +84,12 @@

.pageless-wrapper { font-style: italic; }

html.realtime-preview,
html.realtime-preview body { background: #fff; }
html.realtime-preview #sidebar,
html.realtime-preview .app-navigation { display: none; }
html.realtime-preview #main { margin-left: 0; border: none; }

/* Plugins
---------- */

Expand Down
21 changes: 20 additions & 1 deletion wa-apps/blog/themes/sidebar/stream_posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ <h3>
<a href="{$post.link}">{$post.cut_link_label|default:'[`Continue reading →`]'}</a>
{/if}
</div>

{* attached album photo thumbs *}
{if $post.album_id && $post.album.id && $post.album.photos}
{$photos_loaded = 1} {* required for proper photo thumbs retinification *}
<div class="photo-album-attachment">
<ul class="thumbs">
{foreach $post.album.photos as $p}
<li><a href="{$post.link}#photo{$p.id}"><img src="{$p.thumb_crop.url}" class="retinify" width="96" height="96" alt="{$p.name|escape}"></a></li>
{/foreach}
</ul>
</div>
{/if}

{* @event prepare_posts_frontend.%plugin_id%.after *}
{if !empty($post.plugins.after)}
Expand All @@ -69,4 +81,11 @@ <h3>
{if $page lt 2}
{_w('%d post','%d posts',0)}
{/if}
{/foreach}
{/foreach}

{if !empty($photos_loaded) && blogPhotosBridge::is2xEnabled()}
<script src="{$wa_url}wa-content/js/jquery-plugins/jquery.retina.min.js"></script>
<script>$(function() { "use strict";
$.Retina && $('img.retinify').retina();
});</script>
{/if}
6 changes: 5 additions & 1 deletion wa-apps/blog/themes/sidebar/theme.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE theme PUBLIC "wa-app-theme" "http://www.webasyst.com/wa-content/xml/wa-app-theme.dtd">
<theme id="sidebar" system="0" vendor="webasyst" author="Webasyst" app="blog" parent_theme_id="site:sidebar" version="2.0.0">
<theme id="sidebar" system="0" vendor="webasyst" author="Webasyst" app="blog" parent_theme_id="site:sidebar" version="2.0.1">
<name locale="en_US">Sidebar 2.0</name>
<name locale="ru_RU">Sidebar 2.0</name>
<files>
Expand Down Expand Up @@ -40,6 +40,10 @@
<description locale="en_US">Dedicated post page</description>
<description locale="ru_RU">Страница одной записи блога</description>
</file>
<file path="post.album.html" custom="0">
<description locale="en_US">Photo album attached to the blog post</description>
<description locale="ru_RU">Фотоальбом, прикрепленный к записи в блоге</description>
</file>
<file path="page.html" custom="0">
<description locale="en_US">Static info page</description>
<description locale="ru_RU">Информационная страница</description>
Expand Down

0 comments on commit 638f4fc

Please sign in to comment.