4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/generators/cdm_migrator/install/install_generator.rb', line 4
def inject_dashboard_link
file_path = "app/views/hyrax/dashboard/sidebar/_tasks.html.erb"
if File.file?(file_path)
title = "<li class=\"h5\"><%= t('hyrax.admin.sidebar.tasks') %></li>"
perm = " <% if can? :review, :submissions %>"
gsub_file file_path,/[ \t]*(<li class="h5"><%= t\('hyrax\.admin\.sidebar\.tasks'\) %><\/li>)\n[\s\S]*[ \t]*(<% if can\? :review, :submissions %>)\n/ do |match|
""
end
gsub_file file_path,/[ \t]*(<% if can\? :review, :submissions %>)\n[\s\S]*[ \t]*(<li class="h5"><%= t\('hyrax\.admin\.sidebar\.tasks'\) %><\/li>)\n/ do |match|
""
end
prepend_to_file file_path do
title + "\n" \
"<li>\n" \
" <%= menu.collapsable_section t('CDM Migrator'),\n" \
" icon_class: \"fa fa-map-signs\",\n" \
" id: 'collapseCdmMigrator',\n" \
" open: menu.cdm_migrator_section? do %>\n" \
" <%= menu.nav_link(main_app.cdm_start_path) do %>\n" \
" <span class=\"fa fa-map\"></span> <span class=\"sidebar-action-text\"><%= t('CDM Mapping Tool') %></span>\n" \
" <% end %>\n" \
" <%= menu.nav_link(main_app.file_path_checker_path) do %>\n" \
" <span class=\"fa fa-check-circle\"></span><span>File Path Checker</span>\n" \
" <% end %>\n" \
" <%= menu.nav_link(main_app.csv_upload_path) do %>\n"\
" <span class=\"fa fa-angle-double-up\"></span> <span class=\"sidebar-action-text\"><%= t('CSV Batch Uploader') %></span>\n" \
" <% end %>\n" \
" <%= menu.nav_link(main_app.csv_my_batches_path) do %>\n" \
" <span class=\"fa fa-database\"></span> <span class=\"sidebar-action-text\"><%= t('Batches') %></span>\n" \
" <% end %>\n" \
" <% end %>\n" \
" </li>\n" + perm + "\n"
end
else
copy_file "sidebar/_tasks.html.erb", "app/views/hyrax/dashboard/sidebar/_tasks.html.erb"
end
end
|