Skip to content

Commit

Permalink
move collection from development branch to here
Browse files Browse the repository at this point in the history
  • Loading branch information
dcnb committed Dec 13, 2023
1 parent 458668a commit a8ad255
Show file tree
Hide file tree
Showing 205 changed files with 9,628 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dcnb @owikle @evanwill
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

source 'https://rubygems.org'

unless Gem.win_platform?
gem 'image_optim'
gem 'image_optim_pack'
end
gem 'jekyll'
gem 'mini_magick'
gem 'rake'

gem 'webrick', '~> 1.7'
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 CollectionBuilder contributors, evanwill, dcnb, owikle, jylisadoney, University of Idaho Library Digital Initiatives, https://www.lib.uidaho.edu/digital/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# digital-collections-template-cb-csv

<https://www.lib.uidaho.edu/digital/>

A highly customized version of [CollectionBuilder-CSV](https://github.com/CollectionBuilder/collectionbuilder-csv) used to generate University of Idaho Library Digital Collections.

The main branch represents our base collection template.
Additional branches contain a variety of individual collections with customized metadata and features.
Updates to the main branch can be merged into the collection branches to maintain the centralized template.

This repository is specifically for building U of I Library projects and trails behind development of the general [CollectionBuilder-CSV](https://github.com/CollectionBuilder/collectionbuilder-csv) template.
If you are interested in this approach, please visit [CollectionBuilder](https://collectionbuilder.github.io/) to learn more!

----------

## CollectionBuilder

<https://collectionbuilder.github.io/>

CollectionBuilder is a project of University of Idaho Library's [Digital Initiatives](https://www.lib.uidaho.edu/digital/) and the [Center for Digital Inquiry and Learning](https://cdil.lib.uidaho.edu) (CDIL) following the [Lib-Static](https://lib-static.github.io/) methodology.
Powered by the open source static site generator [Jekyll](https://jekyllrb.com/) and a modern static web stack, it puts collection metadata to work building beautiful sites.

The basic theme is created using [Bootstrap](https://getbootstrap.com/).
Metadata visualizations are built using open source libraries such as [DataTables](https://datatables.net/), [Leafletjs](http://leafletjs.com/), [Spotlight gallery](https://github.com/nextapps-de/spotlight), [lazysizes](https://github.com/aFarkas/lazysizes), and [Lunr.js](https://lunrjs.com/).
Object metadata is exposed using [Schema.org](http://schema.org) and [Open Graph protocol](http://ogp.me/) standards.

## License

This license does *NOT* include any objects or images used in digital collections, which may have individually applied licenses described by a "rights" field.
CollectionBuilder code is licensed [MIT](https://github.com/CollectionBuilder/collectionbuilder-csv/blob/master/LICENSE).
This license does not include external dependencies included in the `assets/lib` directory, which are covered by their individual licenses.
162 changes: 162 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# frozen_string_literal: true

# CollectionBuilder-CSV helper tasks

require 'csv'
require 'fileutils'
require 'image_optim' unless Gem.win_platform?
require 'mini_magick'

###############################################################################
# TASK: deploy
###############################################################################

desc 'Build site with production env'
task :deploy do
ENV['JEKYLL_ENV'] = 'production'
system('bundle', 'exec', 'jekyll', 'build')
end

###############################################################################
# Helper Functions
###############################################################################

def prompt_user_for_confirmation(message)
response = nil
loop do
print "#{message} (Y/n): "
$stdout.flush
response = case $stdin.gets.chomp.downcase
when '', 'y' then true
when 'n' then false
end
break unless response.nil?

puts 'Please enter "y" or "n"'
end
response
end

def process_and_optimize_image(filename, file_type, output_filename, size, density)
image_optim = ImageOptim.new(svgo: false) unless Gem.win_platform?
if filename == output_filename && file_type == :image && !Gem.win_platform?
puts "Optimizing: #{filename}"
begin
image_optim.optimize_image!(output_filename)
rescue StandardError => e
puts "Error optimizing #{filename}: #{e.message}"
end
elsif filename == output_filename && file_type == :pdf
puts "Skipping: #{filename}"
else
puts "Creating: #{output_filename}"
begin
if file_type == :pdf
inputfile = "#{filename}[0]"
magick = MiniMagick::Tool::Convert.new
magick.density(density)
magick << inputfile
magick.resize(size)
magick.flatten
magick << output_filename
magick.call
else
image = MiniMagick::Image.open(filename)
image.format('jpg')
image.resize(size)
image.flatten
image.write(output_filename)
end
image_optim.optimize_image!(output_filename) unless Gem.win_platform?
rescue StandardError => e
puts "Error creating #{filename}: #{e.message}"
end
end
end

###############################################################################
# TASK: generate_derivatives
###############################################################################

desc 'Generate derivative image files from collection objects'
task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :compress_originals] do |_t, args|
# set default arguments
args.with_defaults(
thumbs_size: '300x300',
small_size: '800x800',
density: '300',
missing: 'true',
compress_originals: 'false'
)

# set the folder locations
objects_dir = 'objects'
thumb_image_dir = 'objects/thumbs'
small_image_dir = 'objects/small'

# Ensure that the output directories exist.
[thumb_image_dir, small_image_dir].each do |dir|
FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
end

# support these file types
EXTNAME_TYPE_MAP = {
'.jpeg' => :image,
'.jpg' => :image,
'.pdf' => :pdf,
'.png' => :image,
'.tif' => :image,
'.tiff' => :image
}.freeze

# CSV output
list_name = File.join(objects_dir, 'object_list.csv')
field_names = 'object_location,image_small,image_thumb'.split(',')
CSV.open(list_name, 'w') do |csv|
csv << field_names

# Iterate over all files in the objects directory.
Dir.glob(File.join(objects_dir, '*')).each do |filename|
# Skip subdirectories and the README.md file.
if File.directory?(filename) || File.basename(filename) == 'README.md' || File.basename(filename) == 'object_list.csv'
next
end

# Determine the file type and skip if unsupported.
extname = File.extname(filename).downcase
file_type = EXTNAME_TYPE_MAP[extname]
unless file_type
puts "Skipping file with unsupported extension: #{filename}"
csv << ["/#{filename}", nil, nil]
next
end

# Get the lowercase filename without any leading path and extension.
base_filename = File.basename(filename, '.*').downcase

# Optimize the original image.
if args.compress_originals == 'true'
puts "Optimizing: #{filename}"
process_and_optimize_image(filename, file_type, filename, nil, nil)
end

# Generate the thumb image.
thumb_filename = File.join(thumb_image_dir, "#{base_filename}_th.jpg")
if args.missing == 'false' || !File.exist?(thumb_filename)
process_and_optimize_image(filename, file_type, thumb_filename, args.thumbs_size, args.density)
else
puts "Skipping: #{thumb_filename} already exists"
end

# Generate the small image.
small_filename = File.join([small_image_dir, "#{base_filename}_sm.jpg"])
if (args.missing == 'false') || !File.exist?(small_filename)
process_and_optimize_image(filename, file_type, small_filename, args.small_size, args.density)
else
puts "Skipping: #{small_filename} already exists"
end
csv << ["/#{filename}", "/#{small_filename}", "/#{thumb_filename}"]
end
end
puts "\e[32mSee '#{list_name}' for list of objects and derivatives created.\e[0m"
end
78 changes: 78 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
##########
# collectionbuilder-csv
# Jekyll Digital Collection Generator
# https://github.com/CollectionBuilder/collectionbuilder-csv
##########

##########
# URL VARIABLES
#
# site domain, full URL to the production location of your collection
url:
# path to location on the domain if necessary e.g. /digital/hjccc
baseurl:
# location of code, the full url to your github repository
source-code: https://github.com/uidaholib/digital-collections-template-cb-csv

# url to the shared assets folder on mainweb
digital-assets: https://www.lib.uidaho.edu/assets

##########
# SITE SETTINGS
#
# title of site appears in banner
title: Taylor Wilderness Research Station Archive
# tagline, a short phrase that will appear throughout the site in the top banner
tagline: Voices, Artifacts, and Archives from Taylor
# description appears in meta tags and other locations
# this description might appear in search result lists, keep around 160 characters max
description: "The Taylor Wilderness Research Station Archive features video interviews, archival documents, artifacts, research outputs, and other photographs and ephemera collected from those who have made Taylor the unique and transformative place it's been for over 40 years."
# keywords, a short list of subjects describing the collection, separated by semicolon, to appear in rich markup
keywords: idaho;history;inland northwest;wilderness
# creator of the digital collection, to appear in meta tags; we typically use our GitHub usernames but feel free to just use your name
author: dcnb

##########
# COLLECTION SETTINGS
#
# Set the metadata for your collection (the name of the CSV file in your _data directory that describes the objects in your collection)
# Use the filename of your CSV **without** the ".csv" extension! E.g. _data/demo-metadata.csv --> "demo-metadata"
metadata: taylor
# page generation settings [optional!]
# [optional: only used if you need to tweak CB defaults or generate from more than one data file]
# page_gen:
# - data: 'demo-metadata'
# template: 'item'
# name: 'objectid'
# dir: 'items'
# extension: 'html'
# filter: 'objectid'

##########
# Site/Organization Branding
# Enter information for your organization (replacing the CDIL links and name below) if you'd like to brand your site with a logo
# To remove the branding, comment out these values, or delete them.
#
organization-name: "University of Idaho Library Digital Initiatives"
organization-link: https://www.lib.uidaho.edu/digital/
organization-logo-banner: https://www.lib.uidaho.edu/media/images/ui_library_horizontal.png
organization-logo-nav: https://www.lib.uidaho.edu/media/digital/liblogo_white.png

##########
# ROBOTS EXCLUDE
#
# set noindex to true if you do NOT want Google to index your site
# noindex: true

##########
# BUILD SETTINGS
#
# Note: use environment variable on build command to include analytics
# JEKYLL_ENV=production jekyll build
# (this is done automatically by gh-pages build)
#
# ignore stuff
exclude: [docs/, Rakefile, README.md, LICENSE, CODEOWNERS]
# compress CSS output
sass:
style: compressed
8 changes: 8 additions & 0 deletions _data/config-browse.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
field,display_name,btn,hidden,sort_name
Title,,,true,Title
date,Date,,,Date
creator,Creator,,,Creator
description,,,true,
subject,,true
location,,true
identifier,,,true,Identifier
5 changes: 5 additions & 0 deletions _data/config-map.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
field,display_name,search
date,Date,true
creator,Creator,true
subject,Subjects,true
location,Location,true
15 changes: 15 additions & 0 deletions _data/config-metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
field,display_name,browse_link,external_link,dc_map,schema_map
title,Title,,,DCTERMS.title,headline
creator,Creator,,,DCTERMS.creator,creator
archival date,Date Created
date,,,,DCTERMS.date,dateCreated
description,Description,,,DCTERMS.description,description
subject,Subjects,true,,DCTERMS.subject,keywords
location,Location,,,,contentLocation
latitude,Latitude,,,,
longitude,Longitude,,,,
source,Source,,,,
identifier,Source Identifier,,,,
type,Type,,,DCTERMS.type,
format,Format,,,,encodingFormat
rightsstatement,,,,DCTERMS.rights,license
9 changes: 9 additions & 0 deletions _data/config-nav.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
display_name,stub,dropdown_parent
Home,/,
Browse,/browse.html,
Subjects,/subjects.html,
Authors,/authors.html,
Map,/map.html,
Timeline,/timeline.html,
Data,/data.html,
About,/about.html,
7 changes: 7 additions & 0 deletions _data/config-search.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
field,index,display
title,true,true
date,true,true
creator,true,false
description,true,true
subject,true,true
location,true,false
5 changes: 5 additions & 0 deletions _data/config-table.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
field,display_name
title,Title
date,Date
description,Description
subject,Subjects
19 changes: 19 additions & 0 deletions _data/config-theme-colors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
color_class,color
primary,#F1B300
secondary,
success,
info,#00AEC7
warning,
danger,
light,
dark,
pride-gold,#F1B300
clearwater,#00AEC7
clearwater-light,#8BD5E5
payette-blue,#003E51
ponderosa-pine,#004E42
garnet,#D22630
wild-rose,#E10098
palouse-green,#00AF66
black-color,#191919
grey-color,#808080
Loading

0 comments on commit a8ad255

Please sign in to comment.