diff --git a/app/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb b/app/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb
new file mode 100644
index 0000000000..597887680e
--- /dev/null
+++ b/app/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb
@@ -0,0 +1,2 @@
+<%= f.input :title, :input_html => { :disabled => true } %>
+<%= f.input :description, as: :text %>
diff --git a/app/views/hyrax/admin/collection_types/index.html.erb b/app/views/hyrax/admin/collection_types/index.html.erb
index 849089fbe5..aa6efee474 100644
--- a/app/views/hyrax/admin/collection_types/index.html.erb
+++ b/app/views/hyrax/admin/collection_types/index.html.erb
@@ -34,7 +34,7 @@
<%= collection_type.title %> |
- <%= link_to hyrax.edit_admin_collection_type_path(collection_type), class: 'btn btn-primary btn-sm' do %>
+ <%= link_to hyrax.edit_admin_collection_type_path(collection_type), class: 'btn btn-primary btn-sm', data: { turbolinks: false } do %>
<%= t('helpers.action.edit') %>
<% end %>
<% unless collection_type.admin_set? || collection_type.user_collection? %>
diff --git a/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb b/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb
index f965e83f1c..c999c7fe99 100644
--- a/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb
+++ b/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb
@@ -1,9 +1,11 @@
RSpec.describe 'hyrax/admin/collection_types/_form.html.erb', type: :view do
let(:collection_type) { build(:collection_type) }
+ # let(:collection_type) { build(:collection_type, machine_id: "type_does_not_matter") }
let(:form) { Hyrax::Forms::Admin::CollectionTypeForm.new(collection_type: collection_type) }
before do
assign(:form, form)
+ assign(:collection_type, collection_type)
end
it "has 3 tabs" do
diff --git a/spec/views/hyrax/admin/collection_types/_form_metadata.html.erb_spec.rb b/spec/views/hyrax/admin/collection_types/_form_metadata.html.erb_spec.rb
index 72d05a3daf..17e124791a 100644
--- a/spec/views/hyrax/admin/collection_types/_form_metadata.html.erb_spec.rb
+++ b/spec/views/hyrax/admin/collection_types/_form_metadata.html.erb_spec.rb
@@ -1,5 +1,5 @@
RSpec.describe 'hyrax/admin/collection_types/_form_metadata.html.erb', type: :view do
- let(:collection_type) { Hyrax::CollectionType.new }
+ let(:collection_type) { create(:collection_type) }
let(:collection_type_form) { Hyrax::Forms::Admin::CollectionTypeForm.new }
let(:form) do
@@ -17,6 +17,7 @@
it "renders the name field" do
expect(rendered).to have_content(I18n.t("simple_form.labels.collection_type.title"))
expect(rendered).to have_selector("input#collection_type_title")
+ expect(rendered).not_to have_css("#collection_type_title[disabled]")
end
it "renders the description field" do
diff --git a/spec/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb_spec.rb b/spec/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb_spec.rb
new file mode 100644
index 0000000000..7bc1c9920f
--- /dev/null
+++ b/spec/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb_spec.rb
@@ -0,0 +1,27 @@
+RSpec.describe 'hyrax/admin/collection_types/_form_metadata_admin_set.html.erb', type: :view do
+ let(:collection_type) { create(:admin_set_collection_type) }
+ let(:collection_type_form) { Hyrax::Forms::Admin::CollectionTypeForm.new }
+
+ let(:form) do
+ view.simple_form_for(collection_type, url: '/update') do |fs_form|
+ return fs_form
+ end
+ end
+
+ before do
+ assign(:form, collection_type_form)
+ allow(view).to receive(:f).and_return(form)
+ render
+ end
+
+ it "renders the name field as readonly" do
+ expect(rendered).to have_content(I18n.t("simple_form.labels.collection_type.title"))
+ expect(rendered).to have_selector("input#collection_type_title")
+ expect(rendered).to have_css("#collection_type_title[disabled]")
+ end
+
+ it "renders the description field" do
+ expect(rendered).to have_content(I18n.t("simple_form.labels.collection_type.description"))
+ expect(rendered).to have_selector("textarea#collection_type_description")
+ end
+end
|