Module: CiniiBooksHelper

Defined in:
app/helpers/cinii_books_helper.rb

Instance Method Summary collapse

Instance Method Details



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/cinii_books_helper.rb', line 3

def link_to_import_from_cinii(ncid)
  if ncid.blank?
    t('enju_nii.not_available')
  else
    identifier_type = IdentifierType.where(name: 'ncid').first
    if identifier_type
      manifestation = Identifier.where(body: ncid, identifier_type_id: identifier_type.id).first.try(:manifestation)
    end
    unless manifestation
      button_to t('enju_nii.add'), cinii_books_path(book: {ncid: ncid}), method: :post, data: {disable_with: t('page.saving')}
    else
      link_to t('enju_nii.already_exists'), manifestation
    end
  end
end