source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/batch_edits_helper.rb | Ruby | apache-2.0 | 197 | main | 458 | # frozen_string_literal: true
module Hyrax
##
# View Helpers for Hydra Batch Edit functionality
module BatchEditsHelper
# Displays the delete button for batch editing
def batch_delete
render 'hyrax/batch_edits/delete_selected'
end
# Displays a "check all" button with a dropdown that has "S... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/contact_form_helper.rb | Ruby | apache-2.0 | 197 | main | 642 | # frozen_string_literal: true
module Hyrax
##
# Helpers for displaying Hyrax's default contact form.
module ContactFormHelper
##
# @api public
#
# Provides the "issue type" options for the contact form dropdown. The
# response should be compatible with ActionView's `options_for_select`
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/title_helper.rb | Ruby | apache-2.0 | 197 | main | 806 | # frozen_string_literal: true
module Hyrax::TitleHelper
def application_name
t('hyrax.product_name', default: super)
end
def construct_page_title(*elements)
(elements.flatten.compact + [application_name]).join(' // ')
end
##
# @deprecated
def curation_concern_page_title(curation_concern)
De... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/content_block_helper_behavior.rb | Ruby | apache-2.0 | 197 | main | 381 | # frozen_string_literal: true
module Hyrax
module ContentBlockHelperBehavior
def displayable_content_block(content_block, **options)
return unless display_content_block? content_block
tag.div(raw(content_block.value), **options)
end
def display_content_block?(content_block)
content_bloc... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/collections_helper.rb | Ruby | apache-2.0 | 197 | main | 6,891 | # frozen_string_literal: true
module Hyrax
module CollectionsHelper # rubocop:disable Metrics/ModuleLength
##
# @since 3.1.0
# @return [Array<SolrDocument>]
def available_child_collections(collection:)
Hyrax::Collections::NestedCollectionQueryService
.available_child_collections(parent: ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/charts_helper.rb | Ruby | apache-2.0 | 197 | main | 493 | # frozen_string_literal: true
module Hyrax
module ChartsHelper
# @example A chart with a drilldown
# {
# "First" => {
# "Second" => 3,
# "Third" => 3
# }
# }
# @example A chart without a drilldown
# {
# "First" => 3,
# "Second" => 4
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/embargo_helper.rb | Ruby | apache-2.0 | 197 | main | 1,729 | # frozen_string_literal: true
module Hyrax
module EmbargoHelper
def assets_with_expired_embargoes
@assets_with_expired_embargoes ||= EmbargoService.assets_with_expired_embargoes
end
def assets_under_embargo
@assets_under_embargo ||= EmbargoService.assets_under_embargo
end
def assets_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/membership_helper.rb | Ruby | apache-2.0 | 197 | main | 2,242 | # frozen_string_literal: true
module Hyrax
module MembershipHelper
##
# @param resource [#member_of_collection_ids, #member_of_collections_json]
#
# @return [String] JSON for `data-members`
#
# @todo optimize collection name lookup. the legacy `WorkForm`
# implementation pulls all the c... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behavior.rb | Ruby | apache-2.0 | 197 | main | 920 | # frozen_string_literal: true
module Hyrax
module CitationsBehavior
include Hyrax::CitationsBehaviors::CommonBehavior
include Hyrax::CitationsBehaviors::Formatters
include Hyrax::CitationsBehaviors::PublicationBehavior
include Hyrax::CitationsBehaviors::NameBehavior
include Hyrax::CitationsBehavio... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/permission_levels_helper.rb | Ruby | apache-2.0 | 197 | main | 955 | # frozen_string_literal: true
module Hyrax
module PermissionLevelsHelper
##
# @return [Hash<String, String>] a map from i18nized strings to permission
# level keywords
def configured_permission_levels
Hyrax.config.permission_levels.values.index_by do |level|
I18n.t("hyrax.permission_l... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/iiif_helper.rb | Ruby | apache-2.0 | 197 | main | 806 | # frozen_string_literal: true
module Hyrax
module IiifHelper
def iiif_viewer_display(work_presenter, locals = {})
render iiif_viewer_display_partial(work_presenter),
**locals.merge(presenter: work_presenter)
end
def iiif_viewer_display_partial(work_presenter)
'hyrax/base/iiif_vie... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/hyrax_helper_behavior.rb | Ruby | apache-2.0 | 197 | main | 16,295 | # coding: utf-8
# frozen_string_literal: true
module Hyrax
module HyraxHelperBehavior
include Hyrax::CitationsBehavior
include ERB::Util # provides html_escape
include Hyrax::ContactFormHelper
include Hyrax::TitleHelper
include Hyrax::FileSetHelper
include Hyrax::AbilityHelper
include Hyra... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/works_helper.rb | Ruby | apache-2.0 | 197 | main | 384 | # frozen_string_literal: true
module Hyrax
module WorksHelper
def available_collections(work:)
return [] if @current_ability.blank?
all_collections = Hyrax::CollectionsService.new(self).all_search_results(:deposit)
return all_collections if work.blank?
all_collections.reject { |col| wor... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/blacklight_override.rb | Ruby | apache-2.0 | 197 | main | 1,191 | # frozen_string_literal: true
module Hyrax
# Overrides of methods defined by the Blacklight gem.
module BlacklightOverride
def application_name
t('hyrax.product_name', default: super)
end
# rubocop:disable Metrics/MethodLength
def index_field_label(document, field)
field_config = index_... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/trophy_helper.rb | Ruby | apache-2.0 | 197 | main | 924 | # frozen_string_literal: true
module Hyrax
module TrophyHelper
def display_trophy_link(user, id, args = {}, &_block)
return unless user
trophy = user.trophies.where(work_id: id).exists?
trophyclass = trophy ? "trophy-on" : "trophy-off"
args[:add_text] ||= t("hyrax.dashboard.my.action.high... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/formatters.rb | Ruby | apache-2.0 | 197 | main | 735 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module Formatters
class BaseFormatter
include Hyrax::CitationsBehaviors::CommonBehavior
include Hyrax::CitationsBehaviors::NameBehavior
attr_reader :view_context
def initialize(view_context)
@vie... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/common_behavior.rb | Ruby | apache-2.0 | 197 | main | 374 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module CommonBehavior
def persistent_url(work)
"#{Hyrax.config.persistent_hostpath}#{work.id}"
end
def clean_end_punctuation(text)
return text[0, text.length - 1] if text && ([".", ",", ":", ";", "/"].include? ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/name_behavior.rb | Ruby | apache-2.0 | 197 | main | 1,667 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module NameBehavior
include Hyrax::CitationsBehaviors::CommonBehavior
# return all unique authors with end punctuation removed
def author_list(work)
all_authors(work) { |author| clean_end_punctuation(CGI.escapeHTML(auth... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/publication_behavior.rb | Ruby | apache-2.0 | 197 | main | 1,227 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module PublicationBehavior
include Hyrax::CitationsBehaviors::CommonBehavior
def setup_pub_date(work)
first_date = work.date_created.first if work.date_created
if first_date.present?
first_date = CGI.escapeH... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/title_behavior.rb | Ruby | apache-2.0 | 197 | main | 1,529 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module TitleBehavior
include Hyrax::CitationsBehaviors::CommonBehavior
TITLE_NOCAPS = ["a", "an", "and", "but", "by", "for", "it", "of", "the", "to", "with"].freeze
EXPANDED_NOCAPS = TITLE_NOCAPS + ["about", "across", "before"... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/formatters/open_url_formatter.rb | Ruby | apache-2.0 | 197 | main | 1,234 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module Formatters
class OpenUrlFormatter < BaseFormatter
def format(work)
export_text = []
export_text << "url_ver=Z39.88-2004&ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/formatters/apa_formatter.rb | Ruby | apache-2.0 | 197 | main | 2,362 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module Formatters
class ApaFormatter < BaseFormatter
include Hyrax::CitationsBehaviors::PublicationBehavior
include Hyrax::CitationsBehaviors::TitleBehavior
def format(work)
text = ''
text += au... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/formatters/mla_formatter.rb | Ruby | apache-2.0 | 197 | main | 1,915 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module Formatters
class MlaFormatter < BaseFormatter
include Hyrax::CitationsBehaviors::PublicationBehavior
include Hyrax::CitationsBehaviors::TitleBehavior
def format(work)
text = ''
# setup f... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb | Ruby | apache-2.0 | 197 | main | 2,106 | # frozen_string_literal: true
module Hyrax
module CitationsBehaviors
module Formatters
class ChicagoFormatter < BaseFormatter
include Hyrax::CitationsBehaviors::PublicationBehavior
include Hyrax::CitationsBehaviors::TitleBehavior
def format(work)
text = ""
# setu... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/iiif_manifest_cache_prewarm_job.rb | Ruby | apache-2.0 | 197 | main | 355 | # frozen_string_literal: true
class IiifManifestCachePrewarmJob < Hyrax::ApplicationJob
##
# @param work [ActiveFedora::Base]
def perform(work)
presenter = Hyrax::IiifManifestPresenter.new(work)
manifest_builder.manifest_for(presenter: presenter)
end
private
def manifest_builder
Hyrax::Cachin... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/file_set_attached_event_job.rb | Ruby | apache-2.0 | 197 | main | 876 | # frozen_string_literal: true
# Log a fileset attachment to activity streams
class FileSetAttachedEventJob < ContentEventJob
# Log the event to the fileset's and its container's streams
def log_event(repo_object)
repo_object.log_event(event)
curation_concern.log_event(event)
end
def action
"User #{... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/lease_expiry_job.rb | Ruby | apache-2.0 | 197 | main | 527 | # frozen_string_literal: true
class LeaseExpiryJob < Hyrax::ApplicationJob
def perform
records_with_expired_leases.each do |resource|
Hyrax::LeaseManager.release_lease_for(resource: resource) &&
Hyrax::AccessControlList(resource).save
end
end
##
# @return [Enumerator<String>] ids for all ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/import_export_job.rb | Ruby | apache-2.0 | 197 | main | 873 | # frozen_string_literal: true
require 'open3'
class ImportExportJob < ApplicationJob
include Open3
# @param resource [String] uri of the resource
# @param mode [String] "import" or "export" mode
# @param dir [String] location of export
# TODO: Support BagIt profile
def perform(resource:, mode: 'export', d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/import_url_job.rb | Ruby | apache-2.0 | 197 | main | 3,917 | # frozen_string_literal: true
require 'uri'
require 'tmpdir'
require 'browse_everything/retriever'
##
# Given a {FileSet} that has an +#import_url+ property, download that file and
# deposit into Fedora.
#
# @note this is commonly called during deposit by {AttachFilesToWorkJob} (when
# files are uploaded directly as... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/inherit_permissions_job.rb | Ruby | apache-2.0 | 197 | main | 1,592 | # frozen_string_literal: true
# A job to apply work permissions to all contained files set
#
class InheritPermissionsJob < Hyrax::ApplicationJob
# Perform the copy from the work to the contained filesets
#
# @param work containing access level and filesets
def perform(work)
case work
when ActiveFedora::... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_deposit_event_job.rb | Ruby | apache-2.0 | 197 | main | 264 | # frozen_string_literal: true
# Log a concern deposit to activity streams
class ContentDepositEventJob < ContentEventJob
def action
"User #{link_to_profile depositor} has deposited #{link_to repo_object.title.first, polymorphic_path(repo_object)}"
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_deposit_error_event_job.rb | Ruby | apache-2.0 | 197 | main | 432 | # frozen_string_literal: true
# Log a concern deposit to activity streams
class ContentDepositErrorEventJob < ContentEventJob
attr_accessor :reason
def perform(repo_object, depositor, reason: '')
self.reason = reason
super(repo_object, depositor)
end
def action
"User #{link_to_profile depositor} d... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_delete_event_job.rb | Ruby | apache-2.0 | 197 | main | 618 | # frozen_string_literal: true
# Log object deletion to activity streams
#
# @attr_reader deleted_work_id The id of the work that has been deleted by the user
class ContentDeleteEventJob < EventJob
attr_reader :deleted_work_id
def perform(deleted_work_id, depositor)
@deleted_work_id = deleted_work_id
super(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/migrate_files_to_valkyrie_job.rb | Ruby | apache-2.0 | 197 | main | 5,099 | ##
# Responsible for conditionally enqueuing the file and thumbnail migration
# logic of an ActiveFedora object.
class MigrateFilesToValkyrieJob < Hyrax::ApplicationJob
# Define a logger for this job
def logger
FileUtils.mkdir_p(Hyrax.config.working_path)
@logger ||= Logger.new(Hyrax.config.working_path.joi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/event_job.rb | Ruby | apache-2.0 | 197 | main | 1,122 | # frozen_string_literal: true
##
# @abstract
#
# A generic job for sending events to a user.
class EventJob < Hyrax::ApplicationJob
include Rails.application.routes.url_helpers
include ActionView::Helpers # For link_to
include HyraxHelper # For link_to_profile
queue_as Hyrax.config.ingest_queue_name
attr_re... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/valkyrie_ingest_job.rb | Ruby | apache-2.0 | 197 | main | 1,812 | # frozen_string_literal: true
##
# Ingests a {Hyrax::UploadedFile} as file member of a {Hyrax::FileSet}.
#
# The {Hyrax::UploadedFile} is passed into {#perform}, and should have a
# {Hyrax::UploadedFile#file_set_uri} identifying an existing {Hyrax::FileSet}.
class ValkyrieIngestJob < Hyrax::ApplicationJob
queue_as H... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/create_derivatives_job.rb | Ruby | apache-2.0 | 197 | main | 1,186 | # frozen_string_literal: true
class CreateDerivativesJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
# @param [FileSet] file_set
# @param [String] file_id identifier for a Hydra::PCDM::File
# @param [String, NilClass] filepath the cached file within the Hyrax.config.working_path
def perfo... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/embargo_expiry_job.rb | Ruby | apache-2.0 | 197 | main | 557 | # frozen_string_literal: true
class EmbargoExpiryJob < Hyrax::ApplicationJob
def perform
records_with_expired_embargos.each do |resource|
Hyrax::EmbargoManager.release_embargo_for(resource: resource) &&
Hyrax::AccessControlList(resource).save
end
end
##
# @return [Enumerator<Valkyrie::Res... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/attach_files_to_work_with_ordered_members_job.rb | Ruby | apache-2.0 | 197 | main | 1,764 | # frozen_string_literal: true
# Converts UploadedFiles into FileSets and attaches them to works.
class AttachFilesToWorkWithOrderedMembersJob < AttachFilesToWorkJob
attr_reader :ordered_members, :uploaded_files
# @param [ActiveFedora::Base] work - the work object
# @param [Array<Hyrax::UploadedFile>] uploaded_fi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/migrate_sipity_entity_job.rb | Ruby | apache-2.0 | 197 | main | 884 | # frozen_string_literal: true
# migrates a resource's sipity entity so it can be found
class MigrateSipityEntityJob < ApplicationJob
# input [String] id of a migrated resource
def perform(id:)
resource = Hyrax.query_service.find_by(id: id)
new_gid = Hyrax::GlobalID(resource).to_s
return if Sipity::Enti... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/valkyrie_characterization_job.rb | Ruby | apache-2.0 | 197 | main | 405 | # frozen_string_literal: true
class ValkyrieCharacterizationJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
def perform(file_metadata_id)
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_metadata_id)
Hyrax.config.characterization_service
.run(metadata: file_me... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_event_job.rb | Ruby | apache-2.0 | 197 | main | 609 | # frozen_string_literal: true
# A generic job for sending events about repository objects to a user and their followers.
#
# @attr [String] repo_object the object event is specified for
#
class ContentEventJob < EventJob
attr_reader :repo_object
def perform(repo_object, depositor)
@repo_object = repo_object
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/stream_notifications_job.rb | Ruby | apache-2.0 | 197 | main | 548 | # frozen_string_literal: true
class StreamNotificationsJob < Hyrax::ApplicationJob
def perform(users)
# Do not use the ActionCable machinery if the feature is disabled
return unless Hyrax.config.realtime_notifications?
Array.wrap(users).each do |user|
mailbox = UserMailbox.new(user)
Hyrax::Not... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/user_edit_profile_event_job.rb | Ruby | apache-2.0 | 197 | main | 262 | # frozen_string_literal: true
# Log user profile edits to activity streams
class UserEditProfileEventJob < EventJob
def perform(editor)
@editor = editor
super
end
def action
"User #{link_to_profile @editor} has edited their profile"
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/batch_create_job.rb | Ruby | apache-2.0 | 197 | main | 1,877 | # frozen_string_literal: true
class BatchCreateJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
before_enqueue do |job|
operation = job.arguments.last
operation.pending_job(self)
end
# This copies metadata from the passed in attribute to all of the works that
# are members of the ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/attach_files_to_work_job.rb | Ruby | apache-2.0 | 197 | main | 3,085 | # frozen_string_literal: true
# Converts UploadedFiles into FileSets and attaches them to works.
class AttachFilesToWorkJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
# @param [ActiveFedora::Base] work - the work object
# @param [Array<Hyrax::UploadedFile>] uploaded_files - an array of files... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/create_work_job.rb | Ruby | apache-2.0 | 197 | main | 2,187 | # frozen_string_literal: true
# This is a job spawned by the BatchCreateJob
class CreateWorkJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
discard_on StandardError
before_enqueue do |job|
operation = job.arguments.last
operation.pending_job(self)
end
# This copies metadata from ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/characterize_job.rb | Ruby | apache-2.0 | 197 | main | 5,012 | # frozen_string_literal: true
##
# a +ActiveJob+ job to process file characterization.
#
# the characterization process is handled by a service object, which is
# configurable via {CharacterizeJob.characterization_service}.
#
# @example setting a custom characterization service
# class MyCharacterizer
# def run(... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/fixity_check_job.rb | Ruby | apache-2.0 | 197 | main | 2,660 | # frozen_string_literal: true
class FixityCheckJob < Hyrax::ApplicationJob
# A Job class that runs a fixity check (using Hyrax.config.fixity_service)
# which contacts fedora and requests a fixity check), and stores the results
# in an ActiveRecord ChecksumAuditLog row. It also prunes old ChecksumAuditLog
# rows... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/ingest_job.rb | Ruby | apache-2.0 | 197 | main | 689 | # frozen_string_literal: true
class IngestJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
after_perform do |job|
# We want the lastmost Hash, if any.
opts = job.arguments.reverse.detect { |x| x.is_a? Hash } || {}
wrapper = job.arguments.first
ContentNewVersionEventJob.perform_la... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/ingest_local_file_job.rb | Ruby | apache-2.0 | 197 | main | 1,046 | # frozen_string_literal: true
##
# Ingest a local file using ActiveFedora & FileSetActor.
class IngestLocalFileJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
# @param [FileSet, Hyrax::FileSet] file_set
# @param [String] path
# @param [User] user
def perform(file_set, path, user)
__pe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_restored_version_event_job.rb | Ruby | apache-2.0 | 197 | main | 492 | # frozen_string_literal: true
# Log file restored version to activity streams
class ContentRestoredVersionEventJob < ContentEventJob
attr_accessor :revision_id
def perform(file_set, depositor, revision_id)
@revision_id = revision_id
super(file_set, depositor)
end
def action
"User #{link_to_profile... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/change_depositor_event_job.rb | Ruby | apache-2.0 | 197 | main | 1,375 | # frozen_string_literal: true
# Log work depositor change to activity streams
#
# This class simply logs the transfer, pulling data from the object that was
# just transferred. It does not perform the transfer.
class ChangeDepositorEventJob < ContentEventJob
include Rails.application.routes.url_helpers
include Acti... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_new_version_event_job.rb | Ruby | apache-2.0 | 197 | main | 336 | # frozen_string_literal: true
# Log new version of a file to activity streams
class ContentNewVersionEventJob < ContentEventJob
def action
@action ||= "User #{link_to_profile depositor} has added a new version of #{link_to repo_object.title.first, Rails.application.routes.url_helpers.hyrax_file_set_path(repo_obje... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/visibility_copy_job.rb | Ruby | apache-2.0 | 197 | main | 426 | # frozen_string_literal: true
# Responsible for copying the following attributes from the work to each file in the file_sets
#
# * visibility
# * lease
# * embargo
class VisibilityCopyJob < Hyrax::ApplicationJob
# @api public
# @param [Hyrax::WorkBehavior, Hyrax::Resource] work - a Work model,
# using ActiveFed... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/valkyrie_create_derivatives_job.rb | Ruby | apache-2.0 | 197 | main | 1,053 | # frozen_string_literal: true
class ValkyrieCreateDerivativesJob < Hyrax::ApplicationJob
queue_as Hyrax.config.ingest_queue_name
def perform(file_set_id, file_id, _filepath = nil)
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_id)
return if file_metadata.video? && !Hyrax.config.enable_f... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/migrate_resources_job.rb | Ruby | apache-2.0 | 197 | main | 916 | # frozen_string_literal: true
# migrates models from AF to valkyrie
class MigrateResourcesJob < ApplicationJob
attr_writer :errors
# input [Array>>String] Array of ActiveFedora model names to migrate to valkyrie objects
# defaults to AdminSet & Collection models if empty
def perform(ids: [], models: ['AdminSet... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/content_update_event_job.rb | Ruby | apache-2.0 | 197 | main | 258 | # frozen_string_literal: true
# Log content update to activity streams
class ContentUpdateEventJob < ContentEventJob
def action
"User #{link_to_profile depositor} has updated #{link_to repo_object.title.first, polymorphic_path(repo_object)}"
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/concerns/hyrax/members_permission_job_behavior.rb | Ruby | apache-2.0 | 197 | main | 757 | # frozen_string_literal: true
module Hyrax
# Grants read access for the supplied user for the members attached to a work
module MembersPermissionJobBehavior
extend ActiveSupport::Concern
included do
queue_as Hyrax.config.ingest_queue_name
end
private
# Filter the member ids and return o... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/concerns/hyrax/queued_job_behavior.rb | Ruby | apache-2.0 | 197 | main | 518 | # frozen_string_literal: true
module Hyrax
# Grants the user's edit access on the provided FileSet
module QueuedJobBehavior
extend ActiveSupport::Concern
included do
queue_as Hyrax.config.ingest_queue_name
cattr_accessor :requeue_frequency
end
private
def redis_queue
Valkyri... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/concerns/hyrax/permission_job_behavior.rb | Ruby | apache-2.0 | 197 | main | 500 | # frozen_string_literal: true
module Hyrax
# Grants the user's edit access on the provided FileSet
module PermissionJobBehavior
extend ActiveSupport::Concern
included do
queue_as Hyrax.config.ingest_queue_name
end
private
def acl(id)
valk_id = Valkyrie::ID.new(id)
file_set =... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/grant_edit_to_members_job.rb | Ruby | apache-2.0 | 197 | main | 634 | # frozen_string_literal: true
module Hyrax
# Grants edit access for the supplied user for the members attached to a work
class GrantEditToMembersJob < ApplicationJob
include MembersPermissionJobBehavior
# @param work [ActiveFedora::Base] the work object
# @param user_key [String] the user to add
def... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/grant_read_job.rb | Ruby | apache-2.0 | 197 | main | 697 | # frozen_string_literal: true
module Hyrax
# Grants the user's read access on the provided FileSet
class GrantReadJob < ApplicationJob
include PermissionJobBehavior
# @param file_set_id [String] the identifier of the object to grant access to
# @param user_key [String] the user to add
# @param use_v... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/grant_edit_job.rb | Ruby | apache-2.0 | 197 | main | 686 | # frozen_string_literal: true
module Hyrax
# Grants the user's edit access on the provided FileSet
class GrantEditJob < ApplicationJob
include PermissionJobBehavior
# @param file_set_id [String] the identifier of the object to grant access to
# @param user_key [String] the user to add
# @param use_v... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/grant_read_to_members_job.rb | Ruby | apache-2.0 | 197 | main | 634 | # frozen_string_literal: true
module Hyrax
# Grants read access for the supplied user for the members attached to a work
class GrantReadToMembersJob < ApplicationJob
include MembersPermissionJobBehavior
# @param work [ActiveFedora::Base] the work object
# @param user_key [String] the user to add
def... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/queued_indexing_job.rb | Ruby | apache-2.0 | 197 | main | 230 | # frozen_string_literal: true
module Hyrax
class QueuedIndexingJob < ApplicationJob
include QueuedJobBehavior
def perform(size: 200)
redis_queue.index_queue(size: size)
requeue(size: size)
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/queued_delete_job.rb | Ruby | apache-2.0 | 197 | main | 229 | # frozen_string_literal: true
module Hyrax
class QueuedDeleteJob < ApplicationJob
include QueuedJobBehavior
def perform(size: 200)
redis_queue.delete_queue(size: size)
requeue(size: size)
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/propagate_change_depositor_job.rb | Ruby | apache-2.0 | 197 | main | 1,449 | # frozen_string_literal: true
module Hyrax
# updates depositor on file sets and resets permissions if flagged. Used by
# ChangeDepositorService to background changes to lots of file sets
class PropagateChangeDepositorJob < ApplicationJob
# @param work_id [Valkyrie::Id, String] the id of the work
# ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/application_job.rb | Ruby | apache-2.0 | 197 | main | 478 | # frozen_string_literal: true
module Hyrax
# A common base class for all Hyrax jobs.
# This allows downstream applications to manipulate all the hyrax jobs by
# including modules on this class.
class ApplicationJob < ::ApplicationJob
before_enqueue do |job|
job.arguments.map! do |arg|
case arg... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/revoke_edit_from_members_job.rb | Ruby | apache-2.0 | 197 | main | 642 | # frozen_string_literal: true
module Hyrax
# Revokes edit access for the supplied user for the members attached to a work
class RevokeEditFromMembersJob < ApplicationJob
include MembersPermissionJobBehavior
# @param work [ActiveFedora::Base] the work object
# @param user_key [String] the user to remove
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/jobs/hyrax/revoke_edit_job.rb | Ruby | apache-2.0 | 197 | main | 708 | # frozen_string_literal: true
module Hyrax
# Revokes the user's edit access on the provided FileSet
class RevokeEditJob < ApplicationJob
include PermissionJobBehavior
# @param file_set_id [String] the identifier of the object to revoke access from
# @param user_key [String] the user to remove
# @par... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/validators/hyrax/collection_membership_validator.rb | Ruby | apache-2.0 | 197 | main | 1,248 | # frozen_string_literal: true
module Hyrax
##
# Validates that the record passes the multiple membership requirements for collections.
class CollectionMembershipValidator < ActiveModel::Validator
##
# @param multiple_membership_checker
def initialize(options = {})
@multiple_membership_checker = ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | app/validators/hyrax/has_one_title_validator.rb | Ruby | apache-2.0 | 197 | main | 309 | # frozen_string_literal: true
module Hyrax
# validates that the title has at least one title
class HasOneTitleValidator < ActiveModel::Validator
def validate(record)
return unless record.title.reject(&:empty?).empty?
record.errors.add(:title, "You must provide a title")
end
end
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/routes.rb | Ruby | apache-2.0 | 197 | main | 10,501 | # frozen_string_literal: true
Hyrax::Engine.routes.draw do
# Downloads controller route
resources :homepage, only: 'index'
# Route the home page as the root
root to: 'homepage#index'
get '/robots', to: 'homepage#robots'
# Handle routes that existed in Hyrax < 7
# e.g. https://scholarsphere.psu.edu/fi... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/features.rb | Ruby | apache-2.0 | 197 | main | 2,613 | # frozen_string_literal: true
Flipflop.configure do
# Strategies will be used in the order listed here.
strategy :cookie
strategy :active_record, class: Hyrax::Feature
strategy Hyrax::Strategies::YamlStrategy, config: Hyrax.config.feature_config_path
strategy :default
group :site_configuration do
featu... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/storage_adapter_initializer.rb | Ruby | apache-2.0 | 197 | main | 662 | # frozen_string_literal: true
Rails.application.config.after_initialize do
unless Valkyrie::StorageAdapter.storage_adapters.key?(:branding_disk)
Valkyrie::StorageAdapter.register(
Valkyrie::Storage::Disk.new(base_path: Hyrax.config.branding_path,
path_generator: Hyrax::Val... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/indexing_adapter_initializer.rb | Ruby | apache-2.0 | 197 | main | 337 | # frozen_string_literal: true
Valkyrie::IndexingAdapter.register(
Valkyrie::Indexing::Solr::IndexingAdapter.new,
:solr_index
)
Valkyrie::IndexingAdapter.register(
Valkyrie::Indexing::NullIndexingAdapter.new, :null_index
)
Valkyrie::IndexingAdapter.register(
Valkyrie::Indexing::RedisQueue::IndexingAdapter.new,
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/file_length_patch.rb | Ruby | apache-2.0 | 197 | main | 255 | # frozen_string_literal: true
# Valkyrie::Storage::Fedora expects io objects to have #length
class ::File
alias length size unless respond_to? :length
end
class ::Valkyrie::StorageAdapter::StreamFile
alias length size unless respond_to? :length
end |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/1_healthz.rb | Ruby | apache-2.0 | 197 | main | 1,253 | # frozen_string_literal: true
# Add an endpoint at `/healthz` if `OkComputer` is installed.
# - `healthz` functions as a basic liveness check;
# - `healthz/{status_name}` checks a specific registered status;
# - `healthz/all` compiles all registered checks.
#
# To install these checks by default, add `gem 'okcom... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/i18n_extensions.rb | Ruby | apache-2.0 | 197 | main | 6,551 | # frozen_string_literal: true
# Extensions to the I18n module to enable reverse lookup of translation keys by their values
# This is useful for debugging, testing, and finding where specific text comes from in the codebase
module I18n
class << self
# Find translation key(s) that have a specific value
# @para... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/deprecation_patch.rb | Ruby | apache-2.0 | 197 | main | 990 | # frozen_string_literal: true
#
# OVERRIDE deprecation v1.1.0 – handle calls using either the deprecation gem method signature
# or newer Rails method signatues.
# see: https://github.com/samvera/hyrax/issues/7303
# Remove when: dependencies no longer pull ... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/listeners.rb | Ruby | apache-2.0 | 197 | main | 2,126 | # frozen_string_literal: true
Hyrax.publisher.subscribe(Hyrax::Listeners::ActiveFedoraACLIndexListener.new) unless Hyrax.config.disable_wings
Rails.application.reloader.to_prepare do
Hyrax.publisher.default_listeners.each do |listener|
Hyrax.publisher.subscribe(listener)
end
end
# Publish events from old sty... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/simple_form.rb | Ruby | apache-2.0 | 197 | main | 1,696 | # frozen_string_literal: true
require 'simple_form'
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.wrappers :inline, tag: 'span', class: 'form-group inline', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.use :label, class: '... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/new_framework_defaults_7_2.rb | Ruby | apache-2.0 | 197 | main | 433 | # frozen_string_literal: true
# Any options set here are to override Rails 7.2 configuration defaults
if Rails::VERSION::MAJOR >= 7
# These fix a couple of issues arising from Rails 7.2 enforcement of HTML5 semantics
# by default when using certain Rails methods
Rails.application.config.action_view.button_to_ge... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/blacklight_dynamic_sitemap.rb | Ruby | apache-2.0 | 197 | main | 1,826 | # frozen_string_literal: true
require 'hyrax/model_registry'
def build_model_exclusion_filter
classes_to_exclude = Hyrax::ModelRegistry.file_set_class_names + Hyrax::ModelRegistry.admin_set_class_names + ["Hyrax::FileMetadata"]
classes_to_exclude.map! { |klass| klass.gsub(/^::/, '') }.uniq!
"-has_model_ssim:(\"#... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/kaminari_engine_patch.rb | Ruby | apache-2.0 | 197 | main | 390 | # frozen_string_literal: true
# Add support for engine routes to kaminari
Rails.application.config.to_prepare do
Kaminari::Helpers::Tag.class_eval do
def page_url_for(page)
params = params_for(page)
params[:only_path] = true
if @options[:route_set]
@options[:route_set].url_for params
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | config/initializers/reform_rails_6_1_monkey_patch.rb | Ruby | apache-2.0 | 197 | main | 1,146 | # frozen_string_literal: true
return if Rails::VERSION::MAJOR >= 7
# Taken from https://github.com/trailblazer/reform-rails/issues/86#issuecomment-763120151
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Lint/UselessAssignment
module Reform
class Contract < Disposable::Twin
class Result
... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/Gemfile | Ruby | apache-2.0 | 197 | main | 2,300 | # frozen_string_literal: true
# Attempts to determine if a global gem source has ready been added by another Gemfile
if @sources.global_rubygems_source == Bundler::SourceList.new.global_rubygems_source
Bundler.ui.info '[Dassie] Adding global rubygems source.'
source 'https://rubygems.org'
else
Bundler.ui.info "[D... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/application.rb | Ruby | apache-2.0 | 197 | main | 1,707 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dassie
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails ve... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/puma.rb | Ruby | apache-2.0 | 197 | main | 2,212 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/routes.rb | Ruby | apache-2.0 | 197 | main | 1,192 | require 'sidekiq/web'
Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq' # for sidekik monitoring; completely public
mount Riiif::Engine => 'images', as: :riiif if Hyrax.config.iiif_image_server?
mount BrowseEverything::Engine => '/browse'
mount Bulkrax::Engine, at: '/'
mount Blacklight... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/environments/test.rb | Ruby | apache-2.0 | 197 | main | 1,895 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.assets.debug = true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scr... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/environments/production.rb | Ruby | apache-2.0 | 197 | main | 3,999 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/environments/development.rb | Ruby | apache-2.0 | 197 | main | 2,649 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/riiif.rb | Ruby | apache-2.0 | 197 | main | 1,509 | # frozen_string_literal: true
Rails.application.reloader.to_prepare do
Riiif::Image.info_service = lambda do |id, _file|
# id will look like a path to a pcdm:file
# (e.g. rv042t299%2Ffiles%2F6d71677a-4f80-42f1-ae58-ed1063fd79c7)
# but we just want the id for the FileSet it's attached to.
fs_id = id.s... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/mime_types.rb | Ruby | apache-2.0 | 197 | main | 200 | Mime::Type.register "application/n-triples", :nt
Mime::Type.register "application/ld+json", :jsonld
Mime::Type.register "text/turtle", :ttl
Mime::Type.register 'application/x-endnote-refer', :endnote |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/wings.rb | Ruby | apache-2.0 | 197 | main | 4,200 | # frozen_string_literal: true
# rubocop:disable Metrics/BlockLength
# Freyja setup adapted from hyku
if Hyrax.config.valkyrie_transition?
Rails.application.config.after_initialize do
[ # List AF work models
GenericWork
].each do |klass|
Wings::ModelRegistry.register("#{klass}Resource".constantize... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/mailboxer.rb | Ruby | apache-2.0 | 197 | main | 747 | Mailboxer.setup do |config|
#Configures if your application uses or not email sending for Notifications and Messages
config.uses_emails = true
#Configures the default from for emails sent for Messages and Notifications
config.default_from = "no-reply@mailboxer.com"
#Configures the methods needed by mailboxe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/bulkrax.rb | Ruby | apache-2.0 | 197 | main | 5,093 | # frozen_string_literal: true
Rails.application.reloader.to_prepare do
Bulkrax.setup do |config|
# Add local parsers
# config.parsers += [
# { name: 'MODS - My Local MODS parser', class_name: 'Bulkrax::ModsXmlParser', partial: 'mods_fields' },
# ]
# WorkType to use as the default if none is spe... |
github | samvera/hyrax | https://github.com/samvera/hyrax | .dassie/config/initializers/simple_form_bootstrap.rb | Ruby | apache-2.0 | 197 | main | 4,855 | # frozen_string_literal: true
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'btn btn-default'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.