Skip to content

Commit

Permalink
Merge branch 'content_block_updates' into adventist_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Sep 21, 2023
2 parents 1a548cf + 29873b1 commit ad05a98
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 175 deletions.
44 changes: 0 additions & 44 deletions app/controllers/hyrax/content_blocks_controller.rb

This file was deleted.

18 changes: 18 additions & 0 deletions app/controllers/hyrax/content_blocks_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.0 to add home_text to permitted_params - Adding themes
module Hyrax
module ContentBlocksControllerDecorator
# override hyrax v2.9.0 added the home_text content block to permitted_params - Adding Themes
def permitted_params
params.require(:content_block).permit(:marketing,
:announcement,
:home_text,
:homepage_about_section_heading,
:homepage_about_section_content,
:researcher)
end
end
end

Hyrax::ContentBlocksController.prepend Hyrax::ContentBlocksControllerDecorator
131 changes: 0 additions & 131 deletions app/controllers/hyrax/homepage_controller.rb

This file was deleted.

20 changes: 20 additions & 0 deletions app/controllers/hyrax/homepage_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# OVERRIDE Hyrax 3.5 to add content blocks
module Hyrax
module HomepageControllerDecorator

def index
@presenter = presenter_class.new(current_ability, collections)
@featured_researcher = ContentBlock.for(:researcher)
@marketing_text = ContentBlock.for(:marketing)
@featured_work_list = FeaturedWorkList.new
@announcement_text = ContentBlock.for(:announcement)
@homepage_about_section_heading = ContentBlock.for(:homepage_about_section_heading)
@homepage_about_section_content = ContentBlock.for(:homepage_about_section_content)
recent
end
end
end

Hyrax::HomepageController.prepend Hyrax::HomepageControllerDecorator
42 changes: 42 additions & 0 deletions app/views/hyrax/content_blocks/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<li>
<a href="#researcher" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t(:'hyrax.content_blocks.tabs.featured_researcher') %></a>
</li>
<li>
<a href="#homepage_about_section_heading" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t(:'hyrax.content_blocks.tabs.homepage_about_section_heading') %></a>
</li>
<li>
<a href="#homepage_about_section_content" role="tab" data-toggle="tab" class="nav-safety-confirm"><%= t(:'hyrax.content_blocks.tabs.homepage_about_section_content') %></a>
</li>
</ul>
<div class="tab-content">
<div id="announcement_text" class="tab-pane active">
Expand Down Expand Up @@ -90,6 +96,42 @@
<% end %>
</div>
</div>
<div id="homepage_about_section_heading" class="tab-pane">
<div class="panel panel-default labels">
<%= simple_form_for ContentBlock.for(:homepage_about_section_heading), url: hyrax.content_block_path(ContentBlock.for(:homepage_about_section_heading)), html: {class: 'nav-safety'} do |f| %>
<div class="panel-body">
<div class="field form-group">
<%= f.label :homepage_about_section_heading %><br />
<%# the following line was changed from hyrax to give some context for what this context block does %>
<p class="content-block-instructions"><%= t(:'hyrax.content_blocks.instructions.homepage_about_section_heading_instructions') %></p>
<%= f.text_area :homepage_about_section_heading, value: f.object.value, class: 'form-control tinymce', rows: 20, cols: 120 %>
</div>
</div>
<div class="panel-footer">
<%= link_to t(:'hyrax.content_blocks.cancel'), hyrax.admin_admin_sets_path, class: 'btn btn-default pull-right' %>
<%= f.button :submit, class: 'btn btn-primary pull-right' %>
</div>
<% end %>
</div>
</div>
<div id="homepage_about_section_content" class="tab-pane">
<div class="panel panel-default labels">
<%= simple_form_for ContentBlock.for(:homepage_about_section_content), url: hyrax.content_block_path(ContentBlock.for(:homepage_about_section_content)), html: {class: 'nav-safety'} do |f| %>
<div class="panel-body">
<div class="field form-group">
<%= f.label :homepage_about_section_content %><br />
<%# the following line was changed from hyrax to give some context for what this context block does %>
<p class="content-block-instructions"><%= t(:'hyrax.content_blocks.instructions.homepage_about_section_content_instructions') %></p>
<%= f.text_area :homepage_about_section_content, value: f.object.value, class: 'form-control tinymce', rows: 20, cols: 120 %>
</div>
</div>
<div class="panel-footer">
<%= link_to t(:'hyrax.content_blocks.cancel'), hyrax.admin_admin_sets_path, class: 'btn btn-default pull-right' %>
<%= f.button :submit, class: 'btn btn-primary pull-right' %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<%= tinymce :content_block %>

0 comments on commit ad05a98

Please sign in to comment.