sufia 6.0.0.rc4 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/History.md +280 -0
  5. data/README.md +180 -98
  6. data/SUFIA_VERSION +1 -1
  7. data/app/assets/images/site_images/collection-icon.svg +168 -0
  8. data/app/assets/javascripts/sufia/uploader.js +7 -4
  9. data/app/assets/stylesheets/sufia.css.scss +1 -1
  10. data/app/assets/stylesheets/sufia/_collections.scss +33 -13
  11. data/app/assets/stylesheets/sufia/_file-show.scss +24 -0
  12. data/app/assets/stylesheets/sufia/_settings.scss +4 -0
  13. data/app/controllers/concerns/sufia/catalog.rb +1 -11
  14. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +13 -15
  15. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +3 -1
  16. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +2 -1
  17. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -0
  18. data/app/controllers/concerns/sufia/files_controller_behavior.rb +4 -1
  19. data/app/controllers/concerns/sufia/homepage_controller.rb +4 -11
  20. data/app/controllers/concerns/sufia/my_controller_behavior.rb +3 -21
  21. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +6 -6
  22. data/app/controllers/concerns/sufia/users_controller_behavior.rb +7 -7
  23. data/app/controllers/my/collections_controller.rb +1 -8
  24. data/app/controllers/my/files_controller.rb +1 -1
  25. data/app/controllers/my/highlights_controller.rb +1 -9
  26. data/app/controllers/my/shares_controller.rb +1 -8
  27. data/app/helpers/generic_file_helper.rb +4 -0
  28. data/app/helpers/sufia/sufia_helper_behavior.rb +3 -3
  29. data/app/helpers/sufia_url_helper.rb +9 -0
  30. data/app/jobs/content_depositor_change_event_job.rb +5 -5
  31. data/app/search_builders/sufia/search_builder.rb +50 -0
  32. data/app/views/_user_util_links.html.erb +6 -4
  33. data/app/views/batch_edits/_check_all.html.erb +1 -1
  34. data/app/views/catalog/index.html.erb +3 -30
  35. data/app/views/collections/_media_display.html.erb +1 -1
  36. data/app/views/collections/_show_descriptions.html.erb +1 -1
  37. data/app/views/collections/_show_document_list_row.html.erb +2 -2
  38. data/app/views/dashboard/_index_partials/_heading_actions.html.erb +16 -12
  39. data/app/views/generic_files/_browse_everything.html.erb +3 -1
  40. data/app/views/generic_files/_local_file_import.html.erb +0 -1
  41. data/app/views/generic_files/_multiple_upload.html.erb +0 -1
  42. data/app/views/generic_files/_show_descriptions.html.erb +6 -11
  43. data/app/views/generic_files/_show_details.html.erb +41 -65
  44. data/app/views/generic_files/new.html.erb +1 -0
  45. data/app/views/generic_files/show.html.erb +2 -1
  46. data/app/views/generic_files/upload/_alerts.html.erb +5 -13
  47. data/app/views/homepage/_home_header.html.erb +6 -7
  48. data/app/views/my/_index_partials/_list_collections.html.erb +1 -1
  49. data/app/views/my/index.html.erb +2 -2
  50. data/app/views/records/edit_fields/_resource_type.html.erb +1 -1
  51. data/config/initializers/sufia_events.rb +2 -3
  52. data/config/locales/sufia.en.yml +11 -2
  53. data/lib/generators/sufia/install_generator.rb +5 -1
  54. data/lib/generators/sufia/templates/catalog_controller.rb +3 -5
  55. data/lib/generators/sufia/upgrade600_generator.rb +26 -0
  56. data/lib/sufia/version.rb +1 -1
  57. data/spec/actors/generic_file/actor_spec.rb +14 -0
  58. data/spec/controllers/collections_controller_spec.rb +19 -2
  59. data/spec/controllers/dashboard_controller_spec.rb +43 -12
  60. data/spec/controllers/generic_files_controller_spec.rb +24 -1
  61. data/spec/controllers/transfers_controller_spec.rb +4 -4
  62. data/spec/controllers/users_controller_spec.rb +18 -4
  63. data/spec/fixtures/spoken-text.m4a +0 -0
  64. data/spec/helpers/dashboard_helper_spec.rb +1 -1
  65. data/spec/helpers/sufia_url_helper_spec.rb +15 -0
  66. data/spec/inputs/select_with_help_input_spec.rb +15 -0
  67. data/spec/jobs/{active_fedora_pid_based_job_spec.rb → active_fedora_id_based_job_spec.rb} +2 -2
  68. data/spec/jobs/audit_job_spec.rb +2 -2
  69. data/spec/lib/sufia/id_service_spec.rb +8 -8
  70. data/spec/lib/sufia/user_stat_importer_spec.rb +9 -1
  71. data/spec/models/ability_spec.rb +7 -4
  72. data/spec/models/checksum_audit_log_spec.rb +10 -10
  73. data/spec/models/collection_spec.rb +8 -13
  74. data/spec/models/fits_datastream_spec.rb +17 -0
  75. data/spec/models/generic_file_spec.rb +9 -1
  76. data/spec/models/proxy_deposit_request_spec.rb +15 -3
  77. data/spec/services/generic_file_audit_service_spec.rb +1 -1
  78. data/spec/support/features.rb +1 -0
  79. data/spec/support/rake_output.rb +20 -0
  80. data/spec/tasks/rake_spec.rb +58 -0
  81. data/spec/test_app_templates/Gemfile.extra +3 -1
  82. data/spec/views/batch/edit.html.erb_spec.rb +6 -2
  83. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  84. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +6 -2
  85. data/spec/views/dashboard/index_spec.rb +49 -1
  86. data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +9 -0
  87. data/spec/views/generic_file/show.html.erb_spec.rb +13 -8
  88. data/spec/views/homepage/_home_header.html.erb_spec.rb +26 -0
  89. data/spec/views/users/_user_util_links.html.erb_spec.rb +20 -0
  90. data/spec/views/users/show.html.erb_spec.rb +1 -1
  91. data/sufia-models/app/actors/sufia/generic_file/actor.rb +1 -1
  92. data/sufia-models/app/jobs/active_fedora_id_based_job.rb +22 -0
  93. data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +5 -20
  94. data/sufia-models/app/jobs/audit_job.rb +5 -6
  95. data/sufia-models/app/jobs/characterize_job.rb +1 -1
  96. data/sufia-models/app/jobs/create_derivatives_job.rb +1 -1
  97. data/sufia-models/app/jobs/import_url_job.rb +2 -2
  98. data/sufia-models/app/models/batch.rb +18 -4
  99. data/sufia-models/app/models/checksum_audit_log.rb +2 -2
  100. data/sufia-models/app/models/concerns/sufia/ability.rb +7 -1
  101. data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +1 -1
  102. data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +23 -14
  103. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +1 -1
  104. data/sufia-models/app/models/datastreams/fits_datastream.rb +1 -36
  105. data/sufia-models/app/models/proxy_deposit_request.rb +6 -6
  106. data/sufia-models/app/services/sufia/generic_file_audit_service.rb +1 -1
  107. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -1
  108. data/sufia-models/app/services/sufia/id_service.rb +2 -3
  109. data/sufia-models/app/services/sufia/noid.rb +1 -1
  110. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +1 -1
  111. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +5 -0
  112. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +5 -0
  113. data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +21 -0
  114. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +20 -1
  115. data/sufia-models/lib/sufia/models/version.rb +1 -1
  116. data/sufia-models/lib/tasks/batch_cleanup.rake +19 -0
  117. data/sufia-models/lib/tasks/migrate.rake +21 -0
  118. data/sufia-models/lib/tasks/sufia-models_tasks.rake +55 -38
  119. data/sufia-models/sufia-models.gemspec +1 -1
  120. data/sufia.gemspec +2 -2
  121. metadata +44 -38
  122. data/app/assets/images/site_images/bg_body.png +0 -0
  123. data/app/assets/images/site_images/bg_breadcrumbs.png +0 -0
  124. data/app/assets/images/site_images/bg_button1.png +0 -0
  125. data/app/assets/images/site_images/bg_button2.png +0 -0
  126. data/app/assets/images/site_images/bg_button3.png +0 -0
  127. data/app/assets/images/site_images/bg_content.png +0 -0
  128. data/app/assets/images/site_images/bg_content2.png +0 -0
  129. data/app/assets/images/site_images/bg_footer.png +0 -0
  130. data/app/assets/images/site_images/bg_masthead.png +0 -0
  131. data/app/assets/images/site_images/bg_search_field.png +0 -0
  132. data/app/assets/images/site_images/bg_search_header.png +0 -0
  133. data/app/assets/images/site_images/bg_signin.png +0 -0
  134. data/app/assets/images/site_images/carrot_blue.png +0 -0
  135. data/app/assets/images/site_images/carrot_yellow.png +0 -0
  136. data/app/assets/images/site_images/icon_arrow2_up.png +0 -0
  137. data/app/assets/images/site_images/icon_arrow3_down.png +0 -0
  138. data/app/assets/images/site_images/icon_arrow3_right.png +0 -0
  139. data/app/assets/images/site_images/icon_arrow_down.png +0 -0
  140. data/app/assets/images/site_images/icons_sprite.png +0 -0
  141. data/app/assets/images/site_images/logo_psuss_footer.png +0 -0
  142. data/app/views/catalog/_edit_partials/_default.html.erb +0 -55
  143. data/spec/support/fedora_conf/fedora.fcfg +0 -953
@@ -1,16 +1,20 @@
1
1
  <div class="col-xs-12 heading-row">
2
- <div class="col-xs-6 col-sm-3 heading-tile">
3
- <%= link_to sufia.new_generic_file_path do %>
4
- <span class="glyphicon glyphicon-upload"></span>
5
- <%= t("sufia.dashboard.upload") %>
6
- <% end %>
7
- </div>
8
- <div class="col-xs-6 col-sm-3 heading-tile">
9
- <%= link_to collections.new_collection_path, id: "hydra-collection-add" do %>
10
- <span class="glyphicon glyphicon-plus"></span>
11
- <%= t("sufia.dashboard.create_collection") %>
12
- <% end %>
13
- </div>
2
+ <% if can?(:create, GenericFile) %>
3
+ <div class="col-xs-6 col-sm-3 heading-tile">
4
+ <%= link_to sufia.new_generic_file_path do %>
5
+ <span class="glyphicon glyphicon-upload"></span>
6
+ <%= t("sufia.dashboard.upload") %>
7
+ <% end %>
8
+ </div>
9
+ <% end %>
10
+ <% if can?(:create, Collection) %>
11
+ <div class="col-xs-6 col-sm-3 heading-tile">
12
+ <%= link_to collections.new_collection_path, id: "hydra-collection-add" do %>
13
+ <span class="glyphicon glyphicon-plus"></span>
14
+ <%= t("sufia.dashboard.create_collection") %>
15
+ <% end %>
16
+ </div>
17
+ <% end %>
14
18
  <div class="col-xs-6 col-sm-3 heading-tile">
15
19
  <%= link_to sufia.dashboard_collections_path, id: "hydra-collection-view" do %>
16
20
  <span class="glyphicon glyphicon-th"></span>
@@ -1,5 +1,7 @@
1
1
  <%= render partial: 'generic_files/upload/agreement' %>
2
- <%= render partial: 'generic_files/upload/alerts' %>
2
+ <div class="alert alert-success">
3
+ <%= t("sufia.upload.cloud_timeout_message", contact_href: link_to(t("sufia.upload.alert.contact_href_text"), sufia.contact_form_index_path)) %>
4
+ </div>
3
5
  <div class="well">
4
6
  <%= form_tag(sufia.generic_files_path, id: 'browse_everything_form', method: 'post') do %>
5
7
  <%= render partial: 'generic_files/upload/tos_checkbox' %>
@@ -1,3 +1,2 @@
1
1
  <%= render partial: 'generic_files/upload/agreement' %>
2
- <%= render partial: 'generic_files/upload/alerts' %>
3
2
  <%= render partial: 'generic_files/upload/local_file_import_chooser' %>
@@ -1,4 +1,3 @@
1
1
  <%= render partial: 'generic_files/upload/agreement' %>
2
- <%= render partial: 'generic_files/upload/alerts' %>
3
2
  <%= render partial: 'generic_files/upload/form' %>
4
3
  <%= render partial: 'generic_files/upload/script_templates' %>
@@ -1,12 +1,7 @@
1
-
2
- <h2 class="non lower">Descriptions</h2>
3
- <table class="table table-striped"><!-- class="verticalheadings"> -->
4
- <tbody>
5
- <% present_terms(@presenter) do |r, term| %>
6
- <tr>
7
- <th><%= r.label(term) %></th>
8
- <td><%= r.value(term) %></td>
9
- </tr>
1
+ <h2>Descriptions</h2>
2
+ <dl class="dl-horizontal file-show-term file-show-descriptions">
3
+ <% present_terms(@presenter,@presenter.terms - [:title, :description]) do |r, term| %>
4
+ <dt><%= r.label(term) %></dt>
5
+ <dd><%= r.value(term) %></dd>
10
6
  <% end %>
11
- </tbody>
12
- </table> <!-- /verticalheadings -->
7
+ </dl>
@@ -1,69 +1,45 @@
1
- <h2 class="non lower">File Details</h2>
2
- <table class="table table-striped">
3
- <tbody>
4
- <tr>
5
- <th>Depositor</th>
6
- <td itemprop="accountablePerson" itemscope itemtype="http://schema.org/Person"><span itemprop="name"><%= link_to_profile @generic_file.depositor %></span></td>
7
- </tr>
8
- <tr>
9
- <th>Date Uploaded</th>
10
- <td itemprop="datePublished">
11
- <%= @generic_file.date_uploaded %>
12
- </td>
13
- </tr>
14
- <tr>
15
- <th>Date Modified</th>
16
- <td itemprop="dateModified">
17
- <%= @generic_file.date_modified %>
18
- </td>
19
- </tr>
20
- <tr>
21
- <th>Audit Status</th>
22
- <td><%= @audit_status %></td>
23
- </tr>
24
- <% unless @generic_file.related_files.empty? %>
25
- <tr>
26
- <th>Related Files</th>
27
- <td>
28
- <div class="related-files">
29
- <dl><dt>
30
- <% @generic_file.related_files.each do |f| %>
31
- <dd><%= link_to(f.label, sufia.generic_file_url(f)) %></dd>
32
- <% end %>
33
- </dt></dl>
34
- </div>
35
- </td>
36
- </tr>
37
- <% end %>
38
- <tr>
39
- <th>Characterization</th>
40
- <td>
41
- <%= "not yet characterized" if @generic_file.characterization_terms.values.flatten.map(&:empty?).reduce(true) { |sum, value| sum && value } %>
42
- <% @generic_file.characterization_terms.each_pair do |term, values| %>
43
- <div>
44
- <% label = term.to_s %>
45
- <% if label == "format_label" %>
46
- <% label = "File Format" %>
47
- <% values = @generic_file.file_format %>
48
- <% end %>
49
- <% label = label.humanize %>
50
- <% if values.is_a? Array %>
51
- <% length = values.length %>
52
- <% length = Sufia.config.fits_message_length-1 if term == :status_message && values.length > Sufia.config.fits_message_length-1 %>
53
- <% values[0..length].each_with_index do |value, idx| %>
1
+ <h2>File Details</h2>
2
+ <dl class="dl-horizontal file-show-term file-show-details">
3
+ <dt>Depositor</dt>
4
+ <dd itemprop="accountablePerson" itemscope itemtype="http://schema.org/Person"><span itemprop="name"><%= link_to_profile @generic_file.depositor %></span></dd>
5
+ <dt>Date Uploaded</dt>
6
+ <dd itemprop="datePublished"><%= @generic_file.date_uploaded %></dd>
7
+ <dt>Date Modified</dt>
8
+ <dd itemprop="dateModified"><%= @generic_file.date_modified %></dd>
9
+ <dt>Audit Status</dt>
10
+ <dd><%= @audit_status %></dd>
11
+ <% unless @generic_file.related_files.empty? %>
12
+ <dt>Related Files</dt>
13
+ <% @generic_file.related_files.each do |f| %>
14
+ <dd><%= link_to(f.label, sufia.generic_file_url(f)) %></dd>
15
+ <% end %>
16
+ <% end %>
17
+ <dt>Characterization</dt>
18
+ <dd>
19
+ <%= "not yet characterized" if @generic_file.characterization_terms.values.flatten.map(&:empty?).reduce(true) { |sum, value| sum && value } %>
20
+ <% @generic_file.characterization_terms.each_pair do |term, values| %>
21
+ <div>
22
+ <% label = term.to_s %>
23
+ <% if label == "format_label" %>
24
+ <% label = "File Format" %>
25
+ <% values = @generic_file.file_format %>
26
+ <% end %>
27
+ <% label = label.humanize %>
28
+ <% if values.is_a? Array %>
29
+ <% length = values.length %>
30
+ <% length = Sufia.config.fits_message_length-1 if term == :status_message && values.length > Sufia.config.fits_message_length-1 %>
31
+ <% values[0..length].each_with_index do |value, idx| %>
54
32
  <% next if value.empty? %>
55
33
  <%= "#{label}: #{value.truncate(250)}" %>
56
34
  <%= "<br />".html_safe unless idx == length %>
57
- <% end %>
58
- <% if length != values.length %>
59
- <%= render partial: "generic_files/extra_fields_modal", locals: {name: term, values: values, start: Sufia.config.fits_message_length}%>
60
- <% end %>
61
- <% else %>
62
- <%= "#{label}: #{values.truncate(250)}" %><br />
63
35
  <% end %>
64
- </div>
65
- <% end %>
66
- </td>
67
- </tr>
68
- </tbody>
69
- </table> <!-- /verticalheadings -->
36
+ <% if length != values.length %>
37
+ <%= render partial: "generic_files/extra_fields_modal", locals: {name: term, values: values, start: Sufia.config.fits_message_length}%>
38
+ <% end %>
39
+ <% else %>
40
+ <%= "#{label}: #{values.truncate(250)}" %><br />
41
+ <% end %>
42
+ </div>
43
+ <% end %>
44
+ </dd>
45
+ </dl>
@@ -1,4 +1,5 @@
1
1
  <h2>Upload</h2>
2
+ <%= render partial: 'generic_files/upload/alerts' %>
2
3
  <%# using partials rather than inlining, so implementers can add or change stuff on this page without much duplication %>
3
4
  <ul class="nav nav-tabs" role="tablist" title="Data Source Selectors" id="upload_tabs">
4
5
  <li class="active" id="computer_tab" title="<%= t('sufia.upload.my_computer.sr_tab_label')+' '+ t('sufia.upload.my_computer.tab_label') %>"><a role="tab" href="#local" data-toggle="tab"><i class="glyphicon glyphicon-folder-open" aria-hidden="true"></i> <%= t('sufia.upload.my_computer.tab_label')%></a></li>
@@ -47,7 +47,8 @@
47
47
  <%= render 'show_collections' %>
48
48
  </div>
49
49
  <div itemscope itemtype="<%= @presenter.itemtype %>" class="col-xs-12 col-sm-8">
50
- <h1 class="visibility"><%= @presenter.title.first %> <%= render_visibility_badge %></h1>
50
+ <h1 class="visibility"><%= display_multiple @presenter.title %> <%= render_visibility_badge %></h1>
51
+ <p class="genericfile_description"><%= display_multiple @presenter.description %></p>
51
52
  <%= render 'show_descriptions' %>
52
53
  <%= render 'show_details' %>
53
54
  <%= render 'users/activity_log', events: @events %>
@@ -1,17 +1,9 @@
1
- <div class="alert alert-info hide" id="success">
2
- You have successfully uploaded some of your files. Either continue to upload or edit use the links below to abandon the rest of your added files.
3
- <p>
4
- <%= link_to 'Add Descriptions', GenericFilesController.upload_complete_path(@batch_id), class: 'btn' %>
5
- </p>
1
+ <div class="alert alert-warning" id="fail">
2
+ <%= t("sufia.upload.alert.fail_html", reload_href: link_to(t("sufia.upload.alert.fail_restart_href_text"), sufia.new_generic_file_path), contact_href: link_to(t("sufia.upload.alert.contact_href_text"), sufia.contact_form_index_path)) %>
6
3
  </div>
7
4
 
8
- <div class="alert hide" id="fail">
9
- There was a problem during upload. Please click the &quot;Start Upload&quot; button or <%= link_to 'start over', sufia.new_generic_file_path %>
5
+ <div class="alert alert-warning" id="partial_fail">
6
+ <%= t("sufia.upload.alert.partial_fail_html", metadata_href: link_to(t("sufia.upload.alert.partial_fail_metadata_href_text"), GenericFilesController.upload_complete_path(@batch_id), class: 'btn'), contact_href: link_to(t("sufia.upload.alert.contact_href_text"), sufia.contact_form_index_path)) %>
10
7
  </div>
11
8
 
12
- <div class="alert hide" id="partial_fail">
13
- One or more files did not upload successfully. To continue using the files uploaded use one of the links below.<br />
14
- <%= link_to 'Add Descriptions', GenericFilesController.upload_complete_path(@batch_id), class: 'btn' %>
15
- </div>
16
-
17
- <div class="alert hide" id="errmsg"> </div>
9
+ <div class="alert alert-warning" id="errmsg"> </div>
@@ -1,12 +1,11 @@
1
1
  <div class="home_call_action col-xs-12 col-sm-4 pull-right">
2
- <div class="home_share_work">
3
- <%= link_to "<i class=\"glyphicon glyphicon-upload\"></i> #{t('sufia.share_button')}".html_safe, sufia.new_generic_file_path, class: "btn btn-primary btn-lg btn-block", id: "contribute_link" %>
4
- <p class="text-center"><a href="/terms/">Terms of Use</a></p>
5
- </div><!-- /.home_share_work -->
2
+ <% if can?(:view_share_work, GenericFile) %>
3
+ <div class="home_share_work">
4
+ <%= link_to "<i class=\"glyphicon glyphicon-upload\"></i> #{t('sufia.share_button')}".html_safe, sufia.new_generic_file_path, class: "btn btn-primary btn-lg btn-block", id: "contribute_link" %>
5
+ <p class="text-center"><a href="/terms/">Terms of Use</a></p>
6
+ </div><!-- /.home_share_work -->
7
+ <% end %>
6
8
  </div><!-- /.col-xs-3 -->
7
9
  <div class="col-xs-12 col-sm-8">
8
10
  <%= render partial: "marketing" %>
9
11
  </div>
10
-
11
-
12
-
@@ -5,7 +5,7 @@
5
5
  <td width="41%">
6
6
  <div class="media">
7
7
  <%= link_to [collections, document], class: "pull-left", "aria-hidden" => true do %>
8
- <span class="glyphicon glyphicon-th collection-icon-small">
8
+ <%= image_tag "site_images/collection-icon.svg", class: "collection-icon-small" %>
9
9
  <% end %>
10
10
  <div class="media-body">
11
11
  <div class="media-heading">
@@ -33,8 +33,8 @@
33
33
  <%= render partial: 'document_list' %>
34
34
 
35
35
  <% content_for :sidebar do %>
36
- <%= link_to t("sufia.dashboard.upload"), sufia.new_generic_file_path, class: "btn btn-primary" %>
37
- <%= link_to t("sufia.dashboard.create_collection"), collections.new_collection_path, id: "hydra-collection-add", class: "btn btn-primary" %>
36
+ <%= link_to t('sufia.dashboard.upload_html'), sufia.new_generic_file_path, class: "btn btn-primary" %>
37
+ <%= link_to t('sufia.dashboard.create_collection_html'), collections.new_collection_path, id: "hydra-collection-add", class: "btn btn-primary" %>
38
38
  <%= render partial: 'facets', locals: {current_tab: current_tab} %>
39
39
  <% end %>
40
40
 
@@ -1,2 +1,2 @@
1
1
  <%= f.input :resource_type, as: :select_with_help, collection: Sufia.config.resource_types,
2
- input_html: { class: 'form-control', multiple: true, required: true } %>
2
+ input_html: { class: 'form-control', multiple: true } %>
@@ -14,7 +14,6 @@ Sufia.config.after_update_metadata = lambda { |generic_file, user|
14
14
  Sufia.queue.push(ContentUpdateEventJob.new(generic_file.id, user.user_key))
15
15
  }
16
16
 
17
- Sufia.config.after_destroy = lambda { |pid, user|
18
- Sufia.queue.push(ContentDeleteEventJob.new(pid, user.user_key))
17
+ Sufia.config.after_destroy = lambda { |id, user|
18
+ Sufia.queue.push(ContentDeleteEventJob.new(id, user.user_key))
19
19
  }
20
-
@@ -47,6 +47,13 @@ en:
47
47
  local_ingest:
48
48
  tab_label: "Network/Server Location"
49
49
  processing: "File is being processed; you may edit when processing has completed"
50
+ alert:
51
+ fail_html: "There was a problem during upload, none of your files uploaded correctly. Please %{reload_href}. Use the %{contact_href} to report the error if it persists."
52
+ fail_restart_href_text: "start over"
53
+ contact_href_text: "contact form"
54
+ partial_fail_html: "One or more files did not upload successfully. To continue using the files that uploaded %{metadata_href}. <br /> Use the %{contact_href} to report the error if it persists."
55
+ partial_fail_metadata_href_text: "edit their metadata"
56
+ cloud_timeout_message: "Please note that if you upload a large number of files within a short period of time, the cloud provider may not be able to accommodate your request. If you experience any errors uploading from the cloud, let us know via the %{contact_href}."
50
57
  homepage:
51
58
  featured_works:
52
59
  tab_label: 'Featured Works'
@@ -59,8 +66,8 @@ en:
59
66
  dashboard:
60
67
  title: "My Dashboard"
61
68
  greeting: "Hello, "
62
- upload: "Upload"
63
- create_collection: "Create Collection"
69
+ upload_html: '<span class="glyphicon glyphicon-upload"></span> Upload'
70
+ create_collection_html: '<span class="glyphicon glyphicon-plus"></span> Create Collection'
64
71
  view_collections: "View Collections"
65
72
  view_files: "View Files"
66
73
  user_activity: "User Activity"
@@ -121,6 +128,8 @@ en:
121
128
  visibility:
122
129
  open: "Open Access"
123
130
  private: "Private"
131
+ open_title_attr: "Change the visibility of this resource"
132
+ private_title_attr: "Change the visibility of this resource"
124
133
  user_profile:
125
134
  no_followers: "No one is following you."
126
135
  no_following: "You are not following anyone."
@@ -77,7 +77,7 @@ module Sufia
77
77
 
78
78
  # The engine routes have to come after the devise routes so that /users/sign_in will work
79
79
  def inject_routes
80
- gsub_file 'config/routes.rb', 'root :to => "catalog#index"', ''
80
+ gsub_file 'config/routes.rb', /root (:to =>|to:) "catalog#index"/, ''
81
81
 
82
82
  routing_code = "\n Hydra::BatchEdit.add_routes(self)\n" +
83
83
  " # This must be the very last route in the file because it has a catch-all route for 404 errors.
@@ -101,6 +101,10 @@ module Sufia
101
101
  end
102
102
  end
103
103
 
104
+ def install_sufia_600
105
+ generate "sufia:upgrade600"
106
+ end
107
+
104
108
  def install_blacklight_gallery
105
109
  generate "blacklight_gallery:install"
106
110
  end
@@ -8,16 +8,14 @@ require 'parslet'
8
8
  require 'parsing_nesting/tree'
9
9
 
10
10
  class CatalogController < ApplicationController
11
- include Blacklight::Catalog
12
- # Extend Blacklight::Catalog with Hydra behaviors (primarily editing).
11
+ include Hydra::Catalog
13
12
  include Hydra::Controller::ControllerBehavior
14
- include BlacklightAdvancedSearch::ParseBasicQ
15
13
  include Sufia::Catalog
16
14
 
17
15
  # These before_filters apply the hydra access controls
18
16
  before_filter :enforce_show_permissions, only: :show
19
17
  # This applies appropriate access controls to all solr queries
20
- CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
18
+ CatalogController.search_params_logic += [:add_access_controls_to_solr_params, :add_advanced_parse_q_to_solr]
21
19
 
22
20
  skip_before_filter :default_html_head
23
21
 
@@ -304,7 +302,7 @@ class CatalogController < ApplicationController
304
302
  # whether the sort is ascending or descending (it must be asc or desc
305
303
  # except in the relevancy case).
306
304
  # label is key, solr field is value
307
- config.add_sort_field "score desc, #{uploaded_field} desc", label: "relevance \u25BC"
305
+ config.add_sort_field "score desc, #{uploaded_field} desc", label: "relevance"
308
306
  config.add_sort_field "#{uploaded_field} desc", label: "date uploaded \u25BC"
309
307
  config.add_sort_field "#{uploaded_field} asc", label: "date uploaded \u25B2"
310
308
  config.add_sort_field "#{modified_field} desc", label: "date modified \u25BC"
@@ -0,0 +1,26 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'rails/generators'
3
+
4
+ class Sufia::Upgrade600Generator < Rails::Generators::Base
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ desc """
9
+ This generator for upgrading sufia to 6.0 makes the following changes to your application:
10
+ 1. Adds Sufia::SearchBuilder to SearchBuilder
11
+ """
12
+
13
+ def insert_builder
14
+ insert_into_file 'app/models/search_builder.rb', after: /include Blacklight::Solr::SearchBuilderBehavior/ do
15
+ # First line should be generated by Hydra. projecthydra/hydra-head#255
16
+ "\n include Hydra::AccessControlsEnforcement" +
17
+ "\n include Sufia::SearchBuilder\n"
18
+ end
19
+ end
20
+
21
+ def migrations
22
+ generate "sufia:models:upgrade600"
23
+ end
24
+
25
+ end
26
+
@@ -1,3 +1,3 @@
1
1
  module Sufia
2
- VERSION = "6.0.0.rc4"
2
+ VERSION = "6.0.0"
3
3
  end
@@ -20,6 +20,20 @@ describe Sufia::GenericFile::Actor do
20
20
  actor.create_content(uploaded_file, 'world.png', 'content', 'image/png')
21
21
  end
22
22
 
23
+ context "when generic_file.title is empty and generic_file.label is not" do
24
+ let(:file) { "world.png" }
25
+ let(:long_name) { "an absurdly long title that goes on way to long and messes up the display of the page which should not need to be this big in order to show this impossibly long, long, long, oh so long string" }
26
+ let(:short_name) { "Nice Short Name" }
27
+ let(:actor) { Sufia::GenericFile::Actor.new(generic_file, user) }
28
+ before do
29
+ allow(generic_file).to receive(:label).and_return(short_name)
30
+ allow(Sufia.queue).to receive(:push)
31
+ actor.create_content(fixture_file_upload(file), long_name, 'content', 'image/png')
32
+ end
33
+ subject { generic_file.title }
34
+ it { is_expected.to eql [short_name] }
35
+ end
36
+
23
37
  context "with two existing versions from different users" do
24
38
 
25
39
  let(:file1) { "world.png" }
@@ -30,6 +30,15 @@ describe CollectionsController do
30
30
  }.to change{ Collection.count }.by(1)
31
31
  end
32
32
 
33
+ it "should remove blank strings from params before creating Collection" do
34
+ expect {
35
+ post :create, collection: {
36
+ title: "My First Collection ", creator: [""] }
37
+ }.to change{ Collection.count }.by(1)
38
+ expect(assigns[:collection].title).to eq("My First Collection ")
39
+ expect(assigns[:collection].creator).to eq([])
40
+ end
41
+
33
42
  it "should create a Collection with files I can access" do
34
43
  @asset1 = GenericFile.new(title: ["First of the Assets"])
35
44
  @asset1.apply_depositor_metadata(user.user_key)
@@ -48,12 +57,12 @@ describe CollectionsController do
48
57
  expect(collection.members).to match_array [@asset1, @asset2]
49
58
  end
50
59
 
51
- it "should add docs to collection if batch ids provided and add the collection id to the documents int he colledction" do
60
+ it "should add docs to the collection if a batch id is provided and add the collection id to the documents in the collection" do
52
61
  @asset1 = GenericFile.new(title: ["First of the Assets"])
53
62
  @asset1.apply_depositor_metadata(user.user_key)
54
63
  @asset1.save
55
64
  post :create, batch_document_ids: [@asset1.id],
56
- collection: { title: "My Secong Collection ", description: "The Description\r\n\r\nand more" }
65
+ collection: { title: "My Second Collection ", description: "The Description\r\n\r\nand more" }
57
66
  expect(assigns[:collection].members).to eq [@asset1]
58
67
  asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
59
68
  expect(asset_results["response"]["numFound"]).to eq 1
@@ -113,6 +122,14 @@ describe CollectionsController do
113
122
  collection.reload
114
123
  expect(collection.creator).to eq ['Emily']
115
124
  end
125
+
126
+ it "should remove blank strings from params before updating Collection metadata" do
127
+ put :update, id: collection, collection: {
128
+ title: "My Next Collection ", creator: [""] }
129
+ expect(assigns[:collection].title).to eq("My Next Collection ")
130
+ expect(assigns[:collection].creator).to eq([])
131
+ end
132
+
116
133
  end
117
134
  end
118
135