Skip to content

Instantly share code, notes, and snippets.

View jkeck's full-sized avatar
:shipit:

Jessie Keck jkeck

:shipit:
View GitHub Profile
@jkeck
jkeck / gist:3515705
Created August 29, 2012 17:07 — forked from MrDys/gist:3512455
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id and is classed with modal and permalink:
<div class="modal permalink" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
def get_addl_item_info(bcode,building,document)
# we need to have ON-ORDER records dealt with even though they don't have a barcode
if doc_on_order?(document)
return {:request_status => true, :status => "unavailable"}
else
if document.respond_to?(:holdings_from_solr)
unless document["item_display"].nil? or bcode.strip.blank?
return mod_item(bcode,building,document,document.holdings_from_solr[bcode.strip.to_sym]) if document.holdings_from_solr.has_key?(bcode.strip.to_sym)
end
end
@jkeck
jkeck / form_ext.rb
Created January 8, 2013 21:31
This would live in the lib directory of a gem. That gem would also provide some JS and some sort of controller logic about how to handle the data / form fields.
module FormExt
module FormHelper
def self.included(arg)
ActionView::Helpers::FormBuilder.send(:include, FormExt::FormBuilder)
end
def multi_valued_text_field_tag(object_name, method, options = {})
output = ''
if options and options[:value] and options[:value].is_a?(Array)
options.merge!(:"data-multivalued" => true)
options[:value].each_with_index do |value, index|
@jkeck
jkeck / access_log-20131201
Created December 5, 2013 00:59
All 403 errors from the apache access log on 2013-12-01
/users/jvine-drupal HTTP/1.1" 403 7482
/users/jvine-drupal HTTP/1.1" 403 7482 "http://libweb-test.stanford.edu/user" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/tech%20desk%20banner.jpg HTTP/1.1" 403 7536
/sites/default/files/styles/large/public/tech%20desk%20banner.jpg HTTP/1.1" 403 7536 "http://libweb-test.stanford.edu/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/disc.png HTTP/1.1" 403 7525
/sites/default/files/styles/large/public/disc.png HTTP/1.1" 403 7525 "http://libweb-test.stanford.edu/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36"
/sites/default/files/styles/large/public/computer_0.png HTTP/1.1" 403 6941
/sites/default/files/styles/large/public/computer_0.png HTTP/1.1" 403 6941 "http://libweb-test.stanford.ed
@jkeck
jkeck / _fimlstrip.html.erb
Last active January 3, 2016 10:09
SearchWorks Filmstrip Example
<div class="filmstrip-container">
<div class="filmstrip-total"><%= link_to("View #{pluralize(document.total_collection_members, "item")} in this collection online", catalog_index_path(:f=>{:collection=>[document[:id]]}, :view=>"gallery")) %></div>
<div class="scroll-control disabled" data-direction="left"></div>
<div class="scroll-control" data-direction="right"></div>
<div class="filmstrip" data-preview-container='true'>
<ul>
<%- document.children.each do |doc| -%>
<%- unless doc.image_urls.blank? -%>
<li>
<div>
configure_blacklight do |config|
config.default_solr_params = {
:qt => 'search',
:qf => 'id content url title anchor author',
:rows => 10,
:"hl.fl" => "content",
:"hl.simple.pre" => '<span class="label label-info">',
:"hl.simple.post" => "</span>",
:hl => true
}
def initialize(controller, response_docs)
@controller = controller
@response_docs = response_docs
end
def blacklight_maps_config
@controller.blacklight_config.view.maps
end
def type
@jkeck
jkeck / gist:b63922dc5a66fa368eba
Created August 22, 2014 17:36
Proposed GBS change
(function($) {
/*
jQuery plugin to render Google book covers for image elements
Usage: $(selector).renderGoogleBookCovers();
This plugin :
- collects all 'img.cover-image' elements and batches them
- using ISBN, OCLC & LCCN value(s) of image elements inside each batch,
Google cover images are added using Google Books API
@jkeck
jkeck / blacklight-customization.md
Last active August 29, 2015 14:16
Outline for Blacklight Customization Workshop at HydraConnect.

Basic Configuration

  • i18n (a lot of view overrides could be accomplished with i18n overrides)
  • blacklight_config (Controller Configuration)
    • Facets
    • Fields
    • Sorts
    • Search fields (search type drop-down)
    • Thumbnail by field

Advanced Configuration

@jkeck
jkeck / app.rb
Created April 17, 2015 18:12
Example configuration
config.libraries = {
'ARS' => 'Archive of Recorded Sound',
'ART' => 'Art & Architecture Library',
'BIOLOGY' => 'Biology Library (Falconer)',
'BUSINESS' => 'Business Library',
'CHEMCHMENG' => 'Chemistry & ChemEng Library (Swain)',
'CLASSICS' => 'Classics Library',
'EARTH-SCI' => 'Earth Sciences Library (Branner)',
'EAST-ASIA' => 'East Asia Library',
'EDUCATION' => 'Education Library (Cubberley)',