Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

Resolve #6 #7

* Setup controller overrides
* add js/css
* add logo
  • Loading branch information...
ruebot committed Aug 17, 2017
1 parent cdafe99 commit 756e0b31a58b62cb5dc6847ca25197a812d89c19

This file was deleted.

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 44.1 (41455) - http://www.bohemiancoding.com/sketch -->
<title>Compact</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square">
<g id="Compact" stroke="#000000">
<path d="M1.43885093,2.44444444 L6.83349609,2.44444444" id="Line"></path>
<path d="M1.43885093,4.44444444 L6.83349609,4.44444444" id="Line"></path>
<path d="M1.43885093,6.44444444 L6.83349609,6.44444444" id="Line"></path>
<path d="M1.43885093,8.44444444 L6.83349609,8.44444444" id="Line"></path>
<path d="M1.43885093,10.4444444 L6.83349609,10.4444444" id="Line"></path>
<path d="M1.43885093,12.4444444 L6.83349609,12.4444444" id="Line"></path>
<path d="M1.43885093,14.4444444 L6.83349609,14.4444444" id="Line"></path>
<path d="M9.43885093,2.44444444 L14.8334961,2.44444444" id="Line"></path>
<path d="M9.43885093,4.44444444 L14.8334961,4.44444444" id="Line"></path>
<path d="M9.43885093,6.44444444 L14.8334961,6.44444444" id="Line"></path>
<path d="M9.43885093,8.44444444 L14.8334961,8.44444444" id="Line"></path>
<path d="M9.43885093,10.4444444 L14.8334961,10.4444444" id="Line"></path>
<path d="M9.43885093,12.4444444 L14.8334961,12.4444444" id="Line"></path>
<path d="M9.43885093,14.4444444 L14.8334961,14.4444444" id="Line"></path>
</g>
</g>
</svg>
Binary file not shown.
No changes.

This file was deleted.

@@ -0,0 +1,39 @@
Blacklight.onLoad(function () {
'use strict';
var onlineContentTabSelector = '[data-arclight-online-content-tab="true"]';
var oEmbedViewerSelector = '[data-arclight-oembed="true"]';

$(onlineContentTabSelector).on('shown.bs.tab', function() {
var $viewerElements = $(oEmbedViewerSelector);
if($viewerElements.length === 0) {
return;
}

$viewerElements.each(function (i, element) {
var $el = $(element);
var data = $el.data();
var resourceUrl = data.arclightOembedUrl;
$.ajax({
url: resourceUrl,
dataType: 'html'
}).done(function (response) {
var links = $('<div>' + response.match(/<link .*>/g).join('') + '</div>'); // Parse out link elements so image assets are not loaded
var oEmbedEndPoint = links.find('link[rel="alternate"][type="application/json+oembed"]').prop('href');

if(!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
return;
}

$.ajax({
url: oEmbedEndPoint
}).done(function (oEmbedResponse) {
if(oEmbedResponse.html) {
$el.hide()
.html(oEmbedResponse.html)
.fadeIn(500);
}
});
});
});
});
});
@@ -0,0 +1,4 @@
//= require warclight/oembed_viewer

// Vendor Scripts
//= require responsiveTruncator

This file was deleted.

@@ -0,0 +1 @@
/* Warclight application scss */
@@ -0,0 +1 @@
/* warclight specific scss */
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Warclight
##
# A module to add configuration helpers for certain fields used by Warclight
module FieldConfigHelpers
extend ActiveSupport::Concern
include ActionView::Helpers::OutputSafetyHelper
include ActionView::Helpers::TagHelper
end
end

This file was deleted.

@@ -0,0 +1,8 @@
# frozen_string_literal: true

module Warclight
##
# Warclight specific methods for the Catalog
module Catalog
end
end
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module Warclight
##
# Customized Search Behavior for Warclight
module SearchBehavior
extend ActiveSupport::Concern
end
end
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module Warclight
##
# Extends Blacklight::Solr::Document to provide Warclight specific behavior
module SolrDocument
extend Blacklight::Solr::Document
end
end

This file was deleted.

@@ -0,0 +1,55 @@
# frozen_string_literal: true

require 'rails/generators'

module Warclight
##
# Warclight install generator
class Install < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)

def create_blacklight_catalog
remove_file 'app/controllers/catalog_controller.rb'
copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb'
end

def include_warclight_solrdocument
inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do
"\n include Warclight::SolrDocument"
end
end

def install_blacklight_range_limit
generate 'blacklight_range_limit:install'
end

def add_custom_routes
inject_into_file 'config/routes.rb', after: "mount Blacklight::Engine => '/'" do
"\n mount Warclight::Engine => '/'\n"
end
end

def assets
copy_file 'warclight.scss', 'app/assets/stylesheets/warclight.scss'
copy_file 'warclight.js', 'app/assets/javascripts/warclight.js'
inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do
"\n//= require bootstrap/scrollspy\n" \
"\n//= require bootstrap/tab\n"
end
end

def add_warclight_search_behavior
inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do
"\n include Warclight::SearchBehavior"
end
end

def solr_config
directory '../../../../solr', 'solr', force: true
end

def modify_blacklight_yml
gsub_file 'config/locales/blacklight.en.yml', "application_name: 'Blacklight'", "application_name: 'Warclight'"
end
end
end
@@ -0,0 +1,157 @@
# frozen_string_literal: true

class CatalogController < ApplicationController

include Blacklight::Catalog
include Warclight::Catalog

configure_blacklight do |config|
## Class for sending and receiving requests from a search index
# config.repository_class = Blacklight::Solr::Repository
#
## Class for converting Blacklight's url parameters to into request parameters for the search index
# config.search_builder_class = ::SearchBuilder
#
## Model that maps search index responses to the blacklight response model
# config.response_model = Blacklight::Solr::Response

## Default parameters to send to solr for all search-like requests. See also SearchBuilder#processed_parameters
config.default_solr_params = {
rows: 10
}

# solr path which will be added to solr base url before the other solr params.
#config.solr_path = 'select'

# items to show per page, each number in the array represent another option to choose from.
#config.per_page = [10,20,50,100]

## Default parameters to send on single-document requests to Solr. These settings are the Blackligt defaults (see SearchHelper#solr_doc_params) or
## parameters included in the Blacklight-jetty document requestHandler.
#
#config.default_document_solr_params = {
# qt: 'document',
# ## These are hard-coded in the blacklight 'document' requestHandler
# # fl: '*',
# # rows: 1,
# # q: '{!term f=id v=$id}'
#}

# solr field configuration for search results/index views
config.index.title_field = 'title'
#config.index.display_type_field = 'level_ssm'
#config.index.thumbnail_field = 'thumbnail_path_ss'

# solr field configuration for document/show views
#config.show.title_field = 'title_display'
#config.show.display_type_field = 'format'
#config.show.thumbnail_field = 'thumbnail_path_ss'

# solr fields that will be treated as facets by the blacklight application
# The ordering of the field names is the order of the display
#
# Setting a limit will trigger Blacklight's 'more' facet values link.
# * If left unset, then all facet values returned by solr will be displayed.
# * If set to an integer, then "f.somefield.facet.limit" will be added to
# solr request, with actual solr request being +1 your configured limit --
# you configure the number of items you actually want _displayed_ in a page.
# * If set to 'true', then no additional parameters will be sent to solr,
# but any 'sniffed' request limit parameters will be used for paging, with
# paging at requested limit -1. Can sniff from facet.limit or
# f.specific_field.facet.limit solr request params. This 'true' config
# can be used if you set limits in :default_solr_params, or as defaults
# on the solr side in the request handler itself. Request handler defaults
# sniffing requires solr requests to be made with "echoParams=all", for
# app code to actually have it echo'd back to see it.
#
# :show may be set to false if you don't want the facet to be drawn in the
# facet bar
#
# set :index_range to true if you want the facet pagination view to have facet prefix-based navigation
# (useful when user clicks "more" on a large facet and wants to navigate alphabetically across a large set of results)
# :index_range can be an array or range of prefixes that will be used to create the navigation (note: It is case sensitive when searching values)

config.add_facet_field 'content_type_norm', label: "General Content Type", collapse: false
config.add_facet_field 'crawl_years', label: "Crawl Years", collapse: false
config.add_facet_field 'domain', label: "Domain"
config.add_facet_field 'links_domains', label: "Links Domains"
config.add_facet_field 'institution', label: "Institution"
config.add_facet_field 'collection_name', label: "Collection Name"
config.add_facet_field 'collection_number', label: "Collection Number"

# Have BL send all facet field names to Solr, which has been the default
# previously. Simply remove these lines if you'd rather use Solr request
# handler defaults, or have no facets.
config.add_facet_fields_to_solr_request!

# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
config.add_index_field 'title', label: 'Title'
config.add_index_field 'host', label: 'Host'
config.add_index_field 'crawl_date', label: 'Crawl Date'
config.add_index_field 'content_type', label: 'Content Type'
config.add_index_field 'domain', label: 'Domain'
config.add_index_field 'links_domains', label: "This page links to"
config.add_index_field 'institution', label: "Institution"
config.add_index_field 'collection_name', label: "Collection Name"
config.add_index_field 'collection_number', label: "Collection Number"

# solr fields to be displayed in the show (single result) view
# The ordering of the field names is the order of the display
config.add_show_field 'title', label: 'Title'
config.add_show_field 'url', label: 'URL'
config.add_show_field 'host', label: 'Host'
config.add_show_field 'content_type_served', label: 'Content Type Served'
config.add_show_field 'content_length', label: 'Length'
config.add_show_field 'links_hosts', label: "Link Hosts"
config.add_show_field 'content', label: 'Content'

# "fielded" search configuration. Used by pulldown among other places.
# For supported keys in hash, see rdoc for Blacklight::SearchFields
#
# Search fields will inherit the :qt solr request handler from
# config[:default_solr_parameters], OR can specify a different one
# with a :qt key/value. Below examples inherit, except for subject
# that specifies the same :qt as default for our own internal
# testing purposes.
#
# The :key is what will be used to identify this BL search field internally,
# as well as in URLs -- so changing it after deployment may break bookmarked
# urls. A display label will be automatically calculated from the :key,
# or can be specified manually to be different.

# This one uses all the defaults set by the solr request handler. Which
# solr request handler? The one set in config[:default_solr_parameters][:qt],
# since we aren't specifying it otherwise.
config.add_search_field 'all_fields', label: 'All Fields' do |field|
field.include_in_simple_select = true
end

config.add_search_field 'within_collection' do |field|
field.include_in_simple_select = false
field.solr_parameters = {
fq: '-level_sim:Collection'
}
end

# Field-based searches. We have registered handlers in the Solr configuration
# so we have Blacklight use the `qt` parameter to invoke them
#config.add_search_field 'keyword', label: 'Keyword' do |field|
# field.qt = 'search' # default
#end

# "sort results by" select (pulldown)
# label in pulldown is followed by the name of the SOLR field to sort by and
# whether the sort is ascending or descending (it must be asc or desc
# except in the relevancy case).
#config.add_sort_field 'score desc, title_sort asc', label: 'relevance'

# If there are more than this many search results, no spelling ("did you
# mean") suggestion is offered.
config.spell_max = 5

# Configuration for autocomplete suggestor
config.autocomplete_enabled = true
config.autocomplete_path = 'suggest'
end
end
@@ -0,0 +1,2 @@
//= require warclight/warclight
//= require stickyfill
@@ -0,0 +1,3 @@
/*
*= require warclight/application
*/

0 comments on commit 756e0b3

Please sign in to comment.
You can’t perform that action at this time.