curation_concerns 0.3.0 → 0.4.0

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 (155) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +1 -2
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/VERSION +1 -1
  8. data/app/assets/javascripts/curation_concerns/curation_concerns.js +2 -0
  9. data/app/assets/javascripts/curation_concerns/uploader.js +4 -4
  10. data/app/assets/stylesheets/curation_concerns/_modules.scss +1 -0
  11. data/app/assets/stylesheets/curation_concerns/_positioning.scss +3 -0
  12. data/app/assets/stylesheets/curation_concerns/modules/icons.scss +11 -0
  13. data/app/controllers/concerns/curation_concerns/api.rb +1 -12
  14. data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +20 -6
  15. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +44 -25
  16. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +32 -23
  17. data/app/controllers/concerns/curation_concerns/parent_container.rb +0 -11
  18. data/app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb +1 -1
  19. data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +7 -1
  20. data/app/controllers/concerns/curation_concerns/upload_sets_controller_behavior.rb +19 -7
  21. data/app/controllers/curation_concerns/permissions_controller.rb +1 -1
  22. data/app/forms/curation_concerns/forms/collection_edit_form.rb +6 -2
  23. data/app/forms/curation_concerns/forms/work_form.rb +14 -3
  24. data/app/forms/curation_concerns/upload_set_form.rb +43 -0
  25. data/app/helpers/curation_concerns/ability_helper.rb +12 -18
  26. data/app/helpers/curation_concerns/file_set_helper.rb +1 -1
  27. data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
  28. data/app/helpers/curation_concerns/permissions_helper.rb +20 -0
  29. data/app/helpers/curation_concerns/url_helper.rb +3 -11
  30. data/app/inputs/multi_value_with_help_input.rb +8 -0
  31. data/app/inputs/select_with_help_input.rb +3 -0
  32. data/app/inputs/select_with_modal_help_input.rb +36 -0
  33. data/app/inputs/with_help_icon.rb +34 -0
  34. data/app/presenters/curation_concerns/collection_presenter.rb +9 -0
  35. data/app/presenters/curation_concerns/file_set_presenter.rb +2 -1
  36. data/app/presenters/curation_concerns/presents_attributes.rb +16 -0
  37. data/app/presenters/curation_concerns/work_show_presenter.rb +3 -2
  38. data/app/renderers/curation_concerns/attribute_renderer.rb +22 -4
  39. data/app/renderers/curation_concerns/configured_microdata.rb +40 -0
  40. data/app/services/curation_concerns/parent_service.rb +1 -1
  41. data/app/views/catalog/_action_menu_partials/_default.html.erb +2 -2
  42. data/app/views/collections/_form.html.erb +8 -9
  43. data/app/views/collections/_sort_and_per_page.html.erb +25 -23
  44. data/app/views/collections/show.html.erb +1 -1
  45. data/app/views/curation_concerns/base/_attributes.html.erb +1 -1
  46. data/app/views/curation_concerns/base/_form.html.erb +6 -7
  47. data/app/views/curation_concerns/base/_form_permission.html.erb +3 -0
  48. data/app/views/curation_concerns/base/_multiple_upload.html.erb +3 -0
  49. data/app/views/curation_concerns/base/_show_actions.html.erb +2 -2
  50. data/app/views/curation_concerns/base/_versioning.html.erb +1 -1
  51. data/app/views/curation_concerns/base/_visibility.html.erb +17 -0
  52. data/app/views/curation_concerns/base/show.html.erb +1 -1
  53. data/app/views/curation_concerns/classify_concerns/new.html.erb +1 -1
  54. data/app/views/curation_concerns/file_sets/_actions.html.erb +2 -2
  55. data/app/views/curation_concerns/file_sets/_form.html.erb +1 -1
  56. data/app/views/curation_concerns/file_sets/_rights_modal.html.erb +41 -0
  57. data/app/views/curation_concerns/file_sets/media_display/_default.html.erb +4 -1
  58. data/app/views/curation_concerns/file_sets/media_display/_image.html.erb +9 -8
  59. data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +9 -7
  60. data/app/views/curation_concerns/file_sets/media_display/_pdf.html.erb +7 -5
  61. data/app/views/curation_concerns/file_sets/show.html.erb +2 -2
  62. data/app/views/curation_concerns/file_sets/upload/_alerts.html.erb +3 -3
  63. data/app/views/curation_concerns/file_sets/upload/_form.html.erb +1 -1
  64. data/app/views/curation_concerns/file_sets/upload/_script_templates.html.erb +1 -1
  65. data/app/views/curation_concerns/permissions/confirm.html.erb +1 -1
  66. data/app/views/curation_concerns/single_use_links_viewer/show.html.erb +1 -1
  67. data/app/views/embargoes/edit.html.erb +4 -4
  68. data/app/views/layouts/curation_concerns.html.erb +1 -1
  69. data/app/views/leases/edit.html.erb +3 -3
  70. data/app/views/shared/_add_works.html.erb +6 -3
  71. data/app/views/upload_sets/_base_metadata.html.erb +12 -0
  72. data/app/views/upload_sets/_metadata.html.erb +3 -13
  73. data/app/views/upload_sets/edit.html.erb +1 -1
  74. data/config/locales/curation_concerns.en.yml +46 -0
  75. data/curation_concerns.gemspec +5 -4
  76. data/lib/curation_concerns/engine.rb +5 -0
  77. data/lib/curation_concerns/form_builder.rb +16 -0
  78. data/lib/curation_concerns/rails/routes.rb +7 -5
  79. data/lib/generators/curation_concerns/install_generator.rb +1 -1
  80. data/lib/generators/curation_concerns/work/work_generator.rb +1 -1
  81. data/spec/actors/curation_concerns/file_set_actor_spec.rb +26 -16
  82. data/spec/controllers/curation_concerns/file_sets_controller_json_spec.rb +14 -4
  83. data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +3 -3
  84. data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +4 -4
  85. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +21 -0
  86. data/spec/controllers/curation_concerns/single_use_links_controller_spec.rb +2 -2
  87. data/spec/controllers/curation_concerns/single_use_links_viewer_controller_spec.rb +1 -1
  88. data/spec/controllers/upload_sets_controller_spec.rb +20 -27
  89. data/spec/factories/file_sets.rb +1 -0
  90. data/spec/factories/generic_works.rb +1 -0
  91. data/spec/factories/users.rb +0 -12
  92. data/spec/features/collection_spec.rb +1 -3
  93. data/spec/forms/collection_edit_form_spec.rb +16 -1
  94. data/spec/forms/upload_set_form_spec.rb +55 -0
  95. data/spec/forms/work_form_spec.rb +68 -3
  96. data/spec/helpers/curation_concerns/ability_helper_spec.rb +45 -0
  97. data/spec/helpers/curation_concerns/permissions_helper_spec.rb +12 -0
  98. data/spec/helpers/url_helper_spec.rb +0 -3
  99. data/spec/indexers/collection_indexer_spec.rb +5 -0
  100. data/spec/indexers/{file_set_indexing_service_spec.rb → file_set_indexer_spec.rb} +40 -2
  101. data/spec/indexers/{generic_work_indexing_service_spec.rb → work_indexer_spec.rb} +1 -1
  102. data/spec/inputs/multi_value_with_help_input_spec.rb +32 -0
  103. data/spec/inputs/select_with_help_input_spec.rb +43 -0
  104. data/spec/inputs/select_with_modal_help_input_spec.rb +21 -0
  105. data/spec/jobs/import_url_job_spec.rb +33 -1
  106. data/spec/jobs/ingest_file_job_spec.rb +29 -16
  107. data/spec/jobs/upload_set_update_job_spec.rb +24 -11
  108. data/spec/lib/curation_concerns/messages_spec.rb +2 -2
  109. data/spec/lib/curation_concerns/name_spec.rb +20 -0
  110. data/spec/lib/curation_concerns/null_logger_spec.rb +10 -0
  111. data/spec/models/curation_concerns/collection_behavior_spec.rb +41 -10
  112. data/spec/models/curation_concerns/work_behavior_spec.rb +1 -13
  113. data/spec/models/file_set_spec.rb +19 -4
  114. data/spec/models/generic_work_spec.rb +7 -2
  115. data/spec/models/quick_classification_query_spec.rb +35 -0
  116. data/spec/models/upload_set_spec.rb +5 -7
  117. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +20 -0
  118. data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +10 -3
  119. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +13 -1
  120. data/spec/renderers/curation_concerns/attribute_renderer_spec.rb +41 -8
  121. data/spec/routing/curation_concerns/routes_spec.rb +2 -2
  122. data/spec/routing/route_spec.rb +1 -1
  123. data/spec/services/file_set_audit_service_spec.rb +46 -4
  124. data/spec/spec_helper.rb +5 -7
  125. data/spec/views/collections/_sort_and_per_page.html.erb_spec.rb +32 -0
  126. data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +8 -1
  127. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +36 -2
  128. data/spec/views/curation_concerns/file_sets/_file_set.html.erb_spec.rb +3 -2
  129. data/spec/views/curation_concerns/file_sets/show.html.erb_spec.rb +56 -0
  130. data/spec/views/curation_concerns/single_use_links_viewer/show.html.erb_spec.rb +19 -0
  131. data/spec/views/shared/_add_content.html.erb_spec.rb +3 -3
  132. data/spec/views/single_use_links/new_download.html.erb_spec.rb +1 -1
  133. data/spec/views/upload_sets/_metadata.html.erb_spec.rb +28 -0
  134. metadata +80 -50
  135. data/app/assets/stylesheets/curation_concerns/help_requests.scss +0 -3
  136. data/app/controllers/concerns/curation_concerns/without_namespace.rb +0 -16
  137. data/app/controllers/registrations_controller.rb +0 -19
  138. data/app/controllers/sessions_controller.rb +0 -4
  139. data/app/views/curation_concerns/file_sets/_multiple_upload.html.erb +0 -3
  140. data/spec/fixtures/Example.ogg +0 -0
  141. data/spec/fixtures/charter.docx +0 -0
  142. data/spec/fixtures/countdown.avi +0 -0
  143. data/spec/fixtures/curation_concerns_generic_stub.txt +0 -1
  144. data/spec/fixtures/empty_file.txt +0 -0
  145. data/spec/fixtures/files/image.png +0 -0
  146. data/spec/fixtures/image.jp2 +0 -0
  147. data/spec/fixtures/image.jpg +0 -0
  148. data/spec/fixtures/piano_note.wav +0 -0
  149. data/spec/fixtures/sample_mpeg4.mp4 +0 -0
  150. data/spec/fixtures/small_file.txt +0 -1
  151. data/spec/fixtures/spoken-text.m4a +0 -0
  152. data/spec/fixtures/test.pdf +0 -0
  153. data/spec/fixtures/test4.pdf +0 -0
  154. data/spec/fixtures/test5.mp3 +0 -0
  155. data/spec/fixtures/world.png +0 -0
@@ -0,0 +1,43 @@
1
+ module CurationConcerns
2
+ class UploadSetForm
3
+ include HydraEditor::Form
4
+
5
+ self.terms = CurationConcerns::GenericWorkForm.terms
6
+
7
+ delegate :creator, :human_readable_type, :open_access?, :authenticated_only_access?,
8
+ :open_access_with_embargo_release_date?, :private_access?,
9
+ :embargo_release_date, :lease_expiration_date, :member_ids, to: :exemplar_work
10
+
11
+ def initialize(upload_set, current_ability)
12
+ @current_ability = current_ability
13
+ super(upload_set)
14
+ # TODO: instead of using GenericWorkForm, this should be an UploadSetForm
15
+ # work = ::GenericWork.new(creator: [creator_display], title: titles)
16
+ end
17
+
18
+ def exemplar_work
19
+ @exemplar_work ||= GenericWork.new(creator: [creator_display])
20
+ end
21
+
22
+ # @return [Array] a list of the first titles for each of the works.
23
+ def works
24
+ @works ||= model.works.sort { |w1, w2| w1.title.first.downcase <=> w2.title.first.downcase }
25
+ end
26
+
27
+ def self.model_attributes(attrs)
28
+ CurationConcerns::GenericWorkForm.model_attributes(attrs)
29
+ end
30
+
31
+ def self.multiple?(attrs)
32
+ CurationConcerns::GenericWorkForm.multiple?(attrs)
33
+ end
34
+
35
+ private
36
+
37
+ # Override this method if you want the creator to display something other than
38
+ # the user_key, e.g. "current_user.name"
39
+ def creator_display
40
+ @current_ability.current_user.user_key
41
+ end
42
+ end
43
+ end
@@ -12,9 +12,9 @@ module CurationConcerns
12
12
 
13
13
  def visibility_options(variant)
14
14
  options = [
15
- ['Open Access', Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC],
16
- [t('curation_concerns.institution_name'), Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED],
17
- ['Private', Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE]
15
+ Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC,
16
+ Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED,
17
+ Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
18
18
  ]
19
19
  case variant
20
20
  when :restrict
@@ -23,24 +23,18 @@ module CurationConcerns
23
23
  when :loosen
24
24
  options.delete_at(2)
25
25
  end
26
- options
26
+ options.map { |value| [visibility_text(value), value] }
27
27
  end
28
28
 
29
29
  def visibility_badge(value)
30
- case value
31
- when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
32
- content_tag :span, "Open Access", class: "label label-success"
33
- when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
34
- content_tag :span, t('curation_concerns.institution_name'), class: "label label-info"
35
- when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
36
- content_tag :span, "Private", class: "label label-danger"
37
- when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO
38
- content_tag :span, "Embargo", class: "label label-warning"
39
- when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE
40
- content_tag :span, "Lease", class: "label label-warning"
41
- else
42
- content_tag :span, value, class: "label label-info"
43
- end
30
+ klass = t("curation_concerns.visibility.#{value}.class", default: 'label-info')
31
+ content_tag :span, visibility_text(value), class: "label #{klass}"
44
32
  end
33
+
34
+ private
35
+
36
+ def visibility_text(value)
37
+ t("curation_concerns.visibility.#{value}.text", default: value)
38
+ end
45
39
  end
46
40
  end
@@ -3,7 +3,7 @@ module CurationConcerns::FileSetHelper
3
3
  if parent.is_a?(Collection)
4
4
  main_app.collection_path(parent)
5
5
  else
6
- polymorphic_path([main_app, :curation_concerns, parent])
6
+ polymorphic_path([main_app, parent])
7
7
  end
8
8
  end
9
9
 
@@ -8,4 +8,5 @@ module CurationConcerns::MainAppHelpers
8
8
  include CurationConcerns::EmbargoHelper
9
9
  include CurationConcerns::LeaseHelper
10
10
  include CurationConcerns::CollectionsHelper
11
+ include CurationConcerns::PermissionsHelper
11
12
  end
@@ -0,0 +1,20 @@
1
+ module CurationConcerns
2
+ module PermissionsHelper
3
+ def help_link(file, title, aria_label)
4
+ link_to help_icon, '#', 'data-toggle': 'popover', 'data-content': capture_content(file),
5
+ 'data-original-title': title, 'aria-label': aria_label
6
+ end
7
+
8
+ private
9
+
10
+ def capture_content(file)
11
+ capture do
12
+ render file
13
+ end
14
+ end
15
+
16
+ def help_icon
17
+ content_tag 'i', '', 'aria-hidden': true, class: 'help-icon'
18
+ end
19
+ end
20
+ end
@@ -6,22 +6,14 @@ module CurationConcerns
6
6
  if doc.collection?
7
7
  doc
8
8
  else
9
- polymorphic_path([main_app, :curation_concerns, doc])
9
+ polymorphic_path([main_app, doc])
10
10
  end
11
11
  end
12
12
 
13
- def track_collection_path(*args)
14
- main_app.track_solr_document_path(*args)
15
- end
16
-
17
- def track_file_set_path(*args)
18
- main_app.track_solr_document_path(*args)
19
- end
20
-
21
13
  # generated new GenericWork models get registered as curation concerns and need a
22
14
  # track_model_path to render Blacklight-related views
23
- CurationConcerns.config.registered_curation_concern_types.each do |concern|
24
- define_method("track_#{concern.underscore}_path") { |*args| main_app.track_solr_document_path(*args) }
15
+ (['FileSet', 'Collection'] + CurationConcerns.config.registered_curation_concern_types).each do |concern|
16
+ define_method("track_#{concern.constantize.model_name.singular_route_key}_path") { |*args| main_app.track_solr_document_path(*args) }
25
17
  end
26
18
  end
27
19
  end
@@ -0,0 +1,8 @@
1
+ class MultiValueWithHelpInput < MultiValueInput
2
+ include WithHelpIcon
3
+
4
+ # Overriding this so that the class is correct and the javascript for multivalue will work on this.
5
+ def input_type
6
+ 'multi_value'.freeze
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ class SelectWithHelpInput < SimpleForm::Inputs::CollectionSelectInput
2
+ include WithHelpIcon
3
+ end
@@ -0,0 +1,36 @@
1
+ class SelectWithModalHelpInput < MultiValueWithHelpInput
2
+ def link_to_help
3
+ template.link_to "##{attribute_name}Modal", id: "#{input_class}_help_modal", rel: 'button',
4
+ data: { toggle: 'modal' }, 'aria-label': aria_label do
5
+ help_icon
6
+ end
7
+ end
8
+
9
+ private
10
+
11
+ def select_options
12
+ @select_options ||= begin
13
+ collection = options.delete(:collection) || self.class.boolean_collection
14
+ collection.respond_to?(:call) ? collection.call : collection.to_a
15
+ end
16
+ end
17
+
18
+ def build_field(value, _index)
19
+ html_options = input_html_options.dup
20
+
21
+ if @rendered_first_element
22
+ html_options[:id] = nil
23
+ html_options[:required] = nil
24
+ else
25
+ html_options[:id] ||= input_dom_id
26
+ end
27
+ html_options[:class] ||= []
28
+ html_options[:class] += ["#{input_dom_id} form-control multi-text-field"]
29
+ html_options[:'aria-labelledby'] = label_id
30
+ html_options.delete(:multiple)
31
+ @rendered_first_element = true
32
+
33
+ html_options.merge!(options.slice(:include_blank))
34
+ template.select_tag(attribute_name, template.options_for_select(select_options, value), html_options)
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ module WithHelpIcon
2
+ def label(wrapper_options = nil)
3
+ "#{super} #{link_to_help}"
4
+ end
5
+
6
+ protected
7
+
8
+ def link_to_help
9
+ template.link_to '#', id: "#{input_class}_help",
10
+ data: { toggle: 'popover'.freeze,
11
+ content: metadata_help,
12
+ 'original-title': raw_label_text },
13
+ 'aria-label': aria_label do
14
+ help_icon
15
+ end
16
+ end
17
+
18
+ def help_icon
19
+ template.content_tag 'i', nil, "aria-hidden": true, class: "help-icon"
20
+ end
21
+
22
+ def metadata_help
23
+ translate_from_namespace(:metadata_help) || attribute_name.to_s.humanize
24
+ end
25
+
26
+ def aria_label
27
+ translate_from_namespace(:aria_label) || default_aria_label
28
+ end
29
+
30
+ def default_aria_label
31
+ I18n.t("#{i18n_scope}.aria_label.#{lookup_model_names.join('.')}.default",
32
+ title: attribute_name.to_s.humanize)
33
+ end
34
+ end
@@ -2,6 +2,7 @@ module CurationConcerns
2
2
  class CollectionPresenter
3
3
  include ModelProxy
4
4
  include PresentsAttributes
5
+ include ActionView::Helpers::NumberHelper
5
6
  attr_accessor :solr_document, :current_ability
6
7
 
7
8
  # @param [SolrDocument] solr_document
@@ -18,5 +19,13 @@ module CurationConcerns
18
19
  # Metadata Methods
19
20
  delegate :title, :description, :creator, :contributor, :subject, :publisher, :language,
20
21
  :embargo_release_date, :lease_expiration_date, :rights, to: :solr_document
22
+
23
+ def size
24
+ number_to_human_size(@solr_document['bytes_is'])
25
+ end
26
+
27
+ def total_items
28
+ @solr_document['member_ids_ssim'].length
29
+ end
21
30
  end
22
31
  end
@@ -21,7 +21,8 @@ module CurationConcerns
21
21
  # Metadata Methods
22
22
  delegate :title, :description, :creator, :contributor, :subject, :publisher,
23
23
  :language, :date_uploaded, :rights,
24
- :embargo_release_date, :lease_expiration_date, to: :solr_document
24
+ :embargo_release_date, :lease_expiration_date,
25
+ :depositor, :tags, :title_or_label, to: :solr_document
25
26
 
26
27
  def page_title
27
28
  Array(solr_document['label_tesim']).first
@@ -21,5 +21,21 @@ module CurationConcerns
21
21
  def permission_badge_class
22
22
  PermissionBadge
23
23
  end
24
+
25
+ def display_microdata?
26
+ CurationConcerns.config.display_microdata
27
+ end
28
+
29
+ def microdata_type_to_html
30
+ return "" unless display_microdata?
31
+ value = I18n.t(microdata_type_key, default: CurationConcerns.config.microdata_default_type)
32
+ " itemscope itemtype=\"#{value}\"".html_safe
33
+ end
34
+
35
+ private
36
+
37
+ def microdata_type_key
38
+ "curation_concerns.schema_org.resource_type.#{human_readable_type}"
39
+ end
24
40
  end
25
41
  end
@@ -20,8 +20,9 @@ module CurationConcerns
20
20
  to: :solr_document
21
21
 
22
22
  # Metadata Methods
23
- delegate :title, :description, :creator, :contributor, :subject, :publisher, :language,
24
- :embargo_release_date, :lease_expiration_date, :rights, to: :solr_document
23
+ delegate :title, :date_created, :date_modified, :date_uploaded, :description,
24
+ :creator, :contributor, :subject, :publisher, :language, :embargo_release_date,
25
+ :lease_expiration_date, :rights, to: :solr_document
25
26
 
26
27
  def file_presenters
27
28
  @file_sets ||= PresenterFactory.build_presenters(ordered_ids,
@@ -1,7 +1,12 @@
1
+ require "rails_autolink/helpers"
2
+
1
3
  module CurationConcerns
2
4
  class AttributeRenderer
3
5
  include ActionView::Helpers::UrlHelper
4
6
  include ActionView::Helpers::TranslationHelper
7
+ include ActionView::Helpers::TextHelper
8
+ include ConfiguredMicrodata
9
+
5
10
  attr_reader :field, :values, :options
6
11
 
7
12
  # @param [Symbol] field
@@ -19,8 +24,9 @@ module CurationConcerns
19
24
 
20
25
  return markup if !values.present? && !options[:include_empty]
21
26
  markup << %(<tr><th>#{label}</th>\n<td><ul class='tabular'>)
27
+ attributes = microdata_object_attributes(field).merge(class: "attribute #{field}")
22
28
  Array(values).each do |value|
23
- markup << %(<li class="attribute #{field}">#{attribute_value_to_html(value)}</li>\n)
29
+ markup << "<li#{html_attributes(attributes)}>#{attribute_value_to_html(value)}</li>"
24
30
  end
25
31
  markup << %(</ul></td></tr>)
26
32
  markup.html_safe
@@ -38,17 +44,29 @@ module CurationConcerns
38
44
  if field == :rights
39
45
  rights_attribute_to_html(value)
40
46
  else
41
- li_value(value)
47
+ "<span#{html_attributes(microdata_value_attributes(field))}>#{li_value(value)}</span>"
42
48
  end
43
49
  end
44
50
 
51
+ def html_attributes(attributes)
52
+ buffer = ""
53
+ attributes.each do |k, v|
54
+ buffer << " #{k}"
55
+ buffer << %(="#{v}") unless v.blank?
56
+ end
57
+ buffer
58
+ end
59
+
45
60
  def search_field
46
61
  options.fetch(:search_field, field)
47
62
  end
48
63
 
49
64
  def li_value(value)
50
- link_to_if(options[:catalog_search_link], ERB::Util.h(value),
51
- search_path(value))
65
+ if options[:catalog_search_link]
66
+ link_to(ERB::Util.h(value), search_path(value))
67
+ else
68
+ auto_link(value)
69
+ end
52
70
  end
53
71
 
54
72
  def search_path(value)
@@ -0,0 +1,40 @@
1
+ module CurationConcerns
2
+ module ConfiguredMicrodata
3
+ def microdata?(field)
4
+ return false unless CurationConcerns.config.display_microdata
5
+ key = "curation_concerns.schema_org.#{field}.property"
6
+ t(key, default: false)
7
+ end
8
+
9
+ def microdata_object?(field)
10
+ return false unless CurationConcerns.config.display_microdata
11
+ key = "curation_concerns.schema_org.#{field}.type"
12
+ t(key, default: false)
13
+ end
14
+
15
+ def microdata_object_attributes(field)
16
+ if microdata_object?(field)
17
+ { itemprop: microdata_property(field), itemscope: '', itemtype: microdata_type(field) }
18
+ else
19
+ {}
20
+ end
21
+ end
22
+
23
+ def microdata_property(field)
24
+ t("curation_concerns.schema_org.#{field}.property")
25
+ end
26
+
27
+ def microdata_type(field)
28
+ t("curation_concerns.schema_org.#{field}.type")
29
+ end
30
+
31
+ def microdata_value_attributes(field)
32
+ if microdata?(field)
33
+ key = microdata_object?(field) ? :value : :property
34
+ { itemprop: t("curation_concerns.schema_org.#{field}.#{key}") }
35
+ else
36
+ {}
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,6 +1,6 @@
1
1
  module CurationConcerns
2
2
  class ParentService
3
- # @param [String] the id of a child GenericFile
3
+ # @param [String] the id of a child FileSet
4
4
  # @return [ActiveFedora::Base] the parent object
5
5
  def self.parent_for(id)
6
6
  ids = ordered_by_ids(id)
@@ -4,14 +4,14 @@
4
4
  <ul class="dropdown-menu">
5
5
  <% if can? :edit, document %>
6
6
  <li>
7
- <%= link_to [:edit, :curation_concerns, document], class: 'itemicon itemedit' do %><i class="glyphicon glyphicon-pencil"></i> Edit <%= document.human_readable_type %>
7
+ <%= link_to [:edit, document], class: 'itemicon itemedit' do %><i class="glyphicon glyphicon-pencil"></i> Edit <%= document.human_readable_type %>
8
8
  <% end %>
9
9
  </li>
10
10
  <li>
11
11
  <% if @collection || (@presenter and @presenter.collection?) # We're on the view page for @collection. -%>
12
12
  <%= link_to_remove_from_collection(document) %>
13
13
  <% else %>
14
- <%= link_to [:curation_concerns, document], class: 'itemicon itemtrash',
14
+ <%= link_to document, class: 'itemicon itemtrash',
15
15
  title: "Delete #{document.human_readable_type}", method: :delete,
16
16
  data: {
17
17
  confirm: "Deleting a #{document.human_readable_type} from #{t('curation_concerns.product_name')} is permanent. Click OK to delete this #{document.human_readable_type} from #{t('curation_concerns.product_name')}, or Cancel to cancel this operation" } do %>
@@ -1,25 +1,24 @@
1
- <%= simple_form_for [collections, @collection] do |f| %>
1
+ <%= simple_form_for [collections, @form] do |f| %>
2
2
 
3
- <% if f.error_notification -%>
3
+ <% if f.error_notification %>
4
4
  <div class="alert alert-danger fade in">
5
5
  <strong>Wait don't go!</strong> There was a problem with your submission. Please review the errors below:
6
6
  <a class="close" data-dismiss="alert" href="#">&times;</a>
7
7
  </div>
8
- <% end -%>
8
+ <% end %>
9
9
 
10
- <%= render 'form_descriptive_fields', curation_concern: @collection, f: f %>
10
+ <%= render 'form_descriptive_fields', f: f %>
11
11
  <%= render 'form_permission', f: f %>
12
-
13
12
  <%= render "curation_concerns/base/form_media", f: f %>
14
13
 
15
14
  <div class="row">
16
15
  <div class="col-md-12 form-actions">
17
16
  <%= f.submit class: 'btn btn-primary require-contributor-agreement' %>
18
- <%- if @collection.new_record? -%>
17
+ <% if action_name == 'new' %>
19
18
  <%= link_to 'Cancel', main_app.root_path, class: 'btn btn-link' %>
20
- <%- else -%>
21
- <%= link_to 'Cancel', collections.collection_path(@collection), class: 'btn btn-link' %>
22
- <%- end -%>
19
+ <% else %>
20
+ <%= link_to 'Cancel', collections.collection_path(@form), class: 'btn btn-link' %>
21
+ <% end %>
23
22
  </div>
24
23
  </div>
25
24
 
@@ -1,29 +1,31 @@
1
1
  <div class="batch-info">
2
2
  <div>
3
- <%= render partial: 'collections/form_for_select_collection', locals: { user_collections: @user_collections } %>
3
+ <%= render 'collections/form_for_select_collection', user_collections: @user_collections %>
4
4
  </div>
5
5
 
6
- <% if params[:action] == "edit" %>
7
- <div class="batch-toggle">
8
- <% session[:batch_edit_state] = "on" %>
9
- <%= button_for_remove_selected_from_collection @presenter %>
10
- </div>
11
- <%end %>
12
- <div class="sort-toggle">
13
- <%-# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {:action=>"index"} but I'm not sure -%>
14
- <% unless @response.response['numFound'] < 2 %>
15
- <%= form_tag collections.collection_path(@presenter), method: :get, class: 'per_page form-inline' do %>
16
- <%= label_tag(:sort, "<span>Sort By:</span>".html_safe) %>
17
- <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort]))) %>
18
- &nbsp;&nbsp;&nbsp;
19
- <%= label_tag(:per_page) do %>
20
- Show <%= select_tag(:per_page, options_for_select(['10', '20', '50', '100'], h(params[:per_page])), title: "Number of results to display per page") %> per page
21
- <% end %>
22
- <%= render_hash_as_hidden_fields(params_for_search.except(:per_page, :sort)) %>
23
- &nbsp;&nbsp;&nbsp;
24
- <button class="btn btn-primary"><i class="icon-refresh"></i> Refresh</button>
25
- <%= render 'view_type_group' %>
26
- <% end %>
27
- <% end unless sort_fields.empty? %>
6
+ <% if action_name == "edit" %>
7
+ <div class="batch-toggle">
8
+ <% session[:batch_edit_state] = "on" %>
9
+ <%= button_for_remove_selected_from_collection collection %>
10
+ </div>
11
+ <% end %>
12
+ <div class="sort-toggle">
13
+ <%-# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {:action=>"index"} but I'm not sure -%>
14
+ <% unless @response.response['numFound'] < 2 %>
15
+ <%= form_tag collections.collection_path(collection), method: :get, class: 'per_page form-inline' do %>
16
+ <%= label_tag :sort do %>
17
+ <span>Sort By:</span>
18
+ <% end %>
19
+ <%= select_tag :sort, options_for_select(sort_fields, h(params[:sort])) %>
20
+ &nbsp;&nbsp;&nbsp;
21
+ <%= label_tag :per_page do %>
22
+ Show <%= select_tag :per_page, options_for_select(['10', '20', '50', '100'], h(params[:per_page])), title: "Number of results to display per page" %> per page
23
+ <% end %>
24
+ <%= render_hash_as_hidden_fields params_for_search.except(:per_page, :sort) %>
25
+ &nbsp;&nbsp;&nbsp;
26
+ <button class="btn btn-primary"><i class="icon-refresh"></i> Refresh</button>
27
+ <%= render 'view_type_group' %>
28
+ <% end %>
29
+ <% end unless sort_fields.empty? %>
28
30
  </div>
29
31
  </div>
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
 
14
14
  <%= render 'search_form' %>
15
- <%= render 'sort_and_per_page' %>
15
+ <%= render 'sort_and_per_page', collection: @presenter %>
16
16
 
17
17
  <% if has_collection_search_parameters? %>
18
18
  <h2>Search Results within this Collection</h2>
@@ -1,4 +1,4 @@
1
- <table class="table table-striped <%= dom_class(@presenter) %> attributes">
1
+ <table class="table table-striped <%= dom_class(@presenter) %> attributes" <%= @presenter.microdata_type_to_html %>>
2
2
  <caption class="table-heading"><h2>Attributes</h2></caption>
3
3
  <thead>
4
4
  <tr><th>Attribute Name</th><th>Values</th></tr>
@@ -1,11 +1,11 @@
1
- <%= simple_form_for [main_app, :curation_concerns, curation_concern],
1
+ <%= simple_form_for [main_app, @form],
2
2
  wrapper_mappings: { multifile: :horizontal_file_input } do |f| %>
3
3
  <% if f.error_notification -%>
4
4
  <div class="alert alert-danger fade in">
5
5
  <strong>Wait don't go!</strong> There was a problem with your submission. Please review the errors below:
6
6
  <a class="close" data-dismiss="alert" href="#">&times;</a>
7
7
  </div>
8
- <% end -%>
8
+ <% end %>
9
9
 
10
10
  <%= render 'form_descriptive_fields', f: f %>
11
11
  <%= render 'form_supplementary_fields', f: f %>
@@ -13,12 +13,11 @@
13
13
  <div class="row">
14
14
  <div class="col-md-12 form-actions">
15
15
  <%= f.submit class: 'btn btn-primary require-contributor-agreement' %>
16
- <%- if curation_concern.new_record? -%>
16
+ <% if curation_concern.new_record? %>
17
17
  <%= link_to 'Cancel', main_app.root_path, class: 'btn btn-link' %>
18
- <%- else -%>
19
- <%= link_to 'Cancel', polymorphic_path([main_app, :curation_concerns, curation_concern]), class: 'btn btn-link' %>
20
- <%- end -%>
18
+ <% else %>
19
+ <%= link_to 'Cancel', polymorphic_path([main_app, curation_concern]), class: 'btn btn-link' %>
20
+ <% end %>
21
21
  </div>
22
22
  </div>
23
-
24
23
  <% end %>
@@ -8,6 +8,9 @@
8
8
  <legend>
9
9
  Visibility
10
10
  <small>Who should be able to view or download this content?</small>
11
+ <span id="visibility_tooltip" class="h5">
12
+ <%= help_link 'visibility', 'Visibility', 'Usage information for visibility' %>
13
+ </span>
11
14
  </legend>
12
15
 
13
16
  <%= render "form_permission_note" %>
@@ -0,0 +1,3 @@
1
+ <%= render 'curation_concerns/file_sets/upload/alerts', presenter: @presenter %>
2
+ <%= render 'curation_concerns/file_sets/upload/form', presenter: @presenter %>
3
+ <%= render 'curation_concerns/file_sets/upload/script_templates', presenter: @presenter %>
@@ -1,9 +1,9 @@
1
1
  <% if collector || editor %>
2
2
  <div class="form-actions">
3
3
  <% if editor %>
4
- <%= link_to "Edit This #{@presenter.human_readable_type}", edit_polymorphic_path([main_app, :curation_concerns, @presenter]), class: 'btn btn-default' %>
4
+ <%= link_to "Edit This #{@presenter.human_readable_type}", edit_polymorphic_path([main_app, @presenter]), class: 'btn btn-default' %>
5
5
  <%= link_to "Attach a File", main_app.new_curation_concerns_file_set_path(@presenter), class: 'btn btn-default' %>
6
- <%= link_to "Delete This #{@presenter.human_readable_type}", [main_app, :curation_concerns, @presenter], class: 'btn btn-danger pull-right', data: { confirm: "Delete this #{@presenter.human_readable_type}?" }, method: :delete %>
6
+ <%= link_to "Delete This #{@presenter.human_readable_type}", [main_app, @presenter], class: 'btn btn-danger pull-right', data: { confirm: "Delete this #{@presenter.human_readable_type}?" }, method: :delete %>
7
7
  <% end %>
8
8
  </div>
9
9
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <h2>Versions</h2>
3
3
  <div class="well">
4
4
 
5
- <%= form_for [main_app, :curation_concerns, curation_concern], html: { multipart: true } do |f| %>
5
+ <%= form_for [main_app, curation_concern], html: { multipart: true } do |f| %>
6
6
  <h3>Restore Previous Version</h3>
7
7
  <% @version_list.each do |version| %>
8
8
  <div class="form-group">
@@ -0,0 +1,17 @@
1
+ <p>This setting will determine who can view your file, and the associated metadata. Setting
2
+ the visibility to <span class='label label-success'>Open Access</span> will allow your
3
+ content to be discovered in Google and viewed by anyone. The visibility setting
4
+ <span class='label label-info'><%=t('curation_concerns.institution_name') %></span> will only allow
5
+ users who are logged into <%=t('curation_concerns.product_name') %> (via WebAccess) to view the content.
6
+ Files that are marked <span class='label label-danger'>Private</span> are only able to be viewed
7
+ by users and/or groups that have been given specific access in the &quot;Share With&quot; section.
8
+ </p>
9
+
10
+ <p>
11
+ Permissions in <%=t('curation_concerns.product_name') %> are hierarchical. This means that you cannot set
12
+ the visibility of a file to <span class='label label-success'>Open Access</span> or
13
+ <span class='label label-info'><%=t('curation_concerns.institution_name') %></span> and simultaneously
14
+ try to restrict the access of a single user. However, you may mark the visibility of
15
+ a file as <span class='label label-danger'>Private</span> and then grant access to
16
+ particular users and/or groups for that file in the &quot;Share With&quot; section.
17
+ </p>
@@ -10,7 +10,7 @@
10
10
  <%= render 'attributes', curation_concern: @presenter %>
11
11
  <%= render 'related_files', presenter: @presenter %>
12
12
  <% if editor %>
13
- <%= render partial: 'curation_concerns/file_sets/multiple_upload', presenter: @presenter %>
13
+ <%= render 'multiple_upload', presenter: @presenter %>
14
14
  <% end %>
15
15
 
16
16
  <%= render "show_actions", collector: collector, editor: editor%>