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/presenters/hyrax/work_usage.rb
Ruby
apache-2.0
197
main
841
# frozen_string_literal: true module Hyrax # TODO: - Analytics do we still need this? # Follows the model established by {FileUsage}. # # Called by the stats controller, it finds cached work pageview data, # and prepares it for visualization in /app/views/stats/work.html.erb class WorkUsage < StatsUsagePre...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/iiif_manifest_presenter.rb
Ruby
apache-2.0
197
main
6,639
# frozen_string_literal: true module Hyrax ## # This presenter wraps objects in the interface required by +IIIFManifiest+. # It will accept either a Work-like resource or a {SolrDocument}. # # @example with a work # # monograph = Monograph.new # presenter = IiifManifestPresenter.new(monograph) # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/select_type_presenter.rb
Ruby
apache-2.0
197
main
1,552
# frozen_string_literal: true module Hyrax class SelectTypePresenter def initialize(concern) @concern = concern end attr_reader :concern def icon_class ModelIcon.css_class_for(concern) end def description translate('description') end def name translate('name...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/user_profile_presenter.rb
Ruby
apache-2.0
197
main
929
# frozen_string_literal: true module Hyrax class UserProfilePresenter ## # @param user [::User] # @param ability [::Ability] def initialize(user, ability) @user = user @ability = ability end ## # @!attribute [r] ability # @return [::Ability] # @!attribute [r] user ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/transfers_presenter.rb
Ruby
apache-2.0
197
main
1,024
# frozen_string_literal: true module Hyrax class TransfersPresenter def initialize(current_user, view_context) @current_user = current_user @view_context = view_context end def render_sent_transfers if outgoing_proxy_deposits.present? render 'hyrax/transfers/sent', outgoing_prox...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/permission_badge.rb
Ruby
apache-2.0
197
main
1,023
# frozen_string_literal: true module Hyrax class PermissionBadge include ActionView::Helpers::TagHelper VISIBILITY_LABEL_CLASS = { authenticated: "badge-info", embargo: "badge-warning", lease: "badge-warning", open: "badge-success", restricted: "badge-danger" }.freeze #...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/lease_presenter.rb
Ruby
apache-2.0
197
main
800
# frozen_string_literal: true module Hyrax # Presents leased objects class LeasePresenter include ModelProxy attr_accessor :solr_document delegate :human_readable_type, :visibility, :to_s, to: :solr_document # @param [SolrDocument] solr_document def initialize(solr_document) @solr_docume...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/select_type_list_presenter.rb
Ruby
apache-2.0
197
main
1,156
# frozen_string_literal: true module Hyrax # Presents the list of work type options that a user may choose from when deciding to # create a new work class SelectTypeListPresenter # @param current_user [User] def initialize(current_user) @current_user = current_user end class_attribute :row_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/composite_presenter_factory.rb
Ruby
apache-2.0
197
main
750
# frozen_string_literal: true module Hyrax ## # Dynamic presenter which instantiates a file set presenter if given an object # with a given ID, but otherwise instantiates a work presenter. class CompositePresenterFactory attr_reader :file_set_presenter_class, :work_presenter_class, :file_set_ids def i...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/member_presenter_factory.rb
Ruby
apache-2.0
197
main
2,876
# frozen_string_literal: true module Hyrax # Creates the presenters of the members (member works and file sets) of a specific object class MemberPresenterFactory class_attribute :file_presenter_class, :work_presenter_class # modify this attribute to use an alternate presenter class for the files self.fi...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/single_use_link_presenter.rb
Ruby
apache-2.0
197
main
1,022
# frozen_string_literal: true module Hyrax class SingleUseLinkPresenter include ActionView::Helpers::TranslationHelper attr_reader :link delegate :download_key, :expired?, :to_param, to: :link # @param link [SingleUseLink] def initialize(link) @link = link end def human_readable_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/fixity_status_presenter.rb
Ruby
apache-2.0
197
main
3,221
# frozen_string_literal: true module Hyrax # Creates fixity status messages to display to user, for a fileset. # Determines status by looking up existing recorded ChecksumAuditLog objects, # does not actually do a check itself. # # See FileSetFixityCheckService and ChecksumAuditLog for actually performing #...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/select_collection_type_presenter.rb
Ruby
apache-2.0
197
main
669
# frozen_string_literal: true module Hyrax class SelectCollectionTypePresenter ## # @!attribute [r] collection_type # @return [CollectionType] attr_reader :collection_type ## # @param [CollectionType] collection_type a Hyrax::CollectionType def initialize(collection_type) @collect...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/file_usage.rb
Ruby
apache-2.0
197
main
980
# frozen_string_literal: true module Hyrax ## # Called by the stats controller, it finds cached file pageview data, # and prepares it for visualization in /app/views/stats/file.html.erb class FileUsage < StatsUsagePresenter def initialize(id) self.model = Hyrax.query_service.find_by(id: id) end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin_set_options_presenter.rb
Ruby
apache-2.0
197
main
2,828
# frozen_string_literal: true module Hyrax # Presents the options for the AdminSet widget on the create/edit form class AdminSetOptionsPresenter ## # @param [Hyrax::AdminSetService] service def initialize(service, current_ability: service.context.current_ability) @service = service @current_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/characterization_behavior.rb
Ruby
apache-2.0
197
main
2,844
# frozen_string_literal: true module Hyrax module CharacterizationBehavior extend ActiveSupport::Concern class_methods do def characterization_terms [ :byte_order, :compression, :height, :width, :color_space, :profile_name, :profile_version, :orientation, :color_map, :image_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/model_icon.rb
Ruby
apache-2.0
197
main
204
# frozen_string_literal: true module Hyrax class ModelIcon def self.css_class_for(model) I18n.t(:"hyrax.icons.#{model.model_name.i18n_key}", default: :"hyrax.icons.default") end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/displays_image.rb
Ruby
apache-2.0
197
main
3,028
# frozen_string_literal: true require 'iiif_manifest' module Hyrax # This gets mixed into FileSetPresenter in order to create # a canvas on a IIIF manifest module DisplaysImage extend ActiveSupport::Concern # Creates a display image only where FileSet is an image. # # @return [IIIFManifest::Disp...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/presenter_factory.rb
Ruby
apache-2.0
197
main
2,126
# frozen_string_literal: true module Hyrax # Responsible building an Array of presenters based on IDs and presenter class given # @todo Extract a SolrDocument finder class that takes a list of pids and returns/yields a ::SolrDocument for each hit in SOLR. # @note The given IDs are loaded from SOLR class Present...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/presents_attributes.rb
Ruby
apache-2.0
197
main
2,472
# frozen_string_literal: true module Hyrax module PresentsAttributes ## # Present the attribute as an HTML table row or dl row. # # @param [Hash] options # @option options [Symbol] :render_as use an alternate renderer # (e.g., :linked or :linked_attribute to use LinkedAttributeRenderer) ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/google_scholar_presenter.rb
Ruby
apache-2.0
197
main
3,448
# frozen_string_literal: true module Hyrax ## # Handles presentation for google scholar meta tags. # # @example # my_book = Monograph.new(title: ['On Moomins'], creator: ['Tove', 'Lars']) # scholar = GoogleScholarPresenter.new(my_book) # # scholar.title => 'On Moomins' # # @see https://schola...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/select_collection_type_list_presenter.rb
Ruby
apache-2.0
197
main
1,466
# frozen_string_literal: true module Hyrax # Presents the list of collection type options that a user may choose from when deciding to create a new work class SelectCollectionTypeListPresenter # @param current_user [User] def initialize(current_user) @current_user = current_user end class_att...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/inspect_work_presenter.rb
Ruby
apache-2.0
197
main
1,581
# frozen_string_literal: true module Hyrax class InspectWorkPresenter def initialize(solr_document, current_ability) @solr_document = solr_document @current_ability = current_ability end attr_reader :solr_document, :current_ability def workflow return { comments: [], roles: [] } unl...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin_stats_presenter.rb
Ruby
apache-2.0
197
main
3,520
# frozen_string_literal: true module Hyrax class AdminStatsPresenter attr_reader :limit, :stats_filters ## # @!attribute [rw] by_depositor # @return [#query] # @!attribute [rw] by_format # @return [#query] # @!attribute [rw] depositor_summary # @return [#depositors] # @!attr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/twitter_presenter.rb
Ruby
apache-2.0
197
main
629
# frozen_string_literal: true module Hyrax # Repeatable logic for presenting twitter handles. # # @note The duplication of code was found via the flay gem module TwitterPresenter # @api public # @param [String] user_key for which we will find the appropriate twitter handle # @return [String] the twi...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/work_show_presenter.rb
Ruby
apache-2.0
197
main
12,427
# frozen_string_literal: true module Hyrax class WorkShowPresenter include ModelProxy include PresentsAttributes include MissingMethodBehavior ## # @!attribute [w] member_presenter_factory # @return [MemberPresenterFactory] attr_writer :member_presenter_factory attr_accessor :solr_d...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/menu_presenter.rb
Ruby
apache-2.0
197
main
3,105
# frozen_string_literal: true module Hyrax # view-model for the admin menu class MenuPresenter def initialize(view_context) @view_context = view_context end attr_reader :view_context delegate :controller, :controller_name, :action_name, :content_tag, :current_page?, :link_to, :c...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/model_proxy.rb
Ruby
apache-2.0
197
main
777
# frozen_string_literal: true module Hyrax # Provide the ActiveModel methods so that this object routes the same as the # object represented by the solr document. module ModelProxy delegate :to_param, :to_key, :id, to: :solr_document delegate :model_name, :to_partial_path, to: :_delegated_to def pers...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/workflow_presenter.rb
Ruby
apache-2.0
197
main
1,377
# frozen_string_literal: true module Hyrax class WorkflowPresenter include ActionView::Helpers::TagHelper def initialize(solr_document, current_ability) @solr_document = solr_document @current_ability = current_ability end attr_reader :solr_document, :current_ability def state ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/file_set_presenter.rb
Ruby
apache-2.0
197
main
3,669
# frozen_string_literal: true module Hyrax class FileSetPresenter include ModelProxy include PresentsAttributes include CharacterizationBehavior include WithEvents include DisplaysImage include MissingMethodBehavior attr_accessor :solr_document, :current_ability, :request # @param [S...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/displays_content.rb
Ruby
apache-2.0
197
main
4,029
# frozen_string_literal: true module Hyrax # rubocop:disable Metrics/ModuleLength module DisplaysContent extend ActiveSupport::Concern # Creates a display content only where FileSet is an image, audio, or video. # # @return [IIIFManifest::V3::DisplayContent] the display content required by the mani...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/version_list_presenter.rb
Ruby
apache-2.0
197
main
1,740
# frozen_string_literal: true module Hyrax ## # @api public class VersionListPresenter include Enumerable attr_reader :versioning_service ## # @param service [Hyrax::VersioningService] def initialize(service) @versioning_service = service end ## # @param [Object] an object...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/version_presenter.rb
Ruby
apache-2.0
197
main
884
# frozen_string_literal: true module Hyrax class VersionPresenter attr_reader :version, :current def initialize(version) @version = version @current = false end delegate :label, :uri, to: :version alias current? current def current! @current = true end def label ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/embargo_presenter.rb
Ruby
apache-2.0
197
main
718
# frozen_string_literal: true module Hyrax # Presents embargoed objects class EmbargoPresenter include ModelProxy attr_accessor :solr_document delegate :human_readable_type, :visibility, :to_s, to: :solr_document # @param [SolrDocument] solr_document def initialize(solr_document) @solr_d...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin_set_presenter.rb
Ruby
apache-2.0
197
main
3,099
# frozen_string_literal: true module Hyrax class AdminSetPresenter < CollectionPresenter delegate :contexts, to: :solr_document def self.terms base = super if Hyrax.config.flexible? && Hyrax.config.admin_set_class.new.respond_to?(:contexts) base | [:contexts] else base ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin_set_selection_presenter.rb
Ruby
apache-2.0
197
main
3,313
# frozen_string_literal: true module Hyrax ## # @api public # @since 3.1.0 # # Presents select options for admin sets. # # Each entry in the {#select_options} return value provides a label for # display, an id to serve as the value, and a data hash which is used as HTML5 # data entries. The data entri...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/missing_method_behavior.rb
Ruby
apache-2.0
197
main
423
# frozen_string_literal: true module Hyrax module MissingMethodBehavior private def method_missing(method_name, *args, &block) return solr_document.public_send(method_name, *args, &block) if solr_document.respond_to?(method_name) super end def respond_to_missing?(method_name, include_pri...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/collection_presenter.rb
Ruby
apache-2.0
197
main
7,671
# frozen_string_literal: true module Hyrax class CollectionPresenter include ModelProxy include PresentsAttributes include ActionView::Helpers::NumberHelper include ActionView::Helpers::TagHelper attr_accessor :solr_document, :current_ability, :request attr_reader :subcollection_count attr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/collapsable_section_presenter.rb
Ruby
apache-2.0
197
main
1,422
# frozen_string_literal: true module Hyrax # Draws a collapsable list widget using the Bootstrap 3 / Collapse.js plugin class CollapsableSectionPresenter # rubocop:disable Metrics/ParameterLists def initialize(view_context:, text:, id:, icon_class:, open:, title: nil) @view_context = view_context ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/dashboard/user_presenter.rb
Ruby
apache-2.0
197
main
1,967
# frozen_string_literal: true module Hyrax module Dashboard # Presenter for dashboard of a non-admin user class UserPresenter def initialize(current_user, view_context, since) @current_user = current_user @view_context = view_context @since = since end def activity ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/workflow_role_presenter.rb
Ruby
apache-2.0
197
main
990
# frozen_string_literal: true module Hyrax module Admin # Displays a single workflow role class WorkflowRolePresenter def initialize(workflow_role) @workflow = workflow_role.workflow @role = workflow_role.role @source_id = workflow.permission_template.source_id end #...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/users_presenter.rb
Ruby
apache-2.0
197
main
941
# frozen_string_literal: true module Hyrax module Admin class UsersPresenter # @return [Array] an array of Users def users @users ||= search end # @return [Number] quantity of users excluding the system users and guest_users def user_count users.count end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/workflow_roles_presenter.rb
Ruby
apache-2.0
197
main
1,084
# frozen_string_literal: true module Hyrax module Admin # Displays a list of users and their associated workflow roles class WorkflowRolesPresenter def users ::User.registered end def presenter_for(user) agent = user.sipity_agent return unless agent AgentPres...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/repository_object_presenter.rb
Ruby
apache-2.0
197
main
1,373
# frozen_string_literal: true module Hyrax module Admin class RepositoryObjectPresenter def as_json(*) counts.map do |k, v| { label: I18n.translate(k, scope: 'hyrax.admin.stats.repository_objects.series'), value: v } end end private delegate :blackli...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/dashboard_presenter.rb
Ruby
apache-2.0
197
main
782
# frozen_string_literal: true module Hyrax module Admin class DashboardPresenter # @return [Fixnum] the number of currently registered users def user_count(start_date, end_date) ::User.where(guest: false) .where({ created_at: start_date.to_date.beginning_of_day..end_date.to_date....
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/repository_growth_presenter.rb
Ruby
apache-2.0
197
main
1,064
# frozen_string_literal: true module Hyrax module Admin class RepositoryGrowthPresenter def initialize(start_date, end_date) @x_min = start_date @x_max = end_date @date_format = ->(x) { x.strftime('%F') } end def as_json(*) works.to_a.zip(collections.to_a).map do...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/presenters/hyrax/admin/user_activity_presenter.rb
Ruby
apache-2.0
197
main
612
# frozen_string_literal: true module Hyrax module Admin class UserActivityPresenter def initialize(start_date, end_date) @x_min = start_date @x_max = end_date @date_format = ->(x) { x } end def as_json(*) new_users.to_a end private def new_use...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/required_data_seeder.rb
Ruby
apache-2.0
197
main
804
# frozen_string_literal: true module Hyrax # This class was created for use in rake tasks and db/seeds.rb. It generates # required repository metadata including Admin Set and User collection types and # the default admin set. # # Seeders of required data are non-destructive. If the data already exists, # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/test_data_seeder.rb
Ruby
apache-2.0
197
main
1,232
# frozen_string_literal: true module Hyrax # This class was created for use in rake tasks and db/seeds.rb. It generates # repository metadata needed for release testing. This data can also be helpful # for local development testing. class TestDataSeeder attr_accessor :logger, :allow_seeding_in_production...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_maintenance.rb
Ruby
apache-2.0
197
main
2,956
# frozen_string_literal: true module Hyrax ## # These methods created for use in rake tasks and db/seeds.rb They can be used to: # * clear repository metadata and related data and files # * clear temporary files # * clear logs # # @note WARNING: DO NOT USE IN PRODUCTION! The methods in this class are d...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/test_data_seeders/user_seeder.rb
Ruby
apache-2.0
197
main
2,041
# frozen_string_literal: true module Hyrax module TestDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # users that can be used in release testing. This data can also be helpful # for local development testing. # # Adding users is non-destructive. If a us...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/test_data_seeders/collection_seeder.rb
Ruby
apache-2.0
197
main
3,891
# frozen_string_literal: true module Hyrax module TestDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collection that can be used in release testing. This data can also be helpful # for local development testing. # # Adding collections is non-destructiv...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/test_data_seeders/collection_type_seeder.rb
Ruby
apache-2.0
197
main
4,025
# frozen_string_literal: true module Hyrax module TestDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collection types that can be used in release testing. This data can also be # helpful for local development testing. # # Adding collection types is non...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/required_data_seeders/flexible_profile_seeder.rb
Ruby
apache-2.0
197
main
871
# frozen_string_literal: true module Hyrax module RequiredDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collections that are required for all Hyrax applications. # # Seeders of required data are non-destructive. If the data already exists, # it will ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/required_data_seeders/collection_seeder.rb
Ruby
apache-2.0
197
main
768
# frozen_string_literal: true module Hyrax module RequiredDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collections that are required for all Hyrax applications. # # Seeders of required data are non-destructive. If the data already exists, # it will n...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/required_data_seeders/collection_type_seeder.rb
Ruby
apache-2.0
197
main
1,155
# frozen_string_literal: true module Hyrax module RequiredDataSeeders # This class was created for use in rake tasks and db/seeds.rb. It generates # collection types that are required for all Hyrax applications. # # Seeders of required data are non-destructive. If the data already exists, # it w...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/repository_metadata_destroyer.rb
Ruby
apache-2.0
197
main
1,756
# frozen_string_literal: true module Hyrax module DataDestroyers # Clear all repository metadata from the datastore (e.g. Fedora, Postgres) # and from Solr. # # @note WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. # Data can not be recovered. # # @note Whe...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/collection_types_destroyer.rb
Ruby
apache-2.0
197
main
858
# frozen_string_literal: true module Hyrax module DataDestroyers # Collection types are recreated by the release seed data. Clear out here to # start with a fresh set. # # @note WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. # Data can not be recovered. # ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb
Ruby
apache-2.0
197
main
1,073
# frozen_string_literal: true module Hyrax module DataDestroyers # Collection branding info is tightly coupled to collections. When they are # removed using wipe!, the associated database entries for collection branding # also have to be deleted. # # @note WARNING: DO NOT USE IN PRODUCTION! The ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/featured_works_destroyer.rb
Ruby
apache-2.0
197
main
921
# frozen_string_literal: true module Hyrax module DataDestroyers # Featured works are tightly coupled to works in the repository. When they # are removed using wipe!, the associated database entries for featured # works also need to be deleted. # # @note WARNING: DO NOT USE IN PRODUCTION! The met...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/permission_templates_destroyer.rb
Ruby
apache-2.0
197
main
1,096
# frozen_string_literal: true module Hyrax module DataDestroyers # PermissionTemplates are tightly coupled to admin sets and collections. # When they are removed using wipe!, the associated database entries for # permission templates also have to be deleted. # # @note WARNING: DO NOT USE IN PRODUC...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/default_admin_set_id_cache_destroyer.rb
Ruby
apache-2.0
197
main
917
# frozen_string_literal: true module Hyrax module DataDestroyers # When the default admin set is removed using wipe!, the cache of the default # admin set id also needs to be deleted. # # @note WARNING: DO NOT USE IN PRODUCTION! The methods in this class are destructive. # Data can not be recov...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/utils/hyrax/data_destroyers/stats_destroyer.rb
Ruby
apache-2.0
197
main
1,087
# frozen_string_literal: true module Hyrax module DataDestroyers # Stats are tightly coupled to works and files in the repository. When they # are removed using wipe!, the associated database entries for stats also # need to be deleted. # # @note WARNING: DO NOT USE IN PRODUCTION! The methods in ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/connections/hyrax/clean_connection.rb
Ruby
apache-2.0
197
main
741
# frozen_string_literal: true module Hyrax # This stands in for ActiveFedora::CleanConnection. It behaves the same way, # but it doesn't clear the has_model assertion class CleanConnection < SimpleDelegator def get(*args) result = __getobj__.get(*args) do |req| prefer_headers = Ldp::PreferHeader...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/abstract_type_relation.rb
Ruby
apache-2.0
197
main
1,261
# frozen_string_literal: true module Hyrax class AbstractTypeRelation < ActiveFedora::Relation def initialize(allowable_types: nil, **opts) @allowable_types = allowable_types super(DummyModel, opts) end def allowable_types @allowable_types || raise(NotImplementedException, "Impl...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/deactivated_lease_search_builder.rb
Ruby
apache-2.0
197
main
307
# frozen_string_literal: true module Hyrax class DeactivatedLeaseSearchBuilder < LeaseSearchBuilder self.default_processor_chain += [:with_deactivated_leases] def with_deactivated_leases(solr_params) solr_params[:fq] ||= [] solr_params[:fq] = 'lease_history_ssim:*' end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/single_admin_set_search_builder.rb
Ruby
apache-2.0
197
main
383
# frozen_string_literal: true module Hyrax class SingleAdminSetSearchBuilder < Hyrax::AdminSetSearchBuilder include Hyrax::SingleResult # @param [#repository,#blacklight_config,#current_ability] context # @param access [Symbol] either :read or :edit access level to filter for def initialize(context, ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/deposit_search_builder.rb
Ruby
apache-2.0
197
main
941
# frozen_string_literal: true module Hyrax class DepositSearchBuilder < ::SearchBuilder # includes the depositor_facet to get information on deposits. # use caution when combining this with other searches as it sets the rows to # zero to just get the facet information # @param solr_parameters the curr...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/collection_member_search_builder.rb
Ruby
apache-2.0
197
main
1,766
# frozen_string_literal: true module Hyrax # This search builder requires that a accessor named "collection" exists in the scope class CollectionMemberSearchBuilder < ::Hyrax::CollectionSearchBuilder include Hyrax::FilterByType attr_writer :collection, :search_includes_models class_attribute :collectio...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/filter_by_type.rb
Ruby
apache-2.0
197
main
1,519
# frozen_string_literal: true module Hyrax module FilterByType extend ActiveSupport::Concern included do self.default_processor_chain += [:filter_models] end # Add queries that excludes everything except for works and collections def filter_models(solr_parameters) solr_parameters[:fq...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/lease_search_builder.rb
Ruby
apache-2.0
197
main
552
# frozen_string_literal: true module Hyrax # Finds objects under lease class LeaseSearchBuilder < Blacklight::SearchBuilder self.default_processor_chain = [:with_pagination, :with_sorting, :only_active_leases] def with_pagination(solr_params) solr_params[:rows] = 1000 end def with_sorting(so...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/works_search_builder.rb
Ruby
apache-2.0
197
main
330
# frozen_string_literal: true module Hyrax # Returns all works, either active or suppressed. # This should only be used by an admin user class WorksSearchBuilder < Hyrax::SearchBuilder include Hyrax::FilterByType self.default_processor_chain -= [:only_active_works] def only_works? true end ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/expired_embargo_search_builder.rb
Ruby
apache-2.0
197
main
468
# frozen_string_literal: true module Hyrax # Finds embargoed objects with release dates in the past class ExpiredEmbargoSearchBuilder < EmbargoSearchBuilder self.default_processor_chain += [:only_expired_embargoes] def only_expired_embargoes(solr_params) solr_params[:fq] ||= [] solr_params[:fq]...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/nested_collections_parent_search_builder.rb
Ruby
apache-2.0
197
main
1,298
# frozen_string_literal: true module Hyrax ## # Searches for all collections that are parents of a given collection. class NestedCollectionsParentSearchBuilder < ::Hyrax::CollectionSearchBuilder include Hyrax::FilterByType attr_reader :child, :page, :limit # @param [Object] scope Typically the contro...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/search_filters.rb
Ruby
apache-2.0
197
main
920
# frozen_string_literal: true module Hyrax module SearchFilters extend ActiveSupport::Concern include Hyrax::FilterByType include FilterSuppressed # TODO: move this to Hydra::AccessControlsEnforcement # @param access [String] what access level to set. Either 'read' or 'edit' # @return [Search...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/admin_admin_set_member_search_builder.rb
Ruby
apache-2.0
197
main
950
# frozen_string_literal: true module Hyrax # Builds a query to find the members of an admin set. # For use on the admin menu, so it includes works regardless of status. class AdminAdminSetMemberSearchBuilder < ::SearchBuilder self.default_processor_chain += [:in_admin_set] self.default_processor_chain -= ...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/single_result.rb
Ruby
apache-2.0
197
main
315
# frozen_string_literal: true module Hyrax module SingleResult extend ActiveSupport::Concern included do self.default_processor_chain += [:find_one] end def find_one(solr_parameters) solr_parameters.append_filter_query("{!raw f=id}#{blacklight_params.fetch(:id)}") end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/admin_set_search_builder.rb
Ruby
apache-2.0
197
main
1,553
# frozen_string_literal: true module Hyrax ### Allows :deposit as a valid type class AdminSetSearchBuilder < ::SearchBuilder # This skips the filter added by FilterSuppressed self.default_processor_chain -= [:only_active_works] # @param [#repository,#blacklight_config,#current_ability] context # @p...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/expired_lease_search_builder.rb
Ruby
apache-2.0
197
main
459
# frozen_string_literal: true module Hyrax # Finds embargoed objects with release dates in the past class ExpiredLeaseSearchBuilder < LeaseSearchBuilder self.default_processor_chain += [:only_expired_leases] def only_expired_leases(solr_params) solr_params[:fq] ||= [] solr_params[:fq] = "lease_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/collection_search_builder.rb
Ruby
apache-2.0
197
main
2,557
# frozen_string_literal: true module Hyrax # Our parent class is the generated SearchBuilder descending from Blacklight::SearchBuilder # It includes Blacklight::Solr::SearchBuilderBehavior, Hydra::AccessControlsEnforcement, Hyrax::SearchFilters # @see https://github.com/projectblacklight/blacklight/blob/master/li...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/file_set_search_builder.rb
Ruby
apache-2.0
197
main
241
# frozen_string_literal: true module Hyrax class FileSetSearchBuilder < ::SearchBuilder include SingleResult # This overrides the models in FilterByType def models Hyrax::ModelRegistry.file_set_classes end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/parent_collection_search_builder.rb
Ruby
apache-2.0
197
main
517
# frozen_string_literal: true module Hyrax # Given the id of a work, find the collections it is a member of class ParentCollectionSearchBuilder < Hyrax::CollectionSearchBuilder delegate :item, to: :scope # include filters into the query to only include the collections containing this item def include_i...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/catalog_search_builder.rb
Ruby
apache-2.0
197
main
3,363
# frozen_string_literal: true ## # The default Blacklight catalog `search_builder_class` for Hyrax. # # Use of this builder is configured in the `CatalogController` generated by # Hyrax's install task. # # If you plan to customize the base catalog search builder behavior (e.g. by # adding a mixin module provided by a b...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/member_with_files_search_builder.rb
Ruby
apache-2.0
197
main
954
# frozen_string_literal: true module Hyrax # Finds the child objects contained within a collection class MemberWithFilesSearchBuilder < ::SearchBuilder class_attribute :from_field self.from_field = 'child_object_ids_ssim' self.default_processor_chain += [:include_collection_ids, :include_contained_files...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/work_search_builder.rb
Ruby
apache-2.0
197
main
413
# frozen_string_literal: true module Hyrax # Finds a single work result. It returns no result if you don't have # access to the requested work. If the work is suppressed (due to being in a # workflow), then it checks to see if the current_user has any workflow role # on the given work. class WorkSearchBuilde...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/embargo_search_builder.rb
Ruby
apache-2.0
197
main
556
# frozen_string_literal: true module Hyrax # Finds embargoed objects class EmbargoSearchBuilder < Blacklight::SearchBuilder self.default_processor_chain = [:with_pagination, :with_sorting, :only_active_embargoes] def with_pagination(solr_params) solr_params[:rows] = 1000 end def with_sorting...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/homepage_search_builder.rb
Ruby
apache-2.0
197
main
309
# frozen_string_literal: true # Added to allow for the My controller to show only things I have edit access to class Hyrax::HomepageSearchBuilder < Hyrax::SearchBuilder include Hyrax::FilterByType self.default_processor_chain += [:add_access_controls_to_solr_params] def only_works? true end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/filter_suppressed_with_roles.rb
Ruby
apache-2.0
197
main
1,732
# frozen_string_literal: true module Hyrax # Overrides FilterSuppressed filter to hide documents marked as # suppressed when the current user is permitted to take no workflow # actions for the work's current state # # Assumes presence of `blacklight_params[:id]` and a SolrDocument # corresponding to that `:...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/filter_suppressed.rb
Ruby
apache-2.0
197
main
411
# frozen_string_literal: true module Hyrax # Injects a search builder filter to hide documents marked as suppressed module FilterSuppressed extend ActiveSupport::Concern included do self.default_processor_chain += [:only_active_works] end def only_active_works(solr_parameters) solr_par...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/deactivated_embargo_search_builder.rb
Ruby
apache-2.0
197
main
317
# frozen_string_literal: true module Hyrax class DeactivatedEmbargoSearchBuilder < EmbargoSearchBuilder self.default_processor_chain += [:with_deactivated_embargos] def with_deactivated_embargos(solr_params) solr_params[:fq] ||= [] solr_params[:fq] = 'embargo_history_ssim:*' end end end
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/exposed_models_relation.rb
Ruby
apache-2.0
197
main
353
# frozen_string_literal: true module Hyrax # A relation that scopes to all user visible models (e.g. works + collections + file sets) class ExposedModelsRelation < AbstractTypeRelation def allowable_types Hyrax::ModelRegistry.work_classes + Hyrax::ModelRegistry.collection_classes + Hyrax::ModelRegistry.fi...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/valkyrie_abstract_type_relation.rb
Ruby
apache-2.0
197
main
991
# frozen_string_literal: true module Hyrax class ValkyrieAbstractTypeRelation def initialize(allowable_types: nil, _opts: {}) @allowable_types = allowable_types end def allowable_types @allowable_types.present? || raise(NotImplementedException, "Implement allowable_types in a subclas...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/collections_search_builder.rb
Ruby
apache-2.0
197
main
1,387
# frozen_string_literal: true # Added to allow for the My controller to show only things I have edit access to class Hyrax::My::CollectionsSearchBuilder < ::Hyrax::CollectionSearchBuilder include Hyrax::My::SearchBuilderBehavior include Hyrax::FilterByType self.default_processor_chain += [:show_only_collections_...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/find_works_search_builder.rb
Ruby
apache-2.0
197
main
1,695
# frozen_string_literal: true # Search for possible works that user can edit and could be a work's child or parent. class Hyrax::My::FindWorksSearchBuilder < Hyrax::My::SearchBuilder include Hyrax::FilterByType self.default_processor_chain += [:filter_on_title, :show_only_other_works, :show_only_works_not_child, :...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/works_search_builder.rb
Ruby
apache-2.0
197
main
729
# frozen_string_literal: true module Hyrax # Added to allow for the Hyrax::My::WorksController to show only things I have deposited # If the work went through mediated deposit, I may no longer have edit access to it. class My::WorksSearchBuilder < My::SearchBuilder include Hyrax::FilterByType # We remove...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/search_builder.rb
Ruby
apache-2.0
197
main
793
# frozen_string_literal: true module Hyrax module My # Search builder for things that the current user has deposited and has edit access to # @abstract class SearchBuilder < ::SearchBuilder # Check for edit access include Hyrax::My::SearchBuilderBehavior self.default_processor_chain += [...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/highlights_search_builder.rb
Ruby
apache-2.0
197
main
524
# frozen_string_literal: true # Added to allow for the My controller to show only things I have edit access to class Hyrax::My::HighlightsSearchBuilder < Hyrax::SearchBuilder include Hyrax::My::SearchBuilderBehavior self.default_processor_chain += [:show_only_highlighted_works] def show_only_highlighted_works(s...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/shares_search_builder.rb
Ruby
apache-2.0
197
main
496
# frozen_string_literal: true # Added to allow for the My controller to show only things I have edit access to class Hyrax::My::SharesSearchBuilder < Hyrax::SearchBuilder include Hyrax::My::SearchBuilderBehavior self.default_processor_chain += [:show_only_shared_files] def show_only_shared_files(solr_parameters...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/my/search_builder_behavior.rb
Ruby
apache-2.0
197
main
469
# frozen_string_literal: true # Behavior for the my controller search builder to allow the my controller to only get access to # items I have edit access to. # # Separating as a behavior allows for easier overriding of the gem behavior. module Hyrax::My::SearchBuilderBehavior extend ActiveSupport::Concern # show o...
github
samvera/hyrax
https://github.com/samvera/hyrax
app/search_builders/hyrax/dashboard/managed_search_filters.rb
Ruby
apache-2.0
197
main
2,849
# frozen_string_literal: true module Hyrax module Dashboard module ManagedSearchFilters extend ActiveSupport::Concern # This includes collection/admin the user can manage and view. def discovery_permissions @discovery_permissions ||= %w[edit read] end # Override to exclude ...