Skip to content

Commit

Permalink
Render catalog#edit using document components.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Sep 21, 2024
1 parent 0419ca6 commit 42b2d9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
12 changes: 0 additions & 12 deletions app/assets/stylesheets/spotlight/_catalog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ form.edit_solr_document {
@extend .col-md-6;
}

.edit_solr_document {
float: right;
@extend .col-md-6;
border-bottom: 1px solid #ccc;
margin-bottom: 1em;
padding-bottom: 1em;
}

.tags, .dl-horizontal {
@extend .col-md-6;
}
Expand All @@ -114,10 +106,6 @@ form.edit_solr_document {
}
}

.edit_solr_document {
@extend .clearfix;
}

#sortAndPerPage {
align-items: flex-end;
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/spotlight/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CatalogController < ::CatalogController
end

before_action only: :edit do
blacklight_config.view.edit(partials: blacklight_config.view_config(:show).partials.dup.insert(2, :edit)) unless blacklight_config.view.key? :edit
blacklight_config.action_mapping.edit.top_level_config = :show
end

def show
Expand Down
12 changes: 10 additions & 2 deletions app/views/spotlight/catalog/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<div id="document" class="document <%= render_document_class %>" itemscope itemtype="<%= @document.itemtype %>">
<%= render_document_partials @document, blacklight_config.view_config(:edit).partials %>
<div class="container">
<div class="row">
<%- view_config = blacklight_config.view_config(action_name: :edit) %>
<%= render view_config.document_component.new(presenter: document_presenter(@document), classes: ['col-md-8'], component: :div, show: true, partials: view_config.partials) do |component| %>
<% component.with_title(as: 'h1', classes: '', link_to_document: false, actions: false) %>
<% end %>
<div class="col-md-4">
<%= render 'edit_default', document: @document %>
</div>
</div>
</div>

0 comments on commit 42b2d9b

Please sign in to comment.