- content_for :title do
= @item.name
.col-sm-6
= image_tag @item.picture.big.url
.col-sm-6
%h2.item-price
= number_to_currency(@item.price)
- if @purchase
.label.label-success.label-bought.pull-right
%i.fa.fa-check
= t('purchased')
- if (teachers = @item.teachers_for_locale(locale)) && teachers.any?
.teachers
- teachers.each do |teacher|
.label.label-default.label-teacher= link_to teacher, items_path(teacher: teacher.to_s)
%p= @item.description.gsub("\n", "
").html_safe
%br
- if @item.publicly_available?
= link_to download_item_path(@item, item_file_id: @item.item_files.first.id), class: 'btn btn-info', target: '_blank' do
%i.fa.fa-download
= t('links.download')
- if @item.item_files.count > 1
= link_to t('see_old_versions'), versions_item_path(@item)
%br
%br
= link_to t('links.back'), root_path, class: 'btn btn-default'
- else
- if @purchase
- if @purchase.active?
- if @purchase.active_from.present?
%blockquote
= t('time_left', value: content_tag(:strong, distance_of_time_in_words(@purchase.active_time_remaining))).html_safe
%p
= link_to download_item_purchase_path(@item, @purchase, item_file_id: @item.item_files.first.id), class: 'btn btn-info', target: '_blank' do
%i.fa.fa-download
= t('links.download')
- if @item.item_files.count > 1
= link_to t('see_old_versions'), versions_item_path(@item)
%br
%br
= link_to t('links.back'), root_path, class: 'btn btn-default'
- else
%blockquote
= t('time_expired')
- else
= form_for [@item, @item.purchases.new], html: { role: 'form', data: { validated: true } } do |f|
= f.hidden_field :item_id
.form-group
= submit_tag t('links.pay_with_paypal'), id: 'paypal-button', class: 'btn btn-primary'
= link_to t('links.back'), root_path, class: 'btn btn-default'
= javascript_include_tag "https://www.paypalobjects.com/js/external/dg.js"