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,19 @@
|
|
1
|
+
class Atrium::ExhibitFacetOrderController < Atrium::BaseController
|
2
|
+
def index
|
3
|
+
@facet_order = Atrium::Exhibit.find(params[:id]).facet_order rescue nil
|
4
|
+
|
5
|
+
respond_to do |format|
|
6
|
+
format.json { render :json => @facet_order }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# NOTE this action is not currently protected from unauthorized use.
|
11
|
+
def update
|
12
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
13
|
+
@exhibit.facet_order = params[:collection]
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.json { render :json => @exhibit.facet_order }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
class Atrium::ExhibitsController < Atrium::BaseController
|
2
|
+
|
3
|
+
before_filter :initialize_collection, :except=>[:index, :create]
|
4
|
+
|
5
|
+
def new
|
6
|
+
@exhibit = Atrium::Exhibit.new
|
7
|
+
respond_to do |format|
|
8
|
+
format.html
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
@exhibit = Atrium::Exhibit.new(params[:atrium_exhibit])
|
14
|
+
if @exhibit.update_attributes(params[:atrium_exhibit])
|
15
|
+
flash[:notice] = 'Exhibit was successfully created.'
|
16
|
+
redirect_to :controller=>"atrium/collections", :action => "edit", :id=>@exhibit.atrium_collection_id
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def edit
|
21
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
22
|
+
@atrium_collection = @exhibit.collection
|
23
|
+
@exhibit_navigation_data = get_exhibit_navigation_data
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
28
|
+
if @exhibit.update_attributes(params[:atrium_exhibit])
|
29
|
+
flash[:notice] = 'Exhibit was successfully updated.'
|
30
|
+
end
|
31
|
+
redirect_to :action => "edit"
|
32
|
+
end
|
33
|
+
|
34
|
+
def show
|
35
|
+
#get children of emission dates
|
36
|
+
@members = get_all_children(@browse_document_list, "is_member_of_s")
|
37
|
+
@exhibit= Atrium::Exhibit.find(params[:id])
|
38
|
+
@exhibit_navigation_data = get_exhibit_navigation_data
|
39
|
+
if @exhibit && @exhibit.filter_query_params && @exhibit.filter_query_params[:solr_doc_ids]
|
40
|
+
|
41
|
+
items_document_ids = @exhibit.filter_query_params[:solr_doc_ids].split(',')
|
42
|
+
|
43
|
+
@collection_items_response, @collection_items_documents = get_solr_response_for_field_values("id",items_document_ids || [])
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
@atrium_showcase=Atrium::Showcase.with_selected_facets(@exhibit.id, @exhibit.class.name, params[:f]).first
|
48
|
+
if @atrium_showcase && !@atrium_showcase.showcase_items[:solr_doc_ids].nil?
|
49
|
+
|
50
|
+
selected_document_ids = @atrium_showcase.showcase_items[:solr_doc_ids].split(',')
|
51
|
+
|
52
|
+
@featured_response, @featured_documents = get_solr_response_for_field_values("id",selected_document_ids || [])
|
53
|
+
end
|
54
|
+
@description_hash=get_description_for_showcase(@atrium_showcase) unless @atrium_showcase.nil?
|
55
|
+
if params[:no_layout]
|
56
|
+
render :layout=>false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_exhibit_scope
|
61
|
+
logger.error("into scoping")
|
62
|
+
session[:copy_folder_document_ids] = session[:folder_document_ids]
|
63
|
+
session[:folder_document_ids] = []
|
64
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
65
|
+
|
66
|
+
session[:folder_document_ids] = @exhibit.filter_query_params[:solr_doc_ids].split(',') if @exhibit.filter_query_params && @exhibit.filter_query_params[:solr_doc_ids]
|
67
|
+
p = params.dup
|
68
|
+
p.delete :action
|
69
|
+
p.delete :id
|
70
|
+
p.delete :controller
|
71
|
+
#make sure to pass in a search_fields parameter so that it shows search results immediately
|
72
|
+
redirect_to catalog_index_path(p)
|
73
|
+
end
|
74
|
+
|
75
|
+
def unset_exhibit_scope
|
76
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
77
|
+
@exhibit.update_attributes(:filter_query_params=>nil)
|
78
|
+
flash[:notice] = 'Exhibit scope removed successfully'
|
79
|
+
render :action => "edit"
|
80
|
+
end
|
81
|
+
|
82
|
+
def destroy
|
83
|
+
@exhibit = Atrium::Exhibit.find(params[:id])
|
84
|
+
Atrium::Exhibit.destroy(params[:id])
|
85
|
+
flash[:notice] = 'Exhibit '+params[:id] +' was deleted successfully.'
|
86
|
+
redirect_to edit_atrium_collection_path(@exhibit.atrium_collection_id)
|
87
|
+
end
|
88
|
+
|
89
|
+
def initialize_collection
|
90
|
+
if collection_id = determine_collection_id
|
91
|
+
return __initialize_collection( collection_id )
|
92
|
+
else
|
93
|
+
return false
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def determine_collection_id
|
101
|
+
if params[:id]
|
102
|
+
exhibit = Atrium::Exhibit.find(params[:id])
|
103
|
+
collection_id = exhibit.atrium_collection_id if exhibit
|
104
|
+
end
|
105
|
+
return collection_id
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
class Atrium::ShowcasesController < Atrium::BaseController
|
2
|
+
|
3
|
+
before_filter :initialize_collection
|
4
|
+
|
5
|
+
def new
|
6
|
+
@parent=parent_object
|
7
|
+
@atrium_showcase= Atrium::Showcase.with_selected_facets(@parent.id, @parent.class.name, params[:facet_selection]).first
|
8
|
+
unless @atrium_showcase
|
9
|
+
@atrium_showcase = @parent.showcases.build({:showcases_id=>@parent.id, :showcases_type=>@parent.class.name})
|
10
|
+
@atrium_showcase.save!
|
11
|
+
if(params[:facet_selection])
|
12
|
+
params[:facet_selection].collect {|key,value| facet_selection = @atrium_showcase.facet_selections.create({:solr_facet_name=>key,:value=>value.first}) }
|
13
|
+
@atrium_showcase.save!
|
14
|
+
end
|
15
|
+
end
|
16
|
+
set_edit_showcase_in_session
|
17
|
+
redirect_to parent_url(@atrium_showcase)
|
18
|
+
end
|
19
|
+
|
20
|
+
def show
|
21
|
+
@atrium_showcase = Atrium::Showcase.find(params[:id])
|
22
|
+
#TODO move this update to model rather in controller
|
23
|
+
unless session[:folder_document_ids].blank?
|
24
|
+
@atrium_showcase.showcase_items ||= Hash.new
|
25
|
+
selected_document_ids = session[:folder_document_ids]
|
26
|
+
@atrium_showcase.showcase_items[:type]="featured"
|
27
|
+
@atrium_showcase.showcase_items[:solr_doc_ids]=selected_document_ids.join(',')
|
28
|
+
else
|
29
|
+
@atrium_showcase.showcase_items={}
|
30
|
+
end
|
31
|
+
@atrium_showcase.save
|
32
|
+
|
33
|
+
session_folder_ids= [] || session[:copy_folder_document_ids]
|
34
|
+
session[:folder_document_ids] = session_folder_ids
|
35
|
+
session[:copy_folder_document_ids]=nil
|
36
|
+
if @atrium_showcase && !@atrium_showcase.showcase_items[:solr_doc_ids].nil?
|
37
|
+
@featured_response, @featured_documents = get_solr_response_for_field_values("id",@atrium_showcase.showcase_items[:solr_doc_ids].split(',') || [])
|
38
|
+
end
|
39
|
+
if params[:no_layout]
|
40
|
+
render :layout=>false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def featured
|
45
|
+
session[:copy_folder_document_ids] = session[:folder_document_ids]
|
46
|
+
session[:folder_document_ids] = []
|
47
|
+
@atrium_showcase = Atrium::Showcase.find(params[:id])
|
48
|
+
parent = @atrium_showcase.parent if @atrium_showcase.parent
|
49
|
+
if parent.is_a?(Atrium::Collection)
|
50
|
+
collection_id = parent.id
|
51
|
+
exhibit_id=nil
|
52
|
+
elsif parent.is_a?(Atrium::Exhibit)
|
53
|
+
exhibit_id = parent.id
|
54
|
+
collection_id = parent.atrium_collection_id
|
55
|
+
else
|
56
|
+
logger.error("Atrium showcase parent is invalid. Please check the parent")
|
57
|
+
collection_id = params[:collection_id]
|
58
|
+
exhibit_id = params[:exhibit_id]
|
59
|
+
end
|
60
|
+
session[:folder_document_ids] = @atrium_showcase.showcase_items[:solr_doc_ids].split(',') if @atrium_showcase.showcase_items && @atrium_showcase.showcase_items[:solr_doc_ids]
|
61
|
+
#make sure to pass in a search_fields parameter so that it shows search results immediately
|
62
|
+
redirect_to catalog_index_path(:add_featured=>true,:collection_id=>collection_id,:exhibit_id=>exhibit_id,:search_field=>"all_fields",:f=>params[:f])
|
63
|
+
end
|
64
|
+
|
65
|
+
def refresh_showcase
|
66
|
+
@atrium_showcase = Atrium::Showcase.find(params[:id])
|
67
|
+
path=@atrium_showcase.for_exhibit? ? atrium_exhibit_path(:id=>@atrium_showcase.showcases_id, :f=>params[:f]) : atrium_collection_path(:id=>@atrium_showcase.showcases_id)
|
68
|
+
unset_edit_showcase_in_session
|
69
|
+
redirect_to path
|
70
|
+
end
|
71
|
+
|
72
|
+
def initialize_collection
|
73
|
+
if collection_id = determine_collection_id
|
74
|
+
return __initialize_collection( collection_id )
|
75
|
+
else
|
76
|
+
return false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def determine_collection_id
|
83
|
+
if params[:id]
|
84
|
+
begin
|
85
|
+
@showcase = Atrium::Showcase.find(params[:id])
|
86
|
+
rescue
|
87
|
+
raise "unable to find showcase from id"
|
88
|
+
end
|
89
|
+
elsif params[:showcase_id]
|
90
|
+
begin
|
91
|
+
@showcase = Atrium::Showcase.find(params[:showcase_id])
|
92
|
+
rescue
|
93
|
+
raise "unable to find showcase from id"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
if @showcase && @showcase.parent
|
97
|
+
if @showcase.parent.is_a?(Atrium::Collection)
|
98
|
+
atrium_collection = @showcase.parent
|
99
|
+
collection_id = atrium_collection.id
|
100
|
+
elsif @showcase.parent.is_a?(Atrium::Exhibit)
|
101
|
+
exhibit = @showcase.parent
|
102
|
+
collection_id = exhibit.atrium_collection_id
|
103
|
+
elsif params[:collection_id]
|
104
|
+
collection_id = params[:collection_id]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
return collection_id
|
108
|
+
end
|
109
|
+
|
110
|
+
def parent_object
|
111
|
+
case
|
112
|
+
when params[:exhibit_id] then parent= Atrium::Exhibit.find_by_id(params[:exhibit_id])
|
113
|
+
when params[:collection_id] then parent = Atrium::Collection.find_by_id(params[:collection_id])
|
114
|
+
end
|
115
|
+
|
116
|
+
return parent
|
117
|
+
end
|
118
|
+
|
119
|
+
def parent_url(showcase)
|
120
|
+
|
121
|
+
path=showcase.for_exhibit? ? atrium_exhibit_path(:id=>showcase.showcases_id, :f=>params[:facet_selection]) : atrium_collection_showcase_path(:id=>showcase.showcases_id, :showcase_id=>showcase.id) #atrium_collection_showcases_path(showcase.showcases_id)
|
122
|
+
return path
|
123
|
+
end
|
124
|
+
|
125
|
+
def unset_edit_showcase_in_session
|
126
|
+
session[:edit_showcase] = nil
|
127
|
+
end
|
128
|
+
|
129
|
+
#def configure_showcase
|
130
|
+
# unless @atrium_showcase
|
131
|
+
# @atrium_showcase=Atrium::Showcase.find(params[:id])
|
132
|
+
# end
|
133
|
+
# @exhibit_navigation_data = get_exhibit_navigation_data
|
134
|
+
# set_edit_showcase_in_session
|
135
|
+
# if @atrium_showcase.for_exhibit?
|
136
|
+
# redirect_to atrium_exhibit_path(:id=>@atrium_showcase.showcases_id, :f=>params[:f])
|
137
|
+
# else
|
138
|
+
# @atrium_collection= Atrium::Collection.find_by_id(@atrium_showcase.showcases_id)
|
139
|
+
# redirect_to atrium_collection_showcase_path(:id=>@atrium_showcase.showcases_id, :showcase_id=>params[:id])
|
140
|
+
# end
|
141
|
+
#end
|
142
|
+
|
143
|
+
#def index
|
144
|
+
# @exhibit = Atrium::Exhibit.find(params[:exhibit_id])
|
145
|
+
# @exhibit_navigation_data = get_exhibit_navigation_data
|
146
|
+
# set_edit_showcase_in_session
|
147
|
+
# redirect_to atrium_collection_path(:id=>@exhibit.atrium_collection_id, :exhibit_number=>@exhibit.id)
|
148
|
+
#end
|
149
|
+
|
150
|
+
#def create
|
151
|
+
# @atrium_showcase = Atrium::Showcase.new(params[:atrium_exhibit_id])
|
152
|
+
# @atrium_showcase.showcase_items ||= Hash.new
|
153
|
+
# logger.info("atrium_showcase = #{@atrium_showcase.inspect}")
|
154
|
+
# @atrium_showcase.save
|
155
|
+
# logger.info("atrium_showcase = #{@atrium_showcase.inspect}")
|
156
|
+
# set_edit_showcase_in_session
|
157
|
+
# if @atrium_showcase.showcases_type=="Atrium::Exhibit"
|
158
|
+
# redirect_to atrium_exhibit_path(:id=>@atrium_showcase.showcases_id, :f=>params[:facet_selection])
|
159
|
+
# else
|
160
|
+
# redirect_to atrium_collection_showcase_path(@atrium_showcase.showcases_id, @atrium_showcase.id, :f=>params[:facet_selection])
|
161
|
+
# end
|
162
|
+
#end
|
163
|
+
|
164
|
+
#def edit
|
165
|
+
#@atrium_showcase = Atrium::Showcase.find(params[:id])
|
166
|
+
#set_edit_showcase_in_session
|
167
|
+
#redirect_to parent_url(@atrium_showcase)
|
168
|
+
#if @atrium_showcase.showcases_type=="atrium_exhibit"
|
169
|
+
# redirect_to atrium_exhibit_path(:id=>@atrium_showcase.showcases_id, :f=>params[:facet_selection])
|
170
|
+
#else
|
171
|
+
# redirect_to atrium_collection_showcase_path(@atrium_showcase.showcases_id, params[:id], :f=>params[:f])
|
172
|
+
#end
|
173
|
+
#end
|
174
|
+
|
175
|
+
#def update
|
176
|
+
# @atrium_showcase = Atrium::Showcase.find(params[:showcase_id])
|
177
|
+
# if @atrium_showcase.update_attributes(params[:atrium_showcase])
|
178
|
+
# flash[:notice] = 'Browse was successfully updated.'
|
179
|
+
# end
|
180
|
+
# redirect_to :action => "edit", :id=>@atrium_showcase.id, :f=>params[:f]
|
181
|
+
#end
|
182
|
+
|
183
|
+
#def selected_featured
|
184
|
+
# @atrium_showcase = Atrium::Showcase.find(params[:id])
|
185
|
+
# selected_document_ids = session[:folder_document_ids]
|
186
|
+
# session[:folder_document_ids] = session[:copy_folder_document_ids]
|
187
|
+
# @response, @documents = get_solr_response_for_field_values("id",selected_document_ids || [])
|
188
|
+
# render :layout => false, :locals=>{:selected_document_ids=>selected_document_ids}
|
189
|
+
#end
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Atrium::BrowseLevel < ActiveRecord::Base
|
2
|
+
self.table_name = 'atrium_browse_levels'
|
3
|
+
|
4
|
+
attr_accessible(
|
5
|
+
:atrium_exhibit_id,
|
6
|
+
:exclude_query_params,
|
7
|
+
:filter_query_params,
|
8
|
+
:level_number,
|
9
|
+
:solr_facet_name,
|
10
|
+
:label
|
11
|
+
)
|
12
|
+
|
13
|
+
validates_presence_of(
|
14
|
+
:atrium_exhibit_id,
|
15
|
+
:level_number,
|
16
|
+
:solr_facet_name
|
17
|
+
)
|
18
|
+
|
19
|
+
belongs_to(
|
20
|
+
:exhibit,
|
21
|
+
:class_name => 'Atrium::Exhibit',
|
22
|
+
:foreign_key => 'atrium_exhibit_id'
|
23
|
+
)
|
24
|
+
|
25
|
+
|
26
|
+
serialize :filter_query_params
|
27
|
+
|
28
|
+
serialize :exclude_query_params
|
29
|
+
|
30
|
+
attr_accessor :selected
|
31
|
+
attr_writer :values
|
32
|
+
|
33
|
+
def values
|
34
|
+
@values ||= []
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
"#{solr_facet_name}"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
class Atrium::Collection < ActiveRecord::Base
|
2
|
+
self.table_name = 'atrium_collections'
|
3
|
+
|
4
|
+
attr_accessible(
|
5
|
+
:collection_items,
|
6
|
+
:filter_query_params,
|
7
|
+
:theme,
|
8
|
+
:title,
|
9
|
+
:title_markup,
|
10
|
+
:collection_description,
|
11
|
+
:search_instructions,
|
12
|
+
:search_facet_names,
|
13
|
+
:url_slug,
|
14
|
+
:exhibits_attributes,
|
15
|
+
:search_facets_attributes
|
16
|
+
)
|
17
|
+
|
18
|
+
has_many(
|
19
|
+
:showcases,
|
20
|
+
:class_name => 'Atrium::Showcase',
|
21
|
+
:as => :showcases,
|
22
|
+
:dependent => :destroy
|
23
|
+
)
|
24
|
+
|
25
|
+
has_many(
|
26
|
+
:search_facets,
|
27
|
+
:class_name => 'Atrium::Search::Facet',
|
28
|
+
:foreign_key => 'atrium_collection_id',
|
29
|
+
:dependent => :destroy
|
30
|
+
)
|
31
|
+
|
32
|
+
accepts_nested_attributes_for :search_facets, :allow_destroy => true
|
33
|
+
|
34
|
+
def search_facet_names
|
35
|
+
search_facets.map{|facet| facet.name }
|
36
|
+
end
|
37
|
+
|
38
|
+
def search_facet_names=(collection_of_facet_names)
|
39
|
+
existing_facet_names = search_facets.map{|facet| facet.name }
|
40
|
+
add_collection_of_facets_by_name( collection_of_facet_names - existing_facet_names )
|
41
|
+
remove_collection_of_facets_by_name( existing_facet_names - collection_of_facet_names )
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_collection_of_facets_by_name(collection_of_facet_names)
|
45
|
+
collection_of_facet_names.each do |name|
|
46
|
+
search_facets << Atrium::Search::Facet.find_or_create_by_name_and_collection_id(name, id)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
private :add_collection_of_facets_by_name
|
50
|
+
|
51
|
+
def remove_collection_of_facets_by_name(collection_of_facet_names)
|
52
|
+
collection_of_facet_names.each do |name|
|
53
|
+
search_facets.delete(Atrium::Search::Facet.find_by_name_and_collection_id(name, id))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
private :remove_collection_of_facets_by_name
|
57
|
+
|
58
|
+
|
59
|
+
has_many(
|
60
|
+
:exhibits,
|
61
|
+
:class_name => 'Atrium::Exhibit',
|
62
|
+
:foreign_key => 'atrium_collection_id',
|
63
|
+
:order => 'set_number ASC',
|
64
|
+
:dependent => :destroy
|
65
|
+
)
|
66
|
+
|
67
|
+
accepts_nested_attributes_for :exhibits, :allow_destroy => true
|
68
|
+
|
69
|
+
def exhibit_order
|
70
|
+
exhibit_order = {}
|
71
|
+
exhibits.map{|exhibit| exhibit_order[exhibit[:id]] = exhibit.set_number }
|
72
|
+
exhibit_order
|
73
|
+
end
|
74
|
+
|
75
|
+
def exhibit_order=(exhibit_order = {})
|
76
|
+
valid_ids = exhibits.select(:id).map{|exhibit| exhibit[:id]}
|
77
|
+
exhibit_order.each_pair do |id, order|
|
78
|
+
Atrium::Exhibit.find(id).update_attributes!(:set_number => order) if valid_ids.include?(id.to_i)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
@@included_themes = ['default']
|
83
|
+
def self.available_themes
|
84
|
+
return @@available_themes if defined? @@available_themes
|
85
|
+
# NOTE: theme filenames should conform to rails expectations and only use periods to delimit file extensions
|
86
|
+
local_themes = Dir.entries(File.join(Rails.root, 'app/views/layouts/atrium_themes')).reject {|f| f =~ /^\./}
|
87
|
+
local_themes.collect!{|f| f.split('.').first}
|
88
|
+
@@available_themes = @@included_themes + local_themes
|
89
|
+
end
|
90
|
+
|
91
|
+
def theme_path
|
92
|
+
theme.blank? ? 'atrium_themes/default' : "atrium_themes/#{theme}"
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
serialize :filter_query_params
|
97
|
+
|
98
|
+
serialize :collection_items, Hash
|
99
|
+
def collection_items
|
100
|
+
read_attribute(:collection_items) || write_attribute(:collection_items, {})
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def solr_doc_ids
|
105
|
+
collection_items[:solr_doc_ids] unless collection_items.blank?
|
106
|
+
end
|
107
|
+
|
108
|
+
def pretty_title
|
109
|
+
title.blank? ? 'Unnamed Collection' : title
|
110
|
+
end
|
111
|
+
|
112
|
+
def display_title
|
113
|
+
has_custom_title? ? title_markup.html_safe : "<h2>#{pretty_title}</h2>".html_safe
|
114
|
+
end
|
115
|
+
|
116
|
+
def has_custom_title?
|
117
|
+
!title_markup.blank?
|
118
|
+
end
|
119
|
+
private :has_custom_title?
|
120
|
+
|
121
|
+
end
|