atrium 0.0.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/.rvmrc +32 -0
- data/GETTING_STARTED.textile +109 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +320 -0
- data/Guardfile +10 -0
- data/README.mkd +56 -0
- data/Rakefile +6 -0
- data/app/assets/images/atrium/ajax-loader.gif +0 -0
- data/app/assets/images/atrium/lightbox-ico-loading.gif +0 -0
- data/app/assets/images/atrium/logo.png +0 -0
- data/app/assets/javascripts/atrium/atrium.js +281 -0
- data/app/assets/javascripts/chosen.jquery.js +899 -0
- data/app/assets/javascripts/ckeditor.warning.js +65 -0
- data/app/assets/javascripts/ckeditor/config.js.coffee +6 -0
- data/app/assets/javascripts/ckeditor/jquery.generateId.js +13 -0
- data/app/assets/javascripts/ckeditor/jquery.jeditable.ckeditor.js +59 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/application_link.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/dialogs/linkItem.js +1470 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/plugin.js +16 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/ui_toolbar_pencil.png +0 -0
- data/app/assets/javascripts/jquery.colorbox.js +864 -0
- data/app/assets/javascripts/jquery.jeditable.js +543 -0
- data/app/assets/stylesheets/atrium/atrium.css +216 -0
- data/app/assets/stylesheets/atrium/chosen-sprite.png +0 -0
- data/app/assets/stylesheets/atrium/chosen.css +367 -0
- data/app/assets/stylesheets/colorbox.css +42 -0
- data/app/assets/stylesheets/controls.png +0 -0
- data/app/assets/stylesheets/loading.gif +0 -0
- data/app/controllers/atrium/base_controller.rb +25 -0
- data/app/controllers/atrium/collection_exhibit_order_controller.rb +21 -0
- data/app/controllers/atrium/collections_controller.rb +165 -0
- data/app/controllers/atrium/customization_controller.rb +41 -0
- data/app/controllers/atrium/descriptions_controller.rb +177 -0
- data/app/controllers/atrium/exhibit_facet_order_controller.rb +19 -0
- data/app/controllers/atrium/exhibits_controller.rb +108 -0
- data/app/controllers/atrium/showcases_controller.rb +193 -0
- data/app/helpers/atrium/base_helper.rb +6 -0
- data/app/models/ability.rb +14 -0
- data/app/models/atrium/browse_level.rb +41 -0
- data/app/models/atrium/collection.rb +121 -0
- data/app/models/atrium/description.rb +128 -0
- data/app/models/atrium/essay.rb +21 -0
- data/app/models/atrium/exhibit.rb +58 -0
- data/app/models/atrium/search/facet.rb +29 -0
- data/app/models/atrium/search/facet_selection.rb +17 -0
- data/app/models/atrium/showcase.rb +173 -0
- data/app/models/atrium/showcase/facet_selection.rb +21 -0
- data/app/models/atrium/showcase/item.rb +19 -0
- data/app/models/role_mapper.rb +23 -0
- data/app/views/_user_util_links.html.erb +25 -0
- data/app/views/atrium/collections/_bookmark_control.html.erb +25 -0
- data/app/views/atrium/collections/_browse_index.html.erb +20 -0
- data/app/views/atrium/collections/_collection_items_index.html.erb +10 -0
- data/app/views/atrium/collections/_document.html.erb +24 -0
- data/app/views/atrium/collections/_document_list.html.erb +6 -0
- data/app/views/atrium/collections/_edit_navigation.html.erb +20 -0
- data/app/views/atrium/collections/_folder_control.html.erb +12 -0
- data/app/views/atrium/collections/_form.html.erb +93 -0
- data/app/views/atrium/collections/_listing.html.erb +18 -0
- data/app/views/atrium/collections/_navigation.html.erb +45 -0
- data/app/views/atrium/collections/_results_pagination.html.erb +9 -0
- data/app/views/atrium/collections/_sort_and_per_page.html.erb +23 -0
- data/app/views/atrium/collections/edit.html.erb +5 -0
- data/app/views/atrium/collections/new.html.erb +6 -0
- data/app/views/atrium/collections/show.html.erb +22 -0
- data/app/views/atrium/descriptions/_form.html.erb +64 -0
- data/app/views/atrium/descriptions/edit.html.erb +4 -0
- data/app/views/atrium/descriptions/index.html.erb +4 -0
- data/app/views/atrium/descriptions/new.html.erb +2 -0
- data/app/views/atrium/descriptions/show.html.erb +20 -0
- data/app/views/atrium/exhibits/_bookmark_control.html.erb +25 -0
- data/app/views/atrium/exhibits/_folder_control.html.erb +12 -0
- data/app/views/atrium/exhibits/_form.html.erb +108 -0
- data/app/views/atrium/exhibits/edit.html.erb +9 -0
- data/app/views/atrium/exhibits/new.html.erb +6 -0
- data/app/views/atrium/exhibits/show.html.erb +26 -0
- data/app/views/atrium/showcases/_showcase_navigation.html.erb +23 -0
- data/app/views/atrium/showcases/show.html.erb +1 -0
- data/app/views/catalog/_collection_home_text.html.erb +6 -0
- data/app/views/catalog/_constraints.html.erb +9 -0
- data/app/views/catalog/_default_collection_text.html.erb +18 -0
- data/app/views/catalog/_default_home_text.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +6 -0
- data/app/views/catalog/_index_partials/_description.html.erb +8 -0
- data/app/views/catalog/_search_form.html.erb +66 -0
- data/app/views/catalog/_show_partials/_description.html.erb +15 -0
- data/app/views/catalog/browse_show.html.erb +18 -0
- data/app/views/catalog/index.html.erb +35 -0
- data/app/views/catalog/list_description.html.erb +24 -0
- data/app/views/catalog/list_item.html.erb +3 -0
- data/app/views/layouts/atrium.html.erb +86 -0
- data/app/views/layouts/atrium_themes/default.html.erb +4 -0
- data/app/views/layouts/item_listing.html.erb +36 -0
- data/app/views/listing/_document.html.erb +27 -0
- data/app/views/listing/_document_list.html.erb +3 -0
- data/app/views/listing/_item_search.html.erb +27 -0
- data/app/views/shared/_banner.html.erb +5 -0
- data/app/views/shared/_collection_complete_list.html.erb +33 -0
- data/app/views/shared/_collection_search_form.html.erb +12 -0
- data/app/views/shared/_collection_title_header.html.erb +3 -0
- data/app/views/shared/_featured_sources.html.erb +20 -0
- data/app/views/shared/_list_descriptions.html.erb +38 -0
- data/app/views/shared/_navigation_browse_levels.html.erb +34 -0
- data/app/views/shared/_showcase_configure_menu.html.erb +22 -0
- data/app/views/shared/_top_navigation.html.erb +9 -0
- data/atrium.gemspec +76 -0
- data/config/routes.rb +12 -0
- data/init.rb +3 -0
- data/lib/application_controller.rb +24 -0
- data/lib/atrium.rb +42 -0
- data/lib/atrium/application_helper.rb +24 -0
- data/lib/atrium/atrium_helper_behavior.rb +162 -0
- data/lib/atrium/catalog.rb +203 -0
- data/lib/atrium/collections_helper.rb +139 -0
- data/lib/atrium/controller.rb +10 -0
- data/lib/atrium/descriptions_helper.rb +23 -0
- data/lib/atrium/engine.rb +12 -0
- data/lib/atrium/layout_helper.rb +13 -0
- data/lib/atrium/routes.rb +99 -0
- data/lib/atrium/solr_helper.rb +440 -0
- data/lib/atrium/version.rb +3 -0
- data/lib/generators/atrium/assets_generator.rb +44 -0
- data/lib/generators/atrium/atrium_generator.rb +149 -0
- data/lib/generators/atrium/cucumber_support_generator.rb +29 -0
- data/lib/generators/atrium/templates/config/role_map_cucumber.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_development.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_production.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_test.yml +2 -0
- data/lib/generators/atrium/templates/config/solr.yml +10 -0
- data/lib/generators/atrium/templates/db/seeds.rb +87 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_browse_levels.rb +18 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_collections.rb +20 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_descriptions.rb +16 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_essays.rb +15 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_exhibits.rb +16 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_search_facets.rb +14 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcase_facet_selections.rb +15 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcase_items.rb +17 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcases.rb +16 -0
- data/lib/generators/atrium/templates/themes/example.html.erb +21 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/atrium_cucumber.rake +121 -0
- data/lib/railties/index.rake +37 -0
- data/tasks/atrium.rake +268 -0
- data/tasks/atrium_rspec.rake +91 -0
- data/test_support/etc/Gemfile +33 -0
- data/test_support/etc/bundle_config +3 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/atrium_collections.feature +162 -0
- data/test_support/features/atrium_exhibits.feature +164 -0
- data/test_support/features/step_definitions/atrium_collection_steps.rb +102 -0
- data/test_support/features/step_definitions/atrium_exhibit_steps.rb +53 -0
- data/test_support/features/step_definitions/bookmarks_steps.rb +6 -0
- data/test_support/features/step_definitions/error_steps.rb +5 -0
- data/test_support/features/step_definitions/folder_steps.rb +27 -0
- data/test_support/features/step_definitions/general_steps.rb +50 -0
- data/test_support/features/step_definitions/record_view_steps.rb +12 -0
- data/test_support/features/step_definitions/saved_searches_steps.rb +22 -0
- data/test_support/features/step_definitions/search_facets_steps.rb +29 -0
- data/test_support/features/step_definitions/search_history_steps.rb +9 -0
- data/test_support/features/step_definitions/search_result_steps.rb +114 -0
- data/test_support/features/step_definitions/search_steps.rb +103 -0
- data/test_support/features/step_definitions/user_steps.rb +5 -0
- data/test_support/features/step_definitions/web_steps.rb +213 -0
- data/test_support/features/support/env.rb +67 -0
- data/test_support/features/support/paths.rb +76 -0
- data/test_support/features/support/selectors.rb +40 -0
- data/test_support/fixtures/atrium_exhibits.yml +3 -0
- data/test_support/spec/controllers/atrium/base_controller_spec.rb +13 -0
- data/test_support/spec/controllers/atrium/collection_exhibit_order_controller_spec.rb +29 -0
- data/test_support/spec/controllers/atrium/collections_controller_spec.rb +185 -0
- data/test_support/spec/controllers/atrium/customization_controller_spec.rb +38 -0
- data/test_support/spec/controllers/atrium/descriptions_controller_spec.rb +150 -0
- data/test_support/spec/controllers/atrium/exhibit_facet_order_controller_spec.rb +36 -0
- data/test_support/spec/controllers/atrium/exhibits_controller_spec.rb +192 -0
- data/test_support/spec/controllers/atrium/showcases_controller_spec.rb +185 -0
- data/test_support/spec/helpers/atrium_collections_helper_spec.rb +147 -0
- data/test_support/spec/helpers/atrium_description_helper_spec.rb +47 -0
- data/test_support/spec/helpers/atrium_solr_helper_spec.rb +512 -0
- data/test_support/spec/models/atrium/browse_level_spec.rb +31 -0
- data/test_support/spec/models/atrium/collection_spec.rb +30 -0
- data/test_support/spec/models/atrium/description_spec.rb +67 -0
- data/test_support/spec/models/atrium/essay_spec.rb +12 -0
- data/test_support/spec/models/atrium/exhibit_spec.rb +76 -0
- data/test_support/spec/models/atrium/search/facet_selection_spec.rb +24 -0
- data/test_support/spec/models/atrium/search/facet_spec.rb +11 -0
- data/test_support/spec/models/atrium/search_facet_spec.rb +54 -0
- data/test_support/spec/models/atrium/showcase/facet_selection_spec.rb +15 -0
- data/test_support/spec/models/atrium/showcase/item_spec.rb +12 -0
- data/test_support/spec/models/atrium/showcase_facet_selection_spec.rb +65 -0
- data/test_support/spec/models/atrium/showcase_spec.rb +134 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/routing/atrium/collections_routing_spec.rb +33 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +47 -0
- data/test_support/spec/support/be_accessible_matcher.rb +8 -0
- data/test_support/spec/support/be_routed_mixin.rb +7 -0
- data/test_support/tmp/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/tmp/step_definitions/edit_document_steps.rb +67 -0
- data/test_support/tmp/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/tmp/step_definitions/hydra_steps.rb +8 -0
- data/test_support/tmp/step_definitions/search_steps.rb +86 -0
- data/test_support/tmp/step_definitions/searching_steps.rb +22 -0
- data/test_support/tmp/step_definitions/select_steps.rb +8 -0
- data/test_support/tmp/step_definitions/show_document_steps.rb +73 -0
- data/test_support/tmp/step_definitions/user_steps.rb +15 -0
- data/test_support/tmp/step_definitions/web_steps.rb +273 -0
- data/test_support/tmp/support/env.rb +54 -0
- data/test_support/tmp/support/paths.rb +57 -0
- metadata +1047 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
# Copy Atrium assets to public folder in current app.
|
3
|
+
# If you want to do this on application startup, you can
|
4
|
+
# add this next line to your one of your environment files --
|
5
|
+
# generally you'd only want to do this in 'development', and can
|
6
|
+
# add it to environments/development.rb:
|
7
|
+
# require File.join(Atrium.root, "lib", "generators", "atrium", "assets_generator.rb")
|
8
|
+
# Atrium::Assets.start(["--force", "--quiet"])
|
9
|
+
|
10
|
+
|
11
|
+
# Need the requires here so we can call the generator from environment.rb
|
12
|
+
# as suggested above.
|
13
|
+
require 'rails/generators'
|
14
|
+
require 'rails/generators/base'
|
15
|
+
module Atrium
|
16
|
+
class Assets < Rails::Generators::Base
|
17
|
+
source_root File.expand_path('../templates', __FILE__)
|
18
|
+
|
19
|
+
def assets
|
20
|
+
unless IO.read("app/assets/stylesheets/application.css").include?("Atrium")
|
21
|
+
insert_into_file "app/assets/stylesheets/application.css", :before => "*/" do
|
22
|
+
%q{
|
23
|
+
* Required by Atrium:
|
24
|
+
*= require 'colorbox'
|
25
|
+
*= require 'atrium/chosen'
|
26
|
+
*= require 'atrium/atrium'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
unless IO.read("app/assets/javascripts/application.js").include?('atrium/atrium')
|
32
|
+
insert_into_file "app/assets/javascripts/application.js", :after => "//= require jquery_ujs" do
|
33
|
+
%q{
|
34
|
+
//
|
35
|
+
// Required by Atrium
|
36
|
+
//= require atrium/atrium}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
directory("../../../../app/assets/images/atrium", "app/assets/images/atrium")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
# require "generators/blacklight/blacklight_generator"
|
6
|
+
|
7
|
+
module Atrium
|
8
|
+
class AtriumGenerator < Rails::Generators::Base
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
|
11
|
+
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
|
13
|
+
argument :model_name, :type => :string , :default => "user"
|
14
|
+
|
15
|
+
desc """
|
16
|
+
This generator makes the following changes to your application:
|
17
|
+
1. Creates several database migrations if they do not exist in /db/migrate
|
18
|
+
2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
|
19
|
+
3. Creates config/solr.yml which you may need to modify to tell atrium where to find fedora & solr
|
20
|
+
6. Creates a number of role_map config files that are used in the placeholder user roles implementation
|
21
|
+
Enjoy!
|
22
|
+
|
23
|
+
"""
|
24
|
+
#
|
25
|
+
# Config Files & Initializers
|
26
|
+
#
|
27
|
+
# Copy all files in templates/config directory to host config
|
28
|
+
def create_configuration_files
|
29
|
+
# Role Mappings
|
30
|
+
copy_file "config/role_map_cucumber.yml", "config/role_map_cucumber.yml"
|
31
|
+
copy_file "config/role_map_development.yml", "config/role_map_development.yml"
|
32
|
+
copy_file "config/role_map_production.yml", "config/role_map_production.yml"
|
33
|
+
copy_file "config/role_map_test.yml", "config/role_map_test.yml"
|
34
|
+
|
35
|
+
# Solr config
|
36
|
+
copy_file "config/solr.yml", "config/solr.yml"
|
37
|
+
|
38
|
+
# Themes
|
39
|
+
copy_file "themes/example.html.erb", "app/views/layouts/atrium_themes/example.html.erb"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Copy all files in templates/public/ directory to public/
|
43
|
+
# Call external generator in AssetsGenerator, so we can
|
44
|
+
# leave that callable seperately too.
|
45
|
+
def copy_public_assets
|
46
|
+
generate "atrium:assets"
|
47
|
+
end
|
48
|
+
|
49
|
+
# Register mimetypes required by hydra-head
|
50
|
+
def add_mime_types
|
51
|
+
puts "Updating Mime Types"
|
52
|
+
insert_into_file "config/initializers/mime_types.rb", :before => 'Mime::Type.register_alias "text/plain", :refworks_marc_txt' do <<EOF
|
53
|
+
Mime::Type.register_alias "text/html", :textile
|
54
|
+
Mime::Type.register_alias "text/html", :inline
|
55
|
+
|
56
|
+
EOF
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Migrations
|
62
|
+
#
|
63
|
+
|
64
|
+
# Implement the required interface for Rails::Generators::Migration.
|
65
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
66
|
+
def self.next_migration_number(dirname)
|
67
|
+
unless @previous_migration_nr
|
68
|
+
if ActiveRecord::Base.timestamped_migrations
|
69
|
+
@previous_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
70
|
+
else
|
71
|
+
@previous_migration_nr = "%.3d" % (current_migration_number(dirname) + 1).to_i
|
72
|
+
end
|
73
|
+
else
|
74
|
+
@previous_migration_nr +=1
|
75
|
+
end
|
76
|
+
@previous_migration_nr.to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
# Add Atrium behaviors and Filters to ApplicationHelper
|
80
|
+
def inject_atrium_helper_behavior
|
81
|
+
insert_into_file "app/helpers/application_helper.rb", :after => 'module ApplicationHelper' do
|
82
|
+
"\n # Adds a atrium collections behaviors into the application helper \n " +
|
83
|
+
" include Atrium::ApplicationHelper\n" +
|
84
|
+
" include Atrium::CollectionsHelper\n" +
|
85
|
+
" include CatalogHelper\n"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Add Atrium behaviors and Filters to CatalogController
|
90
|
+
def inject_atrium_catalog_behavior
|
91
|
+
puts "Adding Atrium behaviors to CatalogController"
|
92
|
+
controller_name = "catalog_controller"
|
93
|
+
file_path = "app/controllers/#{controller_name.underscore}.rb"
|
94
|
+
if File.exists?(file_path)
|
95
|
+
insert_into_file file_path, :after => "require 'blacklight/catalog'" do
|
96
|
+
"\nrequire 'atrium/catalog'"
|
97
|
+
end
|
98
|
+
insert_into_file file_path, :after => 'include Blacklight::Catalog' do
|
99
|
+
"\n # Extend Blacklight::Catalog with Atrium behaviors (primarily editing)." +
|
100
|
+
"\n include Atrium::Catalog"
|
101
|
+
end
|
102
|
+
else
|
103
|
+
puts " \e[31mFailure\e[0m Could not find #{model_name.underscore}.rb. To add Atrium behaviors to your Blacklight::Catalog Controllers, you must include the Atrium::Controller module in the Controller class definition."
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Add Atrium to the application controller
|
108
|
+
def inject_atrium_controller_behavior
|
109
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
110
|
+
" # Adds Atrium behaviors into the application controller \n " +
|
111
|
+
" include Atrium::Controller\n\n"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Inject call to Atrium.add_routes in config/routes.rb
|
116
|
+
def inject_atrium_routes
|
117
|
+
puts "here"
|
118
|
+
insert_into_file "config/routes.rb", :after => 'Blacklight.add_routes(self)' do
|
119
|
+
"\n # Add Atrium routes."
|
120
|
+
"\n Atrium.add_routes(self)"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Setup the database migrations
|
125
|
+
def copy_migrations
|
126
|
+
# Can't get this any more DRY, because we need this order.
|
127
|
+
better_migration_template "create_atrium_collections.rb"
|
128
|
+
better_migration_template "create_atrium_search_facets.rb"
|
129
|
+
better_migration_template "create_atrium_exhibits.rb"
|
130
|
+
better_migration_template "create_atrium_showcases.rb"
|
131
|
+
better_migration_template "create_atrium_showcase_items.rb"
|
132
|
+
better_migration_template "create_atrium_showcase_facet_selections.rb"
|
133
|
+
better_migration_template "create_atrium_browse_levels.rb"
|
134
|
+
better_migration_template "create_atrium_descriptions.rb"
|
135
|
+
better_migration_template "create_atrium_essays.rb"
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def better_migration_template(file)
|
141
|
+
begin
|
142
|
+
migration_template "migrations/#{file}", "db/migrate/#{file}"
|
143
|
+
sleep 1 # ensure scripts have different time stamps
|
144
|
+
rescue
|
145
|
+
puts " \e[1m\e[34mMigrations\e[0m " + $!.message
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end # AtriumGenerator
|
149
|
+
end # Atrium
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
module Atrium
|
6
|
+
class CucumberSupportGenerator < Rails::Generators::Base
|
7
|
+
|
8
|
+
source_root File.expand_path('../../../../test_support/features', __FILE__)
|
9
|
+
|
10
|
+
argument :features_dir, :type => :string , :default => "features"
|
11
|
+
|
12
|
+
desc """
|
13
|
+
This Generator copies Hydra's cucumber step definitions and paths into your application's features directory.
|
14
|
+
We have plans to provide the step definitions directly through the hydra-head gem without requiring this step of copying the files.
|
15
|
+
In the meantime, you need to copy the files in order to use them.
|
16
|
+
|
17
|
+
Defaults to assuming that your cucumber features live in a directory called \"features\". To pass in an alternative path to your features directory,
|
18
|
+
|
19
|
+
rails generate atrium:cucumber_support test_support/features
|
20
|
+
|
21
|
+
"""
|
22
|
+
|
23
|
+
def cucumber_support
|
24
|
+
directory("step_definitions", "#{features_dir}/step_definitions")
|
25
|
+
copy_file("support/paths.rb", "#{features_dir}/support/paths.rb")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This is a sample config file that does not have multiple solr instances. You will also need to be sure to
|
2
|
+
# edit the fedora.yml file to match the solr URL for active-fedora.
|
3
|
+
development:
|
4
|
+
url: http://localhost:8983/solr
|
5
|
+
test: &TEST
|
6
|
+
url: http://127.0.0.1:8983/solr
|
7
|
+
cucumber:
|
8
|
+
<<: *TEST
|
9
|
+
production:
|
10
|
+
url: http://your.production.server:8080/bl_solr/core0
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
+
# Mayor.create(:name => 'Emanuel', :city => cities.first)
|
8
|
+
|
9
|
+
#############################################
|
10
|
+
# User Configuration
|
11
|
+
#############################################
|
12
|
+
email= "test@test.com"
|
13
|
+
if User.find_by_email(email).nil?
|
14
|
+
user= User.create(:email => email, :password => "password", :password_confirmation => "password")
|
15
|
+
else
|
16
|
+
user= User.find_by_email(email)
|
17
|
+
end
|
18
|
+
puts "user created: #{user.inspect}"
|
19
|
+
|
20
|
+
#############################################
|
21
|
+
# Collection Configuration
|
22
|
+
#############################################
|
23
|
+
|
24
|
+
collection= Atrium::Collection.create
|
25
|
+
search_facet= Atrium::Search::Facet.create([{:name=> "format", :atrium_collection_id=> collection.id}])
|
26
|
+
puts "collection created: #{collection.inspect}, search_facet: #{search_facet.inspect}"
|
27
|
+
collection2=Atrium::Collection.create
|
28
|
+
|
29
|
+
#############################################
|
30
|
+
# Exhibit Configuration
|
31
|
+
#############################################
|
32
|
+
exhibit= Atrium::Exhibit.create([{:set_number=> 1, :atrium_collection_id=> collection.id, :label=> "Exhibit 1"}])
|
33
|
+
exhibit2= Atrium::Exhibit.create([{:set_number=> 1, :atrium_collection_id=> collection2.id, :label=> "Exhibit 1"}])
|
34
|
+
puts "exhibit created: #{exhibit.inspect}"
|
35
|
+
facet1=Atrium::BrowseLevel.create([{:atrium_exhibit_id=>1, :level_number=>1, :solr_facet_name=>'pub_date', :label=>'Publication Year'}])
|
36
|
+
facet2=Atrium::BrowseLevel.create([{:atrium_exhibit_id=>1, :level_number=>2, :solr_facet_name=>'language_facet', :label=>'Language'}])
|
37
|
+
|
38
|
+
########################################################################
|
39
|
+
# Add some description to solr which can be used to link to collection
|
40
|
+
########################################################################
|
41
|
+
Blacklight.solr.delete_by_id("desc_solr:1")
|
42
|
+
Blacklight.solr.delete_by_id("desc_solr:2")
|
43
|
+
Blacklight.solr.delete_by_id("desc_solr:3")
|
44
|
+
Blacklight.solr.commit
|
45
|
+
|
46
|
+
doc1= {
|
47
|
+
:id => "desc_solr:1",
|
48
|
+
:format => "Description",
|
49
|
+
:active_fedora_model_s => "Description",
|
50
|
+
:title_t => "Land Office Bank Currency",
|
51
|
+
:title_facet => "Land Office Bank Currency",
|
52
|
+
:title_s => "Land Office Bank Currency",
|
53
|
+
:page_display_s => "newpage",
|
54
|
+
:page_display_t => "newpage",
|
55
|
+
:description_content_s => "<p style=\"margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; \"><span class=\"Apple-style-span\" style=\"color: rgb(51, 51, 51); font-family: Verdana, 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif; font-size: 11px; line-height: 15px; \">Very few colonists had liquid assets as most settlers were small farmers or local merchants holding their wealth as land or in the form of perishable commodities. This situation inhibited investment and economic development. In order to assist people in obtaining liquidity several colonies instituted "Land Office Banks." The bank was operated by the colony with the consent of the Governor and the Board of Trade in London. Basically, a colony would print emissions of currency called "Land Office" notes. In several colonies the notes were allotted to local town or county boards. Property owners could then apply to their local board for a loan, usually up to £100 offering as collateral a portion of their property that was assessed at twice the value of the loan. The individual was required to pay off the loan with interest over a prescribed period of time.</span></p>"
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
doc2= {
|
60
|
+
:id => "desc_solr:2",
|
61
|
+
:format => "Description",
|
62
|
+
:active_fedora_model_s => "Description",
|
63
|
+
:title_t => "Description 2",
|
64
|
+
:title_facet => "Description 2",
|
65
|
+
:title_s => "Description 2",
|
66
|
+
:page_display_s => "samepage",
|
67
|
+
:page_display_t => "samepage",
|
68
|
+
:description_content_s => "this is the actually description of the essay"
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
doc3= {
|
73
|
+
:id => "desc_solr:3",
|
74
|
+
:format => "Description",
|
75
|
+
:active_fedora_model_s => "Description",
|
76
|
+
:title_t => "Description 3",
|
77
|
+
:title_facet => "Description 3",
|
78
|
+
:title_s => "Description 3",
|
79
|
+
:page_display_s => "newpage",
|
80
|
+
:page_display_t => "newpage",
|
81
|
+
:description_content_s => "this is the actually description of the essay"
|
82
|
+
}
|
83
|
+
|
84
|
+
Blacklight.solr.add doc1
|
85
|
+
Blacklight.solr.add doc2
|
86
|
+
Blacklight.solr.add doc3
|
87
|
+
Blacklight.solr.commit
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateAtriumBrowseLevels < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_browse_levels do |t|
|
4
|
+
t.integer :atrium_exhibit_id, :null=>false
|
5
|
+
t.integer :level_number, :null=>false
|
6
|
+
t.string :filter_query_params
|
7
|
+
t.string :solr_facet_name
|
8
|
+
t.string :label
|
9
|
+
t.string :exclude_query_params
|
10
|
+
end
|
11
|
+
add_index :atrium_browse_levels, :id
|
12
|
+
add_index :atrium_browse_levels, :atrium_exhibit_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :atrium_browse_levels
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateAtriumCollections < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_collections do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :url_slug
|
6
|
+
t.string :filter_query_params
|
7
|
+
t.string :theme
|
8
|
+
t.text :title_markup
|
9
|
+
t.text :collection_description
|
10
|
+
t.text :search_instructions
|
11
|
+
t.text :collection_items
|
12
|
+
end
|
13
|
+
add_index :atrium_collections, :id
|
14
|
+
add_index :atrium_collections, :url_slug
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
drop_table :atrium_collections
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateAtriumDescriptions < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_descriptions do |t|
|
4
|
+
t.integer :atrium_showcase_id, :null=>false
|
5
|
+
t.string :page_display
|
6
|
+
t.string :title
|
7
|
+
t.string :description_solr_id
|
8
|
+
end
|
9
|
+
add_index :atrium_descriptions, :id
|
10
|
+
add_index :atrium_descriptions, :atrium_showcase_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :atrium_descriptions
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateAtriumEssays < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_essays do |t|
|
4
|
+
t.integer :atrium_description_id, :null=>false
|
5
|
+
t.string :content_type
|
6
|
+
t.text :content
|
7
|
+
end
|
8
|
+
add_index :atrium_essays, :id
|
9
|
+
add_index :atrium_essays, :atrium_description_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :atrium_contents
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateAtriumExhibits < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_exhibits do |t|
|
4
|
+
t.integer :atrium_collection_id, :null=>false
|
5
|
+
t.integer :set_number, :null=>false
|
6
|
+
t.string :label
|
7
|
+
t.string :filter_query_params
|
8
|
+
end
|
9
|
+
add_index :atrium_exhibits, :id
|
10
|
+
add_index :atrium_exhibits, :atrium_collection_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :atrium_exhibits
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateAtriumSearchFacets < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :atrium_search_facets do |t|
|
4
|
+
t.integer :atrium_collection_id, :null=>false
|
5
|
+
t.string :name
|
6
|
+
end
|
7
|
+
add_index :atrium_search_facets, :id
|
8
|
+
add_index :atrium_search_facets, :atrium_collection_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table :atrium_search_facets
|
13
|
+
end
|
14
|
+
end
|