Created
February 13, 2013 21:30
-
-
Save greendog/4948494 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LiquorTemplateLoader | |
def self.namespace_to_params(pack, namespace) | |
if namespace == :html | |
scope = pack.html_templates | |
externals = [ :site, :request ] | |
elsif namespace == :email | |
scope = pack.email_templates | |
externals = [ :site, :subscription ] | |
end | |
[ scope, externals ] | |
end | |
def self.load(pack, namespace) | |
manager = Liquor::Manager.new(import: [ | |
# Plugins | |
Liquor::Pagination, | |
FeedbackTag, | |
EmailTag, | |
# Core and plugin functions | |
CoreFunctions, | |
# Functions by model classes | |
VideoFunctions, | |
PostFunctions, | |
MobileFunctions, | |
EventFunctions, | |
MarkupFunctions | |
]) | |
scope, scope_externals = namespace_to_params(pack, namespace) | |
template_externals_map = scope.system_templates | |
ActiveSupport::Notifications.instrument("load.liquor") do | |
scope.includes(:site).turned_on.each do |template| | |
name, body = template.name, template.body | |
if manager.partial? name | |
manager.register_partial name, body | |
else | |
ActiveSupport::Notifications.instrument("load_template.liquor", name: name) do | |
if template_externals_map.include? name | |
externals = scope_externals + template_externals_map[name] | |
else | |
externals = scope_externals | |
end | |
manager.register_template name, body, externals | |
end | |
end | |
end | |
end | |
ActiveSupport::Notifications.instrument("compile.liquor") do | |
manager.compile | |
end | |
manager | |
end | |
def self.try_load(pack, namespace) | |
manager = load(pack, namespace) | |
manager.errors | |
end | |
@cache = {} | |
@cache_timestamps = {} | |
def self.load_with_caching(pack, namespace) | |
cache_key = "#{pack.id}_#{namespace}" | |
scope, = namespace_to_params(pack, namespace) | |
last_updated_at = scope.maximum('updated_at') || Time.now | |
if !@cache_timestamps.has_key?(cache_key) || | |
@cache_timestamps[cache_key] < last_updated_at | |
@cache[cache_key] = load(pack, namespace) | |
@cache_timestamps[cache_key] = last_updated_at | |
end | |
@cache[cache_key] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PublicController < ApplicationController | |
def render_template(name, locals={}, options={}) | |
environment = { | |
site: @current_site.to_drop, | |
request: LiquorRequest.new(request, self), | |
}.merge(locals) | |
if production_domain? | |
pack = @current_site.production_pack | |
else | |
pack = @current_site.development_pack | |
end | |
manager = LiquorTemplateLoader.load_with_caching(pack, :html) | |
if !manager.success? | |
show_errors_with_splash_page(manager, name, manager.errors) | |
return | |
end | |
if !manager.has_template?(name) | |
if name == '404' | |
render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false | |
else | |
render_404 | |
end | |
return | |
end | |
with_layout = options.delete(:layout) | |
with_layout = true if with_layout.nil? | |
if with_layout | |
layout_name = 'layout' | |
end | |
headers["Content-Type"] ||= 'text/html; charset=utf-8' | |
handle_liquor_errors(manager, name) do | |
render :liquor => { | |
:manager => manager, | |
:template => name, | |
:layout => layout_name, | |
:environment => environment, | |
} | |
end | |
end | |
rescue_from ActiveRecord::RecordNotFound, with: :render_404 | |
rescue_from ActionController::RoutingError, with: :render_404 | |
def render_404(error=nil) | |
# UserResourcesController: | |
# 1) Gets invoked when used from the main site, | |
# 2) Needs to render templates, thus subclasses PublicController, | |
# 3) Raises AC::RoutingError even when on the main site. | |
if on_the_main_site? | |
raise error | |
else | |
render_template '404' | |
end | |
end | |
protected | |
def handle_liquor_errors(manager, template_name) | |
if production_domain? | |
errors = Liquor::Runtime.capture_errors do | |
yield | |
end | |
if errors.any? | |
# Type errors are caught here. They are posted to ErrorApp and | |
# appended as console.log() to response body. | |
enqueue_liquor_error(manager, template_name, errors, false) | |
append_errors_to_response_body(manager, template_name, errors) | |
end | |
else | |
yield | |
end | |
# rescue Liquor::HostError => e | |
# In the future, HostErrors should be handled distinctively, as they | |
# signify that _we_ fucked up, as opposed to the template author. | |
# For now, everything is posted into our Airbrake anyway. | |
rescue Liquor::SourceMappedError => e | |
if production_domain? | |
# Type errors will be caught and munged in the code above. If a | |
# Liquor::SourceMappedError falls through, then it's more severe, | |
# cannot be munged and so the app should show 500 instead. | |
enqueue_liquor_error(manager, template_name, [ e ], true) | |
render file: Rails.root.join('public', '500.html'), status: :internal_server_error, layout: false | |
else | |
# If we have arrived here from development mode, then this is | |
# any template error, as type errors are not munged in developer mode. | |
# Show splashscreen to the user. | |
show_errors_with_splash_page(manager, template_name, [ e ]) | |
end | |
end | |
def enqueue_liquor_error(manager, template_name, errors, is_500=true) | |
job = LiquorRuntimeErrorJob.new( | |
@current_site, request.url, | |
template_name, errors, is_500) | |
Delayed::Job.enqueue(job) | |
end | |
def show_errors_with_splash_page(manager, template_name, errors) | |
@manager = manager | |
@errors = errors | |
render 'public/liquor_errors', layout: 'dev' | |
end | |
def append_errors_to_response_body(manager, template_name, errors) | |
log_statements = errors.map do |e| | |
%Q{console.log("Liquor error: " + #{e.message.inspect} + "\\n" + #{manager.decorate(e).join("\\n").inspect});} | |
end.join("\n ") | |
script = <<-SCRIPT | |
<script type="text/javascript"> | |
if(console !== undefined) { | |
#{log_statements} | |
} | |
</script> | |
SCRIPT | |
response.body = response.body.sub %r{(</html>)}, "#{script}\\1" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% content_for "title" capture: %}{{ artist.name }} - Respect Production (Респект Продакшн){% end content_for %} | |
{% assign is_full_bio = !is_empty(request.param("bio")) %} | |
<!--BEGIN .wrap --> | |
<div class="wrap wrap-alt" id="artist-row"> | |
<!--BEGIN .col1 --> | |
<div class="col1"> | |
<dl class="artists"> | |
<dt>Артисты</dt> | |
<dd> | |
<ul> | |
{% for current_artist in: site.self_and_descendant_artists.active.with_orders.sort_by_human_order(site) do: %} | |
<li {% if current_artist == artist then: %}class="here"{% end if %}><a href="{{ current_artist.url(site) }}">{{ current_artist.name }}</a></li> | |
{% end for %} | |
</ul> | |
</dd> | |
</dl> | |
{% include "radio_and_subscribe_vertical" %} | |
{% include "donate" %} | |
{% assign artist_name = "Respect Production" %} | |
{% assign vk_url = "http://vkontakte.ru/club9525" %} | |
{% assign tw_url = "http://twitter.com/Respect_Pro" %} | |
{% assign fb_url = "" %} | |
{% assign artist_name = "Respect production" %} | |
{% assign vk_url = "http://vkontakte.ru/club9525" %} | |
{% assign tw_url = "http://twitter.com/Respect_Pro" %} | |
{% assign fb_url = null %} | |
{! Влади !} | |
{% if artist.id == 3 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/id3883830" %} | |
{% assign tw_url = "http://twitter.com/vlady__kasta" %} | |
{% assign fb_url = "http://www.facebook.com/vladykasta" %} | |
{% end if %} | |
{! Змей !} | |
{% if artist.id == 6 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/zigizmey" %} | |
{% assign tw_url = "http://twitter.com/zmey__kasta" %} | |
{% assign fb_url = "http://www.facebook.com/profile.php?id=100000124267163&fref=ts" %} | |
{% end if %} | |
{! Хамиль !} | |
{% if artist.id == 5 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign tw_url = "http://twitter.com/Hamil__kasta" %} | |
{% end if %} | |
{! Шым !} | |
{% if artist.id == 4 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/id6012030" %} | |
{% assign tw_url = "http://twitter.com/shym__kasta" %} | |
{% end if %} | |
{! Каста !} | |
{% if artist.id == 2 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/club9525" %} | |
{% assign tw_url = "https://twitter.com/#!/kasta_ru" %} | |
{% assign fb_url = "https://www.facebook.com/kastanews" %} | |
{% end if %} | |
{! Песочные люди !} | |
{% if artist.id == 17 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/sandmen_official" %} | |
{% end if %} | |
{! Жара !} | |
{% if artist.id == 51 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/jara_sandman" %} | |
{% assign tw_url = "http://twitter.com/Jara_Sandman" %} | |
{% end if %} | |
{! Кравц !} | |
{% if artist.id == 34 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/id13641471" %} | |
{% assign tw_url = "https://twitter.com/#!/kravz1" %} | |
{% assign fb_url = "https://www.facebook.com/pages/Kravz/193475877340584" %} | |
{% end if %} | |
{! Маринесса !} | |
{% if artist.id == 26 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/club12116101" %} | |
{% assign tw_url = "http://twitter.com/MarinessaP" %} | |
{% assign fb_url = "http://www.facebook.com/profile.php?id=100001101726963&fref=ts" %} | |
{% end if %} | |
{! Корж !} | |
{% if artist.id == 42 then: %} | |
{% assign artist_name = artist.name %} | |
{% assign vk_url = "http://vk.com/max_korzh" %} | |
{% assign tw_url = "http://twitter.com/#!/MAX_KORZH_mus" %} | |
{% assign fb_url = "http://www.facebook.com/max.korzh?fref=ts" %} | |
<style> | |
body { | |
background: url('/img/backgrounds/max_korzh.jpg') !important; | |
} | |
.page { | |
padding: 10px; | |
background: rgba(255, 255, 255, 0.5 ); | |
} | |
</style> | |
{% end if %} | |
{% if !is_empty(fb_url) || !is_empty(tw_url) || !is_empty(vk_url) then: %} | |
<p class="social"><span>{{ artist_name }} в сети</span> | |
{% if !is_empty(fb_url) then: %} | |
<a href="{{ fb_url }}"><img src="/img/facebook.png" alt="" /></a> | |
{% end if %} | |
{% if !is_empty(vk_url) then: %} | |
<a href="{{ vk_url }}"><img src="/img/vkontakte.png" alt="" /></a> | |
{% end if %} | |
{% if !is_empty(tw_url) then: %} | |
<a href="{{ tw_url }}"><img src="/img/twitter.png" alt="" /></a> | |
{% end if %} | |
</p> | |
{% end if %} | |
</div> | |
<!--END .col1 --> | |
<!--BEGIN .col2 --> | |
<div class="col2"> | |
<div class="megahead"> | |
<h1>{{ artist.name }}</h1> | |
{% assign url = artist.url_to_external_or_site %} | |
{% if !is_empty(url) then: %}<p class="link"><a href="{{ url }}">на сайт артиста</a></p>{% end if %} | |
</div> | |
{% assign playlist_array = site.playlists.find_all_by(name:artist.name) %} | |
{% if !is_empty(playlist_array) && is_empty(request.param('bio')) then: %} | |
{% assign playlist = playlist_array[0] %} | |
{% if !is_empty(playlist.playlist_items) then: %} | |
<!--BEGIN .tracks --> | |
<div class="tracks tracks_highlight"> | |
<div class="mediaholder"> | |
{% for item in: playlist.playlist_items do: %} | |
<div {% unless item_loop.is_first then: %}style="display: none"{% end unless %}> | |
{% if item.video then: %} | |
{{ resize_embed_html(item.item.code width: 568 height: 341) }} | |
{% else: %} | |
<img src='{{ image_url(item.item.release size: '568x316') }}'> | |
<object type="application/x-shockwave-flash" data="/player_mp3_multi.swf" width="568" height="25"> | |
<param name="bgcolor" value="#000000" /> | |
<param name="movie" value="/player_mp3_multi.swf" /> | |
<param value="mp3={{ url_escape(url_escape(item.item.preview_file_url)) }}&width=568&height=25&showvolume=1&showlist=0&bgcolor=000000&bgcolor1=000000&loadingcolor=D5D5D5&sliderovercolor=D5D5D5&buttonovercolor=D5D5D5&currentmp3color=D5D5D5&scrollbarovercolor=D5D5D5" name="FlashVars" /> | |
</object> | |
{% end if %} | |
</div> | |
{% end for %} | |
</div> | |
<!--BEGIN .playlist --> | |
<div class="playlist pager_container"> | |
{% assign groups = in_groups_of(playlist.playlist_items size:6) %} | |
<h2>Актуальный плейлист</h2> | |
{% assign global_index = 0 %} | |
{% for group in: groups do: %} | |
<div class="track_playlist pagetolist {% if group_loop.is_first then: %}first current{% end if %} {% if group_loop.is_last then: %}last{% end if %}" {% unless group_loop.is_first then: %}style="display:none"{% end unless %}> | |
<ul> | |
{% for item in: group do: %} | |
{% if !is_empty(item) then: %} | |
{% if item.video then: %} | |
<li class="video" rel="{{ global_index }}"><a href="#"><strong>{{ item.item.title }}</strong>{{ join(item.item.artist_names with:", ") }}<i></i></a></li> | |
{% else: %} | |
<li rel="{{ global_index }}"><a href="#"><strong>{{ item.item.title }}</strong> {{ item.item.plain_artists_title_html }}<i></i></a></li> | |
{% end if %} | |
{% assign global_index = global_index + 1 %} | |
{% end if %} | |
{% end for %} | |
</ul> | |
</div> | |
{% end for %} | |
<p class="pagi"><span class="pages"><strong class="currentpage">1</strong> / <span class="numberofpages">{{ size(groups) }}</span></span> <span class="prev disabled"></span> <span class="next {% if size(groups) == 1 then: %}disabled{% end if %}"></span></p> | |
</div> | |
<!--END .playlist --> | |
</div> | |
<!--END .tracks --> | |
{% end if %} | |
{% end if %} | |
<!--BEGIN .subwrap --> | |
<div class="subwrap"> | |
<!--BEGIN .col21 --> | |
<div class="col21 {% if is_empty(request.param('bio')) then: %}bordertop{% end if %}"> | |
{% if !is_empty(request.param('bio')) then: %} | |
<div class="post border bottom"> | |
{{ clean_media(artist.description) }} | |
</div> | |
{% else: %} | |
<!--BEGIN .col21-left --> | |
<div class="col21-left"> | |
<!--BEGIN .concerts --> | |
{% assign events = artist.events.reverse.around_current(limit: 20 from_past: 1) %} | |
{% assign event_groups = group_by_handled_at(events) %} | |
<div class="concerts pager_container"> | |
<h2>Концерты</h2> | |
{% if is_empty(event_groups) then: %} | |
Текущих концертов нет | |
{% else: %} | |
<div class="pagetolist current first"> | |
{% for group in: event_groups do: %} | |
{% unless group_loop.is_first && is_empty(group[0]) then: %} | |
<h3>{{ strftime(group[0].handled_at_date format: "%B") }}</h3> | |
{% end unless %} | |
<ul class="concdates"> | |
{% for event in: group do: %} | |
{% if !is_empty(event) then: %} | |
<li> | |
<span><strong>{{ strftime(event.handled_at_date format: "%d") }}</strong> {{ strftime(event.handled_at_date format: "%b") }}</span> | |
<div class="cc"> | |
<abbr> | |
<strong>{{ event.artist_names|join with:", " }}</strong> {% if !is_empty(event.external_url) then: %} <a href="{{absolute_url(event.external_url)}}" target="_blank">{{ event.address }}, {{ event.title }}</a> {% else: %} {{ event.address }}, {{ event.title }} {% end if %} | |
</abbr> | |
</div> | |
</li> | |
{% end if %} | |
{% end for %} | |
<ul> | |
{% end for %} | |
</div> | |
{% end if %} | |
</div> | |
<!--END .concerts --> | |
</div> | |
<!--END .col21-left --> | |
<!--BEGIN .col21-right --> | |
{% assign posts = site.blog.aggregated_posts.scoped_to_artist(artist).limit(25) %} | |
{% assign post_groups = in_groups_of(posts size:5) %} | |
<div class="col21-right"> | |
<h2 class="h2">Новости артиста</h2> | |
<div class="pager_container"> | |
{% if is_empty(posts) then: %} | |
Новостей нет | |
{% end if %} | |
{% for post_group in: post_groups do: %} | |
<div class="pagetolist {% if post_group_loop.is_first then: %}first current{% end if %}{% if post_group_loop.is_last then: %}last{% end if %}" {% unless post_group_loop.is_first then: %}style="display: none"{% end unless %}> | |
{% for post in: post_group do: %} | |
{% if !is_empty(post) then: %} | |
<!--BEGIN .hentry --> | |
<div class="hentry hentry-bigpic"> | |
<a href="{{ post.url(site) }}">{{ image_tag(post size: '220x143') }}</a> | |
<h3><a href="{{ post.url(site) }}">{{ post.title }}</a></h3> | |
<p class="published">{{ strftime(post.published_at format: "%d.%m.%y") }}</p> | |
<p>{{ post.preface }}</p> | |
</div> | |
<!--END .hentry --> | |
{% end if %} | |
{% end for %} | |
</div> | |
{% end for %} | |
{% if size(post_groups) > 1 then: %} | |
<p class="pagi"> | |
<span class="pages"> | |
<span class="currentpage">1</span> / <span class="numberofpages">{{ size(post_groups) }}</span> | |
</span> | |
<span class="prev disabled"></span> <span class="next "></span> | |
</p> | |
{% end if %} | |
</div> | |
</div> | |
<!--END .col22-right --> | |
{% end if %} | |
</div> | |
<!--END .col21 --> | |
<!--BEGIN .col22 --> | |
<div class="col22"> | |
{% include "sidebar_banner" %} | |
{% include "twitter" %} | |
</div> | |
<!--END .col22 --> | |
</div> | |
<!--END .subwrap --> | |
</div> | |
<!--END .col2 --> | |
</div> | |
<!--END .wrap-alt --> | |
{% unless is_full_bio then: %} | |
<!--BEGIN .cc1 --> | |
<div class="cc1"> | |
{% include "shop" %} | |
{% include "mobile_offers" %} | |
</div> | |
<!--END .cc1 --> | |
<!--BEGIN .cc2 --> | |
<div class="cc2"> | |
<!--BEGIN .artist-media --> | |
<div class="artist-media"> | |
{% assign albums = artist.photoalbums %} | |
{% unless includes(albums element: artist.primary_photoalbum) then: %} | |
{% assign albums = compact(albums + [artist.primary_photoalbum]) %} | |
{% end unless %} | |
{% if size(albums) > 0 then: %} | |
<!--BEGIN .gallery --> | |
<div class="gallery pager_container"> | |
<h2 class="h2">Галерея</h2> | |
<div class="gall-wrap"> | |
{% assign photo_groups = in_groups_of(albums size:4) %} | |
{% for photo_group in: photo_groups do: %} | |
<div class="pagetolist {% if photo_group_loop.is_first then: %}first current{% end if %} {% if photo_group_loop.is_last then: %}last{% end if %}" {% unless photo_group_loop.is_first then: %}style="display: none"{% end unless %}> | |
<ul> | |
{% for photoalbum in: photo_group do: %} | |
{% if !is_empty(photoalbum) then: %} | |
{% assign photo = photoalbum.cover %} | |
{% if is_empty(photo) && size(photoalbum.photos) > 0 then: %} | |
{% assign photo = photoalbum.photos[0] %} | |
{% end if %} | |
{% if !is_empty(photo) then: %} | |
<li><a href="{{photoalbum.url}}">{{ thumbnail_tag(photo size: '115x75') }}</a></li> | |
{% end if %} | |
{% end if %} | |
{% end for %} | |
</ul> | |
</div> | |
{% end for %} | |
</div> | |
{% if size(photo_groups) > 1 then: %} | |
<p class="pagi"> | |
<span class="pages"> | |
<span class="currentpage">1</span> / <span class="numberofpages">{{ size(photo_groups) }}</span> | |
</span> | |
<span class="prev disabled"></span> <span class="next "></span> | |
</p> | |
{% end if %} | |
</div> | |
<!--END .gallery --> | |
{% end if %} | |
{% assign dvd_releases = artist.releases.recent.scoped_to_media_kind('dvd') %} | |
{% assign not_dvd_releases = artist.releases.recent.scoped_to_not_media_kind('dvd') %} | |
{% if !is_empty(not_dvd_releases) || !is_empty(dvd_releases) then: %} | |
{% assign groups = in_columns(not_dvd_releases count:2) %} | |
<!-- BEGIN releases --> | |
<div class="releases"> | |
<h2>Релизы</h2> | |
<!--BEGIN .releases-wrap --> | |
<div class="releases-wrap"> | |
<!-- BEGIN release col --> | |
<div class="release-col"> | |
{% for release in: groups[0] do: %} | |
{% if !is_empty(release) then: %} | |
<!--BEGIN .release --> | |
<div class="release"> | |
<a href="{{ release.url(site) }}"> | |
{{ image_tag(release size: '85x85') }} | |
</a> | |
<div class="cc"> | |
<h3><a href="{{ release.url(site) }}">{{ release.title }}</a></h3> | |
<p class="title">{{ release.plain_artists_title_html }}</p> | |
{% if release.is_released then: %} | |
<p class="published">{{ strftime(release.released_at format:"%Y") }}</p> | |
{% if !is_empty(release.store_url) then: %} | |
<p class="published"><a href="{{ release.store_url }}">Скачать альбом</a></p> | |
{% end if %} | |
{% if release.has_audio then: %} | |
<p class="act"><a href="{{ release.url(site) }}"><img src="/img/audio.png" alt="" /></a></p> | |
{% end if %} | |
{% else: %} | |
<p class="published">{{ strftime(release.released_at format: "%d.%m.%Y") }}</p> | |
{% end if %} | |
</div> | |
</div> | |
<!--END .releases --> | |
{% end if %} | |
{% end for %} | |
</div> | |
<!-- end release-col --> | |
{% if size(not_dvd_releases) > 1 then: %} | |
<!-- BEGIN release col --> | |
<div class="release-col release-col-right"> | |
{% for release in: groups[1] do: %} | |
{% if !is_empty(release) then: %} | |
<!--BEGIN .release --> | |
<div class="release"> | |
<a href="{{ release.url(site) }}"> | |
{{ image_tag(release size: '85x85') }} | |
</a> | |
<div class="cc"> | |
<h3><a href="{{ release.url(site) }}">{{ release.title }}</a></h3> | |
<p class="title">{{ release.plain_artists_title_html }}</p> | |
{% if release.is_released then: %} | |
<p class="published">{{ strftime(release.released_at format:"%Y") }}</p> | |
{% if release.has_audio then: %} | |
<p class="act"><a href="{{ release.url(site) }}"><img src="/img/audio.png" alt="" /></a></p> | |
{% end if %} | |
{% else: %} | |
<p class="published">{{ strftime(release.released_at format: "%d.%m.%Y") }}</p> | |
{% end if %} | |
</div> | |
</div> | |
<!--END .releases --> | |
{% end if %} | |
{% end for %} | |
</div> | |
<!-- end release-col --> | |
{% end if %} | |
</div> | |
<!--END .releases-wrap --> | |
{% assign groups = in_columns(dvd_releases count:2) %} | |
<!--BEGIN .releases-wrap --> | |
<div class="releases-wrap"> | |
{% if !is_empty(groups[0]) then: %} | |
<!-- BEGIN release col --> | |
<div class="release-col"> | |
{% for release in: groups[0] do: %} | |
{% if !is_empty(release) then: %} | |
<!--BEGIN .release --> | |
<div class="release"> | |
<a href="{{ release.url(site) }}"> | |
{{ image_tag(release size: '60x85') }} | |
</a> | |
<div class="cc dvd"> | |
<h3><a href="{{ release.url(site) }}">{{ release.title }}</a></h3> | |
<p class="title">{{ release.plain_artists_title_html }}</p> | |
{% if release.is_released then: %} | |
<p class="published">{{ strftime(release.released_at format:"%Y") }}</p> | |
{% if release.has_audio then: %} | |
<p class="act"><a href="{{ release.url(site) }}"><img src="/img/audio.png" alt="" /></a></p> | |
{% end if %} | |
{% else: %} | |
<p class="published">{{ strftime(release.released_at format: "%d.%m.%Y") }}</p> | |
{% end if %} | |
</div> | |
</div> | |
<!--END .releases --> | |
{% end if %} | |
{% end for %} | |
</div> | |
<!-- end release-col --> | |
{% end if %} | |
{% if size(dvd_releases) > 1 then: %} | |
<!-- BEGIN release col --> | |
<div class="release-col release-col-right"> | |
{% for release in: groups[1] do: %} | |
{% if !is_empty(release) then: %} | |
<!--BEGIN .release --> | |
<div class="release"> | |
<a href="{{ release.url(site) }}"> | |
{{ image_tag(release size: '60x85') }} | |
</a> | |
<div class="cc dvd"> | |
<h3><a href="{{ release.url(site) }}">{{ release.title }}</a></h3> | |
<p class="title">{{ release.plain_artists_title_html }}</p> | |
{% if release.is_released then: %} | |
<p class="published">{{ strftime(release.released_at format:"%Y") }}</p> | |
{% if release.has_audio then: %} | |
<p class="act"><a href="{{ release.url(site) }}"><img src="/img/audio.png" alt="" /></a></p> | |
{% end if %} | |
{% else: %} | |
<p class="published">{{ strftime(release.released_at format: "%d.%m.%Y") }}</p> | |
{% end if %} | |
</div> | |
</div> | |
<!--END .releases --> | |
{% end if %} | |
{% end for %} | |
</div> | |
<!-- end release-col --> | |
{% end if %} | |
</div> | |
<!--END .releases-wrap --> | |
</div> | |
<!-- releases --> | |
{% end if %} | |
</div> | |
<!--END .artist-media --> | |
<!--BEGIN .b-static --> | |
<div class="b-static" id="artist-bio"> | |
<div class="clr"></div> | |
<h2>{{ artist.name }}</h2> | |
<div class="bio-short"> | |
{{ truncate_words(clean_media(artist.description) words:50) }} | |
</div> | |
<a class="more show-full" href="?bio=full">Читать полностью</a> | |
</div> | |
<!--END .b-static --> | |
</div> | |
<!--END .cc2 --> | |
{% end unless %} | |
<div class="clr"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment