worthwhile 0.0.1.alpha → 0.0.1
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.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/.travis.yml +19 -0
- data/Gemfile +7 -11
- data/README.md +8 -12
- data/Rakefile +17 -2
- data/app/actors/concerns/worthwhile/manages_embargoes_actor.rb +79 -0
- data/app/actors/curation_concern/base_actor.rb +68 -0
- data/app/actors/curation_concern/generic_file_actor.rb +40 -0
- data/app/actors/curation_concern/generic_work_actor.rb +92 -0
- data/app/actors/curation_concern/linked_resource_actor.rb +4 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/javascripts/worthwhile/.gitkeep +0 -0
- data/app/assets/javascripts/worthwhile/accept_contributor_agreement.js +15 -0
- data/app/assets/javascripts/worthwhile/application.js +18 -0
- data/app/assets/javascripts/worthwhile/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/worthwhile/embargoes.js +17 -0
- data/app/assets/javascripts/worthwhile/facet_mine.js +22 -0
- data/app/assets/javascripts/worthwhile/help_modal.js +36 -0
- data/app/assets/javascripts/worthwhile/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/worthwhile/link_users.js.coffee +126 -0
- data/app/assets/javascripts/worthwhile/manage_repeating_fields.js +74 -0
- data/app/assets/javascripts/worthwhile/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/worthwhile/proxy_submission.js +23 -0
- data/app/assets/javascripts/worthwhile/select_works.js.coffee +20 -0
- data/app/assets/javascripts/worthwhile/worthwhile.js +45 -0
- data/app/assets/stylesheets/worthwhile.css.scss +23 -0
- data/app/assets/stylesheets/worthwhile/_global-variables.css.scss +5 -0
- data/app/assets/stylesheets/worthwhile/_modules.css.scss +14 -0
- data/app/assets/stylesheets/worthwhile/_positioning.css.scss +138 -0
- data/app/assets/stylesheets/worthwhile/_theme.css.scss +46 -0
- data/app/assets/stylesheets/worthwhile/_typography.css.scss +142 -0
- data/app/assets/stylesheets/worthwhile/_variables_bootstrap.css.scss +7 -0
- data/app/assets/stylesheets/worthwhile/_worthwhile.css.scss +7 -0
- data/app/assets/stylesheets/worthwhile/downloads.css.scss +3 -0
- data/app/assets/stylesheets/worthwhile/help_requests.css.scss +3 -0
- data/app/assets/stylesheets/worthwhile/modules/accessibility.css.scss +50 -0
- data/app/assets/stylesheets/worthwhile/modules/accordion.css.scss +33 -0
- data/app/assets/stylesheets/worthwhile/modules/attributes.css.scss +26 -0
- data/app/assets/stylesheets/worthwhile/modules/classify_work.css.scss +100 -0
- data/app/assets/stylesheets/worthwhile/modules/collections.css.scss +42 -0
- data/app/assets/stylesheets/worthwhile/modules/embargoes.css.scss +15 -0
- data/app/assets/stylesheets/worthwhile/modules/emphatic_action_area.css.scss +14 -0
- data/app/assets/stylesheets/worthwhile/modules/forms.css.scss +116 -0
- data/app/assets/stylesheets/worthwhile/modules/multi_value_fields.css.scss +52 -0
- data/app/assets/stylesheets/worthwhile/modules/pagination.css.scss +4 -0
- data/app/assets/stylesheets/worthwhile/modules/search_results.css.scss +55 -0
- data/app/assets/stylesheets/worthwhile/modules/site_actions.css.scss +53 -0
- data/app/assets/stylesheets/worthwhile/modules/site_search.css.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +59 -0
- data/app/controllers/concerns/worthwhile/application_controller_behavior.rb +23 -0
- data/app/controllers/concerns/worthwhile/catalog_controller.rb +347 -0
- data/app/controllers/concerns/worthwhile/curation_concern_controller.rb +131 -0
- data/app/controllers/concerns/worthwhile/files_controller.rb +149 -0
- data/app/controllers/concerns/worthwhile/manages_embargoes.rb +22 -0
- data/app/controllers/concerns/worthwhile/parent_container.rb +31 -0
- data/app/controllers/concerns/worthwhile/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/worthwhile/without_namespace.rb +15 -0
- data/app/controllers/curation_concern/generic_files_controller.rb +6 -0
- data/app/controllers/curation_concern/generic_works_controller.rb +6 -0
- data/app/controllers/curation_concern/linked_resources_controller.rb +68 -0
- data/app/controllers/curation_concern/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +44 -0
- data/app/controllers/leases_controller.rb +34 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/controllers/worthwhile/application_controller.rb +7 -0
- data/app/controllers/worthwhile/classify_concerns_controller.rb +35 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/datastreams/worthwhile/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/worthwhile/properties_datastream.rb +28 -0
- data/app/helpers/curate/collections_helper.rb +133 -0
- data/app/helpers/worthwhile/ability_helper.rb +46 -0
- data/app/helpers/worthwhile/attribute_helper.rb +67 -0
- data/app/helpers/worthwhile/catalog_helper.rb +38 -0
- data/app/helpers/worthwhile/collections_helper.rb +19 -0
- data/app/helpers/worthwhile/embargo_helper.rb +17 -0
- data/app/helpers/worthwhile/generic_file_helper.rb +19 -0
- data/app/helpers/worthwhile/lease_helper.rb +18 -0
- data/app/helpers/worthwhile/main_app_helpers.rb +14 -0
- data/app/helpers/worthwhile/render_constraints_helper.rb +42 -0
- data/app/helpers/worthwhile/search_paths_helper.rb +13 -0
- data/app/helpers/worthwhile/thumbnail_helper.rb +11 -0
- data/app/helpers/worthwhile/title_helper.rb +23 -0
- data/app/helpers/worthwhile/url_helper.rb +16 -0
- data/app/inputs/multi_value_input.rb +72 -0
- data/app/models/collection.rb +15 -0
- data/app/models/concerns/curation_concern/collection_model.rb +62 -0
- data/app/models/concerns/curation_concern/curatable.rb +77 -0
- data/app/models/concerns/curation_concern/has_representative.rb +14 -0
- data/app/models/concerns/curation_concern/human_readable_type.rb +23 -0
- data/app/models/concerns/curation_concern/with_basic_metadata.rb +49 -0
- data/app/models/concerns/curation_concern/with_editors.rb +44 -0
- data/app/models/concerns/curation_concern/with_generic_files.rb +23 -0
- data/app/models/concerns/curation_concern/with_linked_resources.rb +21 -0
- data/app/models/concerns/curation_concern/work.rb +24 -0
- data/app/models/concerns/worthwhile/ability.rb +34 -0
- data/app/models/concerns/worthwhile/generic_file/versioned_content.rb +18 -0
- data/app/models/concerns/worthwhile/generic_file_base.rb +64 -0
- data/app/models/concerns/worthwhile/solr_document_behavior.rb +140 -0
- data/app/models/generic_work.rb +5 -0
- data/app/models/worthwhile/classify_concern.rb +47 -0
- data/app/models/worthwhile/content_version.rb +23 -0
- data/app/models/worthwhile/contributor_agreement.rb +23 -0
- data/app/models/worthwhile/generic_file.rb +5 -0
- data/app/models/worthwhile/linked_resource.rb +41 -0
- data/app/models/worthwhile/quick_classification_query.rb +31 -0
- data/app/services/worthwhile/curation_concern.rb +21 -0
- data/app/services/worthwhile/embargo_service.rb +26 -0
- data/app/services/worthwhile/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +17 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +48 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +22 -0
- data/app/views/collections/new.html.erb +15 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curate/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/curate/collections/_button_remove_from_collection.html.erb +6 -0
- data/app/views/curate/collections/_form_to_add_member.html.erb +27 -0
- data/app/views/curate/collections/add_member_form.html.erb +6 -0
- data/app/views/curation_concern/base/_attributes.html.erb +25 -0
- data/app/views/curation_concern/base/_collections.html.erb +26 -0
- data/app/views/curation_concern/base/_form.html.erb +27 -0
- data/app/views/curation_concern/base/_form_additional_information.html.erb +9 -0
- data/app/views/curation_concern/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concern/base/_form_contributor_agreement.html.erb +29 -0
- data/app/views/curation_concern/base/_form_descriptive_fields.erb +23 -0
- data/app/views/curation_concern/base/_form_files_and_links.html.erb +29 -0
- data/app/views/curation_concern/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concern/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concern/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concern/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concern/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concern/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concern/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concern/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concern/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concern/base/_related_files.html.erb +24 -0
- data/app/views/curation_concern/base/_related_resources.html.erb +40 -0
- data/app/views/curation_concern/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concern/base/edit.html.erb +15 -0
- data/app/views/curation_concern/base/new.html.erb +14 -0
- data/app/views/curation_concern/base/show.html.erb +32 -0
- data/app/views/curation_concern/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concern/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concern/generic_files/_media_display.html.erb +20 -0
- data/app/views/curation_concern/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concern/generic_files/show.html.erb +15 -0
- data/app/views/curation_concern/generic_works/_generic_work.html.erb +3 -0
- data/app/views/curation_concern/linked_resources/_form.html.erb +11 -0
- data/app/views/curation_concern/linked_resources/edit.html.erb +5 -0
- data/app/views/curation_concern/linked_resources/new.html.erb +5 -0
- data/app/views/curation_concern/permissions/confirm.html.erb +13 -0
- data/app/views/curation_concern/worthwhile/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concern/worthwhile/generic_files/_generic_file.html.erb +12 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/common_objects.html.erb +36 -0
- data/app/views/layouts/curate_nd.html.erb +33 -0
- data/app/views/layouts/curate_nd/1_column.html.erb +22 -0
- data/app/views/layouts/curate_nd/2_column.html.erb +26 -0
- data/app/views/layouts/curate_nd/catalog.html.erb +38 -0
- data/app/views/layouts/curate_nd/dashboard.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/views/worthwhile/classify_concerns/new.html.erb +27 -0
- data/app/workers/visibility_copy_worker.rb +29 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/sufia.en.yml +26 -0
- data/config/locales/worthwhile.en.yml +68 -0
- data/config/routes.rb +4 -0
- data/lib/generators/worthwhile/install_generator.rb +74 -0
- data/lib/generators/worthwhile/templates/worthwhile.css.scss +3 -0
- data/lib/generators/worthwhile/templates/worthwhile.js +1 -0
- data/lib/generators/worthwhile/templates/worthwhile_config.rb +3 -0
- data/lib/generators/worthwhile/templates/worthwhile_helper.rb +4 -0
- data/lib/worthwhile.rb +3 -1
- data/lib/worthwhile/configuration.rb +74 -0
- data/lib/worthwhile/controller_resource.rb +10 -0
- data/lib/worthwhile/engine.rb +20 -0
- data/lib/worthwhile/rails/routes.rb +78 -0
- data/lib/worthwhile/spec_support.rb +10 -0
- data/lib/worthwhile/version.rb +1 -1
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concern/generic_work_actor_spec.rb +215 -0
- data/spec/actors/curation_concern/linked_resource_actor_spec.rb +36 -0
- data/spec/actors/worthwile/manages_embargoes_actor_spec.rb +95 -0
- data/spec/controllers/catalog_controller_spec.rb +114 -0
- data/spec/controllers/collections_controller_spec.rb +216 -0
- data/spec/controllers/curation_concern/generic_files_controller_spec.rb +258 -0
- data/spec/controllers/curation_concern/generic_works_controller_spec.rb +171 -0
- data/spec/controllers/curation_concern/linked_resources_controller_spec.rb +123 -0
- data/spec/controllers/curation_concern/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +53 -0
- data/spec/controllers/embargoes_controller_spec.rb +107 -0
- data/spec/controllers/leases_controller_spec.rb +95 -0
- data/spec/controllers/worthwhile/classify_concerns_controller_spec.rb +35 -0
- data/spec/factories/collections_factory.rb +21 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +18 -0
- data/spec/factories/generic_works.rb +37 -0
- data/spec/factories/linked_resources_factory.rb +18 -0
- data/spec/factories/users.rb +15 -0
- data/spec/features/add_external_link_spec.rb +25 -0
- data/spec/features/add_file_spec.rb +28 -0
- data/spec/features/collection_spec.rb +238 -0
- data/spec/features/embargo_spec.rb +45 -0
- data/spec/features/lease_spec.rb +43 -0
- data/spec/features/update_file_spec.rb +28 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +19 -0
- data/spec/matchers.rb +24 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/models/collection_spec.rb +136 -0
- data/spec/models/curation_concern/collection_model_spec.rb +50 -0
- data/spec/models/curation_concern/work_spec.rb +30 -0
- data/spec/models/generic_work_spec.rb +24 -0
- data/spec/models/worthwhile/content_version_spec.rb +27 -0
- data/spec/models/worthwhile/generic_file_spec.rb +77 -0
- data/spec/models/worthwhile/linked_resource_spec.rb +76 -0
- data/spec/routing/worthwhile/routes_spec.rb +23 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/lease_service_spec.rb +37 -0
- data/spec/spec_helper.rb +30 -5
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concern/factory_helpers.rb +14 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_a_curation_concern_model.rb +40 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -29
- data/spec/views/curation_concern/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concern/base/show.html.erb_spec.rb +25 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +68 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- data/worthwhile.gemspec +9 -3
- metadata +469 -9
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.search-results-list {
|
|
2
|
+
}
|
|
3
|
+
|
|
4
|
+
#documents .document {
|
|
5
|
+
border-top: 1px solid $gray-lighter;
|
|
6
|
+
margin-top: 1em;
|
|
7
|
+
padding-top:.5em;
|
|
8
|
+
|
|
9
|
+
&:before {
|
|
10
|
+
//Overwrite blacklight
|
|
11
|
+
content: none;
|
|
12
|
+
}
|
|
13
|
+
&:first-child {
|
|
14
|
+
border-top:none;
|
|
15
|
+
margin-top:0;
|
|
16
|
+
padding-top:0;
|
|
17
|
+
}
|
|
18
|
+
.search-result-actions {
|
|
19
|
+
@include make-xs-column(8);
|
|
20
|
+
@include make-xs-column-offset(4);
|
|
21
|
+
@include make-sm-column(2);
|
|
22
|
+
@include make-sm-column-offset(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.document-thumbnail {
|
|
26
|
+
@include make-xs-column(4);
|
|
27
|
+
@include make-sm-column(2);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.document-metadata {
|
|
31
|
+
@include make-xs-column(8);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.canonical-image {
|
|
35
|
+
width: 100%; // no bigger than the parent
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.resource-type {
|
|
39
|
+
margin-bottom:0;
|
|
40
|
+
position:absolute;
|
|
41
|
+
right:0;
|
|
42
|
+
text-align:center;
|
|
43
|
+
top:0;
|
|
44
|
+
width:80%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.modal {
|
|
48
|
+
text-align:left;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.search-result-details {
|
|
54
|
+
}
|
|
55
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#site-actions {
|
|
2
|
+
.dropdown-menu {
|
|
3
|
+
text-align:left;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// Overriding default boostrap behavior
|
|
7
|
+
.btn-group + .btn-group {
|
|
8
|
+
margin-left:0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dropdown-menu {
|
|
13
|
+
.item-with-options,
|
|
14
|
+
.item-option {
|
|
15
|
+
display:block;
|
|
16
|
+
padding:3px 20px;
|
|
17
|
+
line-height:20px;
|
|
18
|
+
color:#333;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.item-options{
|
|
22
|
+
margin:0;
|
|
23
|
+
padding:0;
|
|
24
|
+
list-style-type:none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.item-option{
|
|
28
|
+
padding-left:30px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* TODO: convert this from compiled bootstrap styles to SASS mixins if available. */
|
|
32
|
+
.item-option:hover,
|
|
33
|
+
.item-option:focus {
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
color: white;
|
|
36
|
+
background-color: #0056b7;
|
|
37
|
+
background-image: -moz-linear-gradient(top, #005bc1, #004fa8);
|
|
38
|
+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#005bc1), to(#004fa8));
|
|
39
|
+
background-image: -webkit-linear-gradient(top, #005bc1, #004fa8);
|
|
40
|
+
background-image: -o-linear-gradient(top, #005bc1, #004fa8);
|
|
41
|
+
background-image: linear-gradient(to bottom, #005bc1, #004fa8);
|
|
42
|
+
background-repeat: repeat-x;
|
|
43
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FF005BC1', endColorstr='#FF004FA8', GradientType=0);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.menu-heading {
|
|
47
|
+
font-weight:bold;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.link-to-full-list {
|
|
51
|
+
font-style:italic;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.search-form {
|
|
2
|
+
position:relative;
|
|
3
|
+
|
|
4
|
+
.search-query,
|
|
5
|
+
.search-submit {
|
|
6
|
+
-moz-box-sizing: border-box;
|
|
7
|
+
box-sizing:border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.search-query {
|
|
11
|
+
width:100%;
|
|
12
|
+
padding-left:.6em;
|
|
13
|
+
padding-right:12%;
|
|
14
|
+
height: 2.1em;
|
|
15
|
+
border-radius: $input-border-radius;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.search-submit {
|
|
19
|
+
padding:2px;
|
|
20
|
+
position:absolute;
|
|
21
|
+
right:2px;
|
|
22
|
+
text-align:center;
|
|
23
|
+
top:2px;
|
|
24
|
+
white-space:nowrap;
|
|
25
|
+
width:9%;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.search-query-form {
|
|
30
|
+
margin-bottom:.3em;
|
|
31
|
+
padding-left:1em;
|
|
32
|
+
|
|
33
|
+
.search-scope {
|
|
34
|
+
display:block;
|
|
35
|
+
line-height:1.5em;
|
|
36
|
+
margin-bottom:.3em;
|
|
37
|
+
|
|
38
|
+
input {
|
|
39
|
+
margin-top:0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.label-text {
|
|
44
|
+
padding-left:.3em;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
class CollectionsController < ApplicationController
|
|
3
|
+
include Hydra::CollectionsControllerBehavior
|
|
4
|
+
include Blacklight::Catalog::SearchContext
|
|
5
|
+
include Worthwhile::ThemedLayoutController
|
|
6
|
+
include Hydra::AccessControlsEnforcement
|
|
7
|
+
include Worthwhile::WithoutNamespace
|
|
8
|
+
before_filter :filter_docs_with_read_access!, except: [:show, :new]
|
|
9
|
+
CollectionsController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
|
10
|
+
|
|
11
|
+
with_themed_layout '1_column'
|
|
12
|
+
|
|
13
|
+
helper Worthwhile::CatalogHelper
|
|
14
|
+
|
|
15
|
+
protected
|
|
16
|
+
|
|
17
|
+
# Override Hydra::PolicyAwareAccessControlsEnforcement
|
|
18
|
+
def gated_discovery_filters
|
|
19
|
+
return [] if current_user && (current_user.groups.include? 'admin')
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def query_collection_members
|
|
24
|
+
flash[:notice]=nil if flash[:notice] == "Select something first"
|
|
25
|
+
query = params[:cq]
|
|
26
|
+
|
|
27
|
+
#merge in the user parameters and the attach the collection query
|
|
28
|
+
solr_params = (params.symbolize_keys).merge(q: query)
|
|
29
|
+
|
|
30
|
+
# run the solr query to find the collections
|
|
31
|
+
(@response, @member_docs) = get_search_results(solr_params)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def after_destroy(id)
|
|
35
|
+
respond_to do |format|
|
|
36
|
+
format.html { redirect_to main_app.root_path, notice: 'Collection was successfully deleted.' }
|
|
37
|
+
format.json { render json: {id: id}, status: :destroyed, location: @collection }
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize_fields_for_edit
|
|
42
|
+
@collection.initialize_fields
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# If they've selected "owner=mine" then restrict to files I have edit access to
|
|
46
|
+
def discovery_permissions
|
|
47
|
+
if params[:owner]=="mine"
|
|
48
|
+
["edit"]
|
|
49
|
+
else
|
|
50
|
+
super
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Include 'catalog' and 'curation_concern/base' in search path for views
|
|
55
|
+
def _prefixes
|
|
56
|
+
@_prefixes ||= super + ['catalog', 'curation_concern/base']
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Worthwhile
|
|
2
|
+
# Inherit from the host app's ApplicationController
|
|
3
|
+
# This will configure e.g. the layout used by the host
|
|
4
|
+
module ApplicationControllerBehavior
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
included do
|
|
8
|
+
helper Worthwhile::MainAppHelpers
|
|
9
|
+
|
|
10
|
+
rescue_from CanCan::AccessDenied do |exception|
|
|
11
|
+
if [:show, :edit, :update, :destroy].include? exception.action
|
|
12
|
+
render 'unauthorized', status: :unauthorized
|
|
13
|
+
else
|
|
14
|
+
redirect_to main_app.root_url, alert: exception.message
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
rescue_from ActiveFedora::ObjectNotFoundError do |exception|
|
|
19
|
+
render file: "#{Rails.root}/public/404", format: :html, status: :not_found, layout: false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
module Worthwhile::CatalogController
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
include Blacklight::Catalog
|
|
4
|
+
# Extend Blacklight::Catalog with Hydra behaviors (primarily editing).
|
|
5
|
+
include Hydra::Controller::ControllerBehavior
|
|
6
|
+
include BreadcrumbsOnRails::ActionController
|
|
7
|
+
include Worthwhile::ThemedLayoutController
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
with_themed_layout 'catalog'
|
|
11
|
+
helper Worthwhile::CatalogHelper
|
|
12
|
+
# These before_filters apply the hydra access controls
|
|
13
|
+
before_filter :enforce_show_permissions, only: :show
|
|
14
|
+
# This applies appropriate access controls to all solr queries
|
|
15
|
+
CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
|
16
|
+
CatalogController.solr_search_params_logic += [:filter_models]
|
|
17
|
+
|
|
18
|
+
configure_blacklight do |config|
|
|
19
|
+
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
|
20
|
+
config.default_solr_params = {
|
|
21
|
+
qf: search_config['qf'],
|
|
22
|
+
qt: search_config['qt'],
|
|
23
|
+
rows: search_config['rows']
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# solr field configuration for search results/index views
|
|
27
|
+
config.index.title_field = solr_name("desc_metadata__title", :stored_searchable)
|
|
28
|
+
config.index.display_type_field = solr_name("has_model", :symbol)
|
|
29
|
+
|
|
30
|
+
config.index.thumbnail_method = :thumbnail_tag
|
|
31
|
+
config.index.partials.delete(:thumbnail) # we render this inside _index_default.html.erb
|
|
32
|
+
|
|
33
|
+
# solr field configuration for document/show views
|
|
34
|
+
# config.show.title_field = solr_name("desc_metadata__title", :stored_searchable)
|
|
35
|
+
# config.show.display_type_field = solr_name("has_model", :symbol)
|
|
36
|
+
|
|
37
|
+
# solr fields that will be treated as facets by the blacklight application
|
|
38
|
+
# The ordering of the field names is the order of the display
|
|
39
|
+
config.add_facet_field solr_name("human_readable_type", :facetable)
|
|
40
|
+
config.add_facet_field solr_name('desc_metadata__creator', :facetable), limit: 5
|
|
41
|
+
config.add_facet_field solr_name("desc_metadata__tag", :facetable), limit: 5
|
|
42
|
+
config.add_facet_field solr_name("desc_metadata__subject", :facetable), limit: 5
|
|
43
|
+
config.add_facet_field solr_name("desc_metadata__language", :facetable), limit: 5
|
|
44
|
+
config.add_facet_field solr_name("desc_metadata__based_near", :facetable), limit: 5
|
|
45
|
+
config.add_facet_field solr_name("desc_metadata__publisher", :facetable), limit: 5
|
|
46
|
+
config.add_facet_field solr_name("file_format", :facetable), limit: 5
|
|
47
|
+
config.add_facet_field "generic_type_sim", show: false, single: true
|
|
48
|
+
|
|
49
|
+
# Have BL send all facet field names to Solr, which has been the default
|
|
50
|
+
# previously. Simply remove these lines if you'd rather use Solr request
|
|
51
|
+
# handler defaults, or have no facets.
|
|
52
|
+
config.add_facet_fields_to_solr_request!
|
|
53
|
+
|
|
54
|
+
# solr fields to be displayed in the index (search results) view
|
|
55
|
+
# The ordering of the field names is the order of the display
|
|
56
|
+
config.add_index_field solr_name("desc_metadata__description", :stored_searchable)
|
|
57
|
+
config.add_index_field solr_name("desc_metadata__tag", :stored_searchable)
|
|
58
|
+
config.add_index_field solr_name("desc_metadata__subject", :stored_searchable)
|
|
59
|
+
config.add_index_field solr_name("desc_metadata__creator", :stored_searchable)
|
|
60
|
+
config.add_index_field solr_name("desc_metadata__contributor", :stored_searchable)
|
|
61
|
+
config.add_index_field solr_name("desc_metadata__publisher", :stored_searchable)
|
|
62
|
+
config.add_index_field solr_name("desc_metadata__based_near", :stored_searchable)
|
|
63
|
+
config.add_index_field solr_name("desc_metadata__language", :stored_searchable)
|
|
64
|
+
config.add_index_field solr_name("desc_metadata__date_uploaded", :stored_sortable)
|
|
65
|
+
config.add_index_field solr_name("desc_metadata__date_modified", :stored_sortable)
|
|
66
|
+
config.add_index_field solr_name("desc_metadata__date_created", :stored_searchable)
|
|
67
|
+
config.add_index_field solr_name("desc_metadata__rights", :stored_searchable)
|
|
68
|
+
config.add_index_field solr_name("human_readable_type", :stored_searchable)
|
|
69
|
+
config.add_index_field solr_name("desc_metadata__format", :stored_searchable)
|
|
70
|
+
config.add_index_field solr_name("desc_metadata__identifier", :stored_searchable)
|
|
71
|
+
|
|
72
|
+
# solr fields to be displayed in the show (single result) view
|
|
73
|
+
# The ordering of the field names is the order of the display
|
|
74
|
+
config.add_show_field solr_name("desc_metadata__title", :stored_searchable)
|
|
75
|
+
config.add_show_field solr_name("desc_metadata__description", :stored_searchable)
|
|
76
|
+
config.add_show_field solr_name("desc_metadata__tag", :stored_searchable)
|
|
77
|
+
config.add_show_field solr_name("desc_metadata__subject", :stored_searchable)
|
|
78
|
+
config.add_show_field solr_name("desc_metadata__creator", :stored_searchable)
|
|
79
|
+
config.add_show_field solr_name("desc_metadata__contributor", :stored_searchable)
|
|
80
|
+
config.add_show_field solr_name("desc_metadata__publisher", :stored_searchable)
|
|
81
|
+
config.add_show_field solr_name("desc_metadata__based_near", :stored_searchable)
|
|
82
|
+
config.add_show_field solr_name("desc_metadata__language", :stored_searchable)
|
|
83
|
+
config.add_show_field solr_name("desc_metadata__date_uploaded", :stored_sortable)
|
|
84
|
+
config.add_show_field solr_name("desc_metadata__date_modified", :stored_sortable)
|
|
85
|
+
config.add_show_field solr_name("desc_metadata__date_created", :stored_searchable)
|
|
86
|
+
config.add_show_field solr_name("desc_metadata__rights", :stored_searchable)
|
|
87
|
+
config.add_show_field solr_name("human_readable_type", :stored_searchable)
|
|
88
|
+
config.add_show_field solr_name("desc_metadata__format", :stored_searchable)
|
|
89
|
+
config.add_show_field solr_name("desc_metadata__identifier", :stored_searchable)
|
|
90
|
+
|
|
91
|
+
# "fielded" search configuration. Used by pulldown among other places.
|
|
92
|
+
# For supported keys in hash, see rdoc for Blacklight::SearchFields
|
|
93
|
+
#
|
|
94
|
+
# Search fields will inherit the :qt solr request handler from
|
|
95
|
+
# config[:default_solr_parameters], OR can specify a different one
|
|
96
|
+
# with a :qt key/value. Below examples inherit, except for subject
|
|
97
|
+
# that specifies the same :qt as default for our own internal
|
|
98
|
+
# testing purposes.
|
|
99
|
+
#
|
|
100
|
+
# The :key is what will be used to identify this BL search field internally,
|
|
101
|
+
# as well as in URLs -- so changing it after deployment may break bookmarked
|
|
102
|
+
# urls. A display label will be automatically calculated from the :key,
|
|
103
|
+
# or can be specified manually to be different.
|
|
104
|
+
#
|
|
105
|
+
# This one uses all the defaults set by the solr request handler. Which
|
|
106
|
+
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
|
107
|
+
# since we aren't specifying it otherwise.
|
|
108
|
+
config.add_search_field('all_fields', label: 'All Fields', :include_in_advanced_search => false) do |field|
|
|
109
|
+
title_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
|
110
|
+
label_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
|
111
|
+
contributor_name = solr_name("desc_metadata__contributor", :stored_searchable, type: :string)
|
|
112
|
+
field.solr_parameters = {
|
|
113
|
+
:qf => "#{title_name} noid_tsi #{label_name} file_format_tesim #{contributor_name}",
|
|
114
|
+
:pf => "#{title_name}"
|
|
115
|
+
}
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# Now we see how to over-ride Solr request handler defaults, in this
|
|
120
|
+
# case for a BL "search field", which is really a dismax aggregate
|
|
121
|
+
# of Solr search fields.
|
|
122
|
+
# creator, title, description, publisher, date_created,
|
|
123
|
+
# subject, language, resource_type, format, identifier, based_near,
|
|
124
|
+
config.add_search_field('contributor') do |field|
|
|
125
|
+
# solr_parameters hash are sent to Solr as ordinary url query params.
|
|
126
|
+
|
|
127
|
+
# :solr_local_parameters will be sent using Solr LocalParams
|
|
128
|
+
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
|
129
|
+
# Solr parameter de-referencing like $title_qf.
|
|
130
|
+
# See: http://wiki.apache.org/solr/LocalParams
|
|
131
|
+
solr_name = solr_name("desc_metadata__contributor", :stored_searchable, type: :string)
|
|
132
|
+
field.solr_local_parameters = {
|
|
133
|
+
:qf => solr_name,
|
|
134
|
+
:pf => solr_name
|
|
135
|
+
}
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
config.add_search_field('creator') do |field|
|
|
139
|
+
solr_name = solr_name("desc_metadata__creator", :stored_searchable, type: :string)
|
|
140
|
+
field.solr_local_parameters = {
|
|
141
|
+
:qf => solr_name,
|
|
142
|
+
:pf => solr_name
|
|
143
|
+
}
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
config.add_search_field('title') do |field|
|
|
147
|
+
solr_name = solr_name("desc_metadata__title", :stored_searchable, type: :string)
|
|
148
|
+
field.solr_local_parameters = {
|
|
149
|
+
:qf => solr_name,
|
|
150
|
+
:pf => solr_name
|
|
151
|
+
}
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
config.add_search_field('description') do |field|
|
|
155
|
+
field.label = "Abstract or Summary"
|
|
156
|
+
solr_name = solr_name("desc_metadata__description", :stored_searchable, type: :string)
|
|
157
|
+
field.solr_local_parameters = {
|
|
158
|
+
:qf => solr_name,
|
|
159
|
+
:pf => solr_name
|
|
160
|
+
}
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
config.add_search_field('publisher') do |field|
|
|
164
|
+
solr_name = solr_name("desc_metadata__publisher", :stored_searchable, type: :string)
|
|
165
|
+
field.solr_local_parameters = {
|
|
166
|
+
:qf => solr_name,
|
|
167
|
+
:pf => solr_name
|
|
168
|
+
}
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
config.add_search_field('date_created') do |field|
|
|
172
|
+
solr_name = solr_name("desc_metadata__created", :stored_searchable, type: :string)
|
|
173
|
+
field.solr_local_parameters = {
|
|
174
|
+
:qf => solr_name,
|
|
175
|
+
:pf => solr_name
|
|
176
|
+
}
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
config.add_search_field('subject') do |field|
|
|
180
|
+
solr_name = solr_name("desc_metadata__subject", :stored_searchable, type: :string)
|
|
181
|
+
field.solr_local_parameters = {
|
|
182
|
+
:qf => solr_name,
|
|
183
|
+
:pf => solr_name
|
|
184
|
+
}
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
config.add_search_field('language') do |field|
|
|
188
|
+
solr_name = solr_name("desc_metadata__language", :stored_searchable, type: :string)
|
|
189
|
+
field.solr_local_parameters = {
|
|
190
|
+
:qf => solr_name,
|
|
191
|
+
:pf => solr_name
|
|
192
|
+
}
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
config.add_search_field('human_readable_type') do |field|
|
|
196
|
+
solr_name = solr_name("human_readable_type", :stored_searchable, type: :string)
|
|
197
|
+
field.solr_local_parameters = {
|
|
198
|
+
:qf => solr_name,
|
|
199
|
+
:pf => solr_name
|
|
200
|
+
}
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
config.add_search_field('format') do |field|
|
|
204
|
+
field.include_in_advanced_search = false
|
|
205
|
+
solr_name = solr_name("desc_metadata__format", :stored_searchable, type: :string)
|
|
206
|
+
field.solr_local_parameters = {
|
|
207
|
+
:qf => solr_name,
|
|
208
|
+
:pf => solr_name
|
|
209
|
+
}
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
config.add_search_field('identifier') do |field|
|
|
213
|
+
field.include_in_advanced_search = false
|
|
214
|
+
solr_name = solr_name("desc_metadata__id", :stored_searchable, type: :string)
|
|
215
|
+
field.solr_local_parameters = {
|
|
216
|
+
:qf => solr_name,
|
|
217
|
+
:pf => solr_name
|
|
218
|
+
}
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
config.add_search_field('based_near') do |field|
|
|
222
|
+
field.label = "Location"
|
|
223
|
+
solr_name = solr_name("desc_metadata__based_near", :stored_searchable, type: :string)
|
|
224
|
+
field.solr_local_parameters = {
|
|
225
|
+
:qf => solr_name,
|
|
226
|
+
:pf => solr_name
|
|
227
|
+
}
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
config.add_search_field('tag') do |field|
|
|
231
|
+
solr_name = solr_name("desc_metadata__tag", :stored_searchable, type: :string)
|
|
232
|
+
field.solr_local_parameters = {
|
|
233
|
+
:qf => solr_name,
|
|
234
|
+
:pf => solr_name
|
|
235
|
+
}
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
config.add_search_field('depositor') do |field|
|
|
239
|
+
solr_name = solr_name("desc_metadata__depositor", :stored_searchable, type: :string)
|
|
240
|
+
field.solr_local_parameters = {
|
|
241
|
+
:qf => solr_name,
|
|
242
|
+
:pf => solr_name
|
|
243
|
+
}
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
config.add_search_field('rights') do |field|
|
|
247
|
+
solr_name = solr_name("desc_metadata__rights", :stored_searchable, type: :string)
|
|
248
|
+
field.solr_local_parameters = {
|
|
249
|
+
:qf => solr_name,
|
|
250
|
+
:pf => solr_name
|
|
251
|
+
}
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
# "sort results by" select (pulldown)
|
|
256
|
+
# label in pulldown is followed by the name of the SOLR field to sort by and
|
|
257
|
+
# whether the sort is ascending or descending (it must be asc or desc
|
|
258
|
+
# except in the relevancy case).
|
|
259
|
+
# label is key, solr field is value
|
|
260
|
+
config.add_sort_field "score desc, #{uploaded_field} desc", label: "relevance \u25BC"
|
|
261
|
+
config.add_sort_field "#{uploaded_field} desc", label: "date uploaded \u25BC"
|
|
262
|
+
config.add_sort_field "#{uploaded_field} asc", label: "date uploaded \u25B2"
|
|
263
|
+
config.add_sort_field "#{modified_field} desc", label: "date modified \u25BC"
|
|
264
|
+
config.add_sort_field "#{modified_field} asc", label: "date modified \u25B2"
|
|
265
|
+
|
|
266
|
+
# If there are more than this many search results, no spelling ("did you
|
|
267
|
+
# mean") suggestion is offered.
|
|
268
|
+
config.spell_max = 5
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
module ClassMethods
|
|
273
|
+
def t *args
|
|
274
|
+
I18n.translate *args
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def uploaded_field
|
|
278
|
+
# system_create_dtsi
|
|
279
|
+
solr_name('desc_metadata__date_uploaded', :stored_sortable, type: :date)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def modified_field
|
|
283
|
+
solr_name('desc_metadata__date_modified', :stored_sortable , type: :date)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def search_config
|
|
287
|
+
{'qf' => ['desc_metadata__title_tesim','desc_metadata__name_tesim'], 'qt' => 'search', 'rows' => 10}
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
protected
|
|
293
|
+
|
|
294
|
+
# Override Hydra::PolicyAwareAccessControlsEnforcement
|
|
295
|
+
def gated_discovery_filters
|
|
296
|
+
return [] if current_user && (current_user.groups.include? 'admin')
|
|
297
|
+
super
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Overriding Blacklight so that the search results can be displayed in a way compatible with
|
|
301
|
+
# tokenInput javascript library. This is used for suggesting "Related Works" to attach.
|
|
302
|
+
def render_search_results_as_json
|
|
303
|
+
{"docs" => @response["response"]["docs"].map {|solr_doc| serialize_work_from_solr(solr_doc) }}
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def serialize_work_from_solr(solr_doc)
|
|
307
|
+
title = solr_doc["desc_metadata__title_tesim"].first
|
|
308
|
+
title << " (#{solr_doc["human_readable_type_tesim"].first})" if solr_doc["human_readable_type_tesim"].present?
|
|
309
|
+
{
|
|
310
|
+
pid: solr_doc["id"],
|
|
311
|
+
title: title
|
|
312
|
+
}
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# show only files with edit permissions in lib/hydra/access_controls_enforcement.rb apply_gated_discovery
|
|
316
|
+
def discovery_permissions
|
|
317
|
+
return ["edit"] if params[:works] == 'mine'
|
|
318
|
+
super
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# This is included as part of blacklight search solr params logic
|
|
322
|
+
def filter_models(solr_parameters, user_parameters)
|
|
323
|
+
solr_parameters[:fq] ||= []
|
|
324
|
+
solr_parameters[:fq] << '(' + (work_clauses + collection_clauses).join(' OR ') + ')'
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def work_clauses
|
|
328
|
+
return [] if params.has_key?(:f) && Array(params[:f][:generic_type_sim]).include?('Collection')
|
|
329
|
+
Worthwhile.configuration.registered_curation_concern_types.map(&:constantize).map do |klass|
|
|
330
|
+
ActiveFedora::SolrService.construct_query_for_rel(has_model: klass.to_class_uri)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
def collection_clauses
|
|
335
|
+
return [] if params.has_key?(:f) && Array(params[:f][:generic_type_sim]).include?('Work')
|
|
336
|
+
[ActiveFedora::SolrService.construct_query_for_rel(has_model: Collection.to_class_uri)]
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def depositor
|
|
340
|
+
#Hydra.config[:permissions][:owner] maybe it should match this config variable, but it doesn't.
|
|
341
|
+
Solrizer.solr_name('depositor', :stored_searchable, type: :string)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def sort_field
|
|
345
|
+
"#{Solrizer.solr_name('system_create', :sortable)} desc"
|
|
346
|
+
end
|
|
347
|
+
end
|