lib/spotlight/engine.rb in blacklight-spotlight-3.0.0.alpha.9 vs lib/spotlight/engine.rb in blacklight-spotlight-3.0.0.alpha.10

- old
+ new

@@ -158,10 +158,11 @@ config.masthead_initial_crop_selection = [1200, 120] config.thumbnail_initial_crop_selection = [120, 120] # Configure the CarrierWave file storage mechanism config.uploader_storage = :file + config.featured_image_masthead_size = [1800, 180] config.featured_image_thumb_size = [400, 300] config.featured_image_square_size = [400, 400] config.contact_square_size = [70, 70] # Additional page configurations to be made available to page editing widgets @@ -211,9 +212,28 @@ } # Whitelisting the available_locales is necessary here, as any dependency we # add could add an available locale which could break things if unexpected. config.i18n.available_locales = config.i18n_locales.keys + + # Copy of JbuilderHandler tweaked to spit out YAML for translation exports + class TranslationYamlHandler + cattr_accessor :default_format + self.default_format = :yaml + + def self.call(template, source = nil) + source ||= template.source + # this juggling is required to keep line numbers right in the error + %{__already_defined = defined?(json); json||=JbuilderTemplate.new(self); #{source} + json.attributes!.to_yaml unless (__already_defined && __already_defined != "method")} + end + end + + initializer :yamlbuilder do + ActiveSupport.on_load :action_view do + ActionView::Template.register_template_handler :yamlbuilder, TranslationYamlHandler + end + end # Query parameters for autocomplete requests config.autocomplete_search_field = 'autocomplete' config.default_autocomplete_params = { qf: 'id^1000 full_title_tesim^100 id_ng full_title_ng', facet: false,