Skip to content

Commit

Permalink
Resolves #20 and #7 by refactoring metadata within PlumSchema into th…
Browse files Browse the repository at this point in the history
…e Schema:: Modules; Adds explicitly defined "suppressed" fields for decorated Valkyrie Resources

Migrating the refactored Schema Modules into the ImportedMetadata Class

Addressing styling rules and updating the RuboCops for the Schema Modules

Restructuring the attributes based upon their sources (where possible)

Tracking the new schema Modules

Excluding the Schema Modules from the coverage analysis

Extending the test suites for the schema Modules; Extending the test for the ScannedResource View displayed attributes

Resolving styling issues

Removing extraneous legacy attributes from being suppressed

Removing the unneeded Schema::Schema Module
  • Loading branch information
jrgriffiniii committed Aug 8, 2017
1 parent b3ed4cc commit 2c34528
Show file tree
Hide file tree
Showing 39 changed files with 1,180 additions and 353 deletions.
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ Metrics/BlockLength:
Metrics/MethodLength:
Exclude:
- 'db/migrate/**/*'
- 'app/models/plum_schema.rb'
- 'app/models/schema/dublin_core.rb'
- 'app/models/schema/marc_relators.rb'
- 'app/models/schema/plum/local.rb'
- 'spec/services/manifest_builder_spec.rb'
Metrics/ModuleLength:
Exclude:
- 'app/models/plum_schema.rb'
- 'app/models/schema/dublin_core.rb'
- 'app/models/schema/marc_relators.rb'
RSpec/MultipleExpectations:
Enabled: false
RSpec/ExampleLength:
Expand Down
5 changes: 3 additions & 2 deletions app/decorators/application_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# frozen_string_literal: true
class ApplicationDecorator < Draper::Decorator
class_attribute :display_attributes
class_attribute :suppressed_attributes, :display_attributes
self.suppressed_attributes = []
self.display_attributes = []
delegate_all

def display_attributes
Hash[
self.class.display_attributes.map do |attribute|
(self.class.display_attributes - self.class.suppressed_attributes).map do |attribute|
[attribute, Array.wrap(self.[](attribute))]
end
]
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/scanned_resource_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
class ScannedResourceDecorator < Valkyrie::ResourceDecorator
self.display_attributes = [:imported_author, :internal_resource, :created_at, :updated_at, :rendered_rights_statement, :member_of_collections, :rendered_holding_location]
self.display_attributes += Schema::Common.attributes + [:member_of_collections, :rendered_holding_location]
delegate :query_service, to: :metadata_adapter
delegate :author, to: :primary_imported_metadata, prefix: :imported

Expand Down
15 changes: 15 additions & 0 deletions app/decorators/valkyrie/resource_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# frozen_string_literal: true
class Valkyrie::ResourceDecorator < ApplicationDecorator
self.suppressed_attributes = [
:description,
:rights_statement,
:holding_location,
:title,
:depositor,
:source_metadata_identifier,
:source_metadata,
:nav_date,
:pdf_type,
:ocr_language,
:keyword,
:source_jsonld,
:sort_title
]
self.display_attributes = [:internal_resource, :created_at, :updated_at]

def created_at
Expand Down
2 changes: 1 addition & 1 deletion app/models/imported_metadata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
class ImportedMetadata < Valkyrie::Resource
include PlumSchema
include Schema::Plum
end
320 changes: 0 additions & 320 deletions app/models/plum_schema.rb

This file was deleted.

Loading

0 comments on commit 2c34528

Please sign in to comment.