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/indexers/hyrax/valkyrie_work_indexer.rb
Ruby
apache-2.0
197
main
364
# frozen_string_literal: true module Hyrax ## # @deprecated use +Hyrax::Indexers::PcdmObjectIndexer+ instead class ValkyrieWorkIndexer < Hyrax::Indexers::PcdmObjectIndexer def initialize(*args, **kwargs) Deprecation.warn "`Hyrax::ValkyrieWorkIndexer` is deprecated. Use `Hyrax::Indexers::PcdmObjectIndex...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/valkyrie_file_set_indexer.rb
Ruby
apache-2.0
197
main
361
# frozen_string_literal: true module Hyrax ## # @deprecated use +Hyrax::Indexers::FileSetIndexer+ instead class ValkyrieFileSetIndexer < Hyrax::Indexers::FileSetIndexer def initialize(*args, **kwargs) Deprecation.warn "`Hyrax::ValkyrieFileSetIndexer` is deprecated. Use `Hyrax::Indexers::FileSetIndexer`...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/file_set_indexer.rb
Ruby
apache-2.0
197
main
2,804
# frozen_string_literal: true module Hyrax class FileSetIndexer < ActiveFedora::IndexingService include Hyrax::IndexesThumbnails include Hyrax::IndexesBasicMetadata STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored) def generate_solr_document # rubocop:disable Metrics/AbcSize, Metri...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/basic_metadata_indexer.rb
Ruby
apache-2.0
197
main
1,945
# frozen_string_literal: true module Hyrax # This class gets called by ActiveFedora::IndexingService#olrize_rdf_assertions class BasicMetadataIndexer < ActiveFedora::RDF::IndexingService class_attribute :stored_and_facetable_fields, :stored_fields, :symbol_fields self.stored_and_facetable_fields = %i[resour...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/valkyrie_collection_indexer.rb
Ruby
apache-2.0
197
main
396
# frozen_string_literal: true module Hyrax ## # @deprecated use +Hyrax::Indexers::PcdmCollectionIndexer+ instead class ValkyrieCollectionIndexer < Hyrax::PcdmCollectionIndexer # also deprecated def initialize(*args, **kwargs) Deprecation.warn "`Hyrax::ValkyrieCollectionIndexer` is deprecated. Use `Hyra...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/valkyrie_indexer.rb
Ruby
apache-2.0
197
main
574
# frozen_string_literal: true module Hyrax ## # @deprecated use +Hyrax::Indexers::ResourceIndexer+ instead class ValkyrieIndexer < Hyrax::Indexers::ResourceIndexer def initialize(*args, **kwargs) Deprecation.warn "`Hyrax::ValkyrieIndexer` is deprecated. Use `Hyrax::Indexers::ResourceIndexer` instead." ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/collection_indexer.rb
Ruby
apache-2.0
197
main
867
# frozen_string_literal: true module Hyrax class CollectionIndexer < Hydra::PCDM::CollectionIndexer include Hyrax::IndexesThumbnails STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored) self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService # @yield [Hash] calls the yie...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/admin_set_indexer.rb
Ruby
apache-2.0
197
main
733
# frozen_string_literal: true module Hyrax class AdminSetIndexer < ActiveFedora::IndexingService include Hyrax::IndexesThumbnails self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService def generate_solr_document super.tap do |solr_doc| # Makes Admin Sets show under the "Admin ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/deep_indexing_service.rb
Ruby
apache-2.0
197
main
4,705
# frozen_string_literal: true require 'linkeddata' # we need all the linked data types, because we don't know what types a service might return. module Hyrax class DeepIndexingService < BasicMetadataIndexer # We're overiding the default indexer in order to index the RDF labels. In order # for this to be calle...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/indexers/pcdm_collection_indexer.rb
Ruby
apache-2.0
197
main
1,365
# frozen_string_literal: true module Hyrax module Indexers ## # Indexes properties common to PCDM Collections class PcdmCollectionIndexer < Hyrax::Indexers::ResourceIndexer include Hyrax::PermissionIndexer include Hyrax::VisibilityIndexer include Hyrax::LocationIndexer include Hyr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/indexers/pcdm_object_indexer.rb
Ruby
apache-2.0
197
main
3,683
# frozen_string_literal: true module Hyrax module Indexers ## # Indexes non‐fileset PCDM objects class PcdmObjectIndexer < Hyrax::Indexers::ResourceIndexer include Hyrax::PermissionIndexer include Hyrax::VisibilityIndexer include Hyrax::LocationIndexer include Hyrax::ThumbnailInde...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/indexers/administrative_set_indexer.rb
Ruby
apache-2.0
197
main
1,132
# frozen_string_literal: true module Hyrax module Indexers ## # Indexes Hyrax::AdministrativeSet objects class AdministrativeSetIndexer < Hyrax::Indexers::ResourceIndexer include Hyrax::PermissionIndexer include Hyrax::VisibilityIndexer include Hyrax::Indexer(:core_metadata) if Hyrax.co...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/indexers/file_set_indexer.rb
Ruby
apache-2.0
197
main
9,655
# frozen_string_literal: true module Hyrax module Indexers ## # Indexes Hyrax::FileSet objects class FileSetIndexer < Hyrax::Indexers::ResourceIndexer # rubocop:disable Metrics/ClassLength include Hyrax::PermissionIndexer include Hyrax::VisibilityIndexer include Hyrax::ThumbnailIndexer ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/indexers/hyrax/indexers/resource_indexer.rb
Ruby
apache-2.0
197
main
3,481
# frozen_string_literal: true module Hyrax module Indexers ## # @api public # # Transforms +Valkyrie::Resource+ models to solr-ready key-value hashes. Use # {#to_solr} to retrieve the indexable hash. # # The default {Hyrax::Indexers::ResourceIndexer} implementation provides # minimal ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers.rb
Ruby
apache-2.0
197
main
449
# frozen_string_literal: true module Hyrax # Module that will contain Renderer classes # @since 0.14.0 # Renderers are used to display Ruby objects to users and take arguments from the Hyrax::Presenter # supplied by the controller. # They are typically used to respond to read requests from the controller, and...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/external_link_attribute_renderer.rb
Ruby
apache-2.0
197
main
305
# frozen_string_literal: true module Hyrax module Renderers class ExternalLinkAttributeRenderer < AttributeRenderer private def li_value(value) auto_link(value) do |link| "<span class='fa fa-external-link'></span>&nbsp;#{link}" end end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/linked_attribute_renderer.rb
Ruby
apache-2.0
197
main
516
# frozen_string_literal: true module Hyrax module Renderers class LinkedAttributeRenderer < AttributeRenderer private def li_value(value) link_to(ERB::Util.h(value), search_path(value)) end def search_path(value) Rails.application.routes.url_helpers.search_catalog_path( ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/attribute_renderer.rb
Ruby
apache-2.0
197
main
3,512
# frozen_string_literal: true require "rails_autolink/helpers" module Hyrax module Renderers class AttributeRenderer include ActionView::Helpers::UrlHelper include ActionView::Helpers::TranslationHelper include ActionView::Helpers::TextHelper include ConfiguredMicrodata attr_reader...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/rights_statement_attribute_renderer.rb
Ruby
apache-2.0
197
main
983
# frozen_string_literal: true module Hyrax module Renderers # This is used by PresentsAttributes to show licenses # e.g.: presenter.attribute_to_html(:rights_statement, render_as: :rights_statement) class RightsStatementAttributeRenderer < AttributeRenderer private ## # Special treatm...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/license_attribute_renderer.rb
Ruby
apache-2.0
197
main
914
# frozen_string_literal: true module Hyrax module Renderers # This is used by PresentsAttributes to show licenses # e.g.: presenter.attribute_to_html(:license, render_as: :license) class LicenseAttributeRenderer < AttributeRenderer private ## # Special treatment for license/rights. A...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/faceted_attribute_renderer.rb
Ruby
apache-2.0
197
main
504
# frozen_string_literal: true module Hyrax module Renderers class FacetedAttributeRenderer < AttributeRenderer private def li_value(value) link_to(ERB::Util.h(value), search_path(value)) end def search_path(value) Rails.application.routes.url_helpers.search_catalog_path("...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/date_attribute_renderer.rb
Ruby
apache-2.0
197
main
250
# frozen_string_literal: true module Hyrax module Renderers class DateAttributeRenderer < AttributeRenderer private def attribute_value_to_html(value) Date.parse(value).to_formatted_s(:standard) end end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/renderers/hyrax/renderers/configured_microdata.rb
Ruby
apache-2.0
197
main
1,381
# frozen_string_literal: true module Hyrax module Renderers module ConfiguredMicrodata def microdata?(field) return false unless Hyrax.config.display_microdata? translate_microdata(field: field, field_context: 'property', default: false) end def microdata_object?(field) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/authorities/qa/authorities/find_works.rb
Ruby
apache-2.0
197
main
1,187
# frozen_string_literal: true module Qa::Authorities class FindWorks < Qa::Authorities::Base class_attribute :search_builder_class self.search_builder_class = Hyrax::My::FindWorksSearchBuilder def search(_q, controller) # The My::FindWorksSearchBuilder expects a current_user return [] unless ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/authorities/qa/authorities/collections.rb
Ruby
apache-2.0
197
main
1,328
# frozen_string_literal: true module Qa::Authorities class Collections < Qa::Authorities::Base class_attribute :search_builder_class self.search_builder_class = Hyrax::CollectionSearchBuilder def search(_q, controller) # The Hyrax::CollectionSearchBuilder expects a current_user return [] unle...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms.rb
Ruby
apache-2.0
197
main
1,905
# frozen_string_literal: true module Hyrax module Forms ## # @api public # # @example defining a form class using HydraEditor-like configuration # class MonographForm < Hyrax::Forms::PcdmObjectForm(Monograph) # self.required_fields = [:title, :creator, :rights_statement] # # oth...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/batch_upload_form.rb
Ruby
apache-2.0
197
main
2,569
# frozen_string_literal: true # It isn't ideal but this form is used for both active fedora and valkyrie. module Hyrax module Forms class BatchUploadForm < Hyrax::Forms::WorkForm self.model_class = BatchUploadItem self.terms -= [:title, :resource_type] attr_accessor :payload_concern # a Class...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/failed_submission_form_wrapper.rb
Ruby
apache-2.0
197
main
4,903
# frozen_string_literal: true module Hyrax module Forms # @deprecated This class should be removed when we switch to # Valkyrie::ChangeSet instead of Hydra::Forms. # # This object is responsible for exposing the user submitted # params from a failed POST/PUT/PATCH. # # @see https://githu...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/work_embargo_form.rb
Ruby
apache-2.0
197
main
1,595
# frozen_string_literal: true module Hyrax module Forms ## # Represents an embargo for edit through a work. That is, this form can # be used to wrap a Work in order to capture state changes related only to # its embargo, ignoring the work's other fields. # # @note this supports the edit funct...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/collection_form.rb
Ruby
apache-2.0
197
main
6,011
# frozen_string_literal: true module Hyrax module Forms # rubocop:disable Metrics/ClassLength class CollectionForm include HydraEditor::Form include HydraEditor::Form::Permissions # Used by the search builder attr_reader :scope delegate :id, :depositor, :permissions, :human_read...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/work_lease_form.rb
Ruby
apache-2.0
197
main
1,546
# frozen_string_literal: true module Hyrax module Forms ## # Represents a lease for edit through a work. That is, this form can # be used to wrap a Work in order to capture state changes related only to # its lease, ignoring the work's other fields. # # @note this supports the edit functional...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/resource_form.rb
Ruby
apache-2.0
197
main
9,222
# frozen_string_literal: true module Hyrax module Forms ## # @api public # # This form wraps +Hyrax::ChangeSet+ in the +HydraEditor::Form+ interface. class ResourceForm < Hyrax::ChangeSet # rubocop:disable Metrics/ClassLength ## # @api private # # @note includes special ha...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/file_set_edit_form.rb
Ruby
apache-2.0
197
main
756
# frozen_string_literal: true module Hyrax::Forms class FileSetEditForm include HydraEditor::Form include HydraEditor::Form::Permissions delegate :depositor, :permissions, :human_readable_type, to: :model self.required_fields = [:title, :creator] self.model_class = ::FileSet self.terms = [...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/embargo.rb
Ruby
apache-2.0
197
main
317
# frozen_string_literal: true module Hyrax module Forms ## # Nested form for embargos. class Embargo < Hyrax::ChangeSet property :visibility_after_embargo property :visibility_during_embargo property :embargo_release_date property :embargo_history, default: [] end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/batch_edit_form.rb
Ruby
apache-2.0
197
main
3,033
# frozen_string_literal: true module Hyrax module Forms class BatchEditForm < Hyrax::Forms::WorkForm # Used for drawing the fields that appear on the page self.terms = [:creator, :contributor, :description, :keyword, :resource_type, :license, :publisher, :date_created, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/workflow_responsibility_form.rb
Ruby
apache-2.0
197
main
943
# frozen_string_literal: true module Hyrax module Forms class WorkflowResponsibilityForm def initialize(params = {}) model_instance.workflow_role_id = params[:workflow_role_id] return unless params[:user_id] user = ::User.find(params[:user_id]) model_instance.agent = user.to_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/permission.rb
Ruby
apache-2.0
197
main
812
# frozen_string_literal: true module Hyrax module Forms ## # Nested form for permissions. # # @note due to historical oddities with Hydra::AccessControls and Hydra # Editor, Hyrax's views rely on `agent_name` and `access` as field # names. we provide these as virtual fields and prepopulate...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/lease.rb
Ruby
apache-2.0
197
main
308
# frozen_string_literal: true module Hyrax module Forms ## # Nested form for leases. class Lease < Hyrax::ChangeSet property :visibility_after_lease property :visibility_during_lease property :lease_expiration_date property :lease_history, default: [] end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/work_form.rb
Ruby
apache-2.0
197
main
8,601
# frozen_string_literal: true module Hyrax module Forms # @abstract class WorkForm # rubocop:disable Metrics/ClassLength include HydraEditor::Form include HydraEditor::Form::Permissions attr_accessor :current_ability # This is required so that fields_for will draw a nested form. ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/resource_batch_edit_form.rb
Ruby
apache-2.0
197
main
3,975
# frozen_string_literal: true module Hyrax module Forms class ResourceBatchEditForm < Hyrax::Forms::ResourceForm # batch edit is unfortunately all or nothing when it comes to flexible metadata # because the form could be a mix of AF records, Valkyrie records and Flexible Valkyrie records # we ha...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/file_set_form.rb
Ruby
apache-2.0
197
main
710
# frozen_string_literal: true module Hyrax module Forms ## # A form for +Hyrax::FileSet+s. class FileSetForm < Hyrax::Forms::ResourceForm if Hyrax.config.file_set_include_metadata? include Hyrax::FormFields(:core_metadata) include Hyrax::FormFields(:file_set_metadata) end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/admin_set_form.rb
Ruby
apache-2.0
197
main
1,429
# frozen_string_literal: true module Hyrax module Forms class AdminSetForm < Hyrax::Forms::CollectionForm self.model_class = AdminSet self.terms = [:title, :description, :thumbnail_id] # Cast any array values on the model to scalars. def [](key) return super if key == :thumbnail_i...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/administrative_set_form.rb
Ruby
apache-2.0
197
main
2,125
# frozen_string_literal: true module Hyrax module Forms ## # @api public # @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking class AdministrativeSetForm < Hyrax::Forms::ResourceForm check_if_flexible(Hyrax::AdministrativeSet) ## # @api private AdminS...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/permission_template_form.rb
Ruby
apache-2.0
197
main
13,755
# frozen_string_literal: true module Hyrax module Forms class PermissionTemplateForm include HydraEditor::Form self.model_class = PermissionTemplate self.terms = [] delegate :access_grants, :access_grants_attributes=, :release_date, :release_period, :visibility, to: :model delegate ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/pcdm_object_form.rb
Ruby
apache-2.0
197
main
2,001
# frozen_string_literal: true module Hyrax module Forms ## # A form for PCDM objects: resources which have collection relationships and # generally resemble +Hyrax::Work+. # # Although File Sets are technically also PCDM objects, they use a separate # form class: +Hyrax::Forms::FileSetForm+. ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/workflow_action_form.rb
Ruby
apache-2.0
197
main
2,368
# frozen_string_literal: true module Hyrax module Forms # Responsible for processing that the :current_ability (and # associated current_user) has taken a Sipity::WorkflowAction on # an object that has a Sipity::Entity. # # The form enforces that the action taken is valid. # # @see Ability...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/pcdm_collection_form.rb
Ruby
apache-2.0
197
main
3,808
# frozen_string_literal: true module Hyrax module Forms ## # @api public # @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking class PcdmCollectionForm < Hyrax::Forms::ResourceForm # rubocop:disable Metrics/ClassLength include Hyrax::FormFields(:core_metadata) if Hyrax.c...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/dashboard/nest_collection_form.rb
Ruby
apache-2.0
197
main
3,968
# frozen_string_literal: true module Hyrax module Forms module Dashboard # Responsible for validating that both the parent and child are valid for nesting; If so, then # also responsible for persisting those changes. class NestCollectionForm include ActiveModel::Model class_attri...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/admin/collection_type_form.rb
Ruby
apache-2.0
197
main
916
# frozen_string_literal: true module Hyrax module Forms module Admin class CollectionTypeForm include ActiveModel::Model attr_accessor :collection_type validates :title, presence: true delegate :title, :description, :brandable, :discoverable, :nestable, :sharable, :share_app...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/admin/appearance.rb
Ruby
apache-2.0
197
main
4,371
# frozen_string_literal: true module Hyrax module Forms module Admin # An object to model and persist the form data for the appearance # customization menu class Appearance extend ActiveModel::Naming # @param [Hash] attributes the list of parameters from the form def ini...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/admin/collection_type_participant_form.rb
Ruby
apache-2.0
197
main
534
# frozen_string_literal: true module Hyrax module Forms module Admin class CollectionTypeParticipantForm include ActiveModel::Model attr_accessor :collection_type_participant validates :agent_id, presence: true validates :agent_type, presence: true validates :access, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/widgets/admin_set_embargo_period.rb
Ruby
apache-2.0
197
main
732
# frozen_string_literal: true module Hyrax module Forms module Widgets class AdminSetEmbargoPeriod # Visibility options for permission templates def options i18n_prefix = "hyrax.admin.admin_sets.form_visibility.release.varies.embargo" [[Hyrax::PermissionTemplate::RELEASE_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/hyrax/forms/widgets/admin_set_visibility.rb
Ruby
apache-2.0
197
main
793
# frozen_string_literal: true module Hyrax module Forms module Widgets class AdminSetVisibility # Visibility options for permission templates def options i18n_prefix = "hyrax.admin.admin_sets.form_visibility.visibility" # NOTE: Visibility 'varies' = '' implies no constrai...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/based_near_field_behavior.rb
Ruby
apache-2.0
197
main
1,748
# frozen_string_literal: true module Hyrax module BasedNearFieldBehavior # Provides compatibility with the behavior of the based_near (location) controlled vocabulary form field. # The form expects a ControlledVocabularies::Location object as input and produces a hash like those # used with accepts_nested...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/contained_in_works_behavior.rb
Ruby
apache-2.0
197
main
640
# frozen_string_literal: true module Hyrax ## # A module of form behaviours for resources which can be contained in works. module ContainedInWorksBehavior ## # @api private InWorksPrepopulator = proc do |_options| self.in_works_ids = if persisted? Hyrax.query_service ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/flexible_form_behavior.rb
Ruby
apache-2.0
197
main
914
# frozen_string_literal: true module Hyrax module FlexibleFormBehavior extend ActiveSupport::Concern included do property :contexts validate :validate_flexible_required_fields end def validate_flexible_required_fields required_fields = singleton_class.schema_definitions.select { |...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/deposit_agreement_behavior.rb
Ruby
apache-2.0
197
main
398
# frozen_string_literal: true module Hyrax ## # A module of form behaviours for depositors and depositor agreements. module DepositAgreementBehavior def self.included(descendant) descendant.property :depositor descendant.property :agreement_accepted, virtual: true, default: false, prepopulator: p...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/permission_behavior.rb
Ruby
apache-2.0
197
main
721
# frozen_string_literal: true module Hyrax ## # A module of form behaviours for populating permissions. module PermissionBehavior def self.included(descendant) descendant.collection(:permissions, virtual: true, default: [], form: Hyrax::Forms::Permissio...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/forms/concerns/hyrax/leaseability_behavior.rb
Ruby
apache-2.0
197
main
2,462
# frozen_string_literal: true module Hyrax ## # A module of form behaviours for embargoes, leases, and resulting # visibilities. module LeaseabilityBehavior def self.included(descendant) # rubocop:disable Metrics/AbcSize descendant.property :visibility, default: VisibilityIntention::PRIVATE, populator...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/file_download_stat.rb
Ruby
apache-2.0
197
main
880
# frozen_string_literal: true class FileDownloadStat < Hyrax::Statistic self.cache_column = :downloads self.event_type = :totalEvents class << self # Hyrax::Download is sent to Hyrax::Analytics.profile as #hyrax__download # see Legato::ProfileMethods.method_name_from_klass def ga_statistics(start_dat...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/single_use_link.rb
Ruby
apache-2.0
197
main
954
# frozen_string_literal: true class SingleUseLink < ActiveRecord::Base validate :expiration_date_cannot_be_in_the_past validate :cannot_be_destroyed alias_attribute :downloadKey, :download_key alias_attribute :itemId, :item_id after_initialize :set_defaults def self.generate_download_key (Digest::SHA...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/user_mailbox.rb
Ruby
apache-2.0
197
main
1,557
# frozen_string_literal: true class UserMailbox attr_reader :user def initialize(user) @user = user end def inbox messages = user.mailbox.inbox messages.each { |m| m.mark_as_read(user) } end def unread_count user.mailbox.inbox(unread: true).count end def label(locale_from_params = ni...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/checksum_audit_log.rb
Ruby
apache-2.0
197
main
2,842
# frozen_string_literal: true class ChecksumAuditLog < ActiveRecord::Base def failed? !passed? end # Only the latest rows for a given file_set_id/checked_uri pair. # Uses a join, so you might have to be careful combining. You would # normally combine this with other conditions, this alone will return #...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/proxy_deposit_request.rb
Ruby
apache-2.0
197
main
5,967
# frozen_string_literal: true # Responsible for persisting the ownership transfer requests and the state of each request. # @see ProxyDepositRequest.enum(:status) # @see ProxyDepositRequest.work_query_service_class for configuration (defaults to Hyrax::WorkQueryService) # @see Hyrax::WorkQueryService class ProxyDeposit...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/batch_upload_item.rb
Ruby
apache-2.0
197
main
739
# frozen_string_literal: true # This stands in for an object to be created from the BatchUploadForm. # It should never actually be persisted in the repository. # The properties on this form should be copied to a real work type. class BatchUploadItem < ActiveFedora::Base include Hyrax::WorkBehavior # This must come ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/collection_branding_info.rb
Ruby
apache-2.0
197
main
1,260
# frozen_string_literal: true class CollectionBrandingInfo < ApplicationRecord attr_accessor :filename, :alt_txt after_initialize :set_collection_attributes def save(file_location, upload_file = true) filename = File.split(local_path).last role_and_filename = File.join(role, filename) if upload_file...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/file_view_stat.rb
Ruby
apache-2.0
197
main
257
# frozen_string_literal: true class FileViewStat < Hyrax::Statistic self.cache_column = :views self.event_type = :pageviews class << self # this is called by the parent class def filter(file) { file_id: file.id.to_s } end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/collection.rb
Ruby
apache-2.0
197
main
878
# frozen_string_literal: true # Provide plain collection model if not defined by the application. # Needed until Hyrax internals do not assume its existence. class ::Collection < Hyrax.config.collection_class; end unless ActiveSupport::Dependencies.then do |deps| # In autoloading environments, when referencing +::Co...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/admin_set.rb
Ruby
apache-2.0
197
main
3,641
# frozen_string_literal: true # There is an interplay between an AdminSet and a PermissionTemplate. Given # that AdminSet is an ActiveFedora::Base and PermissionTemplate is ActiveRecord::Base # we don't have the usual :has_many or :belongs_to methods to assist in defining that # relationship. However, from a conceptual...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/trophy.rb
Ruby
apache-2.0
197
main
246
# frozen_string_literal: true class Trophy < ActiveRecord::Base validate :count_within_limit, on: :create def count_within_limit return if Trophy.where(user_id: user_id).count < 5 errors.add(:base, "Exceeded trophy limit") end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/solr_hit.rb
Ruby
apache-2.0
197
main
421
# frozen_string_literal: true class SolrHit < Delegator def __getobj__ @document # return object we are delegating to, required end alias static_config __getobj__ def __setobj__(obj) @document = obj end attr_reader :document def initialize(document) document = document.with_indifferent_acc...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/job_io_wrapper.rb
Ruby
apache-2.0
197
main
4,855
# frozen_string_literal: true # Primarily for jobs like IngestJob to revivify an equivalent FileActor to one that existed on # the caller's side of an asynchronous Job invocation. This involves providing slots # for the metadata that might travel w/ the actor's various supported types of @file. # For example, we canno...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/featured_work_list.rb
Ruby
apache-2.0
197
main
1,436
# frozen_string_literal: true class FeaturedWorkList include ActiveModel::Model # @param [ActionController::Parameters] a collection of nested perameters def featured_works_attributes=(attributes_collection) attributes_collection = attributes_collection.to_h if attributes_collection.respond_to?(:permitted?) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/content_block.rb
Ruby
apache-2.0
197
main
2,682
# frozen_string_literal: true class ContentBlock < ActiveRecord::Base # The keys in this registry are "public" names for collaborator # objects, and the values are reserved names of ContentBlock # instances, which Hyrax uses as identifiers. Values also correspond # to names of messages that can be sent to the C...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/file_set.rb
Ruby
apache-2.0
197
main
244
# frozen_string_literal: true # Provide plain file set model if not defined by the application. # Needed until Hyrax internals do not assume its existence. class ::FileSet < Hyrax.config.file_set_class; end unless '::FileSet'.safe_constantize
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/featured_work.rb
Ruby
apache-2.0
197
main
675
# frozen_string_literal: true class FeaturedWork < ActiveRecord::Base ## # @!group Class Attributes # # @!attribute feature_limit [r|w] # @return [Integer] class_attribute :feature_limit, default: 5 # @!endgroup Class Attributes ## validate :count_within_limit, on: :create validates :order, inclu...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/sipity.rb
Ruby
apache-2.0
197
main
6,580
# frozen_string_literal: true ## # {Sipity} is a workflow/state engine. # # This module and the classes namespaced within it provide a domain model and # implementation for managing the movement of repository objects through a # defined workflow. The workflows themselves are configured using JSON documents # and loade...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/orcid_validator.rb
Ruby
apache-2.0
197
main
744
# frozen_string_literal: true module Hyrax class OrcidValidator < ActiveModel::Validator ORCID_REGEXP = %r{^(?<prefix>https?://orcid.org/)?(?<orcid>\d{4}-\d{4}-\d{4}-\d{3}[\dX])/?$}.freeze def validate(record) return if record.orcid.blank? record.errors.add(:orcid, 'must be a string of 19 characte...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/statistic.rb
Ruby
apache-2.0
197
main
2,348
# frozen_string_literal: true module Hyrax class Statistic < ActiveRecord::Base self.abstract_class = true class_attribute :cache_column, :event_type class << self include ActionDispatch::Routing::PolymorphicRoutes include Rails.application.routes.url_helpers def statistics_for(object...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/contact_form.rb
Ruby
apache-2.0
197
main
1,007
# frozen_string_literal: true module Hyrax class ContactForm include ActiveModel::Model attr_accessor :contact_method, :category, :name, :email, :subject, :message validates :email, :category, :name, :subject, :message, presence: true validates :email, format: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/lease.rb
Ruby
apache-2.0
197
main
982
# frozen_string_literal: true module Hyrax ## # The Valkyrie model for leases. # # @note Embargo and Lease can, in principle, be collapsed into a single model # with a `#visibility_during`, `#visibility_after`, `#end_date`, and # `#history`. We haven't made this transition in order to simplify legacy ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/collection_type_participant.rb
Ruby
apache-2.0
197
main
1,379
# frozen_string_literal: true module Hyrax class CollectionTypeParticipant < ActiveRecord::Base self.table_name = 'collection_type_participants' belongs_to :hyrax_collection_type, class_name: 'CollectionType' MANAGE_ACCESS = 'manage' CREATE_ACCESS = 'create' GROUP_TYPE = 'group' USER_TYPE = ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/file_metadata.rb
Ruby
apache-2.0
197
main
8,258
# frozen_string_literal: true module Hyrax ## # Casts a resource to an associated FileMetadata # # @param [Valkyrie::StorageAdapter::File] file # # @return [Hyrax::FileMetadata] # @raise [ArgumentError] def self.FileMetadata(file) raise(ArgumentError, "Expected a Valkyrie::StorageAdapter::File; got...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/group_behavior.rb
Ruby
apache-2.0
197
main
1,412
# frozen_string_literal: true module Hyrax ## # An {ActiveSupport::Concern} module that contains the {Hyrax::Group} logic. It is extracted to a # behavior because downstream Hyku has a Hyrax::Group that inherits from ApplicationRecord. In # other words it eschews the plain old Ruby object (PORO). However, b...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/access_control.rb
Ruby
apache-2.0
197
main
1,700
# frozen_string_literal: true module Hyrax ## # A list of permissions pertaining to a specific object. # # `AccessControl`s consist of a set of permissions and an `#access_to` # reference to the object that set governs. # # @see Hyrax::AccessControlList for a low level DSL for managing # `AccessContr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/change_set.rb
Ruby
apache-2.0
197
main
1,374
# frozen_string_literal: true module Hyrax ## # @api private # # Build a changeset class for the given resource class. The ChangeSet will # have fields to match the resource class given. # # To define a custom changeset with validations, use naming convention with "ChangeSet" appended to the end # of t...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/batch_create_operation.rb
Ruby
apache-2.0
197
main
617
# frozen_string_literal: true module Hyrax class BatchCreateOperation < Operation set_callback :success, :after, :batch_success_message set_callback :failure, :after, :batch_failure_message def batch_success_message return unless Hyrax.config.callback.set?(:after_batch_create_success) Hyrax.c...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/administrative_set.rb
Ruby
apache-2.0
197
main
1,689
# frozen_string_literal: true require_dependency 'hyrax/administrative_set_name' module Hyrax ## # Valkyrie model for Admin Set domain objects. # # ## Relationships # # ### Administrative Set and Work # # * Defined: The relationship is defined by the inverse relationship stored in the # work's `:a...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/resource.rb
Ruby
apache-2.0
197
main
5,273
# frozen_string_literal: true require_dependency 'hyrax/resource_name' module Hyrax ## # The base Valkyrie model for Hyrax. # # @note Hyrax permissions are managed via # [Access Control List](https://en.wikipedia.org/wiki/Access-control_list) # style permissions. Legacy Hyrax models powered by `Active...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/permission_template_access.rb
Ruby
apache-2.0
197
main
4,024
# frozen_string_literal: true module Hyrax # Models a single grant of access to an agent (user or group) on a PermissionTemplate class PermissionTemplateAccess < ActiveRecord::Base self.table_name = 'permission_template_accesses' belongs_to :permission_template # An agent should only have any particul...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/download.rb
Ruby
apache-2.0
197
main
246
# frozen_string_literal: true module Hyrax class Download extend ::Legato::Model metrics :totalEvents dimensions :eventCategory, :eventAction, :eventLabel, :date filter :for_file, &->(id) { matches(:eventLabel, id) } end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/operation.rb
Ruby
apache-2.0
197
main
3,313
# frozen_string_literal: true module Hyrax # The database storage of inter-related jobs and their states. class Operation < ActiveRecord::Base PENDING = 'pending' PERFORMING = 'performing' FAILURE = 'failure' SUCCESS = 'success' enum( status: { FAILURE => FAILURE, PENDING ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/virus_scanner.rb
Ruby
apache-2.0
197
main
2,133
# frozen_string_literal: true module Hyrax ## # The default virus scanner ported from +Hyrax::Works+. # # If ClamAV is present, it will be used to check for the presence of a virus. # If ClamAV is not installed or otherwise not available to your application, # +Hyrax::Works+ does no virus checking add assu...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/file_set.rb
Ruby
apache-2.0
197
main
5,194
# frozen_string_literal: true module Hyrax ## # Valkyrie model for `FileSet` domain objects in the Hydra Works model. # # ## Relationships # # ### FileSet and Work # # * Defined: The relationship is defined by the inverse relationship stored in the # work's `:member_ids` attribute. # * Tested: Th...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/group.rb
Ruby
apache-2.0
197
main
396
# frozen_string_literal: true module Hyrax ## # A Plain Old Ruby Object (PORO) representing a named group. # # In Hyku, we replace the PORO with an Application Record. But there is significant duplication # of logic. # # @see Hyrax::GroupBehavior class Group include Hyrax::GroupBehavior def i...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/avatar_validator.rb
Ruby
apache-2.0
197
main
279
# frozen_string_literal: true module Hyrax class AvatarValidator < ActiveModel::Validator def validate(record) return unless record.avatar? record.errors.add(:avatar_file_size, 'must be less than 2MB') if record.avatar.size > 2.megabytes.to_i end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/default_administrative_set.rb
Ruby
apache-2.0
197
main
1,545
# frozen_string_literal: true module Hyrax # This class stores the id of the default `Hyrax::AdministrativeSet`. This is # used to populate a cache of the default admin set in Hyrax::Configuration. # # @see Hyrax::Configuration.default_admin_set # @see Hyrax::Configuration.default_admin_set_id # @see Hyrax...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/model_registry.rb
Ruby
apache-2.0
197
main
3,513
# frozen_string_literal: true module Hyrax ## # There are four conceptual high-level models for the metadata modeling: # # - AdminSet :: Where things are "physically" stored. # - Collection :: What things "logically" belong to. # - Work :: What the thing is about; these are often sub-divided into different...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/work.rb
Ruby
apache-2.0
197
main
5,737
# frozen_string_literal: true module Hyrax ## # Valkyrie model for `Work` domain objects in the Hydra Works model. # # ## Relationships # # ### Administrative Set and Work # # * Defined: The relationship is defined by the work's `:admin_set_id` attribute. # * Tested: The relationship is tested in sha...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/models/hyrax/valkyrie_global_id_proxy.rb
Ruby
apache-2.0
197
main
1,083
# frozen_string_literal: true module Hyrax ## # Support GlobalID and ActiveJob Serialization/Deserialization for # `Valkyrie::Resource` models. # # # @example Serializing a Valkyrie::Resource for ActiveJob # resource = Hyrax.query_service.find_by(id: Valkyrie::ID.new('an_id')) # # MyJob.perform_l...