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 / 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 = {})
@cfitz
cfitz / gist:f031108cc44bd109620b
Created April 14, 2015 13:46
RAC ead converter
class RacEADConverter < EADConverter
def self.import_types(show_hidden = false)
[
{
:name => "rac_ead_xml",
:description => "Import RAC EAD records from an XML file"
}
@cfitz
cfitz / accession_converter.rb
Created April 23, 2015 14:09
Add lots of dates and extents to the ASPACE accession CSV importer
# add this plugin to plugins/local/backend/model/accession_converter.rb
# this plugin allows the CSV importer to have columns like date_3_label, date_3_expression,
# extent_2_type, extent_2_container_summary etc.
class AccessionConverter < Converter
# we alias the old configure method...
self.singleton_class.send(:alias_method,:old_configure, :configure)
@cfitz
cfitz / converter.rb
Created May 28, 2015 15:21
converter.rb
# put this file in
# plugins/local/backend/model/converter.rb
# and restart aspace.
class Converter
# forcibly remove files in the event of an interruption
def remove_files
@batch.each_open_file_path do |path|
@cfitz
cfitz / application_controller.rb
Last active August 29, 2015 14:22
update the css in ASPACE
# plugins/local/frontend/controllers/application_controller.rb
# Obviously, not a application controller, but we just name it this to follow a convention.
class ApplicationController < ActionController::Base
end
module ApplicationHelper
def include_theme_css
css = ""
@cfitz
cfitz / rake_jruby_complete_patch.rake
Last active August 29, 2015 14:25
adding a relative url root
# frontend/lib/tasks/rake_jruby_complete_patch.rake
# Icky to have to do this, but had trouble with the recursive calls to Rake
# running with jruby-complete.jar.
classpath = [File.join(Rails.root, "..", "common")]
classpath << Dir.glob(File.join(Rails.root, "..", "build", "jruby*complete*.jar")).first
$rake_cmd = ["java",
"-XX:MaxPermSize=128m", "-Xmx256m",
@cfitz
cfitz / _branding.html.erb
Last active December 8, 2015 15:35
location deletion hacky fix
<div class="container navbar-branding">
<%= image_tag "archivesspace/archivesspace.small.png", :class=>"img-responsive" %>
</div>
<script>
$(function() {
@cfitz
cfitz / public_formats.rb
Created May 29, 2016 01:02
fix for public formats export to pdf
# add this to plugins/aspace-public-formats/backend/controllers/public_formats.rb and restart
module ExportHelpers
def generate_pdf_from_ead( ead )
xml = ""
ead.each { |e| xml << e }
ASFop.new(xml).to_pdf
end
end
@cfitz
cfitz / _archival_object.html.erb
Created June 7, 2016 12:32
adding root record id to an archival object summary
<fieldset class="form-horizontal">
<section id="summary">
<h3><%= I18n.t("archival_object._public.section.summary") %></h3>
<dl class="dl-horizontal">
<%= label_and_value I18n.t("archival_object.component_id"), archival_object['component_id'] %>
<%= label_and_value I18n.t("archival_object.level"), i18n_enum(:archival_object, 'level', archival_object['level']) %>
<%= label_and_value I18n.t("archival_object.language"), i18n_enum(:archival_object, 'language', archival_object['language']) %>
<%= label_and_value "Root Record ID", @tree_view["path_to_root"].first["id"] %>
</dl>
</section>
!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="/static/",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var a=r(1);n(a)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),i=n(a);t["default"]=i["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,