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

move tools to header #1229

Merged
merged 2 commits into from
Aug 28, 2024
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
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ group :production do
gem 'pg'
end

gem 'blacklight', '~> 8.3'
#gem 'blacklight', '~> 8.3'
gem 'blacklight', github: 'projectblacklight/blacklight', branch: 'main'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After release

  1. remove line 65, comment back in 64
  2. In app/assets/stylesheets/geoblacklight.scss change @import 'blacklight/blacklight'; to @import 'blacklight-frontend/app/assets/stylesheets/blacklight/blacklight';
  3. remove bin/build-css
  4. update package.json scripts to "build:css": "sass ./app/assets/stylesheets/geoblacklight.scss:./app/assets/builds/geoblacklight.css --load-path=node_modules"

gem 'rsolr' # required for Blacklight
gem 'geoblacklight', github: 'geoblacklight/geoblacklight', branch: 'main'
gem 'faraday', '~> 2.0'
Expand Down
24 changes: 15 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ GIT
vite_rails (~> 3.0)
zeitwerk

GIT
remote: https://github.com/projectblacklight/blacklight.git
revision: 918d8cbb7f97e14c166a6818cb4a9388b4f66668
branch: main
specs:
blacklight (8.3.0)
globalid
i18n (>= 1.7.0)
jbuilder (~> 2.7)
kaminari (>= 0.15)
ostruct (>= 0.3.2)
rails (>= 6.1, < 8)
view_component (>= 2.66, < 4)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -103,14 +117,6 @@ GEM
bcrypt_pbkdf (1.1.1-x86_64-darwin)
bigdecimal (3.1.8)
bindex (0.8.1)
blacklight (8.3.0)
globalid
i18n (>= 1.7.0)
jbuilder (~> 2.7)
kaminari (>= 0.15)
ostruct (>= 0.3.2)
rails (>= 6.1, < 8)
view_component (>= 2.66, < 4)
blacklight_dynamic_sitemap (0.6.0)
blacklight (> 6.0)
rails
Expand Down Expand Up @@ -587,7 +593,7 @@ PLATFORMS

DEPENDENCIES
bcrypt_pbkdf (~> 1.1)
blacklight (~> 8.3)
blacklight!
blacklight_dynamic_sitemap (~> 0.3)
blacklight_range_limit (~> 7.0)
bootsnap (>= 1.1.0)
Expand Down
38 changes: 38 additions & 0 deletions app/assets/stylesheets/earthworks.css
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,42 @@ Uncomment lines 142-144
background-color: rgb(var(--stanford-palo-alto-dark-rgb));
--bs-navbar-active-color: white;
border-radius: .25rem;
}

label.toggle-bookmark {
--bs-primary: rgb(var(--bs-link-color-rgb));
color: rgb(var(--bs-link-color-rgb));
}

.header-tools .btn {
--bs-btn-border-color: none;
--bs-btn-hover-border-color: none;
--bs-btn-active-border-color: none;
}

.back-to-search::before {
content: "\f12A";
font-family: "bootstrap-icons";
margin-right: .25rem;
vertical-align: middle;
}

#citationLink, #emailLink {
background-image: none;
padding-left: 0;
--bs-btn-padding-x: .25rem;
--bs-btn-padding-y: 0;
}

#citationLink::before {
content: "\f6B0";
font-family: "bootstrap-icons";
vertical-align: middle;
}

#emailLink::before {
content: "\f32C";
font-family: "bootstrap-icons";
margin-right: .25rem;
vertical-align: middle;
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/geoblacklight.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'bootstrap/scss/bootstrap';
@import 'blacklight-frontend/app/assets/stylesheets/blacklight/blacklight';
@import 'blacklight/blacklight';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok to commit this change and the bin/build-css file? (not questioning it so much as verifying it's ok)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to remember to undo it, but I think it's OK

@import '@geoblacklight/frontend/app/assets/stylesheets/geoblacklight/geoblacklight';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="appliedParams px-0">
<%= link_back_to_catalog class: 'back-to-search' %>
</div>
6 changes: 6 additions & 0 deletions app/components/earthworks/server_applied_params_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module Earthworks
class ServerAppliedParamsComponent < Blacklight::SearchContext::ServerAppliedParamsComponent
end
end
8 changes: 8 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class CatalogController < ApplicationController
config.index.document_component = Earthworks::SearchResultComponent
config.index.title_field = Settings.FIELDS.TITLE

config.bookmark_icon_component = Blacklight::Icons::BookmarkIconComponent

config.track_search_session.applied_params_component = Earthworks::ServerAppliedParamsComponent

config.crawler_detector = ->(req) { req.env['HTTP_USER_AGENT']&.include?('bot') }

# solr field configuration for document/show views
Expand Down Expand Up @@ -326,6 +330,10 @@ class CatalogController < ApplicationController

config.show.document_actions.delete(:sms)

config.add_show_header_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
config.add_show_header_tools_partial(:citation)
config.add_show_header_tools_partial(:email, callback: :email_action, validator: :validate_email_params)

# Configuration for autocomplete suggestor
config.autocomplete_enabled = true
config.autocomplete_path = 'suggest'
Expand Down
13 changes: 13 additions & 0 deletions app/views/catalog/_show_main_content.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<% @page_title = t('blacklight.search.show.title', document_title: document_presenter(@document).html_title, application_name: application_name).html_safe %>
<% content_for(:head) { render_link_rel_alternates } %>

<% document_component = blacklight_config.view_config(:show).document_component -%>
<%= render (document_component).new(document_component.collection_parameter => document_presenter(@document), component: :div, show: true, partials: blacklight_config.view_config(:show).partials) do |component| %>
<% component.with_title(as: 'h1', classes: '', link_to_document: false, actions: false) %>
<% component.with_footer do %>
<% if @document.respond_to?(:export_as_openurl_ctx_kev) %>
<!-- COinS, for Zotero among others. -->
<span class="Z3988" title="<%= @document.export_as_openurl_ctx_kev(document_presenter(@document).display_type) %>"></span>
<% end %>
<% end %>
<% end %>
1 change: 1 addition & 0 deletions app/views/layouts/catalog_result.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<% content_for(:content) do %>
<%= render Blacklight::Document::PageHeaderComponent.new(document: @document, search_context: @search_context, search_session: search_session) %>
<section class="<%= show_sidebar_classes %>">
<%= content_for(:sidebar) %>
</section>
Expand Down
26 changes: 26 additions & 0 deletions bin/build-css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Compile CSS files using dart-sass, but loading stylesheets from upstream engines for
# ease of development.
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

require 'blacklight'

`npx sass ./app/assets/stylesheets/geoblacklight.scss:./app/assets/builds/geoblacklight.css --no-source-map --load-path=node_modules --load-path=#{"#{Blacklight::Engine.root}/app/assets/stylesheets"} --load-path=node_modules #{ARGV.join(' ')}`
3 changes: 2 additions & 1 deletion config/locales/blacklight.en.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
en:
blacklight:
application_name: 'EarthWorks'
back_to_search: 'Back to search results'
search:
form:
search:
Expand All @@ -12,5 +13,5 @@ en:
fields:
search: 'Keywords'
tools:
citation: Citation
citation: Cite
title: 'Other options'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"sass": "^1.77.8"
},
"scripts": {
"build:css": "sass ./app/assets/stylesheets/geoblacklight.scss:./app/assets/builds/geoblacklight.css --load-path=node_modules"
"build:css": "bin/build-css"
}
}