Class: ToSpotlight::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_content_dm_ymlObject



4
5
6
# File 'lib/generators/install/install_generator.rb', line 4

def inject_content_dm_yml
  copy_file('config/to_spotlight.yml', 'config/to_spotlight.yml') unless File.file?('config/to_spotlight.yml')
end


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/install/install_generator.rb', line 8

def inject_dashboard_link
  file_path = 'app/views/hyrax/dashboard/sidebar/_tasks.html.erb'
  if File.file?(file_path)
    insert_into_file file_path, before: /[ \t]*<% if can\? :manage, User %>/m do
      "                 \n<% if can? :review, :submissions %>\n" \
      "							   <%= menu.nav_link(main_app.to_spotlight_index_path) do %>\n" \
      "							   <span class=\"fa fa-flag\" aria-hidden=\"true\"></span> <span class=\"sidebar-action-text\"><%= t('Spotlight Transfers') %></span>\n" \
      "							   <% end %>\n\n"
    end
  else
    copy_file 'sidebar/_tasks.html.erb', 'app/views/hyrax/dashboard/sidebar/_tasks.html.erb'
  end
end