notebook/app/views/content/index.html.erb
2016-11-01 21:51:57 +01:00

65 lines
2.0 KiB
Plaintext

<%
content_type_class = @content.build.class
content_type = content_type_class.name.downcase
%>
<% content_for :sidebar_top do %>
<%= render partial: 'cards/serendipitous/content_question', locals: { question: @question, content: @questioned_content } %>
<% end %>
<% if @content.any? %>
<div class="slider" style="height: 140px;">
<ul class="slides">
<li>
<%= image_tag "card-headers/#{content_type.pluralize}" %>
<img src="http://lorempixel.com/580/250/nature/1">
<div class="caption center-align">
<h3><%= content_type.titleize.pluralize %></h3>
<h5 class="light grey-text text-lighten-3"><%= t("content_oneliners.#{content_type}") %></h5>
</div>
</li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.slider').slider({
height: 200,
indicators: false
});
});
</script>
<h4>
You've created <%= pluralize(@content.count, @content.content_name) %>
<% if @content.count > 0 %>
<small class="right">
<%= link_to new_polymorphic_path(@content.build), class: "btn white #{content_type_class.color}-text" do %>
+
<i class="material-icons <%= content_type_class.color %>-text">
<%= content_type_class.icon %>
</i>
<% end %>
</small>
<% end %>
</h4>
<%= render partial: 'content/list/list', locals: { content_list: @content, show_add_another_form: true } %>
<% elsif @content.empty? %>
<div class="center" style="margin-bottom: 50px;">
<h4>You haven't created any <%= @content.content_name.pluralize %> yet!</h4>
<h1>
<i class="material-icons <%= content_type_class.color %>-text" style="font-size: 200%">
<%= content_type_class.icon %>
</i>
</h1>
<p>
<%= t("content_descriptions.#{content_type}") %>
</p>
<%= link_to "Create your first #{@content.content_name.humanize.downcase}", new_polymorphic_path(@content.build), class: "btn #{content_type_class.color}" %>
</div>
<% end %>