Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix content blocks #2423

Merged
merged 5 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 12 additions & 50 deletions app/views/hyrax/content_blocks/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%# Copied from Hyrax v5.0.0rc2 to add home_text content block form - Adding themes %>
<%# imported from hyrax 3.0.0.pre.rc1 %>
<%# OVERRIDE Hyrax v5.0.1 to add content blocks for:
- Home Page Text for theme
- Home "About" page content %>
<%= render "shared/nav_safety_modal" %>
<div class="card tabs">
<ul class="nav nav-tabs" role="tablist">
Expand All @@ -14,7 +15,7 @@
</a>
</li>
<li id="home-text-nav-item" class="nav-item">
<a href="#home_text" role="tab" data-toggle="tab" class="nav-safety-confirm">
<a href="#home_text" role="tab" data-toggle="tab" class="nav-link nav-safety-confirm">
<%= t(:'hyrax.content_blocks.tabs.home_text') %>
</a>
</li>
Expand All @@ -24,22 +25,16 @@
</a>
</li>
<li id="homepage-about-heading-nav-item" class="nav-item">
<a href="#homepage_about_section_heading" role="tab" data-toggle="tab" class="nav-safety-confirm">
<a href="#homepage_about_section_heading" role="tab" data-toggle="tab" class="nav-link nav-safety-confirm">
<%= t(:'hyrax.content_blocks.tabs.homepage_about_section_heading') %>
</a>
</li>
<li id="homepage-about-content-nav-item" class="nav-item">
<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>
<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>
<a href="#homepage_about_section_content" role="tab" data-toggle="tab" class="nav-link 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 show active">
<div class="card labels">
Expand All @@ -59,6 +54,7 @@
<% end %>
</div>
</div>

<div id="marketing" class="tab-pane">
<div class="card labels">
<%= simple_form_for ContentBlock.for(:marketing), url: hyrax.content_block_path(ContentBlock.for(:marketing)), html: {class: 'nav-safety'} do |f| %>
Expand All @@ -77,7 +73,8 @@
<% end %>
</div>
</div>
<%# Copied from Hyrax v2.9.0 to add home_text content block form - Adding themes %>

<%# OVERRIDE to add home text block %>
<div id="home_text" class="tab-pane">
<div class="card labels">
<%= simple_form_for ContentBlock.for(:home_text), url: hyrax.content_block_path(ContentBlock.for(:home_text)), html: {class: 'nav-safety'} do |f| %>
Expand Down Expand Up @@ -114,6 +111,7 @@
<% end %>
</div>
</div>
<%# OVERRIDE: add about section content blocks %>
<div id="homepage_about_section_heading" class="tab-pane">
<div class="card 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| %>
Expand Down Expand Up @@ -150,42 +148,6 @@
<% end %>
</div>
</div>
<div id="homepage_about_section_heading" class="tab-pane">
<div class="card card-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="card-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="card-footer">
<%= link_to t(:'hyrax.content_blocks.cancel'), hyrax.admin_admin_sets_path, class: 'btn btn-secondary 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="card card-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="card-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="card-footer">
<%= link_to t(:'hyrax.content_blocks.cancel'), hyrax.admin_admin_sets_path, class: 'btn btn-secondary pull-right' %>
<%= f.button :submit, class: 'btn btn-primary pull-right' %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<%= tinymce :content_block %>
5 changes: 4 additions & 1 deletion app/views/shared/_appearance_styles.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body.public-facing footer.navbar {
body.public-facing footer.navbar .navbar-link { color: <%= appearance.footer_link_color %>; }
body.public-facing footer.navbar .navbar-link:hover { color: <%= appearance.footer_link_hover_color %>; }
body.public-facing footer.navbar .navbar-text,
body.public-facing .navbar.navbar-expand-lg .navbar-nav a {
body.public-facing .navbar-dark .navbar-nav .nav-link {
color: <%= appearance.header_and_footer_text_color %> !important;
}
body.public-facing .navbar.navbar-expand-lg { border-color: <%= appearance.header_background_border_color %> !important; }
Expand Down Expand Up @@ -205,6 +205,9 @@ body.public-facing .card-header > .btn.w-100 {
color: <%= appearance.facet_panel_text_color %>;
background-color: <%= appearance.facet_panel_background_color %> !important;
}
body.public-facing .card {
border-color: <%= appearance.facet_panel_border_color %> !important;
}
body.public-facing .card-body > .facet-limit-active {
color: <%= appearance.facet_panel_text_color %> !important;
background-color: <%= appearance.facet_panel_background_color %>;
Expand Down
4 changes: 4 additions & 0 deletions config/locales/hyrax.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,15 @@ en:
featured_researcher: Featured Researcher
home_text: Home Page Text
marketing_text: Marketing Text
homepage_about_section_heading: About Section Heading
homepage_about_section_content: About Section Content
instructions:
announcement_instructions: Announcement Text displays on the homepage. It is for important or timely messages to be made prominently visible to all home page visitors. It would be appropriate to enter an announcement here, for example, to notify users about an upcoming planned maintenance outage of the system.
featured_researcher_instructions: Featured Researcher is a space to enter information and on the home page reserved for highlighting repository users.
home_text_instructions: Home Page Text refers to the custom messaging that is displayed on the home page either in the hero block or another section of the home page. This text appears when selecting a theme that either requires or allows home page text. We recommend no more than 3 sentences in this area.
marketing_instructions: Banner Text refers to the text that is displayed over banner image on the homepage. We recommend no more than approximately 30 characters or spaces in this text area.
homepage_about_section_heading_instructions: This heading is not used by any of the default Hyku themes. It may be used for custom themes.
homepage_about_section_content_instructions: This content is not used by any of the default Hyku themes. It may be used for custom themes.
updated: Content blocks updated.
controls:
about: About
Expand Down
2 changes: 1 addition & 1 deletion spec/views/hyrax/content_blocks/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
end

it "renders the instruction blocks" do
expect(rendered).to have_xpath('//p[@class="content-block-instructions" ]', count: 8)
expect(rendered).to have_xpath('//p[@class="content-block-instructions" ]', count: 6)
end

# TODO: These next 4 tests are tightly coupled with the implimentation,
Expand Down
Loading