Skip to content

Commit

Permalink
Merge branch 'main' into corrects_created_at_predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf authored Aug 5, 2024
2 parents 9c58751 + 4b74958 commit 9c3be46
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
5 changes: 2 additions & 3 deletions app/assets/javascripts/hyrax/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

this.init = function() {
this.$label = this.$element.find('[data-search-element="label"]');
this.$visibleLabel = this.$element.find('.dropdown-toggle').find('span[aria-hidden="true"]');
this.$items = this.$element.find('[data-search-option]');
this.setDefault();
}
Expand All @@ -12,7 +13,6 @@
this.attachEvents();
}


Hyrax.Search.prototype = {
attachEvents: function() {

Expand Down Expand Up @@ -43,6 +43,7 @@

setLabel: function(label) {
this.$label.html(label);
this.$visibleLabel.html(label);
}

}
Expand All @@ -58,8 +59,6 @@

})(jQuery);


Blacklight.onLoad(function() {
$('#search-form-header').search();
});

4 changes: 2 additions & 2 deletions app/services/hyrax/analytics/matomo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def results_array(response, metric)
if result[1].empty?
results.push([result[0].to_date, 0])
elsif result[1].is_a?(Array)
results.push([result[0].to_date, result[1].first[metric]])
results.push([result[0].to_date, result[1].first[metric].to_i])
else
results.push([result[0].to_date, result[1][metric].presence || 0])
results.push([result[0].to_date, result[1][metric].presence.to_i])
end
end
Hyrax::Analytics::Results.new(results)
Expand Down
4 changes: 2 additions & 2 deletions app/services/hyrax/custom_queries/find_file_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_file_metadata_by(id:)
result = query_service.find_by(id: id)
unless result.is_a? Hyrax::FileMetadata
raise ::Valkyrie::Persistence::ObjectNotFoundError,
"Result type #{result.internal_resource} for id #{id} is not a `Hyrax::FileMetadata`"
"Result type #{result&.internal_resource} for id #{id} is not a `Hyrax::FileMetadata`"
end
result
end
Expand All @@ -44,7 +44,7 @@ def find_file_metadata_by_alternate_identifier(alternate_identifier:)
result = query_service.find_by_alternate_identifier(alternate_identifier: alternate_identifier)
unless result.is_a? Hyrax::FileMetadata
raise ::Valkyrie::Persistence::ObjectNotFoundError,
"Result type #{result.internal_resource} for alternate_identifier #{alternate_identifier} is not a `Hyrax::FileMetadata`"
"Result type #{result&.internal_resource} for alternate_identifier #{alternate_identifier} is not a `Hyrax::FileMetadata`"
end
result
end
Expand Down
25 changes: 9 additions & 16 deletions app/views/catalog/_search_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,17 @@
<span class="sr-only" data-search-element="label"><%= t("hyrax.search.form.option.all.label_long", application_name: application_name) %></span>
<span aria-hidden="true"><%= t("hyrax.search.form.option.all.label_short") %></span>
</button>

<ul class="dropdown-menu dropdown-menu-right">
<li class="dropdown-item">
<%= link_to t("hyrax.search.form.option.all.label_long", application_name: application_name), "#",
data: { "search-option" => main_app.search_catalog_path, "search-label" => t("hyrax.search.form.option.all.label_short") } %>
</li>
<li class="dropdown-item">
<%= link_to t("hyrax.search.form.option.my_works.label_long"), "#",
data: { "search-option" => hyrax.my_works_path, "search-label" => t("hyrax.search.form.option.my_works.label_short") } %>
</li>
<li class="dropdown-item">
<%= link_to t("hyrax.search.form.option.my_collections.label_long"), "#",
data: { "search-option" => hyrax.my_collections_path, "search-label" => t("hyrax.search.form.option.my_collections.label_short") } %>
</li>
</ul>
<div class="dropdown-menu dropdown-menu-right">
<%= link_to t("hyrax.search.form.option.all.label_long", application_name: application_name), "#", class: "dropdown-item",
data: { "search-option" => main_app.search_catalog_path, "search-label" => t("hyrax.search.form.option.all.label_short") } %>
<%= link_to t("hyrax.search.form.option.my_works.label_long"), "#", class: "dropdown-item",
data: { "search-option" => hyrax.my_works_path, "search-label" => t("hyrax.search.form.option.my_works.label_short") } %>
<%= link_to t("hyrax.search.form.option.my_collections.label_long"), "#", class: "dropdown-item",
data: { "search-option" => hyrax.my_collections_path, "search-label" => t("hyrax.search.form.option.my_collections.label_short") } %>
</div>
<% end %>
</div><!-- /.input-group-btn -->
</div><!-- /.input-group -->

</div><!-- /.form-group -->
<% end %>

0 comments on commit 9c3be46

Please sign in to comment.