worthwhile 0.0.1.alpha → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,27 @@
|
|
1
|
+
<% content_for :page_header do %>
|
2
|
+
|
3
|
+
<h2>What are you uploading?</h2>
|
4
|
+
<p>Before we can begin we need to know a little about what you're uploading.</p>
|
5
|
+
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
|
9
|
+
<div class="row">
|
10
|
+
<ul class="classify-work">
|
11
|
+
<% classify_concern.all_curation_concern_classes.each do |klass| %>
|
12
|
+
<% if can? :create, klass %>
|
13
|
+
<li class="work-type">
|
14
|
+
<h3 class="title"><%= klass.human_readable_type %></h3>
|
15
|
+
<p class="short-description"><%= klass.human_readable_short_description %></p>
|
16
|
+
<%= link_to 'Add New',
|
17
|
+
main_app.new_polymorphic_path([:curation_concern, klass]),
|
18
|
+
class: "add-button btn btn-primary #{dom_class(klass, 'add_new')}"
|
19
|
+
%>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
<li class="work-type placeholder" aria-hidden="true"></li>
|
24
|
+
<li class="work-type placeholder" aria-hidden="true"></li>
|
25
|
+
<li class="work-type placeholder" aria-hidden="true"></li>
|
26
|
+
</ul>
|
27
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class VisibilityCopyWorker
|
2
|
+
def queue_name
|
3
|
+
:permissions
|
4
|
+
end
|
5
|
+
|
6
|
+
attr_accessor :pid
|
7
|
+
|
8
|
+
def initialize(pid)
|
9
|
+
self.pid = pid
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
work = ActiveFedora::Base.find(pid)
|
14
|
+
work.generic_files.each do |file|
|
15
|
+
# visibility must come first, because it can clear an embargo/lease
|
16
|
+
file.visibility = work.visibility
|
17
|
+
|
18
|
+
file.embargo_release_date = work.embargo_release_date
|
19
|
+
file.visibility_during_embargo = work.visibility_during_embargo
|
20
|
+
file.visibility_after_embargo = work.visibility_after_embargo
|
21
|
+
|
22
|
+
file.lease_expiration_date = work.lease_expiration_date
|
23
|
+
file.visibility_during_lease = work.visibility_during_lease
|
24
|
+
file.visibility_after_lease = work.visibility_after_lease
|
25
|
+
file.save!
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'simple_form'
|
2
|
+
# Use this setup block to configure all options available in SimpleForm.
|
3
|
+
SimpleForm.setup do |config|
|
4
|
+
config.wrappers :inline, tag: 'span', class: 'form-group inline', error_class: 'has-error' do |b|
|
5
|
+
b.use :html5
|
6
|
+
b.use :placeholder
|
7
|
+
b.use :label, class: 'control-label'
|
8
|
+
b.use :input, class: 'form-control'
|
9
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
10
|
+
end
|
11
|
+
|
12
|
+
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
13
|
+
b.use :html5
|
14
|
+
b.use :placeholder
|
15
|
+
b.use :label, class: 'control-label'
|
16
|
+
b.wrapper tag: 'div' do |ba|
|
17
|
+
ba.use :input, class: 'form-control'
|
18
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
19
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
24
|
+
# Check the Bootstrap docs (http://getbootstrap.com/css/)
|
25
|
+
# to learn about the different styles for forms and inputs,
|
26
|
+
# buttons and other elements.
|
27
|
+
config.default_wrapper = :vertical_form
|
28
|
+
|
29
|
+
config.error_notification_class = 'alert alert-danger'
|
30
|
+
config.button_class = 'btn btn-default'
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
en:
|
2
|
+
sufia:
|
3
|
+
product_name: "Curate"
|
4
|
+
institution_name: "Your Institution"
|
5
|
+
institution_homepage_url: "#"
|
6
|
+
division_name: "Your Division at Institution"
|
7
|
+
division_homepage_url: "#"
|
8
|
+
search:
|
9
|
+
form:
|
10
|
+
q:
|
11
|
+
label: "Search Curate"
|
12
|
+
placeholder: "Type keywords in here"
|
13
|
+
search_facets:
|
14
|
+
label: "View:"
|
15
|
+
profile:
|
16
|
+
default_title: "Selected Works:"
|
17
|
+
work:
|
18
|
+
editor:
|
19
|
+
legend: "Content Editors"
|
20
|
+
caption: "Who should be able to make changes to this work?"
|
21
|
+
individual:
|
22
|
+
name: "Individual"
|
23
|
+
help: "At least one person should be able to edit this work"
|
24
|
+
group:
|
25
|
+
name: "Group"
|
26
|
+
help: "Add groups to allow others to collaboratively edit this work."
|
@@ -0,0 +1,68 @@
|
|
1
|
+
en:
|
2
|
+
worthwhile:
|
3
|
+
catalog:
|
4
|
+
index:
|
5
|
+
type_tabs:
|
6
|
+
all: All
|
7
|
+
blacklight:
|
8
|
+
search:
|
9
|
+
fields:
|
10
|
+
facet:
|
11
|
+
human_readable_type_sim: Type of Work
|
12
|
+
desc_metadata__creator_sim: Creator
|
13
|
+
desc_metadata__tag_sim: Keyword
|
14
|
+
desc_metadata__subject_sim: Subject
|
15
|
+
desc_metadata__language_sim: Language
|
16
|
+
desc_metadata__based_near_sim: Location
|
17
|
+
desc_metadata__publisher_sim: Publisher
|
18
|
+
file_format_sim: Format
|
19
|
+
generic_type_sim: Type
|
20
|
+
index:
|
21
|
+
desc_metadata__description_tesim: "Description"
|
22
|
+
desc_metadata__tag_tesim: "Keyword"
|
23
|
+
desc_metadata__subject_tesim: "Subject"
|
24
|
+
desc_metadata__creator_tesim: "Creator"
|
25
|
+
desc_metadata__contributor_tesim: "Contributor"
|
26
|
+
desc_metadata__publisher_tesim: "Publisher"
|
27
|
+
desc_metadata__based_near_tesim: "Location"
|
28
|
+
desc_metadata__language_tesim: "Language"
|
29
|
+
desc_metadata__date_uploaded_tesi: "Date Uploaded"
|
30
|
+
desc_metadata__date_modified_tesi: "Date Modified"
|
31
|
+
desc_metadata__date_created_tesim: "Date Created"
|
32
|
+
desc_metadata__rights_tesim: "Rights"
|
33
|
+
human_readable_type_tesim: "Resource Type"
|
34
|
+
desc_metadata__format_tesim: "File Format"
|
35
|
+
desc_metadata__identifier_tesim: "Identifier"
|
36
|
+
show:
|
37
|
+
desc_metadata__title_tesim: "Title"
|
38
|
+
desc_metadata__description_tesim: "Description"
|
39
|
+
desc_metadata__tag_tesim: "Keyword"
|
40
|
+
desc_metadata__subject_tesim: "Subject"
|
41
|
+
desc_metadata__creator_tesim: "Creator"
|
42
|
+
desc_metadata__contributor_tesim: "Contributor"
|
43
|
+
desc_metadata__publisher_tesim: "Publisher"
|
44
|
+
desc_metadata__based_near_tesim: "Location"
|
45
|
+
desc_metadata__language_tesim: "Language"
|
46
|
+
desc_metadata__date_uploaded_tesi: "Date Uploaded"
|
47
|
+
desc_metadata__date_modified_tesi: "Date Modified"
|
48
|
+
desc_metadata__date_created_tesim: "Date Created"
|
49
|
+
desc_metadata__rights_tesim: "Rights"
|
50
|
+
human_readable_type_tesim: "Resource Type"
|
51
|
+
desc_metadata__format_tesim: "File Format"
|
52
|
+
desc_metadata__identifier_tesim: "Identifier"
|
53
|
+
simple_form:
|
54
|
+
hints:
|
55
|
+
defaults:
|
56
|
+
description: 'Please keep your description to 300 words or fewer.'
|
57
|
+
labels:
|
58
|
+
defaults:
|
59
|
+
lease_expiration_date: 'until'
|
60
|
+
embargo_release_date: 'until'
|
61
|
+
visibility_during_embargo: 'Restricted to'
|
62
|
+
visibility_after_embargo: 'then open it up to'
|
63
|
+
visibility_during_lease: 'Is available for'
|
64
|
+
visibility_after_lease: 'then restrict it to'
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
data/config/routes.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Worthwhile
|
4
|
+
class Install < Rails::Generators::Base
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def run_blacklight_generator
|
9
|
+
say_status("warning", "GENERATING BL", :yellow)
|
10
|
+
generate 'blacklight:install', '--devise'
|
11
|
+
|
12
|
+
say_status("warning", "GENERATING HYDRA-HEAD", :yellow)
|
13
|
+
generate "hydra:head -f"
|
14
|
+
|
15
|
+
say_status("warning", "GENERATING SUFIA", :yellow)
|
16
|
+
generate "sufia:models:install#{options[:force] ? ' -f' : ''}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_catalog_controller
|
20
|
+
say_status("warning", "Removing Blacklight's generated CatalogController...", :yellow)
|
21
|
+
remove_file('app/controllers/catalog_controller.rb')
|
22
|
+
end
|
23
|
+
|
24
|
+
def inject_application_controller_behavior
|
25
|
+
inject_into_file 'app/controllers/application_controller.rb', :after => /Blacklight::Controller\s*\n/ do
|
26
|
+
" include Worthwhile::ApplicationControllerBehavior\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def inject_routes
|
31
|
+
inject_into_file 'config/routes.rb', :after => /devise_for :users\s*\n/ do
|
32
|
+
" mount Hydra::Collections::Engine => '/'\n"\
|
33
|
+
" mount Worthwhile::Engine, at: '/'\n"\
|
34
|
+
" worthwhile_collections\n"\
|
35
|
+
" worthwhile_curation_concerns\n"\
|
36
|
+
" worthwhile_embargo_management\n"\
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def inject_ability
|
41
|
+
inject_into_file 'app/models/ability.rb', :after => /Hydra::Ability\s*\n/ do
|
42
|
+
" include Worthwhile::Ability\n"\
|
43
|
+
" self.ability_logic += [:everyone_can_create_curation_concerns]\n\n"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Add behaviors to the SolrDocument model
|
48
|
+
def inject_solr_document_behavior
|
49
|
+
file_path = "app/models/solr_document.rb"
|
50
|
+
if File.exists?(file_path)
|
51
|
+
inject_into_file file_path, after: /include Blacklight::Solr::Document.*$/ do
|
52
|
+
"\n # Adds Worthwhile behaviors to the SolrDocument.\n" +
|
53
|
+
" include Worthwhile::SolrDocumentBehavior\n"
|
54
|
+
end
|
55
|
+
else
|
56
|
+
puts " \e[31mFailure\e[0m Worthwhile requires a SolrDocument object. This generators assumes that the model is defined in the file #{file_path}, which does not exist."
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def assets
|
61
|
+
copy_file "worthwhile.css.scss", "app/assets/stylesheets/worthwhile.css.scss"
|
62
|
+
copy_file "worthwhile.js", "app/assets/javascripts/worthwhile.js"
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_helper
|
66
|
+
copy_file "worthwhile_helper.rb", "app/helpers/worthwhile_helper.rb"
|
67
|
+
#inject_into_class 'app/helpers/application_helper.rb', ApplicationHelper, " include WorthwhileHelper"
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_config_file
|
71
|
+
copy_file "worthwhile_config.rb", "config/initializers/worthwhile_config.rb"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require worthwhile/application
|
data/lib/worthwhile.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
module Worthwhile
|
2
|
+
|
3
|
+
class << self
|
4
|
+
attr_accessor :configuration
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.configure
|
8
|
+
self.configuration ||= Configuration.new
|
9
|
+
yield(configuration)
|
10
|
+
end
|
11
|
+
|
12
|
+
class Configuration
|
13
|
+
# An anonymous function that receives a path to a file
|
14
|
+
# and returns AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE if no
|
15
|
+
# virus is found; Any other returned value means a virus was found
|
16
|
+
attr_writer :default_antivirus_instance
|
17
|
+
def default_antivirus_instance
|
18
|
+
@default_antivirus_instance ||= lambda {|file_path|
|
19
|
+
AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Configure default search options from config/search_config.yml
|
24
|
+
attr_writer :search_config
|
25
|
+
def search_config
|
26
|
+
@search_config ||= "search_config not set"
|
27
|
+
end
|
28
|
+
|
29
|
+
# Configure the application root url.
|
30
|
+
attr_writer :application_root_url
|
31
|
+
def application_root_url
|
32
|
+
@application_root_url || (raise RuntimeError.new("Make sure to set your Worthwhile.configuration.application_root_url"))
|
33
|
+
end
|
34
|
+
|
35
|
+
# When was this last built/deployed
|
36
|
+
attr_writer :build_identifier
|
37
|
+
def build_identifier
|
38
|
+
# If you restart the server, this could be out of sync; A better
|
39
|
+
# implementation is to read something from the file system. However
|
40
|
+
# that detail is an exercise for the developer.
|
41
|
+
@build_identifier ||= Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Override characterization runner
|
45
|
+
attr_accessor :characterization_runner
|
46
|
+
|
47
|
+
def register_curation_concern(*curation_concern_types)
|
48
|
+
Array(curation_concern_types).flatten.compact.each do |cc_type|
|
49
|
+
class_name = normalize_concern_name(cc_type)
|
50
|
+
if ! registered_curation_concern_types.include?(class_name)
|
51
|
+
self.registered_curation_concern_types << class_name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns the class names (strings) of the registered curation concerns
|
57
|
+
def registered_curation_concern_types
|
58
|
+
@registered_curation_concern_types ||= []
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns the classes of the registered curation concerns
|
62
|
+
def curation_concerns
|
63
|
+
registered_curation_concern_types.map(&:constantize)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def normalize_concern_name(c)
|
69
|
+
c.to_s.camelize
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
configure {}
|
74
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#Load blacklight which will give worthwhile views a higher preference than those in blacklight
|
2
|
+
require 'blacklight'
|
3
|
+
require 'sufia/models'
|
4
|
+
require 'hydra-collections'
|
5
|
+
|
6
|
+
module Worthwhile
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
isolate_namespace Worthwhile
|
9
|
+
require 'breadcrumbs_on_rails'
|
10
|
+
|
11
|
+
config.autoload_paths += %W(
|
12
|
+
#{config.root}/lib
|
13
|
+
#{config.root}/app/actors/concerns
|
14
|
+
)
|
15
|
+
|
16
|
+
initializer 'worthwhile.initialize' do
|
17
|
+
require 'worthwhile/rails/routes'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
|
4
|
+
def worthwhile_curation_concerns
|
5
|
+
resources :downloads, only: :show
|
6
|
+
namespace :curation_concern, path: :concern do
|
7
|
+
Worthwhile.configuration.registered_curation_concern_types.map(&:tableize).each do |curation_concern_name|
|
8
|
+
namespaced_resources curation_concern_name, except: [:index]
|
9
|
+
end
|
10
|
+
resources :permissions, only: [] do
|
11
|
+
member do
|
12
|
+
get :confirm
|
13
|
+
post :copy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
resources :linked_resources, only: [:new, :create], path: 'container/:parent_id/linked_resources'
|
17
|
+
resources :linked_resources, only: [:show, :edit, :update, :destroy]
|
18
|
+
resources :generic_files, only: [:new, :create], path: 'container/:parent_id/generic_files'
|
19
|
+
resources :generic_files, only: [:show, :edit, :update, :destroy] do
|
20
|
+
member do
|
21
|
+
get :versions
|
22
|
+
put :rollback
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Used in conjunction with Hydra::Collections::Engine routes.
|
29
|
+
# Adds routes for doing paginated searches within a collection's contents
|
30
|
+
# @example in routes.rb:
|
31
|
+
# mount Hydra::Collections::Engine => '/'
|
32
|
+
# worthwhile_collections
|
33
|
+
def worthwhile_collections
|
34
|
+
resources :collections, only: :show do
|
35
|
+
member do
|
36
|
+
get 'page/:page', action: :index
|
37
|
+
get 'facet/:id', action: :facet, as: :dashboard_facet
|
38
|
+
end
|
39
|
+
collection do
|
40
|
+
get :add_member_form
|
41
|
+
put '', action: :update
|
42
|
+
put :remove_member
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def worthwhile_embargo_management
|
48
|
+
resources :embargoes, only: [:index, :edit, :destroy] do
|
49
|
+
collection do
|
50
|
+
patch :update
|
51
|
+
end
|
52
|
+
end
|
53
|
+
resources :leases, only: [:index, :edit, :destroy] do
|
54
|
+
collection do
|
55
|
+
patch :update
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
# Namespaces routes appropriately
|
62
|
+
# @example route_namespaced_target("worthwhile/generic_work") is equivalent to
|
63
|
+
# namespace "worthwhile" do
|
64
|
+
# resources "generic_work", except: [:index]
|
65
|
+
# end
|
66
|
+
def namespaced_resources(target, opts={})
|
67
|
+
if target.include?("/")
|
68
|
+
the_namespace = target[0..target.index("/")-1]
|
69
|
+
new_target = target[target.index("/")+1..-1]
|
70
|
+
namespace the_namespace do
|
71
|
+
namespaced_resources(new_target, opts)
|
72
|
+
end
|
73
|
+
else
|
74
|
+
resources target, opts
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|