Skip to content

Commit

Permalink
Simplify the Batch Import form (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-dce authored Sep 1, 2021
1 parent 1c261cb commit 410f9fa
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 101 deletions.
106 changes: 5 additions & 101 deletions app/views/zizia/csv_imports/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,101 +1,5 @@
<%= form_with(model: csv_import, local: true, html: { multipart: true }, url: preview_csv_import_path) do |form| %>
<%= form.hidden_field :manifest_cache %>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<h3><span class="bullet">1</span> Prepare Your Content</h3>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Read the Metadata Field Guide</b> to learn what fields are available for import.
</div>
<div class="text-center">
<a href="/importer_documentation/guide" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-book"></i> Field Guide</a>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">B</span></h4>
<div class="step">
<b>Download a CSV template</b> and start filling in your metadata.
</div>
<div class="text-center">
<a href="/importer_documentation/csv" data-turbolinks="false" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list-alt"></i> Import Template</a>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">C</span></h4>
<div class="step">
<b>Upload your files</b> over SFTP, using a tool like <a href="https://filezilla-project.org">FileZilla</a> to transfer files.
</div>
</div>
</div>
<div class="col-md-4">
<h3><span class="bullet">2</span> Upload Your Files</h3>
<% if collections? %>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Upload a CSV</b> that lists the metadata and files you want to import.
</div>
<div class="text-center">
<%= render "file_upload", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">B</span></h4>
<div class="step">
<b>Choose a collection</b> that you'd like your new works to be associated with.
</div>
<div class="text-center">
<%= render "collection_selection", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">C</span></h4>
<div class="step">
<b>Select update behavior.</b> New works will always be added to the repository. Existing works can be overwritten, updated,
or ignored.
</div>
<div class="text-center">
<%= render "update_actor_stack", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">D</span></h4>
<div class="step">
<b>Preview your import</b> and start the import if everything looks good.
or overwritten
</div>
<div class="text-center">
<%= render "actions", form: form %>
</div>
</div>
<% else %>
<div class="well well-sm no-collection ">
<h4><span class="bullet">A</span></h4>
<div class="step">
You must <a href="/dashboard/collections">create a collection</a> before importing content.
</div>
</div>
<% end %>
</div>
<div class="col-md-4">
<h3><span class="bullet">3</span> Monitor Your Progress</h3>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Check the status</b> of batches that have been submitted for import.
</div>
<div class="text-center">
<a href="/csv_import_details/index" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list"></i> Import History</a>
</div>
</div>
</div>
</div> <!-- row -->
<div class="row">
<%= render "error", csv_import: csv_import %>
</div> <!-- row -->
</div> <!-- panel-body -->
</div> <!-- panel -->
<% end %>
<% if Flipflop.new_zizia_ui? %>
<%= render 'import_form', csv_import: @csv_import %>
<% else %>
<%= render 'old_form', csv_import: @csv_import %>
<% end %>
62 changes: 62 additions & 0 deletions app/views/zizia/csv_imports/_import_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<%= form_with(model: csv_import, local: true, html: { multipart: true }, url: preview_csv_import_path) do |form| %>
<%= form.hidden_field :manifest_cache %>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">

<div class="col-md-4">
<% if collections? %>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Upload a CSV</b> that lists the metadata and files you want to import.
</div>
<div class="text-center">
<%= render "file_upload", form: form %>
</div>
</div>
<div class="well well-sm" style="display: none">
<h4><span class="bullet">Z</span></h4>
<div class="step">
<b>Choose a collection</b> that you'd like your new works to be associated with.
</div>
<div class="text-center">
<%= render "collection_selection", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">B</span></h4>
<div class="step">
<b>Select update behavior.</b> New works will always be added to the repository. Existing works can be overwritten, updated,
or ignored.
</div>
<div class="text-center">
<%= render "update_actor_stack", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">C</span></h4>
<div class="step">
<b>Preview your import</b> and start the import if everything looks good.
or overwritten
</div>
<div class="text-center">
<%= render "actions", form: form %>
</div>
</div>
<% else %>
<div class="well well-sm no-collection ">
<h4><span class="bullet">A</span></h4>
<div class="step">
You must <a href="/dashboard/collections">create a collection</a> before importing content.
</div>
</div>
<% end %>
</div>
</div> <!-- row -->
<div class="row">
<%= render "error", csv_import: csv_import %>
</div> <!-- row -->
</div> <!-- panel-body -->
</div> <!-- panel -->
<% end %>
101 changes: 101 additions & 0 deletions app/views/zizia/csv_imports/_old_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<%= form_with(model: csv_import, local: true, html: { multipart: true }, url: preview_csv_import_path) do |form| %>
<%= form.hidden_field :manifest_cache %>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<h3><span class="bullet">1</span> Prepare Your Content</h3>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Read the Metadata Field Guide</b> to learn what fields are available for import.
</div>
<div class="text-center">
<a href="/importer_documentation/guide" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-book"></i> Field Guide</a>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">B</span></h4>
<div class="step">
<b>Download a CSV template</b> and start filling in your metadata.
</div>
<div class="text-center">
<a href="/importer_documentation/csv" data-turbolinks="false" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list-alt"></i> Import Template</a>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">C</span></h4>
<div class="step">
<b>Upload your files</b> over SFTP, using a tool like <a href="https://filezilla-project.org">FileZilla</a> to transfer files.
</div>
</div>
</div>
<div class="col-md-4">
<h3><span class="bullet">2</span> Upload Your Files</h3>
<% if collections? %>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Upload a CSV</b> that lists the metadata and files you want to import.
</div>
<div class="text-center">
<%= render "file_upload", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">B</span></h4>
<div class="step">
<b>Choose a collection</b> that you'd like your new works to be associated with.
</div>
<div class="text-center">
<%= render "collection_selection", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">C</span></h4>
<div class="step">
<b>Select update behavior.</b> New works will always be added to the repository. Existing works can be overwritten, updated,
or ignored.
</div>
<div class="text-center">
<%= render "update_actor_stack", form: form %>
</div>
</div>
<div class="well well-sm">
<h4><span class="bullet">D</span></h4>
<div class="step">
<b>Preview your import</b> and start the import if everything looks good.
or overwritten
</div>
<div class="text-center">
<%= render "actions", form: form %>
</div>
</div>
<% else %>
<div class="well well-sm no-collection ">
<h4><span class="bullet">A</span></h4>
<div class="step">
You must <a href="/dashboard/collections">create a collection</a> before importing content.
</div>
</div>
<% end %>
</div>
<div class="col-md-4">
<h3><span class="bullet">3</span> Monitor Your Progress</h3>
<div class="well well-sm">
<h4><span class="bullet">A</span></h4>
<div class="step">
<b>Check the status</b> of batches that have been submitted for import.
</div>
<div class="text-center">
<a href="/csv_import_details/index" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-list"></i> Import History</a>
</div>
</div>
</div>
</div> <!-- row -->
<div class="row">
<%= render "error", csv_import: csv_import %>
</div> <!-- row -->
</div> <!-- panel-body -->
</div> <!-- panel -->
<% end %>
6 changes: 6 additions & 0 deletions config/features.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true
Flipflop.configure do
feature :new_zizia_ui,
default: false,
description: "Show new UI features and workflows in Zizia importer."
end
4 changes: 4 additions & 0 deletions lib/zizia/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Engine < ::Rails::Engine
app.config.assets.precompile << %w[zizia/application.js zizia/application.css]
end

initializer "load_features" do
Flipflop::FeatureLoader.current.append(self)
end

initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s
config.paths['db/migrate'].expanded.each do |expanded_path|
Expand Down

0 comments on commit 410f9fa

Please sign in to comment.