Class: BlacklightHeatmaps::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BlacklightHeatmaps::Install
- Defined in:
- lib/generators/blacklight_heatmaps/install_generator.rb
Instance Method Summary collapse
- #add_model_mixin ⇒ Object
- #configuration ⇒ Object
- #copy_styles ⇒ Object
- #inject_js ⇒ Object
- #inject_search_builder ⇒ Object
Instance Method Details
#add_model_mixin ⇒ Object
32 33 34 35 36 |
# File 'lib/generators/blacklight_heatmaps/install_generator.rb', line 32 def add_model_mixin inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do "\n include BlacklightHeatmaps::GeometrySolrDocument\n" end end |
#configuration ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/blacklight_heatmaps/install_generator.rb', line 18 def configuration inject_into_file 'app/controllers/catalog_controller.rb', after: 'configure_blacklight do |config|' do "\n # BlacklightHeatmaps configuration values" \ "\n config.geometry_field = :geo_srpt" \ "\n config.heatmap_distErrPct = 0.15 # Default Solr value" \ "\n # Basemaps configured include: 'positron', 'darkMatter', 'OpenStreetMap.HOT'" \ "\n config.basemap_provider = 'positron'" \ "\n config.show.partials.insert(1, :show_leaflet_map)" \ "\n config.index.respond_to.heatmaps = true" \ "\n config.view.heatmaps(partials: [], color_ramp: ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'])" \ "\n" end end |
#copy_styles ⇒ Object
7 8 9 |
# File 'lib/generators/blacklight_heatmaps/install_generator.rb', line 7 def copy_styles copy_file 'blacklight_heatmaps.scss', 'app/assets/stylesheets/blacklight_heatmaps.scss' end |
#inject_js ⇒ Object
11 12 13 14 15 16 |
# File 'lib/generators/blacklight_heatmaps/install_generator.rb', line 11 def inject_js inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do "\n// Required by BlacklightHeatmaps" \ "\n//= require blacklight_heatmaps/default" end end |
#inject_search_builder ⇒ Object
38 39 40 41 42 |
# File 'lib/generators/blacklight_heatmaps/install_generator.rb', line 38 def inject_search_builder inject_into_file 'app/models/search_builder.rb', after: /include Blacklight::Solr::SearchBuilderBehavior.*$/ do "\n include BlacklightHeatmaps::SolrFacetHeatmapBehavior\n" end end |