public/models/aeon_record_mapper.rb
def hide_button?
        # returning false to maintain the original behavior
        return false unless self.repo_settings

        return true if self.repo_settings.fetch(:hide_request_button, false)
        return true if self.repo_settings.fetch(:hide_button_for_accessions, false) && record.is_a?(Accession)

        if (types = self.repo_settings.fetch(:hide_button_for_access_restriction_types, false))
          notes = (record.json['notes'] || []).select {|n| n['type'] == 'accessrestrict' && n.has_key?('rights_restriction')}
                                              .map {|n| n['rights_restriction']['local_access_restriction_type']}
                                              .flatten.uniq

          # hide if the record notes have any of the restriction types listed in config
          return true if (notes - types).length < notes.length
        end

        false
    end
# This method tests whether the button should be hidden. This determination is based
# on the settings for the repository and defaults to false.
This method tests whether the button should be hidden. This determination is based
on the settings for the repository and defaults to false.
This method tests whether the button should be hidden . This determination is based on the settings for the repository and defaults to false .
def hide_button?
        return false unless self.repo_settings
        return true if self.repo_settings.fetch(:hide_request_button, false)
        return true if self.repo_settings.fetch(:hide_button_for_accessions, false) && record.is_a?(Accession)
        if (types = self.repo_settings.fetch(:hide_button_for_access_restriction_types, false))
          notes = (record.json['notes'] || []).select {|n| n['type'] == 'accessrestrict' && n.has_key?('rights_restriction')}
                                              .map {|n| n['rights_restriction']['local_access_restriction_type']}
                                              .flatten.uniq
          return true if (notes - types).length < notes.length
        end
        false
    end
def hide_button? return false unless self . repo_settings return true if self . repo_settings . fetch ( :hide_request_button , false ) return true if self . repo_settings . fetch ( :hide_button_for_accessions , false ) && record . is_a? ( Accession ) if ( types = self . repo_settings . fetch ( :hide_button_for_access_restriction_types , false ) ) notes = ( record . json [ 'notes' ] || [ ] ) . select { | n | n [ 'type' ] == 'accessrestrict' && n . has_key? ( 'rights_restriction' ) } . map { | n | n [ 'rights_restriction' ] [ 'local_access_restriction_type' ] } . flatten . uniq return true if ( notes - types ) . length < notes . length end false end
This method tests whether the button should be hidden.
This method tests whether the button should be hidden .
# returning false to maintain the original behavior # hide if the record notes have any of the restriction types listed in config