app/views/main/news.html.erb
<% content_for :title, " - Aktualności" %>
<h2 class="text-center mrg20t" style="margin-bottom:50px;margin-bottom:60px">Aktualności</h2>
<ul class="cbp_tmtimeline mrg20b news-timeline">
<%- @news.each do |single| -%>
<li>
<time class="cbp_tmtime" datetime=""><span style="margin-top: -9px;"><small style="font-size: 50%"><%= single.created_at.strftime('%F') -%></small></span></time>
<div class="cbp_tmicon"></div>
<div class="cbp_tmlabel">
<h2><%= link_to single.title, view_news_path(single) -%></h2>
<img class="postImg" style="background-image: url('<%= single.image.url -%>'); background-position: center center; height: 200px; width:100%; margin-left:-30px;" alt="">
<div class="mrg25a mrg0l">
<img class="mrg10r" style="width:40px;height:40px; border: 2px solid #955AA4; border-radius: 20px" src="<%= single.user.image %>"> Autor: <%- if single.user.name.present? -%><%= single.user.name -%><%- else -%><%= single.user.nickname -%><%- end -%>
</div>
<div class="postImg mrg10b" style="border-bottom: 2px solid #955AA4; margin-left:-30px;"> </div>
<%- if single.educator_news -%>
<%= raw parse_markdown(single.content)-%>
<%- else -%>
<%= raw single.content -%>
<%- end -%>
</div>
</li>
<%- end -%>
</ul>
<%# paginate @news FIXME : paginacja -%>
<script type="text/javascript">
function resizePostImgs(){
$('.postImg').width($('.cbp_tmlabel').width()+28.8+28.8+2);
}
$(function(){
$(window).on('resize', resizePostImgs);
resizePostImgs();
});
</script>