Skip to content

Commit

Permalink
GBL Admin: thumbnails_via_statesman
Browse files Browse the repository at this point in the history
  • Loading branch information
ewlarson committed Jun 19, 2024
1 parent c346f15 commit 9261ecf
Show file tree
Hide file tree
Showing 11 changed files with 2,389 additions and 2,746 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
gem 'geoblacklight', '4.4'

# GBL Admin
gem 'geoblacklight_admin', git: "https://github.com/geobtaa/geoblacklight_admin.git", branch: "guard-nil-derivative"
gem 'geoblacklight_admin', git: "https://github.com/geobtaa/geoblacklight_admin.git", branch: "feature/thumbnails_via_statesman"
gem 'git', ">= 1.13"
gem "rubyzip", ">= 1.3.0"
gem "awesome_print"
gem "hashdiff"

# GBL Admin dependencies _not_ automatically loading...
gem 'active_storage_validations'
Expand Down
13 changes: 7 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ GIT

GIT
remote: https://github.com/geobtaa/geoblacklight_admin.git
revision: dc3776c11e0e269e735c0633f340839472aaadc2
branch: guard-nil-derivative
revision: 8074592f02f9cd2cc603b103c30e9576e1e6e6ed
branch: feature/thumbnails_via_statesman
specs:
geoblacklight_admin (0.4.1)
active_storage_validations (~> 1.0)
Expand Down Expand Up @@ -172,7 +172,7 @@ GEM
execjs (~> 2)
awesome_print (1.9.2)
aws-eventstream (1.3.0)
aws-partitions (1.943.0)
aws-partitions (1.944.0)
aws-sdk-core (3.197.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand All @@ -181,7 +181,7 @@ GEM
aws-sdk-kms (1.83.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.152.1)
aws-sdk-s3 (1.152.2)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand Down Expand Up @@ -548,7 +548,7 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.5)
nokogiri (1.16.6)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
noticed (1.6.3)
Expand Down Expand Up @@ -676,7 +676,7 @@ GEM
ffi (~> 1.12)
rubyzip (2.3.2)
safely_block (0.4.0)
sanitize (6.1.0)
sanitize (6.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
sass (3.7.4)
Expand Down Expand Up @@ -863,6 +863,7 @@ DEPENDENCIES
git (>= 1.13)
haml
handlebars_assets (~> 0.23.0)
hashdiff
image_processing (>= 1.2)
inline_svg
jbuilder (~> 2.5)
Expand Down
4 changes: 4 additions & 0 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class SolrDocument
:contributor => Settings.FIELDS.PROVIDER
)

def kithe_model
Kithe::Model.find_by_friendlier_id(self.id)
end

def sidecar
# Find or create, and set version
sidecar = SolrDocumentSidecar.where(
Expand Down
7 changes: 7 additions & 0 deletions app/views/catalog/admin.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
%tr
- if @document.sidecar.image.attached?
%td
%span ActionStorage
%div.media
%span.mr-3= image_tag @document.sidecar.image
- else
Expand All @@ -52,6 +53,12 @@
%td
- if @document.sidecar.image_state.last_transition
= @document.sidecar.image_state.last_transition.metadata
%tr
- if @document&.kithe_model&.thumbnail&.present?
%td
%span AWS S3
%div.media
%span.mr-3= image_tag @document&.kithe_model&.thumbnail&.file_url(:thumb_standard_2X)

%h3 URIs
%table.table.responsive
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ class Application < Rails::Application

# Image Processing
config.active_storage.variant_processor = :vips

# YAML
config.active_record.yaml_column_permitted_classes = %w[Symbol Time Date BigDecimal OpenStruct]
end
end
3 changes: 2 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true

config.active_job.queue_adapter = :inline
# config.active_job.queue_adapter = :inline
config.active_job.queue_adapter = :sidekiq

# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@

# Documents
resources :documents do
get "admin"
get "versions"

# DocumentAccesses
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This migration comes from geoblacklight_admin (originally 20240619171628)
class CreateDocumentThumbnailStatesman < ActiveRecord::Migration[7.0]
def change
create_table 'document_thumbnail_transitions', force: :cascade do |t|
t.string 'to_state', null: false
t.text 'metadata', default: '{}'
t.integer 'sort_key', null: false
t.uuid 'kithe_model_id', null: false
t.boolean 'most_recent', null: false
t.datetime 'created_at', precision: 6, null: false
t.datetime 'updated_at', precision: 6, null: false
t.index %w[kithe_model_id most_recent], name: 'thumbnail_transitions_parent_most_recent', unique: true,
where: 'most_recent'
t.index %w[kithe_model_id sort_key], name: 'thumbnail_transitions_parent_sort', unique: true
end
end
end
14 changes: 13 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_03_07_155110) do
ActiveRecord::Schema[7.0].define(version: 2024_06_19_183528) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -240,6 +240,18 @@
t.datetime "updated_at", null: false
end

create_table "document_thumbnail_transitions", force: :cascade do |t|
t.string "to_state", null: false
t.text "metadata", default: "{}"
t.integer "sort_key", null: false
t.uuid "kithe_model_id", null: false
t.boolean "most_recent", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["kithe_model_id", "most_recent"], name: "thumbnail_transitions_parent_most_recent", unique: true, where: "most_recent"
t.index ["kithe_model_id", "sort_key"], name: "thumbnail_transitions_parent_sort", unique: true
end

create_table "document_transitions", force: :cascade do |t|
t.string "to_state", null: false
t.text "metadata", default: "{}"
Expand Down
7 changes: 7 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Run Locally
bundle exec rake geoportal:server

## Test Locally

RAILS_ENV=test bundle exec rake geoportal:test
RAILS_ENV=test bundle exec rake test:system test
Loading

0 comments on commit 9261ecf

Please sign in to comment.