blacklight 5.0.0.pre3 → 5.0.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -16
- data/Gemfile +4 -0
- data/README.md +15 -1
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_bookmark.css.scss +1 -1
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +2 -12
- data/app/assets/stylesheets/blacklight/_facets.css.scss +1 -1
- data/app/assets/stylesheets/blacklight/_header.css.scss +1 -0
- data/app/assets/stylesheets/blacklight/_modal.css.scss +4 -2
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +0 -5
- data/app/controllers/bookmarks_controller.rb +4 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +26 -187
- data/app/helpers/blacklight/catalog_helper_behavior.rb +20 -8
- data/app/helpers/blacklight/facets_helper_behavior.rb +0 -83
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/url_helper_behavior.rb +201 -0
- data/app/helpers/blacklight_url_helper.rb +3 -0
- data/app/views/bookmarks/_tools.html.erb +4 -7
- data/app/views/catalog/_citation.html.erb +1 -1
- data/app/views/catalog/_did_you_mean.html.erb +1 -1
- data/app/views/catalog/_document.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_show_more_like_this.html.erb +1 -1
- data/app/views/catalog/_view_type_group.html.erb +4 -4
- data/app/views/catalog/email.html.erb +2 -2
- data/app/views/catalog/facet.html.erb +1 -1
- data/app/views/catalog/show.html.erb +1 -1
- data/app/views/catalog/sms.html.erb +1 -1
- data/blacklight.gemspec +2 -2
- data/config/jetty.yml +4 -1
- data/config/locales/blacklight.en.yml +3 -0
- data/config/locales/blacklight.fr.yml +3 -0
- data/{lib/generators/blacklight/templates/migrations/create_searches.rb → db/migrate/20140202020201_create_searches.rb} +2 -0
- data/{lib/generators/blacklight/templates/migrations/create_bookmarks.rb → db/migrate/20140202020202_create_bookmarks.rb} +1 -2
- data/gemfiles/rails3.gemfile +2 -0
- data/gemfiles/rails4.gemfile +2 -0
- data/lib/blacklight.rb +1 -40
- data/lib/blacklight/base.rb +3 -9
- data/lib/blacklight/catalog.rb +3 -16
- data/lib/blacklight/catalog/search_context.rb +8 -1
- data/lib/blacklight/configurable.rb +1 -2
- data/lib/blacklight/configuration.rb +13 -3
- data/lib/blacklight/configuration/view_config.rb +71 -0
- data/lib/blacklight/engine.rb +1 -0
- data/lib/blacklight/routes.rb +0 -1
- data/lib/blacklight/solr/document.rb +0 -4
- data/lib/blacklight/solr_helper.rb +8 -2
- data/lib/blacklight/user.rb +1 -16
- data/lib/blacklight/utils.rb +72 -1
- data/lib/generators/blacklight/install_generator.rb +92 -0
- data/lib/generators/blacklight/models_generator.rb +1 -25
- data/lib/generators/blacklight/templates/catalog_controller.rb +28 -32
- data/spec/helpers/blacklight_helper_spec.rb +24 -417
- data/spec/helpers/catalog_helper_spec.rb +13 -13
- data/spec/helpers/facets_helper_spec.rb +0 -127
- data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
- data/spec/helpers/url_helper_spec.rb +360 -0
- data/spec/lib/blacklight/configuration_spec.rb +2 -3
- data/spec/lib/blacklight/solr_helper_spec.rb +11 -17
- data/spec/lib/blacklight/user_spec.rb +0 -41
- data/spec/lib/blacklight_spec.rb +0 -22
- data/spec/lib/utils_spec.rb +35 -4
- data/spec/spec_helper.rb +4 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
- data/spec/views/catalog/_constraints.html.erb_spec.rb +4 -2
- data/spec/views/catalog/_index_default.erb_spec.rb +1 -1
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +1 -5
- data/spec/views/catalog/_show_default.erb_spec.rb +1 -1
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +11 -3
- data/tasks/blacklight.rake +1 -5
- metadata +14 -16
- data/.gitmodules +0 -0
- data/app/views/catalog/endnote.endnote.erb +0 -1
- data/app/views/catalog/show.endnote.erb +0 -1
- data/lib/generators/blacklight/blacklight_generator.rb +0 -97
- data/lib/generators/blacklight/templates/migrations/add_user_types_to_bookmarks_searches.rb +0 -16
- data/lib/generators/blacklight/templates/migrations/remove_editable_fields_from_bookmarks.rb +0 -12
- data/lib/railties/all_tests.rake +0 -39
- data/lib/railties/blacklight_rspec.rake +0 -128
data/.gitmodules
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render_endnote_texts(@documents) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render_endnote_text(@document) %>
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'rails/generators'
|
3
|
-
|
4
|
-
class BlacklightGenerator < Rails::Generators::Base
|
5
|
-
|
6
|
-
source_root File.expand_path('../templates', __FILE__)
|
7
|
-
|
8
|
-
argument :model_name, :type => :string , :default => "user"
|
9
|
-
class_option :devise , :type => :boolean, :default => false, :aliases => "-d", :desc => "Use Devise as authentication logic."
|
10
|
-
class_option :marc , :type => :boolean, :default => false, :aliases => "-m", :desc => "Generate MARC-based demo ."
|
11
|
-
|
12
|
-
desc """
|
13
|
-
This generator makes the following changes to your application:
|
14
|
-
1. Generates blacklight:models
|
15
|
-
2. Creates a number of public assets, including images, stylesheets, and javascript
|
16
|
-
3. Injects behavior into your user application_controller.rb
|
17
|
-
4. Adds example configurations for dealing with MARC-like data
|
18
|
-
5. Adds Blacklight routes to your ./config/routes.rb
|
19
|
-
|
20
|
-
|
21
|
-
Thank you for Installing Blacklight.
|
22
|
-
"""
|
23
|
-
|
24
|
-
def bundle_install
|
25
|
-
Bundler.with_clean_env do
|
26
|
-
run "bundle install"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Copy all files in templates/public/ directory to public/
|
31
|
-
# Call external generator in AssetsGenerator, so we can
|
32
|
-
# leave that callable seperately too.
|
33
|
-
def copy_public_assets
|
34
|
-
generate "blacklight:assets"
|
35
|
-
end
|
36
|
-
|
37
|
-
def generate_blacklight_models
|
38
|
-
|
39
|
-
generator_args = []
|
40
|
-
if options[:devise]
|
41
|
-
generator_args << "--devise #{options[:devise]}"
|
42
|
-
end
|
43
|
-
|
44
|
-
generate 'blacklight:models', generator_args.join(" ")
|
45
|
-
end
|
46
|
-
|
47
|
-
# Add Blacklight to the application controller
|
48
|
-
def inject_blacklight_controller_behavior
|
49
|
-
# prepend_file("app/controllers/application_controller.rb", "require 'blacklight/controller'\n\n")
|
50
|
-
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
51
|
-
" # Adds a few additional behaviors into the application controller \n " +
|
52
|
-
" include Blacklight::Controller\n" +
|
53
|
-
" # Please be sure to impelement current_user and user_session. Blacklight depends on \n" +
|
54
|
-
" # these methods in order to perform user specific actions. \n\n" +
|
55
|
-
" layout 'blacklight'\n\n"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Generate blacklight catalog controller
|
60
|
-
def create_blacklight_catalog
|
61
|
-
copy_file "catalog_controller.rb", "app/controllers/catalog_controller.rb"
|
62
|
-
end
|
63
|
-
|
64
|
-
def generate_blacklight_marc_demo
|
65
|
-
if options[:marc]
|
66
|
-
gem "blacklight_marc"
|
67
|
-
|
68
|
-
Bundler.with_clean_env do
|
69
|
-
run "bundle install"
|
70
|
-
end
|
71
|
-
|
72
|
-
generate 'blacklight_marc:marc'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def inject_blacklight_routes
|
77
|
-
# These will end up in routes.rb file in reverse order
|
78
|
-
# we add em, since each is added at the top of file.
|
79
|
-
# we want "root" to be FIRST for optimal url generation.
|
80
|
-
route('blacklight_for :catalog')
|
81
|
-
route('root :to => "catalog#index"')
|
82
|
-
end
|
83
|
-
|
84
|
-
def add_sass_configuration
|
85
|
-
|
86
|
-
insert_into_file "config/application.rb", :after => "config.assets.enabled = true" do <<EOF
|
87
|
-
|
88
|
-
# Default SASS Configuration, check out https://github.com/rails/sass-rails for details
|
89
|
-
config.assets.compress = !Rails.env.development?
|
90
|
-
|
91
|
-
EOF
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class AddUserTypesToBookmarksSearches < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
add_column :searches, :user_type, :string
|
5
|
-
add_column :bookmarks, :user_type, :string
|
6
|
-
Search.reset_column_information
|
7
|
-
Bookmark.reset_column_information
|
8
|
-
Search.update_all("user_type = '<%=model_name%>'")
|
9
|
-
Bookmark.update_all("user_type = '<%=model_name%>'")
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
remove_column :searches, :user_type
|
14
|
-
remove_column :bookmarks, :user_type
|
15
|
-
end
|
16
|
-
end
|
data/lib/generators/blacklight/templates/migrations/remove_editable_fields_from_bookmarks.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class RemoveEditableFieldsFromBookmarks < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
remove_column :bookmarks, :notes
|
5
|
-
remove_column :bookmarks, :url
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
add_column :bookmarks, :notes, :text
|
10
|
-
add_column :bookmarks, :url, :string
|
11
|
-
end
|
12
|
-
end
|
data/lib/railties/all_tests.rake
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
namespace :blacklight do
|
2
|
-
begin
|
3
|
-
require 'rspec/core'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
desc "Run Blacklight rspec, with test solr"
|
7
|
-
task :all_tests => :hudson
|
8
|
-
|
9
|
-
desc "Run Blacklight rspec, with test solr"
|
10
|
-
task :hudson do
|
11
|
-
Rails.env = 'test' unless ENV['RAILS_ENV']
|
12
|
-
|
13
|
-
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
14
|
-
Rake::Task["blacklight:spec"].invoke
|
15
|
-
end
|
16
|
-
|
17
|
-
raise "test failures: #{error}" if error
|
18
|
-
end
|
19
|
-
|
20
|
-
namespace :all_tests do
|
21
|
-
task :rcov do
|
22
|
-
desc "Run Blacklight rspec tests with rcov"
|
23
|
-
|
24
|
-
rm "blacklight-coverage.data" if File.exist?("blacklight-coverage.data")
|
25
|
-
Rails.env = 'test' unless ENV['RAILS_ENV']
|
26
|
-
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
27
|
-
Rake::Task["blacklight:spec:rcov"].invoke
|
28
|
-
end
|
29
|
-
raise "test failures: #{error}" if error
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
rescue LoadError
|
34
|
-
desc "Not available! (rspec not avail)"
|
35
|
-
task :all_tests do
|
36
|
-
abort 'Not available. Rspec needs to be installed to run blacklight:all_tests'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,128 +0,0 @@
|
|
1
|
-
# Blacklight customization of the Rake tasks that come with rspec-2, to run
|
2
|
-
# specs located in alternate location (inside BL plugin), and to provide
|
3
|
-
# rake tasks for jetty/solr wrapping.
|
4
|
-
#
|
5
|
-
# Same tasks as in ordinary rspec, but prefixed with blacklight:.
|
6
|
-
#
|
7
|
-
# rspec2 keeps it's rake tasks inside it's own code, it doesn't generate them.
|
8
|
-
# We had to copy them from there and modify, may have to be done again
|
9
|
-
# if rspec2 changes a lot, but this code looks relatively cleanish.
|
10
|
-
begin
|
11
|
-
require 'rspec/core'
|
12
|
-
require 'rspec/core/rake_task'
|
13
|
-
if default = Rake.application.instance_variable_get('@tasks')['default']
|
14
|
-
default.prerequisites.delete('test')
|
15
|
-
end
|
16
|
-
|
17
|
-
spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ? "db:test:prepare" : :noop
|
18
|
-
task :noop do; end
|
19
|
-
#task :default => :spec
|
20
|
-
|
21
|
-
blacklight_spec = File.expand_path("./test_support/spec", Blacklight.root)
|
22
|
-
|
23
|
-
# Set env variable to tell our spec/spec_helper.rb where we really are,
|
24
|
-
# so it doesn't have to guess with relative path, which will be wrong
|
25
|
-
# since we allow spec_dir to be in a remote location. spec_helper.rb
|
26
|
-
# needs it before Rails.root is defined there, even though we can
|
27
|
-
# oddly get it here, i dunno.
|
28
|
-
ENV['RAILS_ROOT'] = Rails.root.to_s
|
29
|
-
|
30
|
-
namespace :blacklight do
|
31
|
-
|
32
|
-
desc "Run all specs in spec directory (excluding plugin specs)"
|
33
|
-
RSpec::Core::RakeTask.new(:spec => spec_prereq) do |t|
|
34
|
-
# the user might not have run rspec generator because they don't
|
35
|
-
# actually need it, but without an ./.rspec they won't get color,
|
36
|
-
# let's insist.
|
37
|
-
t.rspec_opts = "--colour"
|
38
|
-
|
39
|
-
# pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
|
40
|
-
t.pattern = "#{blacklight_spec}"
|
41
|
-
end
|
42
|
-
|
43
|
-
# Don't understand what this does or how to make it use our remote stats_directory
|
44
|
-
#task :stats => "spec:statsetup"
|
45
|
-
|
46
|
-
namespace :spec do
|
47
|
-
[:requests, :models, :controllers, :views, :helpers, :mailers, :lib, :routing].each do |sub|
|
48
|
-
desc "Run the code examples in spec/#{sub}"
|
49
|
-
RSpec::Core::RakeTask.new(sub => spec_prereq) do |t|
|
50
|
-
# the user might not have run rspec generator because they don't
|
51
|
-
# actually need it, but without an ./.rspec they won't get color,
|
52
|
-
# let's insist.
|
53
|
-
t.rspec_opts = "--colour"
|
54
|
-
|
55
|
-
# pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
|
56
|
-
t.pattern = "#{blacklight_spec}/#{sub}"
|
57
|
-
|
58
|
-
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
59
|
-
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
60
|
-
t.rcov = true
|
61
|
-
t.rcov_opts = %w{--rails -I../../app -I../../lib --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
62
|
-
t.rcov_opts << %[-o "../../coverage/rcov"]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
desc "Run all specs with rcov"
|
68
|
-
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
|
69
|
-
t.rcov = true
|
70
|
-
# pattern directory name defaults to ./**/*_spec.rb, but has a more concise command line echo
|
71
|
-
t.pattern = File.join(blacklight_spec, "/**/*_spec.rb")
|
72
|
-
t.rspec_opts = "--colour"
|
73
|
-
t.rcov_opts = '-o "../../coverage/rcov" --exclude /gems/,/Library/,/usr/,lib/tasks,.bundle,config,/lib/rspec/,/lib/rspec-'
|
74
|
-
end
|
75
|
-
|
76
|
-
# Blacklight. Solr wrapper. for now just for blacklight:spec, plan to
|
77
|
-
# provide it for all variants eventually.
|
78
|
-
# if you would like to see solr startup messages on STDERR
|
79
|
-
# when starting solr test server during functional tests use:
|
80
|
-
#
|
81
|
-
# rake SOLR_CONSOLE=true
|
82
|
-
desc "blacklight:solr with jetty/solr launch"
|
83
|
-
task :with_solr do
|
84
|
-
require 'jettywrapper'
|
85
|
-
# wrap tests with a test-specific Solr server
|
86
|
-
# Need to look up where the test jetty is located
|
87
|
-
# from solr.yml, we don't hardcode it anymore.
|
88
|
-
|
89
|
-
Rails.env = 'test' unless ENV['RAILS_ENV']
|
90
|
-
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
91
|
-
Rake::Task["blacklight:spec"].invoke
|
92
|
-
end
|
93
|
-
raise "test failures: #{error}" if error
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
# Don't understand what this does or how to make it use our remote stats_directory.
|
98
|
-
# task :statsetup do
|
99
|
-
# require 'rails/code_statistics'
|
100
|
-
# ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
101
|
-
# ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
102
|
-
# ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
103
|
-
# ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
104
|
-
# ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
105
|
-
# ::STATS_DIRECTORIES << %w(Mailer\ specs spec/mailers) if File.exist?('spec/mailers')
|
106
|
-
# ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
|
107
|
-
# ::STATS_DIRECTORIES << %w(Request\ specs spec/requests) if File.exist?('spec/requests')
|
108
|
-
# ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
109
|
-
# ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
110
|
-
# ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
111
|
-
# ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
112
|
-
# ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
113
|
-
# ::CodeStatistics::TEST_TYPES << "Mailer specs" if File.exist?('spec/mailers')
|
114
|
-
# ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
115
|
-
# ::CodeStatistics::TEST_TYPES << "Request specs" if File.exist?('spec/requests')
|
116
|
-
# end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
rescue LoadError
|
120
|
-
# This rescue pattern stolen from cucumber; rspec didn't need it before since
|
121
|
-
# tasks only lived in rspec gem itself, but for Blacklight since we're copying
|
122
|
-
# these tasks into BL, we use the rescue so you can still run BL (without
|
123
|
-
# these tasks) even if you don't have rspec installed.
|
124
|
-
desc 'rspec rake tasks not available (rspec not installed)'
|
125
|
-
task :spec do
|
126
|
-
abort 'Rspec rake tasks not available. Be sure to install rspec gems. '
|
127
|
-
end
|
128
|
-
end
|