Skip to content

Commit

Permalink
Sync views with Hyrax/Hyku (#801)
Browse files Browse the repository at this point in the history
# Story

To make future upgrades easier, this work attempts to remove unnecessary
views, and document the purpose of the overrides for views which are
needed.

Refs #798

# Expected Behavior Before Changes

# Expected Behavior After Changes

No behavior changes are expected.

# Screenshots / Video

<details>
<summary></summary>

</details>

# Notes
  • Loading branch information
laritakr authored Sep 13, 2024
2 parents 1af1a53 + 078c5d6 commit 1dee930
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 175 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/build-test-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Build Test Lint'
name: "Build Test Lint"
run-name: Build Test Lint of ${{ github.ref_name }} by @${{ github.actor }}
on:
push:
Expand All @@ -9,31 +9,35 @@ on:
- main
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
debug_step:
required: false
default: false
description: 'Pause the selected step to debug using tmate'
type: choice
default: ''
options:
- ''
- build
- test
- lint

jobs:
build:
uses: scientist-softserv/actions/.github/workflows/build.yaml@webworkersunited
uses: scientist-softserv/actions/.github/workflows/build.yaml@v0.0.23
secrets: inherit
with:
platforms: 'linux/amd64'
webTarget: hyku-web
platforms: "linux/amd64"
webTarget: hyku-base
workerTarget: hyku-worker

test:
needs: build
uses: scientist-softserv/actions/.github/workflows/test.yaml@webworkersunited
uses: scientist-softserv/actions/.github/workflows/test.yaml@v0.0.23
with:
confdir: '/app/samvera/hyrax-webapp/solr/conf'
rspec_cmd: "cd .. && gem install semaphore_test_boosters && bundle && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"

lint:
needs: build
uses: scientist-softserv/actions/.github/workflows/lint.yaml@webworkersunited
uses: scientist-softserv/actions/.github/workflows/lint.yaml@v0.0.23
with:
webTarget: hyku-web
workerTarget: hyku-worker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ on:

jobs:
deploy:
uses: scientist-softserv/actions/.github/workflows/[email protected].15
uses: scientist-softserv/actions/.github/workflows/[email protected].23
secrets: inherit
9 changes: 0 additions & 9 deletions app/helpers/dog_biscuits_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,4 @@ def truncate_text_and_iconify_link(value)
def truncate_text(text)
text.truncate_words(50, omission: ' ...')
end

def restricted?(term)
return false if DogBiscuits.config.restricted_properties_enabled == false
# evaluate restriction
(
DogBiscuits.config.restricted_properties.include?(term) &&
current_user.send("#{DogBiscuits.config.restricted_role}?") == true
) || !DogBiscuits.config.restricted_properties.include?(term)
end
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%# OVERRIDE Hyku v6.0 to override default colors %>

<%= simple_form_for @form, url: admin_appearance_path do |f| %>
<div class="card-body defaultable-colors">
<% @form.class::DEFAULT_COLORS.each do |color_name, hex| %>
Expand Down
23 changes: 0 additions & 23 deletions app/views/hyrax/base/_form_metadata.html.erb

This file was deleted.

6 changes: 4 additions & 2 deletions app/views/hyrax/base/_metadata.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<%# OVERRIDE Hyrax 2.9.5 to add css classes %>
<%# OVERRIDE Hyrax 5 css classes %>

<dl class="work-show metadata-block <%= dom_class(presenter) %>" <%= presenter.microdata_type_to_html %>>
<%= render 'attribute_rows', presenter: presenter %>
</dl>
<%= presenter.attribute_to_html(:embargo_release_date, render_as: :date, html_dl: true) %>
<%= presenter.attribute_to_html(:lease_expiration_date, render_as: :date, html_dl: true) %>
</dl>
7 changes: 0 additions & 7 deletions app/views/hyrax/base/_pdf_js.html.erb

This file was deleted.

17 changes: 9 additions & 8 deletions app/views/hyrax/base/_representative_media.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<%# OVERRIDE IiifPrint to add bootstrap classes %>
<%# OVERRIDE Hyku 6.0 to add bootstrap classes %>

<% if presenter.video_embed_viewer? %>
<div class="center-block">
<%= video_embed_viewer_display presenter %>
</div>
<% elsif presenter.iiif_viewer? %>
<% if defined?(viewer) && viewer %>
<% if presenter.representative_id.present? && presenter.representative_presenter.present? %>
<% if defined?(viewer) && viewer && presenter.iiif_viewer?%>
<div class="center-block">
<%= iiif_viewer_display presenter %>
</div>
<% elsif Flipflop.default_pdf_viewer? && presenter.show_pdf_viewer? && presenter.file_set_presenters.any?(&:pdf?) %>
<div class="center-block">
<%= render 'pdf_js', file_set_presenter: presenter.file_set_presenters.first %>
</div>
<% else %>
<div class="center-block">
<%= render media_display_partial(presenter.representative_presenter), file_set: presenter.representative_presenter %>
</div>
<% end %>
<% else %>
<%= image_tag 'default.png', class: "canonical-image center-block", alt: 'default representative image' %>
<% alt = block_for(name: 'default_work_image_text') || 'Default work thumbnail' %>
<%= image_tag default_work_image, class: "canonical-image center-block", alt: alt %>
<% end %>
75 changes: 40 additions & 35 deletions app/views/hyrax/base/_show_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
<%# OVERRIDE Hyrax 2.9.1 and 2 parts from the main branch as of 7/14/2021 . There was a bug for 2.9.1-2.9.5 that caused the feature/unfeature buttons to show up on the work-show page for editors when they should not. This has since been fixed in hyrax but this override fixes it for ADL. %>

<%# OVERRIDE Hyku 6.0 to customize layout %>
<div class="show-actions">
<% if !workflow_restriction?(presenter) %>
<% if presenter.show_deposit_for?(collections: @user_collections) %>
<input type="checkbox" aria-label="Batch Documents" style="display:none" name="batch_document_ids[]" id="batch_document_<%= presenter.id %>" value="<%= presenter.id %>" class="batch_document_selector" checked="checked" />
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
class: 'btn btn-default submits-batches submits-batches-add',
data: { toggle: "modal", target: "#collection-list-container" } %>
<% end %>
<% if presenter.work_featurable? %>
<%= link_to t('.feature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'feature' },
class: presenter.display_feature_link? ? 'btn btn-default' : 'btn btn-default collapse' %>

<%= link_to t('.unfeature'), hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'unfeature' },
class: presenter.display_unfeature_link? ? 'btn btn-default' : 'btn btn-default collapse' %>
<% end %>
<% end %>
<% if Hyrax.config.analytics? %>
<%= link_to "Analytics", presenter.stats_path, id: 'stats', class: 'btn btn-default' %>
<% # turbolinks needs to be turned off or the page will use the cache and the %>
<% # analytics graph will not show unless the page is refreshed. %>
<%= link_to t('.analytics'), presenter.stats_path, id: 'stats', class: 'btn btn-default', data: { turbolinks: false } %>
<% end %>
<% if presenter.editor? %>
<%= link_to "Edit", edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default' %>
<%= link_to "Delete", [main_app, presenter], class: 'btn btn-danger', data: { confirm: "Delete this #{presenter.human_readable_type}?" }, method: :delete %>
<% if presenter.member_presenters.size > 1 %>
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-default' %>
<% end %>
<%# OVERRIDE lines 14-26 from hyrax main branch 7/14/2021 %>
<% if presenter.valid_child_concerns.length > 0 %>
<% if presenter.editor? && !workflow_restriction?(presenter) %>
<%= link_to t('.edit'), edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default', data: { turbolinks: block_valkyrie_redirect? } %>
<% if presenter.member_count > 1 %>
<%= link_to t("hyrax.file_manager.link_text"), polymorphic_path([main_app, :file_manager, presenter]), class: 'btn btn-default' %>
<% end %>
<% if presenter.valid_child_concerns.length > 0 %>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" type="button" id="dropdown-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= t('.attach_child') %> <span class="caret"></span></button>
<ul class="dropdown-menu">
<% presenter.valid_child_concerns.each do |concern| %>
<li>
<%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular.to_sym], parent_id: presenter.id) %>
</li>
<% end %>
</ul>
<%= t('.attach_child') %>
</button>
<div class="dropdown-menu">
<% presenter.valid_child_concerns.each do |concern| %>
<%= link_to "Attach #{concern.human_readable_type}", polymorphic_path([main_app, :new, :hyrax, :parent, concern.model_name.singular.to_sym], parent_id: presenter.id), class: "dropdown-item" %>
<% end %>
</div>
</div>
<% end %>
<% end %>
<% if presenter.show_deposit_for?(collections: @user_collections) %>
<input type="checkbox" style="display:none" name="batch_document_ids[]" id="batch_document_<%= presenter.id %>" value="<%= presenter.id %>" class="batch_document_selector" checked="checked" />
<%= button_tag t('hyrax.dashboard.my.action.add_to_collection'),
class: 'btn btn-default submits-batches submits-batches-add',
data: { toggle: "modal", target: "#collection-list-container" } %>
<% end %>
<% if presenter.work_featurable? %>
<%# OVERRIDE lines 38 & 41 from hyrax main branch 7/14/2021 %>
<%= link_to "Feature", hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'feature' },
class: presenter.display_feature_link? ? 'btn btn-default' : 'btn btn-default collapse' %>
<%= link_to "Unfeature", hyrax.featured_work_path(presenter, format: :json),
data: { behavior: 'unfeature' },
class: presenter.display_unfeature_link? ? 'btn btn-default' : 'btn btn-default collapse' %>
<%# OVERRIDE to validate delete permission %>
<% if current_ability.can?(:delete, presenter.solr_document) %>
<%= link_to t('.delete'), [main_app, presenter], class: 'btn btn-danger', data: { confirm: t('.confirm_delete', work_type: presenter.human_readable_type) }, method: :delete %>
<% end %>
<% end %>
</div>
<!-- COinS hook for Zotero -->
<span class="Z3988" title="<%= export_as_openurl_ctx_kev(presenter) %>"></span>
<!-- Render Modals -->
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>
<%= render 'hyrax/dashboard/collections/form_for_select_collection', user_collections: @user_collections %>
2 changes: 2 additions & 0 deletions app/views/hyrax/base/_video_embed_viewer.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<%# Override Hyrax 6.0 to modify class %>

<div class="viewer-wrapper">
<iframe class='video-embed-viewer' src="<%="#{@presenter.solr_document[:video_embed_tesim].first}"%>" title="Video Player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
71 changes: 10 additions & 61 deletions app/views/hyrax/collections/_sort_and_per_page.html.erb
Original file line number Diff line number Diff line change
@@ -1,70 +1,19 @@
<%# OVERRIDE Hyrax 2.9.5 %>
<%# OVERRIDE Hyrax 5 to apply styling to pagination above public show collection works list %>

<% if show_sort_and_per_page? && active_sort_fields.many? %>
<% if show_sort_and_per_page? && collection_member_sort_fields.many? %>
<%= form_tag collection_path(collection), method: :get, class: 'per_page form-horizontal' do %>
<%= render 'view_type_group' %>
<fieldset class="pull-left">
<fieldset class="float-left">
<legend class="sr-only"><%= t('hyrax.sort_label') %></legend>
<%= label_tag(:sort) do %>
<span>Sort By:</span>
<% end %>
<%# OVERRIDE here to change the select dropdown to a bootstrap btn group to style them%>
<div class="btn-group">
<button id="sort-dropdown-text" type="button" class="btn dropdown-btn">
<% if h(params[:sort]).present? && active_sort_fields[h(params[:sort])].present? %>
<%= active_sort_fields[h(params[:sort])].label %>
<% else %>
<%= active_sort_fields.first.last&.label %>
<% end %>
</button>
<button type="button" class="btn dropdown-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<% active_sort_fields.each do |f| %>
<li class="dropdown-item sort-dropdown-item" data-value="<%= f.first %>"><%= f.last.label %></li>
<% end %>
</ul>
<% initial_sort_value = h(params[:sort]).present? ? h(params[:sort]) : active_sort_fields.keys.first %>
<%= hidden_field_tag(:sort, initial_sort_value) %>
</div>
<%= label_tag(:sort, t('.sort_by_html')) %>

<%= select_tag(:sort, options_from_collection_for_select(collection_member_sort_fields, 'first', lambda {|field| field.last.label}, h(params[:sort])), class: "btn-group btn dropdown-btn dropdown-toggle") %>
<%= label_tag(:per_page) do %>
<span class="tiny-nudge">Results Per Page:</span>
<span class="tiny-nudge"><%= t('.results_per_page') %></span>
<%= select_tag(:per_page, options_for_select(Hyrax.config.range_for_number_of_results_to_display_per_page, h(params[:per_page])), title: t('.number_of_results_to_display_per_page'), class: "btn-group btn dropdown-btn dropdown-toggle") %>
<% end %>
<% initial_per_page_value = h(params[:per_page]).present? ? h(params[:per_page]) : '10' %>
<div class="btn-group tiny-nudge">
<button id="per-page-dropdown-text" type="button" class="btn dropdown-btn"><%= initial_per_page_value %></button>
<button type="button" class="btn dropdown-btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Results Per Page</span>
</button>
<ul class="dropdown-menu">
<li class="dropdown-item per-page-dropdown-item" data-value="10">10</li>
<li class="dropdown-item per-page-dropdown-item" data-value="20">20</li>
<li class="dropdown-item per-page-dropdown-item" data-value="50">50</li>
<li class="dropdown-item per-page-dropdown-item" data-value="100">100</li>
</ul>
<%= hidden_field_tag(:per_page, initial_per_page_value) %>
</div>
<%= render_hash_as_hidden_fields(search_state.params_for_search.except(:per_page, :sort)) %>
&nbsp;<button class="btn btn-default tiny-nudge"><span class="glyphicon glyphicon-refresh"></span>Refresh</button>
<%= render Blacklight::HiddenSearchStateComponent.new(params: search_state.params_for_search.except(:per_page, :sort)) %>
&nbsp;<button class="btn btn-default tiny-nudge"><span class="fa fa-refresh"></span> <%= t('helpers.action.refresh') %></button>
</fieldset>
<% end %>
<% end %>



<script>
$('.sort-dropdown-item').on('click', function(e) {
e.preventDefault();
$('#sort').val(e.target.dataset.value);
$('#sort-dropdown-text').html(e.target.innerText);
});

$('.per-page-dropdown-item').on('click', function(e) {
e.preventDefault();
$('#per_page').val(e.target.dataset.value);
$('#per-page-dropdown-text').html(e.target.innerText);
});
</script>
8 changes: 0 additions & 8 deletions app/views/records/edit_fields/_default.html.erb

This file was deleted.

5 changes: 0 additions & 5 deletions app/views/records/edit_fields/_note.html.erb

This file was deleted.

21 changes: 17 additions & 4 deletions app/views/records/edit_fields/_part_of.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<%# override default.html.erb for JournalArticle only %>
<% if f.object.class.to_s.include? 'JournalArticle' %>
<%= f.input key,
as: :multi_value,
Expand All @@ -9,9 +10,21 @@
required: f.object.required?(key)
%>
<% else %>
<%# This is Hyrax's default.html.erb %>
<% return if f.object.try(:hidden?, key) %>

<% record = f.object.model %>
<% if f.object.multiple? key %>
<%= f.input key, as: :multi_value, input_html: { class: 'form-control' }, required: f.object.required?(key) %>
<% else %>
<%= f.input key, required: f.object.required?(key) %>
<%= f.input key,
as: :multi_value,
label: label_for(term: key, record_class: record.class),
hint: hint_for(term: key, record_class: record.class),
input_html: { class: 'form-control' },
required: f.object.required?(key) %>
<% else %>
<%= f.input key,
label: label_for(term: key, record_class: record.class),
hint: hint_for(term: key, record_class: record.class),
required: f.object.required?(key) %>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion ops/staging-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ingress:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-body-size: "0"
cert-manager.io/cluster-issuer: "letsencrypt-production-dns"
cert-manager.io/cluster-issuer: wildcard-issuer
tls:
- hosts:
- '*.s2.adventistdigitallibrary.org'
Expand Down

0 comments on commit 1dee930

Please sign in to comment.