Sha256: 21066e3ffbcfb7aa5fa4742f5e311051cdb9d5be7db4deef684a10be9184e789

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

require 'rails/generators'

class Sufia::Models::CollectionFacetConfigGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  desc """
This Generator makes the following changes to your application:
  1. Updates existing sufia.rb initializer to include a collection_facet configuration
       """

  def banner
    say_status("info", "ADDING COLLECTION_FACET OPTION TO SUFIA CONFIG", :blue)
  end

  def inject_config_initializer
    inject_into_file 'config/initializers/sufia.rb', before: "# Where to store tempfiles, leave blank for the system temp directory (e.g. /tmp)" do
      "  # Add a collection facet to search results.  Possible values are...\n" +
        "  #   nil (default) - do not include collection facet\n" +
        "  #   :user - show for logged in users\n" +
        "  #   :public - show for everyone (e.g. logged in and non-logged in users)\n" +
        "  # config.collection_facet = nil\n"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sufia-models-6.7.0 lib/generators/sufia/models/collection_facet_config_generator.rb
sufia-models-6.6.1 lib/generators/sufia/models/collection_facet_config_generator.rb
sufia-models-6.6.0 lib/generators/sufia/models/collection_facet_config_generator.rb
sufia-models-6.5.0 lib/generators/sufia/models/collection_facet_config_generator.rb