bulkrax 9.3.3 → 9.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/bulkrax/import_export.scss +9 -2
  3. data/app/controllers/bulkrax/importers_controller.rb +9 -0
  4. data/app/jobs/bulkrax/create_relationships_job.rb +7 -3
  5. data/app/jobs/bulkrax/export_work_job.rb +1 -3
  6. data/app/services/bulkrax/sample_csv_service/column_builder.rb +58 -0
  7. data/app/services/bulkrax/sample_csv_service/column_descriptor.rb +56 -0
  8. data/app/services/bulkrax/sample_csv_service/csv_builder.rb +82 -0
  9. data/app/services/bulkrax/sample_csv_service/explanation_builder.rb +51 -0
  10. data/app/services/bulkrax/sample_csv_service/field_analyzer.rb +54 -0
  11. data/app/services/bulkrax/sample_csv_service/file_path_generator.rb +16 -0
  12. data/app/services/bulkrax/sample_csv_service/mapping_manager.rb +36 -0
  13. data/app/services/bulkrax/sample_csv_service/model_loader.rb +40 -0
  14. data/app/services/bulkrax/sample_csv_service/row_builder.rb +33 -0
  15. data/app/services/bulkrax/sample_csv_service/schema_analyzer.rb +69 -0
  16. data/app/services/bulkrax/sample_csv_service/split_formatter.rb +42 -0
  17. data/app/services/bulkrax/sample_csv_service/value_determiner.rb +67 -0
  18. data/app/services/bulkrax/sample_csv_service.rb +78 -0
  19. data/app/views/bulkrax/entries/_parsed_metadata.html.erb +1 -1
  20. data/app/views/bulkrax/entries/_raw_metadata.html.erb +1 -1
  21. data/app/views/bulkrax/entries/show.html.erb +6 -6
  22. data/app/views/bulkrax/exporters/_form.html.erb +19 -43
  23. data/app/views/bulkrax/exporters/edit.html.erb +2 -2
  24. data/app/views/bulkrax/exporters/index.html.erb +5 -5
  25. data/app/views/bulkrax/exporters/new.html.erb +3 -5
  26. data/app/views/bulkrax/exporters/show.html.erb +3 -3
  27. data/app/views/bulkrax/importers/_bagit_fields.html.erb +9 -9
  28. data/app/views/bulkrax/importers/_browse_everything.html.erb +1 -1
  29. data/app/views/bulkrax/importers/_csv_fields.html.erb +11 -11
  30. data/app/views/bulkrax/importers/_edit_form_buttons.html.erb +23 -23
  31. data/app/views/bulkrax/importers/_edit_item_buttons.html.erb +2 -2
  32. data/app/views/bulkrax/importers/_file_uploader.html.erb +3 -3
  33. data/app/views/bulkrax/importers/_form.html.erb +4 -5
  34. data/app/views/bulkrax/importers/_oai_fields.html.erb +8 -18
  35. data/app/views/bulkrax/importers/_xml_fields.html.erb +13 -13
  36. data/app/views/bulkrax/importers/edit.html.erb +2 -2
  37. data/app/views/bulkrax/importers/index.html.erb +13 -13
  38. data/app/views/bulkrax/importers/new.html.erb +10 -9
  39. data/app/views/bulkrax/importers/show.html.erb +7 -7
  40. data/app/views/bulkrax/importers/upload_corrected_entries.html.erb +6 -6
  41. data/app/views/bulkrax/shared/_bulkrax_errors.html.erb +11 -11
  42. data/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb +3 -3
  43. data/config/locales/bulkrax.en.yml +235 -2
  44. data/config/routes.rb +1 -0
  45. data/lib/bulkrax/version.rb +1 -1
  46. data/lib/bulkrax.rb +0 -3
  47. data/lib/tasks/bulkrax_tasks.rake +0 -102
  48. metadata +15 -2
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ # Determines values for CSV cells
5
+ class SampleCsvService::ValueDeterminer
6
+ def initialize(service)
7
+ @service = service
8
+ @column_builder = SampleCsvService::ColumnBuilder.new(service)
9
+ end
10
+
11
+ def determine_value(column, model_name, field_list)
12
+ key = @service.mapping_manager.mapped_to_key(column)
13
+ required_terms = field_list.dig(model_name, 'required_terms')
14
+
15
+ if field_list.dig(model_name, "properties")&.include?(key)
16
+ mark_required_or_optional(key, required_terms)
17
+ elsif special_column?(column, key)
18
+ special_value(column, key, model_name, required_terms)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def special_column?(column, key)
25
+ descriptor = SampleCsvService::ColumnDescriptor.new
26
+ visibility_cols = descriptor.send(:extract_column_names, :visibility)
27
+
28
+ key.in?(['model', 'work_type']) ||
29
+ column.in?(visibility_cols) ||
30
+ column == 'source_identifier' ||
31
+ column == 'rights_statement' ||
32
+ relationship_column?(column) ||
33
+ file_column?(column)
34
+ end
35
+
36
+ def special_value(column, key, model_name, required_terms)
37
+ return SampleCsvService::ModelLoader.determine_klass_for(model_name).to_s if key.in?(['model', 'work_type'])
38
+ return 'Required' if column == 'source_identifier'
39
+ return mark_required_or_optional(key, required_terms) if column == 'rights_statement'
40
+ # collections do not have files
41
+ return nil if file_column?(column) && model_name.in?([Bulkrax.collection_model_class].compact.map(&:to_s))
42
+ 'Optional'
43
+ end
44
+
45
+ def mark_required_or_optional(field, required_terms)
46
+ return 'Unknown' unless required_terms
47
+ required_terms.include?(field) ? 'Required' : 'Optional'
48
+ end
49
+
50
+ def relationship_column?(column)
51
+ relationships = [
52
+ @service.mapping_manager.find_by_flag("related_children_field_mapping", 'children'),
53
+ @service.mapping_manager.find_by_flag("related_parents_field_mapping", 'parents')
54
+ ]
55
+ column.in?(relationships)
56
+ end
57
+
58
+ def file_column?(column)
59
+ file_cols = SampleCsvService::ColumnDescriptor::COLUMN_DESCRIPTIONS[:files].flat_map do |property_hash|
60
+ property_hash.keys.filter_map do |key|
61
+ @service.mappings.dig(key, "from")&.first
62
+ end
63
+ end
64
+ column.in?(file_cols)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ ## Main service class that orchestrates CSV generation
5
+ #
6
+ ## Purpose:
7
+ # Generates CSV import templates that help users understand what fields are available for bulk importing content into a Hyrax repository.
8
+ # The service uses a modular architecture with specialized components that work together to create intelligent, model-specific CSV templates:
9
+
10
+ ## 1. Initialization & Setup
11
+ # Loads Bulkrax field mappings (excluding auto-generated fields) via MappingManager
12
+ # Determines which models to include via ModelLoader (can target a specific model, all models, or none)
13
+ # Supports both ActiveFedora and Valkyrie object factories
14
+
15
+ ## 2. Field Analysis
16
+ # FieldAnalyzer examines each model's schema to extract all available properties, and identifies:
17
+ # Required fields
18
+ # Controlled vocabulary terms
19
+ # If a term column can be split into multiple values during import
20
+ # SchemaAnalyzer introspects model schemas differently based on whether they're Valkyrie or ActiveFedora models
21
+
22
+ ## 3. Column Building
23
+ # ColumnBuilder assembles the complete list of valid CSV columns by combining:
24
+ # Bulkrax-specific fields (model, source_identifier, parent, etc.)
25
+ # Model properties mapped through the field mapping system
26
+ # Controlled vocabulary information
27
+ # Filters out internal/system properties (created_at, updated_at, file_ids, embargo_id, etc.)
28
+
29
+ ## 4. Row Generation
30
+ # The service creates three types of rows:
31
+ # Header Row: Column names mapped through Bulkrax's field mappings
32
+ # Explanation Row: Descriptions of what each column expects (via ExplanationBuilder and ColumnDescriptor)
33
+ # Data Rows: One row per model showing appropriate sample values (via RowBuilder and ValueDeterminer)
34
+
35
+ ## 5. Intelligent Filtering
36
+ # Removes completely empty columns to keep the template clean and focused
37
+ # Preserves columns that contain any data across any model row
38
+
39
+ # 6. Output
40
+ # Can generate either a CSV file (default location: tmp/sample_csv_import_template.csv) or a CSV string
41
+ # Uses Ruby's CSV library for proper formatting and escaping
42
+
43
+ ## Sample Usage:
44
+ # Bulkrax::SampleCsvService.call(model_name: 'GenericWork', output: 'file', file_path: 'path/to/output.csv')
45
+ # Bulkrax::SampleCsvService.call(model_name: nil, output: 'csv_string')
46
+ class SampleCsvService
47
+ attr_reader :model_name, :mappings, :all_models
48
+
49
+ def initialize(model_name: nil)
50
+ @model_name = model_name
51
+ @mapping_manager = MappingManager.new
52
+ @mappings = @mapping_manager.mappings
53
+ @all_models = ModelLoader.new(model_name).models
54
+ @field_analyzer = FieldAnalyzer.new(@mappings)
55
+ @csv_builder = CsvBuilder.new(self)
56
+ end
57
+
58
+ def self.call(model_name: nil, output: 'file', **args)
59
+ raise NameError, "Hyrax is not defined" unless defined?(::Hyrax)
60
+ new(model_name: model_name).send("to_#{output}", **args)
61
+ end
62
+
63
+ def to_file(file_path: nil)
64
+ file_path ||= FilePathGenerator.default_path
65
+ @csv_builder.write_to_file(file_path)
66
+ file_path
67
+ end
68
+
69
+ def to_csv_string
70
+ @csv_builder.generate_string
71
+ end
72
+
73
+ # Delegate methods to appropriate components
74
+ attr_reader :field_analyzer
75
+
76
+ attr_reader :mapping_manager
77
+ end
78
+ end
@@ -2,7 +2,7 @@
2
2
  <div class="accordion-container">
3
3
  <div class="accordion-heading" role="tab" id="parsed-metadata-heading">
4
4
  <a class="accordion-title" role="button" data-toggle="collapse" data-target="#parsed-metadata-show" aria-expanded="true" aria-controls="parsed-metadata-show">
5
- Parsed Metadata:
5
+ <%= t('bulkrax.entry.labels.parsed_metadata') %>:
6
6
  </a>
7
7
  <a role="button" data-toggle="collapse" data-target="#parsed-metadata-show" aria-expanded="true" aria-controls="parsed-metadata-show">
8
8
  <div class="accordion-icon fa fa-times-circle" aria-hidden="true"></div>
@@ -2,7 +2,7 @@
2
2
  <div class="accordion-container">
3
3
  <div class="accordion-heading" role="tab" id="raw-metadata-heading">
4
4
  <a class="accordion-title" role="button" data-toggle="collapse" data-target="#raw-metadata-show" aria-expanded="true" aria-controls="raw-metadata-show">
5
- Raw Metadata:
5
+ <%= t('bulkrax.entry.labels.raw_metadata') %>:
6
6
  </a>
7
7
  <a role="button" data-toggle="collapse" data-target="#raw-metadata-show" aria-expanded="true" aria-controls="raw-metadata-show">
8
8
  <div class="accordion-icon fa fa-times-circle" aria-hidden="true"></div>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <p class='bulkrax-p-align'>
15
15
  <strong><%= t('bulkrax.importer.labels.type') %>:</strong>
16
- <%= @entry.factory_class || 'Unknown' %>
16
+ <%= @entry.factory_class || t('bulkrax.entry.labels.unknown') %>
17
17
  </p>
18
18
  <%= render partial: 'raw_metadata'%>
19
19
 
@@ -39,29 +39,29 @@
39
39
  <% if factory_record.present? %>
40
40
  <% factory_record_class = factory_record.class %>
41
41
  <% factory_record_class_human = factory_record_class.model_name.human %>
42
- <strong><%= factory_record_class_human %> Link:</strong>
42
+ <strong><%= t('bulkrax.entry.labels.record_link', record_type: factory_record_class_human) %>:</strong>
43
43
  <% if defined?(Hyrax) && factory_record_class_human == 'Collection' %>
44
44
  <%= link_to factory_record_class_human, hyrax.polymorphic_path(factory_record) %>
45
45
  <% else %>
46
46
  <%= link_to factory_record_class_human, main_app.polymorphic_path(factory_record) %>
47
47
  <% end %>
48
48
  <% else %>
49
- <strong>Item Link:</strong> Item has not yet been imported successfully
49
+ <strong><%= t('bulkrax.entry.labels.item_link') %>:</strong> <%= t('bulkrax.entry.labels.item_not_imported') %>
50
50
  <% end %>
51
51
  <% rescue => e %>
52
- <strong>Item Link:</strong> Unable to retrieve item (<%= e.message %>)
52
+ <strong><%= t('bulkrax.entry.labels.item_link') %>:</strong> <%= t('bulkrax.entry.labels.item_link_error', message: e.message) %>
53
53
  <% end %>
54
54
  <% else %>
55
55
  <% record = @entry&.hyrax_record %>
56
56
  <% if record.present? && @entry.factory_class %>
57
- <strong><%= record.model_name.human %> Link:</strong>
57
+ <strong><%= t('bulkrax.entry.labels.record_link', record_type: record.model_name.human) %>:</strong>
58
58
  <% if defined?(Hyrax) && record.model_name.human == "Collection" %>
59
59
  <%= link_to record.model_name.human, hyrax.polymorphic_path(record) %>
60
60
  <% else %>
61
61
  <%= link_to record.model_name.human, main_app.polymorphic_path(record) %>
62
62
  <% end %>
63
63
  <% else %>
64
- <strong>Item Link:</strong> No item associated with this entry or class unknown
64
+ <strong><%= t('bulkrax.entry.labels.item_link') %>:</strong> <%= t('bulkrax.entry.labels.item_no_association') %>
65
65
  <% end %>
66
66
  <% end %>
67
67
  </p>
@@ -1,7 +1,7 @@
1
1
  <div class="panel-body card-body">
2
2
  <% if exporter.errors.any? %>
3
3
  <div id="error_explanation">
4
- <h2><%= pluralize(exporter.errors.count, "error") %> prohibited this exporter from being saved:</h2>
4
+ <h2><%= t('bulkrax.exporter.validations.errors_prohibited', count: exporter.errors.count) %></h2>
5
5
 
6
6
  <ul>
7
7
  <% exporter.errors.full_messages.each do |message| %>
@@ -11,35 +11,31 @@
11
11
  </div>
12
12
  <% end %>
13
13
 
14
- <%= form.input :name, label: t('bulkrax.exporter.labels.name'), input_html: { class: 'form-control' } %>
14
+ <%= form.input :name, input_html: { class: 'form-control' } %>
15
15
 
16
16
  <%= form.hidden_field :user_id, value: current_user.id %>
17
17
 
18
18
  <%= form.input :export_type,
19
- collection: form.object.export_type_list,
20
- label: t('bulkrax.exporter.labels.export_type'),
19
+ collection: form.object.export_type_list,
21
20
  required: true,
22
- prompt: 'Please select an export type',
21
+ prompt: t('bulkrax.exporter.prompts.export_type'),
23
22
  input_html: { class: 'form-control' } %>
24
23
 
25
24
  <%= form.input :export_from,
26
25
  collection: form.object.export_from_list,
27
- label: t('bulkrax.exporter.labels.export_from'),
28
26
  required: true,
29
- prompt: 'Please select an export source',
27
+ prompt: t('bulkrax.exporter.prompts.export_from'),
30
28
  input_html: { class: 'form-control' } %>
31
29
 
32
30
  <%= form.input :export_source_importer,
33
- label: t('bulkrax.exporter.labels.importer'),
34
31
  required: true,
35
- prompt: 'Select from the list',
32
+ prompt: t('bulkrax.exporter.prompts.select_from_list'),
36
33
  label_html: { class: 'importer export-source-option d-none hidden' },
37
34
  input_html: { class: 'importer export-source-option d-none hidden form-control' },
38
- collection: form.object.importers_list.sort %>
35
+ collection: form.object.importers_list.sort %>
39
36
 
40
37
  <%= form.input :export_source_collection,
41
- prompt: 'Start typing ...',
42
- label: t('bulkrax.exporter.labels.collection'),
38
+ prompt: t('bulkrax.exporter.prompts.start_typing'),
43
39
  required: true,
44
40
  placeholder: @collection&.title&.first,
45
41
  label_html: { class: 'collection export-source-option d-none hidden' },
@@ -53,61 +49,41 @@
53
49
  %>
54
50
 
55
51
  <%= form.input :export_source_worktype,
56
- label: t('bulkrax.exporter.labels.worktype'),
57
52
  required: true,
58
- prompt: 'Select from the list',
53
+ prompt: t('bulkrax.exporter.prompts.select_from_list'),
59
54
  label_html: { class: 'worktype export-source-option d-none hidden' },
60
55
  input_html: { class: 'worktype export-source-option d-none hidden form-control' },
61
56
  collection: Bulkrax.curation_concerns.map { |cc| [cc.to_s, cc.to_s] } %>
62
57
 
63
58
  <%= form.input :limit,
64
59
  as: :integer,
65
- hint: 'leave blank or 0 for all records',
66
- label: t('bulkrax.exporter.labels.limit'),
67
60
  input_html: { class: 'form-control' } %>
68
61
 
69
- <%= form.input :generated_metadata?,
70
- as: :boolean,
71
- label: t('bulkrax.exporter.labels.generated_metadata'),
72
- hint: t('bulkrax.exporter.hints.generated_metadata') %>
62
+ <%= form.input :generated_metadata?, as: :boolean %>
73
63
 
74
- <%= form.input :include_thumbnails?,
75
- as: :boolean,
76
- label: t('bulkrax.exporter.labels.include_thumbnails'),
77
- hint: t('bulkrax.exporter.hints.include_thumbnails') %>
64
+ <%= form.input :include_thumbnails?, as: :boolean %>
78
65
 
79
- <%= form.input :date_filter,
80
- as: :boolean,
81
- label: t('bulkrax.exporter.labels.filter_by_date') %>
66
+ <%= form.input :date_filter, as: :boolean %>
82
67
 
83
68
  <div id="date_filter_picker" class="d-none hidden">
84
- <%= form.input :start_date,
85
- as: :date,
86
- label: t('bulkrax.exporter.labels.start_date'),
87
- input_html: { class: 'form-control' } %>
88
-
89
- <%= form.input :finish_date,
90
- as: :date,
91
- label: t('bulkrax.exporter.labels.finish_date'),
92
- input_html: { class: 'form-control' } %>
69
+ <%= form.input :start_date, as: :date, input_html: { class: 'form-control' } %>
70
+
71
+ <%= form.input :finish_date, as: :date, input_html: { class: 'form-control' } %>
93
72
  </div>
94
73
  <% if defined?(::Hyrax) %>
95
74
  <%= form.input :work_visibility,
96
- collection: form.object.work_visibility_list,
97
- label: t('bulkrax.exporter.labels.visibility'),
98
- input_html: { class: 'form-control' } %>
75
+ collection: form.object.work_visibility_list,
76
+ input_html: { class: 'form-control' } %>
99
77
  <% end %>
100
78
 
101
79
  <% if defined?(::Hyrax) %>
102
80
  <%= form.input :workflow_status,
103
- collection: form.object.workflow_status_list,
104
- label: t('bulkrax.exporter.labels.status'),
105
- input_html: { class: 'form-control' } %>
81
+ collection: form.object.workflow_status_list,
82
+ input_html: { class: 'form-control' } %>
106
83
  <% end %>
107
84
 
108
85
  <%= form.input :parser_klass,
109
86
  collection: Bulkrax.parsers.map {|p| [p[:name], p[:class_name], {'data-partial' => p[:partial]}] if p[:class_name].constantize.export_supported? }.compact,
110
- label: t('bulkrax.exporter.labels.export_format'),
111
87
  input_html: { class: 'form-control' } %>
112
88
  </div>
113
89
 
@@ -9,9 +9,9 @@
9
9
  <%= render 'form', exporter: @exporter, form: form %>
10
10
  <div class="panel-footer card-footer bulkrax-card-footer">
11
11
  <div class='pull-right'>
12
- <%= form.button :submit, value: 'Update Exporter', class: 'btn btn-primary' %>
12
+ <%= form.button :submit, value: t('helpers.action.exporter.update'), class: 'btn btn-primary' %>
13
13
  |
14
- <%= form.button :submit, value: 'Update and Re-Export All Items', class: 'btn btn-primary' %>
14
+ <%= form.button :submit, value: t('helpers.action.exporter.update_and_re_export'), class: 'btn btn-primary' %>
15
15
  |
16
16
  <% cancel_path = form.object.persisted? ? exporter_path(form.object) : exporters_path %>
17
17
  <%= link_to t('bulkrax.cancel'), cancel_path, class: 'btn btn-default ' %>
@@ -17,11 +17,11 @@
17
17
  <table id='exporters-table' class="table table-striped">
18
18
  <thead>
19
19
  <tr>
20
- <th scope="col">Name</th>
21
- <th scope="col">Status</th>
22
- <th scope="col">Date Exported</th>
23
- <th scope="col">Downloadable Files</th>
24
- <th scope="col">Actions</th>
20
+ <th scope="col"><%= t('bulkrax.table_header.labels.name') %></th>
21
+ <th scope="col"><%= t('bulkrax.table_header.labels.status') %></th>
22
+ <th scope="col"><%= t('bulkrax.table_header.labels.date_exported') %></th>
23
+ <th scope="col"><%= t('bulkrax.table_header.labels.downloadable_files') %></th>
24
+ <th scope="col"><%= t('bulkrax.table_header.labels.actions') %></th>
25
25
  </tr>
26
26
  </thead>
27
27
  </table>
@@ -9,12 +9,10 @@
9
9
  <%= render 'form', exporter: @exporter, form: form %>
10
10
  <div class="panel-footer card-footer bulkrax-card-footer">
11
11
  <div class='pull-right'>
12
- <%= form.button :submit, value: 'Create and Export', class: 'btn btn-primary' %>
13
- |
14
- <%= form.button :submit, value: 'Create', class: 'btn btn-primary' %>
15
- |
12
+ <%= submit_tag t('helpers.action.exporter.create_and_export'), class: 'btn btn-primary me-2' %>
13
+ <%= submit_tag t('helpers.action.exporter.create'), class: 'btn btn-default me-2' %>
16
14
  <% cancel_path = form.object.persisted? ? exporter_path(form.object) : exporters_path %>
17
- <%= link_to t('bulkrax.cancel'), cancel_path, class: 'btn btn-default ' %>
15
+ <%= link_to t('bulkrax.cancel'), cancel_path, class: 'btn btn-default' %>
18
16
  </div>
19
17
  </div>
20
18
  <% end %>
@@ -11,7 +11,7 @@
11
11
  <%= simple_form_for @exporter, method: :get, url: exporter_download_path(@exporter), html: { class: 'form-inline bulkrax-p-align' } do |form| %>
12
12
  <strong>Download:</strong>
13
13
  <%= render 'downloads', exporter: @exporter, form: form %>
14
- <%= form.button :submit, value: 'Download', data: { disable_with: false } %>
14
+ <%= form.button :submit, value: t('helpers.action.exporter.download'), data: { disable_with: false } %>
15
15
  <% end %>
16
16
  <% end %>
17
17
 
@@ -101,9 +101,9 @@
101
101
  <%= render partial: 'bulkrax/shared/entries_tab', locals: { item: @exporter } %>
102
102
  </div>
103
103
  <br>
104
- <%= link_to 'Edit', edit_exporter_path(@exporter) %>
104
+ <%= link_to t('helpers.action.exporter.edit'), edit_exporter_path(@exporter) %>
105
105
  |
106
- <%= link_to 'Back', exporters_path %>
106
+ <%= link_to t('helpers.action.exporter.back'), exporters_path %>
107
107
  </div>
108
108
  </div>
109
109
  </div>
@@ -17,9 +17,9 @@
17
17
 
18
18
  <%= fi.input :visibility,
19
19
  collection: [
20
- ['Public', 'open'],
21
- ['Private', 'restricted'],
22
- ['Institution', 'authenticated']
20
+ [t('bulkrax.importer.bagit.visibility.public'), 'open'],
21
+ [t('bulkrax.importer.bagit.visibility.private'), 'restricted'],
22
+ [t('bulkrax.importer.bagit.visibility.institution'), 'authenticated']
23
23
  ],
24
24
  selected: importer.parser_fields['visibility'] || 'open',
25
25
  input_html: { class: 'form-control' }
@@ -35,15 +35,15 @@
35
35
  input_html: { class: 'form-control' } ,
36
36
  required: false
37
37
  %>
38
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
38
+ <%= fi.input :override_rights_statement, as: :boolean, hint: t('bulkrax.importer.hints.override_rights_statement'), input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
39
39
  <% end %>
40
- <h4>Bag or Bags to Import:</h4>
41
- <p>File upload and Cloud File upload must be a Zip file containing a single BagIt Bag, or a folder containing multiple BagIt Bags.</p>
42
- <p>The Server Path can point to a BagIt Bag, a folder containing BagIt Bags, or a zip file containing either.</p>
40
+ <h4><%= t('bulkrax.importer.bagit.bags_to_import') %></h4>
41
+ <p><%= t('bulkrax.importer.bagit.file_upload_hint') %></p>
42
+ <p><%= t('bulkrax.importer.bagit.server_path_hint') %></p>
43
43
 
44
44
  <%= fi.input :file_style,
45
- collection: ['Upload a File', 'Specify a Path on the Server'] +
46
- (defined?(::Hyrax) && Hyrax.config.browse_everything? ? ['Add Cloud File'] : []),
45
+ collection: [t('bulkrax.importer.bagit.file_style.upload'), t('bulkrax.importer.bagit.file_style.server_path')] +
46
+ (defined?(::Hyrax) && Hyrax.config.browse_everything? ? [t('bulkrax.importer.bagit.file_style.cloud')] : []),
47
47
  as: :radio_buttons, label: false %>
48
48
  <div id='file_upload'>
49
49
  <% if defined?(::Hyrax) %>
@@ -7,6 +7,6 @@
7
7
  <button type="button" data-toggle="browse-everything" data-route="<%=browse_everything_engine.root_path%>"
8
8
  data-target="#<%= f %>" class="btn btn-primary" id="browse">
9
9
  <span class="fa fa-plus"></span>
10
- Add Cloud Files
10
+ <%= t('bulkrax.importer.browse_everything.add_cloud_files') %>
11
11
  </button>
12
12
  </div>
@@ -1,14 +1,14 @@
1
1
  <div class='csv_fields'>
2
2
  <%= fi.input :visibility,
3
- label: 'Default Visibility',
3
+ label: t('bulkrax.importer.csv.labels.default_visibility'),
4
4
  collection: [
5
- ['Public', 'open'],
6
- ['Private', 'restricted'],
7
- ['Institution', 'authenticated']
5
+ [t('bulkrax.importer.csv.visibility.public'), 'open'],
6
+ [t('bulkrax.importer.csv.visibility.private'), 'restricted'],
7
+ [t('bulkrax.importer.csv.visibility.institution'), 'authenticated']
8
8
  ],
9
9
  selected: importer.parser_fields['visibility'] || 'open',
10
10
  input_html: { class: 'form-control' },
11
- hint: 'If your CSV includes the visibility field, it will override the default setting.'
11
+ hint: t('bulkrax.importer.hints.default_visibility')
12
12
  %>
13
13
  <% if defined?(::Hyrax) %>
14
14
  <% rights_statements = Hyrax.config.rights_statement_service_class.new %>
@@ -20,12 +20,12 @@
20
20
  input_html: { class: 'form-control' },
21
21
  required: false
22
22
  %>
23
- <%= fi.input :override_rights_statement, as: :boolean, hint: 'If checked, always use the selected rights statement. If unchecked, use rights or rights_statement from the record and only use the provided value if dc:rights is blank.', input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
23
+ <%= fi.input :override_rights_statement, as: :boolean, hint: t('bulkrax.importer.hints.override_rights_statement'), input_html: { checked: (importer.parser_fields['override_rights_statement'] == "1") } %>
24
24
  <% end %>
25
- <h4>Add CSV or ZIP File to Import:</h4>
25
+ <h4><%= t('bulkrax.importer.csv.add_csv_to_import') %></h4>
26
26
  <%# accept a single file upload; data files and bags will need to be added another way %>
27
- <% file_style_list = ['Upload a File', 'Specify a Path on the Server'] %>
28
- <% file_style_list << 'Existing Entries' unless importer.new_record? %>
27
+ <% file_style_list = [t('bulkrax.importer.csv.file_style.upload'), t('bulkrax.importer.csv.file_style.server_path')] %>
28
+ <% file_style_list << t('bulkrax.importer.csv.file_style.existing_entries') unless importer.new_record? %>
29
29
  <%= fi.input :file_style, collection: file_style_list, as: :radio_buttons, label: false %>
30
30
 
31
31
  <div id='file_upload'>
@@ -45,8 +45,8 @@
45
45
  </div>
46
46
 
47
47
  <% if defined?(::Hyrax) && Hyrax.config.browse_everything? %>
48
- <h4>Add Files to Import:</h4>
49
- <p>Choose files to upload. The filenames must be unique, and the filenames must be referenced in a column called 'file' in the accompanying CSV file.</p>
48
+ <h4><%= t('bulkrax.importer.csv.add_files_to_import') %></h4>
49
+ <p><%= t('bulkrax.importer.csv.add_files_hint') %></p>
50
50
  <%= render 'browse_everything', form: form %>
51
51
  <% end %>
52
52
  <br />
@@ -2,45 +2,45 @@
2
2
  <div class="modal-dialog" role="document">
3
3
  <div class="modal-content">
4
4
  <div class="modal-body">
5
- <h5>Options for Updating the Importer</h5>
5
+ <h5><%= t('bulkrax.importer.edit_form.modal_title') %></h5>
6
6
  <hr />
7
7
 
8
8
  <% if @importer.importer_runs.blank? %>
9
- <p>Only update the values in the importer form. Do not import metadata or files for any works or collections.</p>
10
- <%= form.button :submit, value: 'Update Importer', class: 'btn btn-primary' %>
9
+ <p><%= t('bulkrax.importer.edit_form.update_only_hint') %></p>
10
+ <%= form.button :submit, value: t('helpers.action.importer.update'), class: 'btn btn-primary' %>
11
11
  <hr />
12
- <p>Update the values in the importer form and run the importer for the first time.</p>
13
- <%= form.button :submit, value: 'Update and Import', class: 'btn btn-primary' %>
12
+ <p><%= t('bulkrax.importer.edit_form.update_and_import_hint') %></p>
13
+ <%= form.button :submit, value: t('helpers.action.importer.update_and_import'), class: 'btn btn-primary' %>
14
14
  <% elsif @importer.parser_klass.include?('Oai') %>
15
- <p>Only update the values in the importer form. Do not update metadata or files for any works or collections.</p>
16
- <%= form.button :submit, value: 'Update Importer', class: 'btn btn-primary' %>
15
+ <p><%= t('bulkrax.importer.edit_form.update_only_no_update_hint') %></p>
16
+ <%= form.button :submit, value: t('helpers.action.importer.update'), class: 'btn btn-primary' %>
17
17
  <hr />
18
- <p>Update the values in the importer form and update items that have changed at the source.</p>
19
- <%= form.button :submit, value: 'Update and Harvest Updated Items', class: 'btn btn-primary' %>
18
+ <p><%= t('bulkrax.importer.edit_form.update_and_harvest_hint') %></p>
19
+ <%= form.button :submit, value: t('helpers.action.importer.update_and_harvest_updated'), class: 'btn btn-primary' %>
20
20
  <hr />
21
- <p>Update the values in the importer form and recreate all items from the source.</p>
22
- <%= form.button :submit, value: 'Update and Re-Harvest All Items', class: 'btn btn-primary' %>
21
+ <p><%= t('bulkrax.importer.edit_form.update_and_re_harvest_hint') %></p>
22
+ <%= form.button :submit, value: t('helpers.action.importer.update_and_re_harvest'), class: 'btn btn-primary' %>
23
23
  <% else %>
24
- <p>Only update the values in the importer form. Do not update metadata or files for any works or collections.</p>
25
- <%= form.button :submit, value: 'Update Importer', class: 'btn btn-primary' %>
24
+ <p><%= t('bulkrax.importer.edit_form.update_only_no_update_hint') %></p>
25
+ <%= form.button :submit, value: t('helpers.action.importer.update'), class: 'btn btn-primary' %>
26
26
  <hr />
27
- <p>Update the values in the importer form and update the metadata for all works. Do not update any files.</p>
28
- <%= form.button :submit, value: 'Update Metadata', class: 'btn btn-primary' %>
27
+ <p><%= t('bulkrax.importer.edit_form.update_metadata_hint') %></p>
28
+ <%= form.button :submit, value: t('helpers.action.importer.update_metadata'), class: 'btn btn-primary' %>
29
29
  <hr />
30
- <p>Update the values in the importer form and update the metadata and files for all works. Creates new versions of the files and retains the old versions.</p>
31
- <%= form.button :submit, value: 'Update Metadata and Files', class: 'btn btn-primary' %>
30
+ <p><%= t('bulkrax.importer.edit_form.update_metadata_and_files_hint') %></p>
31
+ <%= form.button :submit, value: t('helpers.action.importer.update_metadata_and_files'), class: 'btn btn-primary' %>
32
32
  <hr />
33
- <p>Update the values in the importer form and update the metadata. Completely removes all files attached to works for this importer and recreates the files from scratch.</p>
33
+ <p><%= t('bulkrax.importer.edit_form.update_and_replace_files_hint') %></p>
34
34
  <%= form.button :submit,
35
- value: 'Update and Replace Files',
35
+ value: t('helpers.action.importer.update_and_replace_files'),
36
36
  class: 'btn btn-primary',
37
- data: {confirm: "Are you sure? This will remove all files before adding them from the import."} %>
37
+ data: {confirm: t('helpers.action.importer.update_and_replace_files_confirm')} %>
38
38
  <hr />
39
- <p>Remove all works and then run the import again from a clean slate. This will remove all files and associations and any edits made since the last import will be lost.</p>
39
+ <p><%= t('bulkrax.importer.edit_form.remove_and_rerun_hint') %></p>
40
40
  <%= form.button :submit,
41
- value: 'Remove and Rerun',
41
+ value: t('helpers.action.importer.remove_and_rerun'),
42
42
  class: 'btn btn-primary',
43
- data: {confirm: "Are you sure? This will delete all the works and any associated files and relationships before re running."} %>
43
+ data: {confirm: t('helpers.action.importer.remove_and_rerun_confirm')} %>
44
44
 
45
45
  <% end %>
46
46
  <hr />
@@ -5,10 +5,10 @@
5
5
  <h5>Options for Updating an Entry</h5>
6
6
  <hr />
7
7
  <p>Rebuild metadata and files.</p>
8
- <%= link_to 'Build', item_entry_path(item, e), method: :patch, class: 'btn btn-primary' %>
8
+ <%= link_to t('helpers.action.importer.build'), item_entry_path(item, e), method: :patch, class: 'btn btn-primary' %>
9
9
  <hr />
10
10
  <p>Remove existing work and then recreate the works metadata and files.</p>
11
- <%= link_to 'Remove and then Build', item_entry_path(item, e, destroy_first: true), method: :patch, class: 'btn btn-primary' %>
11
+ <%= link_to t('helpers.action.importer.remove_and_build'), item_entry_path(item, e, destroy_first: true), method: :patch, class: 'btn btn-primary' %>
12
12
  </div>
13
13
  <div class="modal-footer">
14
14
  <button type="button" class="btn btn-default" data-dismiss="modal"><%= t('helpers.action.cancel') %></button>
@@ -9,12 +9,12 @@
9
9
  accept="<%= accepted_file_types || 'text/csv,application/zip,application/gzip' %>" multiple />
10
10
  <button type="button" class="btn btn-success" onclick="document.getElementById('addfiles').click();">
11
11
  <span class="fa fa-plus"></span>
12
- <span>Add Files</span>
12
+ <span><%= t('bulkrax.importer.file_uploader.add_files') %></span>
13
13
  </button>
14
14
  </div>
15
15
  <button type="reset" id="file-upload-cancel-btn" class="btn btn-warning cancel">
16
16
  <span class="fa fa-ban"></span>
17
- <span>Cancel Upload</span>
17
+ <span><%= t('bulkrax.importer.file_uploader.cancel_upload') %></span>
18
18
  </button>
19
19
  <span class="fileupload-process"></span>
20
20
  </div>
@@ -31,7 +31,7 @@
31
31
  </div>
32
32
  </div>
33
33
  <div class="dropzone">
34
- Drop files here to upload
34
+ <%= t('bulkrax.importer.file_uploader.dropzone') %>
35
35
  </div>
36
36
  <%= render 'hyrax/uploads/js_templates' %>
37
37
  </div>