internetvideogamelibrary/internetvideogamelibrary-website

View on GitHub
app/views/editions/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title do %>
<%=@edition.title%> - <%=@edition.platform.title%> - Internet Video Game Library
<% end %>
<% breadcrumb :edition, @edition %>
<div class="row" class="center-block" itemscope itemtype="http://schema.org/VideoGame">
    <meta itemprop="applicationCategory" content="Game">
    <meta itemprop="url" content="<%= request.original_url%>" />
    <div class="col-sm-3">
        <div class="container-fluid">
            <div class="row">
                <%= image_tag @edition.coverart.url(:medium), alt: "Cover art of #{@edition.title} - #{@edition.platform.display_title}", itemprop: 'image' %>
            </div>
            <% if current_user.present? %>
                <%= add_shelf_dropdown current_user, @user_shelves, @edition, :no_margin => false %>
            <% end %>
            <div class="row">
                <ul class="list-group">
                    <li class="list-group-item text-center"><strong>Game information</strong></li>
                    <li class="list-group-item text-right"><span class="pull-left"><strong>Original title:</strong></span> <%= @edition.work.original_title %></li>
                    <%- if @edition.work.original_release_date.present? %>
                        <li class="list-group-item text-right"><span class="pull-left"><strong>Original release date:</strong></span> <%= @edition.work.original_release_date.strftime('%d/%m/%Y') %></li>
                    <% end -%>
                    <li class="list-group-item text-center"><strong>Game edition information</strong></li>
                    <%- if @edition.developer.present? %>
                        <li class="list-group-item text-right" itemprop="author" itemscope itemtype="http://schema.org/Organization"><span class="pull-left"><strong>Developer:</strong></span> <span itemprop="name"><%= @edition.developer %></span></li>
                    <% end -%>
                    <%- if @edition.publisher.present? %>
                        <li class="list-group-item text-right" itemprop="publisher" itemscope itemtype="http://schema.org/Organization"><span class="pull-left"><strong>Publisher:</strong></span> <span itemprop="name"><%= @edition.publisher %></span></li>
                    <% end -%>
                    <li class="list-group-item text-right"><span class="pull-left"><strong>Region:</strong></span> <%= @edition.region.title %></li>
                    <%- if @edition.release_date.present? %>
                        <li class="list-group-item text-right"><span class="pull-left"><strong>Release date:</strong></span> <span itemprop="datePublished"><%= @edition.release_date.strftime('%d/%m/%Y') %></span></li>
                    <% end -%>
                    <li class="list-group-item text-right"><span class="pull-left"><strong>Media:</strong></span> <%= @edition.media.title %></li>
                    <%- if @edition.genres.length > 0 %>
                        <li class="list-group-item text-right"><span class="pull-left"><strong>Genres:</strong></span> <% @edition.genres.each_with_index do |g, i| %><% if i > 0 %>, <% end %><span itemprop='genre'><%= g.title %></span><% end %></li>
                    <% end -%>
                </ul>
            </div>
            <%- if current_user.present? and current_user.game_maker_or_more? %>
                <div class="row">
                    <%= link_to "Edit this edition", edit_edition_path(@edition) %>
                </div>
                <%- if @edition.expansions.length == 0 %>
                    <div class="row">
                        <%= link_to "Transform this edition into expansion", transform_edition_path(@edition) %>
                    </div>
                <% end -%>
            <% end -%>
        </div>
    </div>
    <div class="col-sm-9">
        <div class="container-fluid">
            <div class="row">
                <h1><span itemprop='name'><%= @edition.title %></span>
                <small itemprop="gamePlatform"><%= @edition.platform.display_title %></small></h1>
            </div>

            <div class="row" itemprop='description'>
                <%= @edition.markdown_description %>
            </div>
            <div class="row vertical-align">
                <div class="col-sm-2">
                    <h6>Other editions<%- if @other_editions_count > 0 %> (<%= @other_editions_count %>)<% end -%>:</h6>
                </div>

                <%- if @other_editions_count > 0 %>
                    <% @other_editions.each do |other| %>
                        <div class="col-sm-2 thumb">
                            <%= link_to other do %>
                                <%= image_tag other.coverart.url(:thumb), alt: "Cover art of #{other.title} - #{other.platform.display_title}" %>
                            <% end %>
                        </div>
                    <% end %>
                <% else %>
                    <div class="col-sm-2">
                        <h6>None found.</h6>
                    </div>
                <% end -%>
            </div>
            <div class="row">&nbsp;</div>
            <div class="row">
                <span itemprop="isPartOf" itemscope itemtype="http://schema.org/VideoGame"><%= link_to "All editions", @edition.work, itemprop: 'url' %><meta itemprop='name' content="<%=@edition.work.original_title%>"><meta itemprop="applicationCategory" content="Game"></span>
                <%- if current_user.present? and current_user.game_maker_or_more? %>
                    |
                    <%= link_to "Add new edition", new_edition_path(:work_id => @edition.work) %>
                    |
                    <%= link_to "Combine", combine_work_path(@edition.work) %>
                <% end -%>
            </div>
            <div class="row">&nbsp;</div>
            <div class="row">
                <div class="col-sm-2" style="padding-left: 10px; padding-right: 10px;">
                    <h6>DLCs/Expansions<%- if @edition.expansions.length > 0 %> (<%= @edition.expansions.length %>)<% end -%>:</h6>
                </div>

                <%- if @edition.expansions.length > 0 %>
                    <% @edition.expansions.each_with_index do |e,i| %>
                        <%- if (i+1) > 0 && ((i+1) % 6 == 0) %>
                            <div class="clearfix"></div>
                        <% end -%>
                        <div class="col-sm-2 thumb" itemprop="softwareAddOn" itemscope itemtype="http://schema.org/VideoGame">
                            <%= link_to [@edition,e], itemprop: 'url' do %>
                                <%= image_tag e.coverart.url(:thumb), alt: "Cover art of #{e.title} - #{e.edition.platform.display_title}" %>
                            <% end %>
                            <meta itemprop="applicationCategory" content="Game">
                        </div>
                    <% end %>
                <% else %>
                    <div class="col-sm-2">
                        <h6>None found.</h6>
                    </div>
                <% end -%>
            </div>
            <%- if current_user.present? and current_user.game_maker_or_more? %>
                <div class="row">&nbsp;</div>
                <div class="row">
                    <%= link_to "Add DLC/Expansion", new_edition_expansion_path(@edition) %>
                </div>
            <% end -%>
        </div>
    </div>
</div>