Skip to content

Commit

Permalink
Merge b42fe69 into dabd516
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Mar 19, 2020
2 parents dabd516 + b42fe69 commit 61c8ef5
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 102 deletions.
4 changes: 3 additions & 1 deletion app/controllers/bundle_contexts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def show

def bundle_contexts_params
params.require(:bundle_context)
.permit(:project_name, :content_structure, :staging_style_symlink, :content_metadata_creation, :bundle_dir, job_runs_attributes: [:job_type])
.permit(:project_name, :content_structure, :staging_style_symlink,
:content_metadata_creation, :bundle_dir, :all_files_public,
job_runs_attributes: [:job_type])
.merge(user: current_user)
end
end
8 changes: 3 additions & 5 deletions app/lib/pre_assembly/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def digital_objects
@digital_objects ||= discover_containers_via_manifest.each_with_index.map do |c, i|
stageable_items = discover_items_via_crawl(c)
row = manifest_rows[i]

DigitalObject.new(self,
container: c,
stageable_items: stageable_items,
Expand Down Expand Up @@ -202,10 +201,9 @@ def all_object_files

# @return [PreAssembly::ObjectFile]
def new_object_file(stageable, file_path)
ObjectFile.new(
file_path,
relative_path: relative_path(get_base_dir(stageable), file_path)
)
options = { relative_path: relative_path(get_base_dir(stageable), file_path) }
options[:file_attributes] = { preserve: 'yes', shelve: 'yes', publish: 'yes' } if bundle_context.all_files_public?
ObjectFile.new(file_path, options)
end

####
Expand Down
81 changes: 30 additions & 51 deletions app/views/bundle_contexts/_new_bc_form.erb
Original file line number Diff line number Diff line change
@@ -1,62 +1,41 @@
<h3>Complete the form below</h3>

<%= simple_form_for(@bundle_context) do |form| %>
<div class="row">
<div class="col-5">
<%= form.input :project_name %>
</div>
</div>
<%= simple_form_for @bundle_context, html: { class: 'col-md-8' } do |form| %>
<%= form.input :project_name %>
<div class="row">
<div class="col-5">
<%= form.simple_fields_for :job_runs do |jt| %>
<%= jt.input :job_type, collection:
[
["Pre Assembly Run", "preassembly"],
["Discovery Report", "discovery_report"]
]
%>
<% end %>
</div>
</div>

<div class="row">
<div class="col-5">
<%= form.input :content_structure, collection:
<%= form.simple_fields_for :job_runs do |jt| %>
<%= jt.input :job_type, collection:
[
['Simple Image', 'simple_image'],
['Simple Book', 'simple_book'],
['File', 'file'],
['Media', 'media'],
['3D', '3d'],
["Pre Assembly Run", "preassembly"],
["Discovery Report", "discovery_report"]
]
%>
</div>
</div>
%>
<% end %>
<%= form.input :content_structure, collection:
[
['Simple Image', 'simple_image'],
['Simple Book', 'simple_book'],
['File', 'file'],
['Media', 'media'],
['3D', '3d'],
]
%>
<div class="row">
<div class="col-5">
<%= form.input :bundle_dir %>
</div>
</div>
<div class="row">
<div class="col-5">
<%= form.input :staging_style_symlink %>
</div>
</div>
<%= form.input :bundle_dir %>
<%= form.input :staging_style_symlink %>
<%= form.input :content_metadata_creation, collection:
[
["Default", "default"],
["Filename", "filename"],
["Media", "media_cm_style"]
]
%>
<div class="row">
<div class="col-5">
<%= form.input :content_metadata_creation, collection:
[
["Default", "default"],
["Filename", "filename"],
["Media", "media_cm_style"]
]
%>
</div>
</div>
<%= form.input :all_files_public,
as: :radio_buttons,
collection: [['Default', false], ['Preserve=Yes, Shelve=Yes, Publish=Yes', true]] %>
<%= form.button :submit, class: "btn-sul-dlss" %>
<% end %>
11 changes: 2 additions & 9 deletions config/initializers/simple_form.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# frozen_string_literal: true

#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/plataformatec/simple_form#custom-components to know
# See https://github.com/heartcombo/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
Expand All @@ -15,7 +14,7 @@
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
Expand Down Expand Up @@ -88,9 +87,6 @@
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'

# ID to add for error notification helper.
# config.error_notification_id = nil

# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]

Expand Down Expand Up @@ -133,9 +129,6 @@
# change this configuration to true.
config.browser_validations = false

# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename, :attached? ]

# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
Expand Down

0 comments on commit 61c8ef5

Please sign in to comment.