Skip to content

Instantly share code, notes, and snippets.

View cfitz's full-sized avatar

Chris Fitzpatrick cfitz

  • Machine Games
  • Sweden
View GitHub Profile
@cfitz
cfitz / gist:e29389c3f3830f589700
Last active August 29, 2015 14:01
Get all the ASPACE resources and their children too
#!/usr/bin/env ruby
require 'json'
require 'rest_client'
# point this to your AS backend
BACKEND_URL = "http://localhost:8089"
TOKEN = { "X-ArchivesSpace-Session" => JSON.parse( RestClient.post "#{BACKEND_URL}/users/admin/login", { password: 'admin'} )["session"] }
# Directory to dump JSON files
@cfitz
cfitz / _branding.html.erb
Last active August 29, 2015 14:01
Localization Examples
<%# Add this file to :
plugins/local/public/views/site/_branding.html.erb to override logo in
https://github.com/hudmol/archivesspace/blob/master/public/app/views/site/_branding.html.erb
%>
<h1>
<%= image_tag "#{AppConfig[:frontend_prefix]}assets/cuhk/cuhk_logo.png", :alt => I18n.t("brand.title") %>
</h1>
@cfitz
cfitz / README
Last active August 29, 2015 14:02
Fedora and Trello + ArchivesSpace ( FaT AS )
This was the developer challenge project submitted by Chris Fitzpatrick (ArchivesSpace )
and Leila Belle Sterman ( Montana St. University ) at Open Repositories 2014.
This is a proof of concept to show how to develop an ArchivesSpace plugin that interacts
with a repository (Fedora 4, in this situation ) and workflow manager ( in this case, https://trello.com/ ).
The basic process is that adding a Digital Object will also update a Trello board with a
card, possibly indicating someone to perform a scanning operation. When file versions
are associated to the digital object, the content will be uploaded to Fedora 4 and
Trello will be updated, possibly indicating that digitization has been completed.
@cfitz
cfitz / delete_locations.rb
Last active August 29, 2015 14:03
Delete ASpace locations
require 'json'
require 'rest_client'
require 'csv'
# this is a script to bulk delete locations in ArchivesSpace.
# To run this, you should have a recent version of ruby installed ( like > 1.9.3 ).
# Then, add the rest_client gem by using the command `gem install rest_client`
# To invoke the script, run simply run it with no parameters
@cfitz
cfitz / delete_repo.rb
Last active August 29, 2015 14:05
Delete ASPACE repository
#!/usr/bin/env ruby
require 'json'
require 'rest_client'
require "highline/import"
# point this to your AS backend
BACKEND_URL = "http://localhost:8089"
TOKEN = { "X-ArchivesSpace-Session" => JSON.parse( RestClient.post "#{BACKEND_URL}/users/admin/login", { password: 'admin'} )["session"] }
@cfitz
cfitz / _header_respository.html.erb
Last active August 29, 2015 14:07
Some basic ASpace overrides...
<=# plugins/local/frontend/views/shared/_header_repository.html.erb %>
<=# just removes the links to classification %>
<div class="container repository-header">
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-repository-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@cfitz
cfitz / _results.html.erb
Last active August 29, 2015 14:08
Add columns to search results
<%
title = I18n.t("search_results.title") if title.nil?
%>
<div class="row-fluid">
<div class="span3">
<%= render_aspace_partial :partial => "search/filter" %>
</div>
<div class="span9">
<div class="record-pane">
@cfitz
cfitz / reports.rb
Created December 8, 2014 22:31
reports.rb
# plugins/local/backend/controllers/reports.rb
class ArchivesSpaceService < Sinatra::Base
ReportManager.registered_reports.each do |uri_suffix, opts|
Endpoint.get("/repositories/:repo_id/reports/#{uri_suffix}")
.description(opts[:description])
.params(*(opts[:params] << ReportHelper.report_formats << ["repo_id", :repo_id]))
.permissions([])
@cfitz
cfitz / aspace_form_helper.rb
Created April 10, 2015 08:34
aspace_form_helper.rb
#
# Add this file to plugins/local/frontend/controllers/aspace_forms_helper.rb
module AspaceFormHelper
COMBOBOX_MIN_LIMIT = 50 # if a <select> has equal or more options than this value, output a combobox
class FormContext
def initialize(name, values_from, parent)
@cfitz
cfitz / form_fix_controller.rb
Last active August 29, 2015 14:18
form_fix_controller.rb
#
# Add this file to plugins/local/frontend/controllers/form_fix_controller.rb
# Obviously not a controller, but the naming convention is used to make sure that
# it loads.
#
module AspaceFormHelper
class FormContext
def label_and_date(name, opts = {})