app/serializers/spotlight/exhibit_export_serializer.rb in blacklight-spotlight-3.0.0.alpha.2 vs app/serializers/spotlight/exhibit_export_serializer.rb in blacklight-spotlight-3.0.0.alpha.3

- old
+ new

@@ -9,11 +9,11 @@ ## # Serialize the Spotlight::BlacklightConfiguration class ConfigurationRepresenter < Roar::Decorator include Roar::JSON - (Spotlight::BlacklightConfiguration.attribute_names - %w(id exhibit_id)).each do |prop| + (Spotlight::BlacklightConfiguration.attribute_names - %w[id exhibit_id]).each do |prop| property prop end property :skip_default_configuration, exec_context: :decorator @@ -34,29 +34,29 @@ end end include Roar::JSON - (Spotlight::Exhibit.attribute_names - %w(id slug masthead_id thumbnail_id)).each do |prop| + (Spotlight::Exhibit.attribute_names - %w[id slug masthead_id thumbnail_id]).each do |prop| property prop, if: config?(:config) end property :theme, if: config?(:config), setter: lambda { |fragment:, represented:, **| represented.theme = fragment if Spotlight::Engine.config.exhibit_themes.include? fragment } collection :main_navigations, class: Spotlight::MainNavigation, decorator: MainNavigationRepresenter, if: config?(:config) collection :contact_emails, class: Spotlight::ContactEmail, if: config?(:config) do - (Spotlight::ContactEmail.attribute_names - %w(id exhibit_id confirmation_token)).each do |prop| + (Spotlight::ContactEmail.attribute_names - %w[id exhibit_id confirmation_token]).each do |prop| property prop end end collection :searches, populator: ->(fragment, options) { options[:represented].searches.find_or_initialize_by(slug: fragment['slug']) }, if: config?(:pages), class: Spotlight::Search do - (Spotlight::Search.attribute_names - %w(id scope exhibit_id masthead_id thumbnail_id)).each do |prop| + (Spotlight::Search.attribute_names - %w[id scope exhibit_id masthead_id thumbnail_id]).each do |prop| property prop end property :masthead, class: Spotlight::Masthead, decorator: FeaturedImageRepresenter, @@ -84,11 +84,11 @@ if: config?(:pages) collection :contacts, populator: ->(fragment, options) { options[:represented].contacts.find_or_initialize_by(slug: fragment['slug']) }, class: Spotlight::Contact, if: config?(:pages) do - (Spotlight::Contact.attribute_names - %w(id exhibit_id)).each do |prop| + (Spotlight::Contact.attribute_names - %w[id exhibit_id]).each do |prop| property prop end property :avatar, class: Spotlight::ContactImage, decorator: FeaturedImageRepresenter end @@ -100,18 +100,18 @@ property :blacklight_configuration, class: Spotlight::BlacklightConfiguration, decorator: ConfigurationRepresenter, if: config?(:blacklight_configuration) collection :custom_fields, populator: ->(fragment, options) { options[:represented].custom_fields.find_or_initialize_by(slug: fragment['slug']) }, class: Spotlight::CustomField, if: config?(:blacklight_configuration) do - (Spotlight::CustomField.attribute_names - %w(id exhibit_id)).each do |prop| + (Spotlight::CustomField.attribute_names - %w[id exhibit_id]).each do |prop| property prop end end collection :solr_document_sidecars, class: Spotlight::SolrDocumentSidecar, if: config?(:resources) do - (Spotlight::SolrDocumentSidecar.attribute_names - %w(id document_type exhibit_id)).each do |prop| + (Spotlight::SolrDocumentSidecar.attribute_names - %w[id document_type exhibit_id]).each do |prop| property prop end property :document_type, exec_context: :decorator @@ -137,11 +137,11 @@ represented.tag = ActsAsTaggableOn::Tag.find_or_create_by name: tag end end collection :attachments, class: Spotlight::Attachment, if: config?(:attachments) do - (Spotlight::Attachment.attribute_names - %w(id exhibit_id file)).each do |prop| + (Spotlight::Attachment.attribute_names - %w[id exhibit_id file]).each do |prop| property prop end property :file, exec_context: :decorator @@ -158,11 +158,11 @@ end end collection :resources, class: ->(options) { options[:fragment].key?('type') ? options[:fragment]['type'].constantize : Spotlight::Resource }, if: config?(:resources) do - (Spotlight::Resource.attribute_names - %w(id upload_id exhibit_id)).each do |prop| + (Spotlight::Resource.attribute_names - %w[id upload_id exhibit_id]).each do |prop| property prop end property :upload, exec_context: :decorator @@ -180,10 +180,10 @@ end collection :languages, class: Spotlight::Language, populator: ->(fragment, options) { options[:represented].languages.find_or_initialize_by(locale: fragment['locale']) }, if: config?(:config) do - (Spotlight::Language.attribute_names - %w(id exhibit_id)).each do |prop| + (Spotlight::Language.attribute_names - %w[id exhibit_id]).each do |prop| property prop end end collection :translations, getter: ->(represented:, **) { represented.translations.unscope(where: :locale) },