atrium 0.0.1.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. data/.gitignore +13 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +32 -0
  4. data/GETTING_STARTED.textile +109 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +320 -0
  7. data/Guardfile +10 -0
  8. data/README.mkd +56 -0
  9. data/Rakefile +6 -0
  10. data/app/assets/images/atrium/ajax-loader.gif +0 -0
  11. data/app/assets/images/atrium/lightbox-ico-loading.gif +0 -0
  12. data/app/assets/images/atrium/logo.png +0 -0
  13. data/app/assets/javascripts/atrium/atrium.js +281 -0
  14. data/app/assets/javascripts/chosen.jquery.js +899 -0
  15. data/app/assets/javascripts/ckeditor.warning.js +65 -0
  16. data/app/assets/javascripts/ckeditor/config.js.coffee +6 -0
  17. data/app/assets/javascripts/ckeditor/jquery.generateId.js +13 -0
  18. data/app/assets/javascripts/ckeditor/jquery.jeditable.ckeditor.js +59 -0
  19. data/app/assets/javascripts/ckeditor/plugins/linkItem/application_link.png +0 -0
  20. data/app/assets/javascripts/ckeditor/plugins/linkItem/dialogs/linkItem.js +1470 -0
  21. data/app/assets/javascripts/ckeditor/plugins/linkItem/plugin.js +16 -0
  22. data/app/assets/javascripts/ckeditor/plugins/linkItem/ui_toolbar_pencil.png +0 -0
  23. data/app/assets/javascripts/jquery.colorbox.js +864 -0
  24. data/app/assets/javascripts/jquery.jeditable.js +543 -0
  25. data/app/assets/stylesheets/atrium/atrium.css +216 -0
  26. data/app/assets/stylesheets/atrium/chosen-sprite.png +0 -0
  27. data/app/assets/stylesheets/atrium/chosen.css +367 -0
  28. data/app/assets/stylesheets/colorbox.css +42 -0
  29. data/app/assets/stylesheets/controls.png +0 -0
  30. data/app/assets/stylesheets/loading.gif +0 -0
  31. data/app/controllers/atrium/base_controller.rb +25 -0
  32. data/app/controllers/atrium/collection_exhibit_order_controller.rb +21 -0
  33. data/app/controllers/atrium/collections_controller.rb +165 -0
  34. data/app/controllers/atrium/customization_controller.rb +41 -0
  35. data/app/controllers/atrium/descriptions_controller.rb +177 -0
  36. data/app/controllers/atrium/exhibit_facet_order_controller.rb +19 -0
  37. data/app/controllers/atrium/exhibits_controller.rb +108 -0
  38. data/app/controllers/atrium/showcases_controller.rb +193 -0
  39. data/app/helpers/atrium/base_helper.rb +6 -0
  40. data/app/models/ability.rb +14 -0
  41. data/app/models/atrium/browse_level.rb +41 -0
  42. data/app/models/atrium/collection.rb +121 -0
  43. data/app/models/atrium/description.rb +128 -0
  44. data/app/models/atrium/essay.rb +21 -0
  45. data/app/models/atrium/exhibit.rb +58 -0
  46. data/app/models/atrium/search/facet.rb +29 -0
  47. data/app/models/atrium/search/facet_selection.rb +17 -0
  48. data/app/models/atrium/showcase.rb +173 -0
  49. data/app/models/atrium/showcase/facet_selection.rb +21 -0
  50. data/app/models/atrium/showcase/item.rb +19 -0
  51. data/app/models/role_mapper.rb +23 -0
  52. data/app/views/_user_util_links.html.erb +25 -0
  53. data/app/views/atrium/collections/_bookmark_control.html.erb +25 -0
  54. data/app/views/atrium/collections/_browse_index.html.erb +20 -0
  55. data/app/views/atrium/collections/_collection_items_index.html.erb +10 -0
  56. data/app/views/atrium/collections/_document.html.erb +24 -0
  57. data/app/views/atrium/collections/_document_list.html.erb +6 -0
  58. data/app/views/atrium/collections/_edit_navigation.html.erb +20 -0
  59. data/app/views/atrium/collections/_folder_control.html.erb +12 -0
  60. data/app/views/atrium/collections/_form.html.erb +93 -0
  61. data/app/views/atrium/collections/_listing.html.erb +18 -0
  62. data/app/views/atrium/collections/_navigation.html.erb +45 -0
  63. data/app/views/atrium/collections/_results_pagination.html.erb +9 -0
  64. data/app/views/atrium/collections/_sort_and_per_page.html.erb +23 -0
  65. data/app/views/atrium/collections/edit.html.erb +5 -0
  66. data/app/views/atrium/collections/new.html.erb +6 -0
  67. data/app/views/atrium/collections/show.html.erb +22 -0
  68. data/app/views/atrium/descriptions/_form.html.erb +64 -0
  69. data/app/views/atrium/descriptions/edit.html.erb +4 -0
  70. data/app/views/atrium/descriptions/index.html.erb +4 -0
  71. data/app/views/atrium/descriptions/new.html.erb +2 -0
  72. data/app/views/atrium/descriptions/show.html.erb +20 -0
  73. data/app/views/atrium/exhibits/_bookmark_control.html.erb +25 -0
  74. data/app/views/atrium/exhibits/_folder_control.html.erb +12 -0
  75. data/app/views/atrium/exhibits/_form.html.erb +108 -0
  76. data/app/views/atrium/exhibits/edit.html.erb +9 -0
  77. data/app/views/atrium/exhibits/new.html.erb +6 -0
  78. data/app/views/atrium/exhibits/show.html.erb +26 -0
  79. data/app/views/atrium/showcases/_showcase_navigation.html.erb +23 -0
  80. data/app/views/atrium/showcases/show.html.erb +1 -0
  81. data/app/views/catalog/_collection_home_text.html.erb +6 -0
  82. data/app/views/catalog/_constraints.html.erb +9 -0
  83. data/app/views/catalog/_default_collection_text.html.erb +18 -0
  84. data/app/views/catalog/_default_home_text.html.erb +6 -0
  85. data/app/views/catalog/_home_text.html.erb +6 -0
  86. data/app/views/catalog/_index_partials/_description.html.erb +8 -0
  87. data/app/views/catalog/_search_form.html.erb +66 -0
  88. data/app/views/catalog/_show_partials/_description.html.erb +15 -0
  89. data/app/views/catalog/browse_show.html.erb +18 -0
  90. data/app/views/catalog/index.html.erb +35 -0
  91. data/app/views/catalog/list_description.html.erb +24 -0
  92. data/app/views/catalog/list_item.html.erb +3 -0
  93. data/app/views/layouts/atrium.html.erb +86 -0
  94. data/app/views/layouts/atrium_themes/default.html.erb +4 -0
  95. data/app/views/layouts/item_listing.html.erb +36 -0
  96. data/app/views/listing/_document.html.erb +27 -0
  97. data/app/views/listing/_document_list.html.erb +3 -0
  98. data/app/views/listing/_item_search.html.erb +27 -0
  99. data/app/views/shared/_banner.html.erb +5 -0
  100. data/app/views/shared/_collection_complete_list.html.erb +33 -0
  101. data/app/views/shared/_collection_search_form.html.erb +12 -0
  102. data/app/views/shared/_collection_title_header.html.erb +3 -0
  103. data/app/views/shared/_featured_sources.html.erb +20 -0
  104. data/app/views/shared/_list_descriptions.html.erb +38 -0
  105. data/app/views/shared/_navigation_browse_levels.html.erb +34 -0
  106. data/app/views/shared/_showcase_configure_menu.html.erb +22 -0
  107. data/app/views/shared/_top_navigation.html.erb +9 -0
  108. data/atrium.gemspec +76 -0
  109. data/config/routes.rb +12 -0
  110. data/init.rb +3 -0
  111. data/lib/application_controller.rb +24 -0
  112. data/lib/atrium.rb +42 -0
  113. data/lib/atrium/application_helper.rb +24 -0
  114. data/lib/atrium/atrium_helper_behavior.rb +162 -0
  115. data/lib/atrium/catalog.rb +203 -0
  116. data/lib/atrium/collections_helper.rb +139 -0
  117. data/lib/atrium/controller.rb +10 -0
  118. data/lib/atrium/descriptions_helper.rb +23 -0
  119. data/lib/atrium/engine.rb +12 -0
  120. data/lib/atrium/layout_helper.rb +13 -0
  121. data/lib/atrium/routes.rb +99 -0
  122. data/lib/atrium/solr_helper.rb +440 -0
  123. data/lib/atrium/version.rb +3 -0
  124. data/lib/generators/atrium/assets_generator.rb +44 -0
  125. data/lib/generators/atrium/atrium_generator.rb +149 -0
  126. data/lib/generators/atrium/cucumber_support_generator.rb +29 -0
  127. data/lib/generators/atrium/templates/config/role_map_cucumber.yml +2 -0
  128. data/lib/generators/atrium/templates/config/role_map_development.yml +2 -0
  129. data/lib/generators/atrium/templates/config/role_map_production.yml +2 -0
  130. data/lib/generators/atrium/templates/config/role_map_test.yml +2 -0
  131. data/lib/generators/atrium/templates/config/solr.yml +10 -0
  132. data/lib/generators/atrium/templates/db/seeds.rb +87 -0
  133. data/lib/generators/atrium/templates/migrations/create_atrium_browse_levels.rb +18 -0
  134. data/lib/generators/atrium/templates/migrations/create_atrium_collections.rb +20 -0
  135. data/lib/generators/atrium/templates/migrations/create_atrium_descriptions.rb +16 -0
  136. data/lib/generators/atrium/templates/migrations/create_atrium_essays.rb +15 -0
  137. data/lib/generators/atrium/templates/migrations/create_atrium_exhibits.rb +16 -0
  138. data/lib/generators/atrium/templates/migrations/create_atrium_search_facets.rb +14 -0
  139. data/lib/generators/atrium/templates/migrations/create_atrium_showcase_facet_selections.rb +15 -0
  140. data/lib/generators/atrium/templates/migrations/create_atrium_showcase_items.rb +17 -0
  141. data/lib/generators/atrium/templates/migrations/create_atrium_showcases.rb +16 -0
  142. data/lib/generators/atrium/templates/themes/example.html.erb +21 -0
  143. data/lib/railties/all_tests.rake +23 -0
  144. data/lib/railties/atrium_cucumber.rake +121 -0
  145. data/lib/railties/index.rake +37 -0
  146. data/tasks/atrium.rake +268 -0
  147. data/tasks/atrium_rspec.rake +91 -0
  148. data/test_support/etc/Gemfile +33 -0
  149. data/test_support/etc/bundle_config +3 -0
  150. data/test_support/etc/rvmrc +32 -0
  151. data/test_support/features/atrium_collections.feature +162 -0
  152. data/test_support/features/atrium_exhibits.feature +164 -0
  153. data/test_support/features/step_definitions/atrium_collection_steps.rb +102 -0
  154. data/test_support/features/step_definitions/atrium_exhibit_steps.rb +53 -0
  155. data/test_support/features/step_definitions/bookmarks_steps.rb +6 -0
  156. data/test_support/features/step_definitions/error_steps.rb +5 -0
  157. data/test_support/features/step_definitions/folder_steps.rb +27 -0
  158. data/test_support/features/step_definitions/general_steps.rb +50 -0
  159. data/test_support/features/step_definitions/record_view_steps.rb +12 -0
  160. data/test_support/features/step_definitions/saved_searches_steps.rb +22 -0
  161. data/test_support/features/step_definitions/search_facets_steps.rb +29 -0
  162. data/test_support/features/step_definitions/search_history_steps.rb +9 -0
  163. data/test_support/features/step_definitions/search_result_steps.rb +114 -0
  164. data/test_support/features/step_definitions/search_steps.rb +103 -0
  165. data/test_support/features/step_definitions/user_steps.rb +5 -0
  166. data/test_support/features/step_definitions/web_steps.rb +213 -0
  167. data/test_support/features/support/env.rb +67 -0
  168. data/test_support/features/support/paths.rb +76 -0
  169. data/test_support/features/support/selectors.rb +40 -0
  170. data/test_support/fixtures/atrium_exhibits.yml +3 -0
  171. data/test_support/spec/controllers/atrium/base_controller_spec.rb +13 -0
  172. data/test_support/spec/controllers/atrium/collection_exhibit_order_controller_spec.rb +29 -0
  173. data/test_support/spec/controllers/atrium/collections_controller_spec.rb +185 -0
  174. data/test_support/spec/controllers/atrium/customization_controller_spec.rb +38 -0
  175. data/test_support/spec/controllers/atrium/descriptions_controller_spec.rb +150 -0
  176. data/test_support/spec/controllers/atrium/exhibit_facet_order_controller_spec.rb +36 -0
  177. data/test_support/spec/controllers/atrium/exhibits_controller_spec.rb +192 -0
  178. data/test_support/spec/controllers/atrium/showcases_controller_spec.rb +185 -0
  179. data/test_support/spec/helpers/atrium_collections_helper_spec.rb +147 -0
  180. data/test_support/spec/helpers/atrium_description_helper_spec.rb +47 -0
  181. data/test_support/spec/helpers/atrium_solr_helper_spec.rb +512 -0
  182. data/test_support/spec/models/atrium/browse_level_spec.rb +31 -0
  183. data/test_support/spec/models/atrium/collection_spec.rb +30 -0
  184. data/test_support/spec/models/atrium/description_spec.rb +67 -0
  185. data/test_support/spec/models/atrium/essay_spec.rb +12 -0
  186. data/test_support/spec/models/atrium/exhibit_spec.rb +76 -0
  187. data/test_support/spec/models/atrium/search/facet_selection_spec.rb +24 -0
  188. data/test_support/spec/models/atrium/search/facet_spec.rb +11 -0
  189. data/test_support/spec/models/atrium/search_facet_spec.rb +54 -0
  190. data/test_support/spec/models/atrium/showcase/facet_selection_spec.rb +15 -0
  191. data/test_support/spec/models/atrium/showcase/item_spec.rb +12 -0
  192. data/test_support/spec/models/atrium/showcase_facet_selection_spec.rb +65 -0
  193. data/test_support/spec/models/atrium/showcase_spec.rb +134 -0
  194. data/test_support/spec/rcov.opts +3 -0
  195. data/test_support/spec/routing/atrium/collections_routing_spec.rb +33 -0
  196. data/test_support/spec/spec.opts +4 -0
  197. data/test_support/spec/spec_helper.rb +47 -0
  198. data/test_support/spec/support/be_accessible_matcher.rb +8 -0
  199. data/test_support/spec/support/be_routed_mixin.rb +7 -0
  200. data/test_support/tmp/step_definitions/catalog_index_steps.rb +14 -0
  201. data/test_support/tmp/step_definitions/edit_document_steps.rb +67 -0
  202. data/test_support/tmp/step_definitions/hydra_metadata_steps.rb +3 -0
  203. data/test_support/tmp/step_definitions/hydra_steps.rb +8 -0
  204. data/test_support/tmp/step_definitions/search_steps.rb +86 -0
  205. data/test_support/tmp/step_definitions/searching_steps.rb +22 -0
  206. data/test_support/tmp/step_definitions/select_steps.rb +8 -0
  207. data/test_support/tmp/step_definitions/show_document_steps.rb +73 -0
  208. data/test_support/tmp/step_definitions/user_steps.rb +15 -0
  209. data/test_support/tmp/step_definitions/web_steps.rb +273 -0
  210. data/test_support/tmp/support/env.rb +54 -0
  211. data/test_support/tmp/support/paths.rb +57 -0
  212. metadata +1047 -0
@@ -0,0 +1,42 @@
1
+ /*
2
+ ColorBox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+
16
+ /*
17
+ User Style:
18
+ Change the following styles to modify the appearance of ColorBox. They are
19
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
20
+ */
21
+ #cboxOverlay{background:#fff;}
22
+ #colorbox{}
23
+ #cboxContent{margin-top:32px; overflow:visible;}
24
+ .cboxIframe{background:#fff;}
25
+ #cboxError{padding:50px; border:1px solid #ccc;}
26
+ #cboxLoadedContent{background:#000; padding:1px;}
27
+ #cboxLoadingGraphic{background:url(loading.gif) no-repeat center center;}
28
+ #cboxLoadingOverlay{background:#000;}
29
+ #cboxTitle{position:absolute; top:-22px; left:0; color:#000;}
30
+ #cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;}
31
+ #cboxSlideshow, #cboxPrevious, #cboxNext, #cboxClose{text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(controls.png) no-repeat 0 0;}
32
+ #cboxPrevious{background-position:0px 0px; right:44px;}
33
+ #cboxPrevious:hover{background-position:0px -25px;}
34
+ #cboxNext{background-position:-25px 0px; right:22px;}
35
+ #cboxNext:hover{background-position:-25px -25px;}
36
+ #cboxClose{background-position:-50px 0px; right:0;}
37
+ #cboxClose:hover{background-position:-50px -25px;}
38
+ .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;}
39
+ .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
40
+ .cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
41
+ .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
42
+ .cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}
@@ -0,0 +1,25 @@
1
+ require 'atrium/layout_helper'
2
+ require 'atrium/atrium_helper_behavior'
3
+
4
+ class Atrium::BaseController < ApplicationController
5
+
6
+ include CatalogHelper
7
+ include BlacklightHelper
8
+ include Blacklight::SolrHelper
9
+ include Atrium::AtriumHelperBehavior
10
+ include Atrium::SolrHelper
11
+ include Atrium::LayoutHelper
12
+ include Atrium::CollectionsHelper
13
+ include Atrium::DescriptionsHelper
14
+
15
+ layout :current_layout
16
+
17
+ self.solr_search_params_logic += [:add_exclude_fq_to_solr]
18
+
19
+ def blacklight_config
20
+ CatalogController.blacklight_config
21
+ end
22
+ helper_method :blacklight_config
23
+ protected :blacklight_config
24
+
25
+ end
@@ -0,0 +1,21 @@
1
+ class Atrium::CollectionExhibitOrderController < Atrium::BaseController
2
+ def index
3
+ respond_to do |format|
4
+ format.json { render :json => collection.exhibit_order }
5
+ end
6
+ end
7
+
8
+ # NOTE this action is not currently protected from unauthorized use.
9
+ def update
10
+ collection.exhibit_order = params[:collection]
11
+
12
+ respond_to do |format|
13
+ format.json { render :json => collection.exhibit_order }
14
+ end
15
+ end
16
+
17
+ protected
18
+ def collection
19
+ @collection ||= Atrium::Collection.find(params[:id])
20
+ end
21
+ end
@@ -0,0 +1,165 @@
1
+ class Atrium::CollectionsController < Atrium::BaseController
2
+
3
+ before_filter :initialize_collection, :except=>[:index, :new]
4
+
5
+ def new
6
+ create
7
+ end
8
+
9
+ def create
10
+ @atrium_collection = Atrium::Collection.new
11
+ @atrium_collection.save
12
+ redirect_to :action => "edit", :id=>@atrium_collection.id
13
+ end
14
+
15
+ #def update_embedded_search
16
+ # render :partial => "shared/featured_search", :locals=>{:content=>params[:content_type]}
17
+ #end
18
+
19
+ def home_page_text_config
20
+ @atrium_collection= Atrium::Collection.find(params[:id])
21
+ end
22
+
23
+ def set_collection_scope
24
+ logger.error("into scoping")
25
+ session[:copy_folder_document_ids] = session[:folder_document_ids]
26
+ session[:folder_document_ids] = []
27
+ @atrium_collection = Atrium::Collection.find(params[:id])
28
+ session[:folder_document_ids] = @atrium_collection.filter_query_params[:solr_doc_ids].split(',') if @atrium_collection.filter_query_params && @atrium_collection.filter_query_params[:solr_doc_ids]
29
+ p = params.dup
30
+ p.delete :action
31
+ p.delete :id
32
+ p.delete :controller
33
+ #make sure to pass in a search_fields parameter so that it shows search results immediately
34
+ redirect_to catalog_index_path(p)
35
+ end
36
+
37
+ def unset_collection_scope
38
+ @atrium_exhibit= Atrium::Exhibit.new
39
+ @atrium_collection = Atrium::Collection.find(params[:id])
40
+ @atrium_collection.update_attributes(:filter_query_params=>nil)
41
+ flash[:notice] = 'Collection scope removed successfully'
42
+ render :action => "edit"
43
+ end
44
+
45
+ def show
46
+ @exhibit_navigation_data = get_exhibit_navigation_data
47
+
48
+ if(params[:collection_number])
49
+ @collection = Atrium::Collection.find(params[:collection_number])
50
+ @atrium_showcase= Atrium::Showcase.with_selected_facets(@collection.id,@collection.class.name, params[:f]).first
51
+ elsif(params[:id])
52
+ @atrium_collection= Atrium::Collection.find(params[:id])
53
+ @atrium_showcase= Atrium::Showcase.with_selected_facets(@atrium_collection.id,@atrium_collection.class.name, params[:f]).first
54
+ end
55
+
56
+ if @atrium_collection && @atrium_collection.filter_query_params && @atrium_collection.filter_query_params[:solr_doc_ids]
57
+
58
+ items_document_ids = @atrium_collection.filter_query_params[:solr_doc_ids].split(',')
59
+ @collection_items_response, @collection_items_documents = get_solr_response_for_field_values("id",items_document_ids || [])
60
+ end
61
+ if(params[:showcase_id] && @atrium_showcase.nil?)
62
+ @atrium_showcase = Atrium::Showcase.find(params[:showcase_id])
63
+ end
64
+ if @atrium_showcase && !@atrium_showcase.showcase_items[:solr_doc_ids].nil?
65
+ selected_document_ids = @atrium_showcase.showcase_items[:solr_doc_ids].split(',')
66
+ @featured_response, @featured_documents = get_solr_response_for_field_values("id",selected_document_ids || [])
67
+ end
68
+ @description_hash=get_description_for_showcase(@atrium_showcase) unless @atrium_showcase.nil?
69
+
70
+ end
71
+
72
+ def edit
73
+ #@atrium_collection = Atrium::Collection.find(params[:id])
74
+ @exhibit_navigation_data = get_exhibit_navigation_data
75
+ @atrium_exhibit= Atrium::Exhibit.new
76
+ end
77
+
78
+ def update
79
+ @atrium_collection = Atrium::Collection.find(params[:id])
80
+ @atrium_exhibit=Atrium::Exhibit.new
81
+ if (params[:atrium_collection])
82
+ params[:atrium_collection][:search_facet_names] ||= []
83
+ params[:atrium_collection][:search_facet_names].delete_if { |elem| elem.empty? } if params[:atrium_collection][:search_facet_names].length > 0
84
+ end
85
+ respond_to do |format|
86
+ if @atrium_collection.update_attributes(params[:atrium_collection])
87
+ refresh_collection
88
+ flash[:notice] = 'Collection was successfully updated.'
89
+ format.html { render :action => "edit" }
90
+ else
91
+ format.html { render :action => "edit" }
92
+ end
93
+ end
94
+ end
95
+
96
+ def destroy
97
+ @atrium_exhibit= Atrium::Exhibit.new
98
+ @atrium_collection = Atrium::Collection.find(params[:id])
99
+ @atrium_collection.destroy
100
+ flash[:notice] = 'Collection deleted.'
101
+ redirect_to catalog_index_path
102
+ end
103
+ =begin
104
+ # Just return nil for collection facet limit because we want to display all values for browse links
105
+ def facet_limit_for(facet_field)
106
+ return nil
107
+ end
108
+ helper_method :facet_limit_for
109
+
110
+ # Returns complete hash of key=facet_field, value=limit.
111
+ # Used by SolrHelper#solr_search_params to add limits to solr
112
+ # request for all configured facet limits.
113
+ def facet_limit_hash
114
+ Blacklight.config[:facet][:limits]
115
+ end
116
+ helper_method :facet_limit_hash
117
+ =end
118
+ end
119
+
120
+
121
+ def initialize_collection
122
+ if collection_id = determine_collection_id
123
+ return __initialize_collection( collection_id )
124
+ else
125
+ return false
126
+ end
127
+ end
128
+
129
+ #protected :initialize_collection
130
+
131
+ private
132
+
133
+ def determine_collection_id
134
+ if params.has_key? :collection_id
135
+ return params[:collection_id]
136
+ elsif params.has_key? :id
137
+ return params[:id]
138
+ elsif params.has_key? :collection_number
139
+ return params[:collection_number]
140
+ end
141
+ end
142
+
143
+ def refresh_collection
144
+ @exhibit_navigation_data = get_exhibit_navigation_data
145
+ end
146
+
147
+ def refresh_browse_level_label(atrium_collection)
148
+ if params[:atrium_collection][:browse_levels_attributes]
149
+ params[:atrium_collection][:browse_levels_attributes].each_pair do |index,values|
150
+ if values[:solr_facet_name] && !values[:label]
151
+ #reset label if facet changing and other label not supplied
152
+ new_label = facet_field_labels[values[:solr_facet_name]]
153
+ unless new_label.nil? || new_label.empty?
154
+ atrium_collection.browse_levels.each_with_index do |browse_level,index|
155
+ if browse_level.solr_facet_name == values[:solr_facet_name]
156
+ atrium_collection.browse_levels[index].label = new_label
157
+ atrium_collection.save!
158
+ break
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,41 @@
1
+ class Atrium::CustomizationController < Atrium::BaseController
2
+ def start
3
+ session[:edit_showcase] = true
4
+
5
+ respond_to do |format|
6
+ format.html { redirect_to redirect_target}
7
+ format.json { render :json => session[:edit_showcase] }
8
+ end
9
+ end
10
+
11
+ def stop
12
+ session[:edit_showcase] = nil
13
+
14
+ respond_to do |format|
15
+ format.html { redirect_to redirect_target}
16
+ format.json { render :json => session[:edit_showcase] }
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def redirect_target
23
+ if params.has_key?(:type) && params.has_key?(:id)
24
+ build_path_from_params
25
+ else
26
+ request.referrer
27
+ end
28
+ end
29
+
30
+ def build_path_from_params
31
+ case params[:type]
32
+ when 'collection'
33
+ atrium_collection_path(params[:id],:f => params[:f])
34
+ when 'exhibit'
35
+ atrium_exhibit_path(params[:id],:f => params[:f])
36
+ else
37
+ request.referrer
38
+ end
39
+ end
40
+
41
+ end
@@ -0,0 +1,177 @@
1
+ class Atrium::DescriptionsController < Atrium::BaseController
2
+
3
+ before_filter :initialize_collection, :get_exhibit_navigation_data
4
+
5
+ def index
6
+ atrium_showcase=Atrium::Showcase.find(params[:showcase_id])
7
+ @atrium_descriptions = atrium_showcase.descriptions
8
+ @description_hash=get_description_for_showcase(atrium_showcase)
9
+ if params[:no_layout]
10
+ render :layout=>false
11
+ end
12
+ end
13
+
14
+ def new
15
+ @atrium_description = Atrium::Description.new(:atrium_showcase_id=>params[:showcase_id])
16
+ @atrium_description.build_essay(:content_type=>"essay")
17
+ @atrium_description.build_summary(:content_type=>"summary")
18
+ end
19
+
20
+ def create
21
+ @atrium_description = Atrium::Description.new(:atrium_showcase_id=>params[:showcase_id])
22
+ @atrium_description.save!
23
+ if @atrium_description.update_attributes(params[:atrium_description])
24
+ flash[:notice] = 'Description was successfully created.'
25
+ redirect_to :action => "edit", :id=>@atrium_description.id
26
+ else
27
+ render :action => "new"
28
+ end
29
+ end
30
+
31
+ def edit
32
+ @atrium_description = Atrium::Description.find(params[:id])
33
+
34
+ #puts "Desc: #{@atrium_description.inspect}, essay = #{@atrium_description.essay.inspect},summary = #{@atrium_description.summary.inspect}"
35
+ @atrium_description.build_essay(:content_type=>"essay") unless @atrium_description.essay
36
+ @atrium_description.build_summary(:content_type=>"summary") unless @atrium_description.summary
37
+ end
38
+
39
+ def update
40
+ @atrium_description = Atrium::Description.find(params[:id])
41
+
42
+ if((params[:atrium_description]) && @atrium_description.update_attributes(params[:atrium_description]))
43
+
44
+
45
+ flash[:notice] = 'Description was successfully updated.'
46
+ elsif(params[:essay_attributes] && @atrium_description.essay.update_attributes(params[:essay_attributes]))
47
+ #if @atrium_description.essay.update_attributes(params[:essay_attributes])
48
+ #refresh_browse_level_label(@atrium_collection)
49
+
50
+
51
+ flash[:notice] = 'Description was successfully updated.'
52
+ #end
53
+ else
54
+
55
+ if @atrium_description.update_attributes(params[:atrium_description])
56
+ #refresh_browse_level_label(@atrium_collection)
57
+ flash[:notice] = 'Exhibit was successfully updated.'
58
+ end
59
+ end
60
+ redirect_to :action => "edit", :id=>@atrium_description.id
61
+ end
62
+
63
+ def show
64
+ @atrium_description = Atrium::Description.find(params[:id])
65
+ @description_hash={}
66
+ unless @atrium_description.description_solr_id.nil?
67
+ p = params.dup
68
+ params.delete :f
69
+ params.delete :q
70
+ desc_response, desc_documents = get_solr_response_for_field_values("id",@atrium_description.description_solr_id)
71
+ desc_documents.each do |doc|
72
+ @description_hash[doc["id"]]= doc["description_content_s"].blank? ? "" : doc["description_content_s"].first
73
+ end
74
+ params.merge!(:f=>p[:f])
75
+ params.merge!(:q=>p[:q])
76
+ end
77
+ end
78
+
79
+ def save_ids_to_descriptions
80
+ unless session[:folder_document_ids].empty?
81
+ description_hash={}
82
+ desc_response, desc_documents = get_solr_response_for_field_values("id",session[:folder_document_ids])
83
+ desc_documents.each do |doc|
84
+ desc_hash={}
85
+ desc_hash["page_display"]= doc["page_display_s"].blank? ? "" : doc["page_display_s"].first
86
+ desc_hash["title"]= doc["title_s"].blank? ? "" : doc["title_s"].first
87
+ description_hash[doc["id"]]=desc_hash
88
+ end
89
+ session[:folder_document_ids].each do |solr_id|
90
+ doc = description_hash[solr_id]
91
+ @atrium_description = Atrium::Description.new(:atrium_showcase_id=>params[:showcase_id], :description_solr_id=>solr_id, :page_display=>doc["page_display"], :title=>doc["title"])
92
+ @atrium_description.save!
93
+ end
94
+
95
+ session_folder_ids=[] || session[:copy_folder_document_ids]
96
+ session[:folder_document_ids] = session_folder_ids
97
+ session[:copy_folder_document_ids]=nil
98
+
99
+ end
100
+ redirect_to :action => "index", :showcase_id=>params[:showcase_id], :no_layout=>true
101
+ end
102
+
103
+ def destroy
104
+ #Need to delete in AJAX way
105
+ @atrium_description = Atrium::Description.find(params[:id])
106
+ Atrium::Description.destroy(params[:id])
107
+ text = 'Description '+params[:id] +' was deleted successfully.'
108
+ render :text => text
109
+ end
110
+
111
+ def add_from_solr
112
+ session[:copy_folder_document_ids] = session[:folder_document_ids]
113
+ session[:folder_document_ids] = []
114
+ @atrium_showcase=Atrium::Showcase.find(params[:showcase_id])
115
+ parent = @atrium_showcase.parent if @atrium_showcase.parent
116
+ if parent.is_a?(Atrium::Collection)
117
+ collection_id = parent.id
118
+ elsif parent.is_a?(Atrium::Exhibit)
119
+ exhibit_id = parent.id
120
+ collection = parent.collection
121
+ collection_id = collection.id if collection
122
+ else
123
+ logger.error("Atrium showcase parent is invalid. Please check the parent")
124
+ collection_id = params[:collection_id]
125
+ exhibit_id = params[:exhibit_id]
126
+ end
127
+ solr_desc_arr=[]
128
+ @atrium_showcase.descriptions.each do |desc|
129
+ solr_desc_arr<<desc.description_solr_id
130
+ end
131
+ session[:folder_document_ids] = solr_desc_arr.uniq
132
+ #make sure to pass in a search_fields parameter so that it shows search results immediately
133
+ redirect_to catalog_index_path(:add_description=>true,:collection_id=>collection_id,:exhibit_id=>exhibit_id,:search_field=>"all_fields",:f=>{"active_fedora_model_s"=>["Description"]})
134
+ end
135
+
136
+ def initialize_collection
137
+ if collection_id = determine_collection_id
138
+ return __initialize_collection( collection_id )
139
+ else
140
+ return false
141
+ end
142
+ end
143
+
144
+
145
+ private
146
+
147
+ def determine_collection_id
148
+ if params[:id]
149
+ begin
150
+ @description = Atrium::Description.find(params[:id])
151
+ if @description
152
+ @showcase= Atrium::Showcase.find(@description.atrium_showcase_id)
153
+ end
154
+ rescue
155
+ raise "unable to find description or showcase from id"
156
+ end
157
+ elsif(params[:showcase_id])
158
+ @showcase= Atrium::Showcase.find(params[:showcase_id])
159
+ end
160
+ ##logger.debug("Showcase: #{@showcase.inspect}")
161
+ if @showcase && @showcase.parent
162
+ if @showcase.parent.is_a?(Atrium::Collection)
163
+ @atrium_collection = @showcase.parent
164
+ collection_id = @atrium_collection.id
165
+ elsif @showcase.parent.is_a?(Atrium::Exhibit)
166
+ @exhibit = @showcase.parent
167
+ @atrium_collection = @exhibit.collection
168
+ collection_id = @atrium_collection.id
169
+ else
170
+ collection_id = params[:collection_id]
171
+ end
172
+ end
173
+ return collection_id
174
+ end
175
+
176
+
177
+ end