Sha256: 41ab37a15edb3b611d04a9b7bbd51aef39ede0711351f226ebbc0ed328abd939

Contents?: true

Size: 980 Bytes

Versions: 19

Compression:

Stored size: 980 Bytes

Contents

module EnjuCirculation
  module ManifestationsHelper
    def link_to_reservation(manifestation, reserve)
      if current_user
        if current_user.has_role?('Librarian')
          link_to t('manifestation.reserve_this'), new_reserve_path(manifestation_id: manifestation.id)
        else
          if manifestation.is_checked_out_by?(current_user)
            I18n.t('manifestation.currently_checked_out')
          else
            if manifestation.is_reserved_by?(current_user)
              link_to t('manifestation.cancel_reservation'), reserve, confirm: t('page.are_you_sure'), method: :delete 
            else
              link_to t('manifestation.reserve_this'), new_reserve_path(manifestation_id: manifestation.id)
            end
          end
        end
      else
        unless manifestation.items.for_checkout.empty?
          link_to t('manifestation.reserve_this'), new_reserve_path(manifestation_id: manifestation.id)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 lib/enju_circulation/helper.rb
enju_circulation-0.3.10 lib/enju_circulation/helper.rb
enju_circulation-0.3.9 lib/enju_circulation/helper.rb
enju_circulation-0.4.0.rc.1 lib/enju_circulation/helper.rb
enju_circulation-0.3.8 lib/enju_circulation/helper.rb
enju_circulation-0.3.7 lib/enju_circulation/helper.rb
enju_circulation-0.4.0.beta.4 lib/enju_circulation/helper.rb
enju_circulation-0.4.0.beta.3 lib/enju_circulation/helper.rb
enju_circulation-0.3.6 lib/enju_circulation/helper.rb
enju_circulation-0.4.0.beta.2 lib/enju_circulation/helper.rb
enju_circulation-0.4.0.beta.1 lib/enju_circulation/helper.rb
enju_circulation-0.3.5 lib/enju_circulation/helper.rb
enju_circulation-0.3.4 lib/enju_circulation/helper.rb
enju_circulation-0.3.3 lib/enju_circulation/helper.rb
enju_circulation-0.3.2 lib/enju_circulation/helper.rb
enju_circulation-0.3.1 lib/enju_circulation/helper.rb
enju_circulation-0.3.0 lib/enju_circulation/helper.rb
enju_circulation-0.3.0.rc.1 lib/enju_circulation/helper.rb
enju_circulation-0.3.0.beta.1 lib/enju_circulation/helper.rb