hyrax 2.0.0.beta5 → 2.0.0.rc1

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/assets/javascripts/hyrax/save_work/visibility_component.es6 +29 -8
  4. data/app/forms/hyrax/forms/permission_template_form.rb +7 -7
  5. data/app/helpers/hyrax/hyrax_helper_behavior.rb +10 -4
  6. data/app/services/hyrax/{rights_statements.rb → rights_statement_service.rb} +1 -1
  7. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +7 -1
  8. data/app/views/records/edit_fields/_rights_statement.html.erb +1 -1
  9. data/config/locales/hyrax.de.yml +1 -0
  10. data/config/locales/hyrax.en.yml +1 -1
  11. data/config/locales/hyrax.es.yml +1 -0
  12. data/config/locales/hyrax.fr.yml +1 -0
  13. data/config/locales/hyrax.it.yml +1 -0
  14. data/config/locales/hyrax.pt-BR.yml +1 -0
  15. data/config/locales/hyrax.zh.yml +1 -0
  16. data/lib/generators/hyrax/templates/catalog_controller.rb +14 -4
  17. data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +4 -2
  18. data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +4 -2
  19. data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +4 -2
  20. data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +6 -0
  21. data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +4 -2
  22. data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +4 -2
  23. data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +4 -2
  24. data/lib/hyrax/version.rb +1 -1
  25. data/spec/forms/hyrax/forms/permission_template_form_spec.rb +7 -0
  26. data/spec/helpers/blacklight_helper_spec.rb +14 -7
  27. data/spec/helpers/hyrax_helper_spec.rb +8 -2
  28. data/spec/javascripts/visibility_component_spec.js +44 -0
  29. data/spec/services/hyrax/{rights_statements_spec.rb → rights_statement_service_spec.rb} +1 -1
  30. data/spec/views/catalog/_index_list_default.html.erb_spec.rb +3 -3
  31. data/spec/views/hyrax/admin/admin_sets/_form_visibility.html.erb_spec.rb +1 -0
  32. data/template.rb +1 -1
  33. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66a42f4f84b9b456857d5b5262a5b424eafe3814
4
- data.tar.gz: 7b78a9ea6a2d7c304ee49da60282e66489520849
3
+ metadata.gz: 6a96b72971c72adabf7c92ab360d35bb5d98eb63
4
+ data.tar.gz: 3292d8aaf5784bcdd8e061f2446ad321e84a64f7
5
5
  SHA512:
6
- metadata.gz: f5cb54d0f8f526b1aa2f6decb4247831a2fc695afb3e3e8cabfc153847ac6029a05d899296070258e4736a397ff37b010ff442b9a961e1672598887f97d34974
7
- data.tar.gz: a7dc23482e9c9362d08dd4845824f6bd5b37ffee27d504799c2ea74e56a0ff4fe0f0950b39a8b60b866748d11b7ff14d9b2bfdcc0da52d1c2a78987d8ea72b2e
6
+ metadata.gz: a12c44a6f0bb8b928a40666fbe8e0f3dbdc0d7c2a84410aff8e550c65916a2644910258160cca03ca806fc4b7f5c17d0fa963fa278dbb7ac49c06ee341f19abc
7
+ data.tar.gz: bf7f7762658984fe13a62829dc706eeb32a070a13c57c8e8320988aa0f0e3a7fe289b12b647626e634871a2e3a7bfffb8427a4d49b3a0e894d7cac4ce5d40cde
data/README.md CHANGED
@@ -13,7 +13,7 @@ Docs: [![Documentation Status](https://inch-ci.org/github/samvera/hyrax.svg?bran
13
13
  [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
14
14
 
15
15
  Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
16
- [![Ready Tickets](https://badge.waffle.io/samvera/hyrax.png?label=ready&milestone=2.0.0&title=Ready)](https://waffle.io/samvera/hyrax?milestone=2.0.0)
16
+ [![Ready Tickets](https://badge.waffle.io/samvera/hyrax.png?label=ready&milestone=2.x%20series&title=Ready)](https://waffle.io/samvera/hyrax?milestone=2.x%20series)
17
17
 
18
18
  # Table of Contents
19
19
 
@@ -63,7 +63,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
63
63
  # Getting started
64
64
 
65
65
  This document contains instructions specific to setting up an app with __Hyrax
66
- v2.0.0.beta5__. If you are looking for instructions on installing a different
66
+ v2.0.0.rc1__. If you are looking for instructions on installing a different
67
67
  version, be sure to select the appropriate branch or tag from the drop-down
68
68
  menu above.
69
69
 
@@ -160,7 +160,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
160
160
  Generate a new Rails application using the template.
161
161
 
162
162
  ```
163
- rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0.beta5/template.rb
163
+ rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0.rc1/template.rb
164
164
  ```
165
165
 
166
166
  Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
@@ -76,14 +76,9 @@ export default class VisibilityComponent {
76
76
  // Apply visibility/release restrictions based on selected AdminSet
77
77
  applyRestrictions(visibility, release_no_delay, release_date, release_before)
78
78
  {
79
- // If immediate release required and visibility specified
80
- if(release_no_delay && visibility) {
81
- // Select required visibility
82
- this.selectVisibility(visibility)
83
- }
84
- else if(release_no_delay) {
85
- // No visibility required, but must be released today. Disable embargo & lease.
86
- this.disableEmbargoAndLease();
79
+ // If immediate release required or the release date is in the past.
80
+ if(release_no_delay || (release_date && (new Date() > Date.parse(release_date)))) {
81
+ this.requireReleaseNow(visibility)
87
82
  }
88
83
  // Otherwise if future date and release_before==true, must be released between today and release_date
89
84
  else if(release_date && release_before) {
@@ -137,6 +132,18 @@ export default class VisibilityComponent {
137
132
  this.selectVisibilityAfterEmbargo(visibility)
138
133
  }
139
134
 
135
+ // Require release now
136
+ requireReleaseNow(visibility) {
137
+ if(visibility) {
138
+ // Select required visibility
139
+ this.selectVisibility(visibility)
140
+ }
141
+ else {
142
+ // No visibility required, but must be released today. Disable embargo & lease.
143
+ this.disableEmbargoAndLease()
144
+ }
145
+ }
146
+
140
147
  // Disable Embargo and Lease options. Work must be released immediately
141
148
  disableEmbargoAndLease() {
142
149
  this.disableVisibilityOptions(["embargo","lease"])
@@ -153,6 +160,8 @@ export default class VisibilityComponent {
153
160
  this.element.find(matchEnabled).prop("disabled", false)
154
161
  }
155
162
  this.element.find(matchDisabled).prop("disabled", true)
163
+
164
+ this.checkEnabledVisibilityOption()
156
165
  }
157
166
 
158
167
  // Disable one or more visibility option (based on array of passed in options),
@@ -166,6 +175,8 @@ export default class VisibilityComponent {
166
175
  this.element.find(matchDisabled).prop("disabled", true)
167
176
  }
168
177
  this.element.find(matchEnabled).prop("disabled", false)
178
+
179
+ this.checkEnabledVisibilityOption()
169
180
  }
170
181
 
171
182
  // Create a jQuery matcher which will match for all the specified options
@@ -255,6 +266,16 @@ export default class VisibilityComponent {
255
266
  return this.element.find("select[id$='_visibility_after_embargo']")
256
267
  }
257
268
 
269
+ // If the selected visibility option is disabled change selection to the
270
+ // least public option that is enabled.
271
+ checkEnabledVisibilityOption() {
272
+ if (this.element.find("[type='radio']:disabled:checked").length > 0) {
273
+ this.element.find("[type='radio']:enabled").last().prop('checked', true)
274
+ // Ensure required option is opened in form
275
+ this.showForm()
276
+ }
277
+ }
278
+
258
279
  // Get today's date in YYYY-MM-DD format
259
280
  getToday() {
260
281
  let today = new Date()
@@ -186,6 +186,8 @@ module Hyrax
186
186
  # Removes release_varies and release_embargo from the returned attributes
187
187
  # These form fields are only used to update release_period
188
188
  # @return [Hash] attributes used to update the model
189
+ # rubocop:disable Metrics/CyclomaticComplexity
190
+ # rubocop:disable Metrics/PerceivedComplexity
189
191
  def permission_template_update_params(raw_attributes)
190
192
  attributes = raw_attributes.except(:release_varies, :release_embargo)
191
193
  # If 'varies' before date option selected, then set release_period='before' and save release_date as-is
@@ -199,19 +201,21 @@ module Hyrax
199
201
  attributes[:release_date] = nil
200
202
  end
201
203
 
202
- if attributes[:release_period] == Hyrax::PermissionTemplate::RELEASE_TEXT_VALUE_NO_DELAY
203
- # If release is "no delay", a release_date should never be allowed/specified
204
+ if attributes[:release_period] == Hyrax::PermissionTemplate::RELEASE_TEXT_VALUE_NO_DELAY || (attributes[:release_period].blank? && raw_attributes[:release_varies].blank?)
205
+ # If release is "no delay" or is "varies" and "allow depositor to decide",
206
+ # then a release_date should never be allowed/specified
204
207
  attributes[:release_date] = nil
205
208
  end
206
209
 
207
210
  attributes
208
211
  end
212
+ # rubocop:enable Metrics/CyclomaticComplexity
213
+ # rubocop:enable Metrics/PerceivedComplexity
209
214
 
210
215
  # validate the hash of attributes used to update the visibility tab of the model
211
216
  # @param [Hash] attributes
212
217
  # @return [String, Nil] the error code if invalid, nil if valid
213
218
  # rubocop:disable Metrics/CyclomaticComplexity
214
- # rubocop:disable Metrics/AbcSize
215
219
  # rubocop:disable Metrics/PerceivedComplexity
216
220
  def validate_visibility_combinations(attributes)
217
221
  return unless attributes.key?(:visibility) # only the visibility tab has validations
@@ -219,9 +223,6 @@ module Hyrax
219
223
  # if "save" without any selections - none of the attributes are present
220
224
  return "nothing" if !attributes[:release_varies] && !attributes[:release_period] && !attributes[:release_date] && !attributes[:release_embargo]
221
225
 
222
- # if "varies" without sub-options (in this case, release_varies will be missing)
223
- return "varies" if attributes[:release_period].blank? && attributes[:release_varies].blank?
224
-
225
226
  # if "varies before" but date not selected
226
227
  return "no_date" if attributes[:release_varies] == Hyrax::PermissionTemplate::RELEASE_TEXT_VALUE_BEFORE_DATE && attributes[:release_date].blank?
227
228
 
@@ -233,7 +234,6 @@ module Hyrax
233
234
  end
234
235
  # rubocop:enable Metrics/CyclomaticComplexity
235
236
  # rubocop:enable Metrics/PerceivedComplexity
236
- # rubocop:enable Metrics/AbcSize
237
237
  end
238
238
  end
239
239
  end
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  module Hyrax
4
2
  module HyraxHelperBehavior
5
3
  include Hyrax::CitationsBehavior
@@ -198,13 +196,21 @@ module Hyrax
198
196
  end
199
197
 
200
198
  # A Blacklight index field helper_method
201
- # @param [Hash] options from blacklight helper_method invocation. Maps rights URIs to links with labels.
202
- # @return [ActiveSupport::SafeBuffer] rights statement links, html_safe
199
+ # @param [Hash] options from blacklight helper_method invocation. Maps license URIs to links with labels.
200
+ # @return [ActiveSupport::SafeBuffer] license links, html_safe
203
201
  def license_links(options)
204
202
  service = Hyrax::LicenseService.new
205
203
  options[:value].map { |right| link_to service.label(right), right }.to_sentence.html_safe
206
204
  end
207
205
 
206
+ # A Blacklight index field helper_method
207
+ # @param [Hash] options from blacklight helper_method invocation. Maps rights statement URIs to links with labels.
208
+ # @return [ActiveSupport::SafeBuffer] rights statement links, html_safe
209
+ def rights_statement_links(options)
210
+ service = Hyrax::RightsStatementService.new
211
+ options[:value].map { |right| link_to service.label(right), right }.to_sentence.html_safe
212
+ end
213
+
208
214
  def link_to_telephone(user)
209
215
  return unless user
210
216
  link_to user.telephone, "wtai://wp/mc;#{user.telephone}" if user.telephone
@@ -1,6 +1,6 @@
1
1
  module Hyrax
2
2
  # Provide select options for the copyright status (edm:rights) field
3
- class RightsStatements < QaSelectService
3
+ class RightsStatementService < QaSelectService
4
4
  def initialize
5
5
  super('rights_statements')
6
6
  end
@@ -14,10 +14,16 @@
14
14
  </div>
15
15
  <div id="release-varies" class="radio">
16
16
  <label>
17
- <%= f.radio_button :release_period, '', checked: !f.object.release_varies.blank? %>
17
+ <%= f.radio_button :release_period, '', checked: f.object.release_period.blank? || !f.object.release_varies.blank? %>
18
18
  <%= t('.release.varies.description') %>
19
19
  </label>
20
20
  <ul>
21
+ <li class="radio form-inline">
22
+ <label>
23
+ <%= f.radio_button :release_varies, '' %>
24
+ <%= t('.release.varies.any') %>
25
+ </label>
26
+ </li>
21
27
  <li class="radio form-inline">
22
28
  <label>
23
29
  <%= f.radio_button :release_varies, Hyrax::PermissionTemplate::RELEASE_TEXT_VALUE_BEFORE_DATE %>
@@ -1,4 +1,4 @@
1
- <% rights_statements = Hyrax::RightsStatements.new %>
1
+ <% rights_statements = Hyrax::RightsStatementService.new %>
2
2
  <%= f.input :rights_statement,
3
3
  collection: rights_statements.select_active_options,
4
4
  include_blank: true,
@@ -133,6 +133,7 @@ de:
133
133
  no_delay: Keine Verzögerung - Freigabe aller Arbeiten, sobald sie hinterlegt sind
134
134
  title: Freigabe
135
135
  varies:
136
+ any: Dem Einzahler erlauben, sich zu entscheiden
136
137
  between: Zwischen "jetzt" und
137
138
  description: 'Variabel - Deponenten können den Freigabedatum für eine einzelne Arbeit festlegen:'
138
139
  embargo:
@@ -80,7 +80,6 @@ en:
80
80
  visibility: "The administrative set's release & visibility settings have been updated."
81
81
  workflow: "The administrative set's workflow has been updated."
82
82
  permission_update_errors:
83
- varies: "Release option 'Varies' requires a date or embargo period."
84
83
  no_date: "A date is required for the selected release option."
85
84
  no_embargo: "An embargo period is required for the selected option."
86
85
  nothing: "Select release options before pressing save."
@@ -132,6 +131,7 @@ en:
132
131
  no_delay: "No delay -- release all works as soon as they are deposited"
133
132
  title: "Release"
134
133
  varies:
134
+ any: "Allow depositor to decide"
135
135
  between: "Between \"now\" and"
136
136
  description: "Varies -- depositors can set the release date for an individual work:"
137
137
  embargo:
@@ -133,6 +133,7 @@ es:
133
133
  no_delay: Sin demora -- liberar todas los trabajos tan pronto como se depositen
134
134
  title: Lanzamiento
135
135
  varies:
136
+ any: Permitir que el depositante decida
136
137
  between: Entre "ahora" y
137
138
  description: 'Varía -- los depositantes pueden fijar la fecha de lanzamiento para un trabajo individual:'
138
139
  embargo:
@@ -133,6 +133,7 @@ fr:
133
133
  no_delay: Pas de retard - libère tous les travaux dès qu'ils sont déposés
134
134
  title: Libération
135
135
  varies:
136
+ any: Permettre au déposant de décider
136
137
  between: Entre «maintenant» et
137
138
  description: 'Variable - les déposants peuvent définir la date de sortie pour un travail individuel:'
138
139
  embargo:
@@ -133,6 +133,7 @@ it:
133
133
  no_delay: Nessun ritardo - rilasciare tutti i lavori non appena vengono depositati
134
134
  title: Liberare
135
135
  varies:
136
+ any: Consentire al depositante di decidere
136
137
  between: Tra "ora" e "
137
138
  description: 'Varia - i depositanti possono impostare la data di rilascio per un lavoro individuale:'
138
139
  embargo:
@@ -133,6 +133,7 @@ pt-BR:
133
133
  no_delay: Sem atraso - liberte todos os trabalhos assim que eles são depositados
134
134
  title: Lançamento
135
135
  varies:
136
+ any: Permitir que o depositante decida
136
137
  between: Entre "agora" e
137
138
  description: 'Varia - os depositantes podem definir a data de lançamento para um trabalho individual:'
138
139
  embargo:
@@ -139,6 +139,7 @@ zh:
139
139
  no_delay: 没有延迟 -- 所有作品一旦存储即可发布
140
140
  title: 发布
141
141
  varies:
142
+ any: 允许存款人决定
142
143
  between: 在'现在'之间
143
144
  description: '可变的 -- 存储者可以设置一件作品的发布日期:'
144
145
  embargo:
@@ -71,7 +71,8 @@ class CatalogController < ApplicationController
71
71
  config.add_index_field solr_name("date_uploaded", :stored_sortable, type: :date), itemprop: 'datePublished', helper_method: :human_readable_date
72
72
  config.add_index_field solr_name("date_modified", :stored_sortable, type: :date), itemprop: 'dateModified', helper_method: :human_readable_date
73
73
  config.add_index_field solr_name("date_created", :stored_searchable), itemprop: 'dateCreated'
74
- config.add_index_field solr_name("rights", :stored_searchable), helper_method: :license_links
74
+ config.add_index_field solr_name("rights_statement", :stored_searchable), helper_method: :rights_statement_links
75
+ config.add_index_field solr_name("license", :stored_searchable), helper_method: :license_links
75
76
  config.add_index_field solr_name("resource_type", :stored_searchable), label: "Resource Type", link_to_search: solr_name("resource_type", :facetable)
76
77
  config.add_index_field solr_name("file_format", :stored_searchable), link_to_search: solr_name("file_format", :facetable)
77
78
  config.add_index_field solr_name("identifier", :stored_searchable), helper_method: :index_field_link, field_name: 'identifier'
@@ -92,7 +93,8 @@ class CatalogController < ApplicationController
92
93
  config.add_show_field solr_name("date_uploaded", :stored_searchable)
93
94
  config.add_show_field solr_name("date_modified", :stored_searchable)
94
95
  config.add_show_field solr_name("date_created", :stored_searchable)
95
- config.add_show_field solr_name("rights", :stored_searchable)
96
+ config.add_show_field solr_name("rights_statement", :stored_searchable)
97
+ config.add_show_field solr_name("license", :stored_searchable)
96
98
  config.add_show_field solr_name("resource_type", :stored_searchable), label: "Resource Type"
97
99
  config.add_show_field solr_name("format", :stored_searchable)
98
100
  config.add_show_field solr_name("identifier", :stored_searchable)
@@ -248,8 +250,16 @@ class CatalogController < ApplicationController
248
250
  }
249
251
  end
250
252
 
251
- config.add_search_field('rights') do |field|
252
- solr_name = solr_name("rights", :stored_searchable)
253
+ config.add_search_field('rights_statement') do |field|
254
+ solr_name = solr_name("rights_statement", :stored_searchable)
255
+ field.solr_local_parameters = {
256
+ qf: solr_name,
257
+ pf: solr_name
258
+ }
259
+ end
260
+
261
+ config.add_search_field('license') do |field|
262
+ solr_name = solr_name("license", :stored_searchable)
253
263
  field.solr_local_parameters = {
254
264
  qf: solr_name,
255
265
  pf: solr_name
@@ -24,8 +24,9 @@ de:
24
24
  identifier_tesim: Identifikator
25
25
  keyword_tesim: Stichwort
26
26
  language_tesim: Sprache
27
+ license_tesim: Lizenz
27
28
  publisher_tesim: Herausgeber
28
- rights_tesim: Rechte
29
+ rights_statement_tesim: Rechte
29
30
  subject_tesim: Fach
30
31
  show:
31
32
  based_near_tesim: Ort
@@ -39,8 +40,9 @@ de:
39
40
  identifier_tesim: Identifikator
40
41
  keyword_tesim: Stichwort
41
42
  language_tesim: Sprache
43
+ license_tesim: Lizenz
42
44
  publisher_tesim: Herausgeber
43
- rights_tesim: Rechte
45
+ rights_statement_tesim: Rechte
44
46
  subject_tesim: Fach
45
47
  title_tesim: Titel
46
48
  hyrax:
@@ -23,8 +23,9 @@ en:
23
23
  identifier_tesim: Identifier
24
24
  keyword_tesim: Keyword
25
25
  language_tesim: Language
26
+ license_tesim: License
26
27
  publisher_tesim: Publisher
27
- rights_tesim: Rights
28
+ rights_statement_tesim: Rights Statement
28
29
  subject_tesim: Subject
29
30
  show:
30
31
  based_near_tesim: Location
@@ -38,8 +39,9 @@ en:
38
39
  identifier_tesim: Identifier
39
40
  keyword_tesim: Keyword
40
41
  language_tesim: Language
42
+ license_tesim: License
41
43
  publisher_tesim: Publisher
42
- rights_tesim: Rights
44
+ rights_statement_tesim: Rights Statement
43
45
  subject_tesim: Subject
44
46
  title_tesim: Title
45
47
  hyrax:
@@ -24,8 +24,9 @@ es:
24
24
  identifier_tesim: Identificador
25
25
  keyword_tesim: Palabra clave
26
26
  language_tesim: Idioma
27
+ license_tesim: Licencia
27
28
  publisher_tesim: Editor
28
- rights_tesim: Derechos
29
+ rights_statement_tesim: Derechos
29
30
  subject_tesim: Tema
30
31
  show:
31
32
  based_near_tesim: Ubicación
@@ -39,8 +40,9 @@ es:
39
40
  identifier_tesim: Identificador
40
41
  keyword_tesim: Palabra clave
41
42
  language_tesim: Idioma
43
+ license_tesim: Licencia
42
44
  publisher_tesim: Editor
43
- rights_tesim: Derechos
45
+ rights_statement_tesim: Derechos
44
46
  subject_tesim: Tema
45
47
  title_tesim: Título
46
48
  hyrax:
@@ -24,7 +24,10 @@ fr:
24
24
  identifier_tesim: Identificateur
25
25
  keyword_tesim: Mot-clé
26
26
  language_tesim: La langue
27
+ license_statement_tesim: Licence
28
+ license_tesim: Licence
27
29
  publisher_tesim: Éditeur
30
+ rights_statement_tesim: Déclaration des droits
28
31
  rights_tesim: Droits
29
32
  subject_tesim: Assujettir
30
33
  show:
@@ -39,7 +42,10 @@ fr:
39
42
  identifier_tesim: Identificateur
40
43
  keyword_tesim: Mot-clé
41
44
  language_tesim: La langue
45
+ license_statement_tesim: Licence
46
+ license_tesim: Licence
42
47
  publisher_tesim: Éditeur
48
+ rights_statement_tesim: Déclaration des droits
43
49
  rights_tesim: Droits
44
50
  subject_tesim: Assujettir
45
51
  title_tesim: Titre
@@ -24,8 +24,9 @@ it:
24
24
  identifier_tesim: Identifier
25
25
  keyword_tesim: Parola chiave
26
26
  language_tesim: Lingua
27
+ license_tesim: Licenza
27
28
  publisher_tesim: Editore
28
- rights_tesim: Diritti
29
+ rights_statement_tesim: Diritti
29
30
  subject_tesim: Soggetto
30
31
  show:
31
32
  based_near_tesim: luogo
@@ -39,8 +40,9 @@ it:
39
40
  identifier_tesim: Identifier
40
41
  keyword_tesim: Parola chiave
41
42
  language_tesim: Lingua
43
+ license_tesim: Licenza
42
44
  publisher_tesim: Editore
43
- rights_tesim: Diritti
45
+ rights_statement_tesim: Diritti
44
46
  subject_tesim: Soggetto
45
47
  title_tesim: Titolo
46
48
  hyrax:
@@ -24,8 +24,9 @@ pt-BR:
24
24
  identifier_tesim: Identificador
25
25
  keyword_tesim: Palavra-chave
26
26
  language_tesim: Língua
27
+ license_tesim: Licença
27
28
  publisher_tesim: Editor
28
- rights_tesim: Direitos
29
+ rights_statement_tesim: Direitos
29
30
  subject_tesim: Sujeito
30
31
  show:
31
32
  based_near_tesim: Localização
@@ -39,8 +40,9 @@ pt-BR:
39
40
  identifier_tesim: Identificador
40
41
  keyword_tesim: Palavra-chave
41
42
  language_tesim: Língua
43
+ license_tesim: Licença
42
44
  publisher_tesim: Editor
43
- rights_tesim: Direitos
45
+ rights_statement_tesim: Direitos
44
46
  subject_tesim: Sujeito
45
47
  title_tesim: Título
46
48
  hyrax:
@@ -24,8 +24,9 @@ zh:
24
24
  identifier_tesim: 识别码
25
25
  keyword_tesim: 关键词
26
26
  language_tesim: 语言
27
+ license_tesim: 执照
27
28
  publisher_tesim: 出版者
28
- rights_tesim: 权
29
+ rights_statement_tesim: 权
29
30
  subject_tesim: 学科
30
31
  show:
31
32
  based_near_tesim: 位置
@@ -39,8 +40,9 @@ zh:
39
40
  identifier_tesim: 识别码
40
41
  keyword_tesim: 关键词
41
42
  language_tesim: 语言
43
+ license_tesim: 执照
42
44
  publisher_tesim: 出版者
43
- rights_tesim: 权
45
+ rights_statement_tesim: 权
44
46
  subject_tesim: 学科
45
47
  title_tesim: 标题
46
48
  hyrax:
data/lib/hyrax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hyrax
2
- VERSION = '2.0.0.beta5'.freeze
2
+ VERSION = '2.0.0.rc1'.freeze
3
3
  end
@@ -317,6 +317,13 @@ RSpec.describe Hyrax::Forms::PermissionTemplateForm do
317
317
  it_behaves_like 'valid attributes'
318
318
  end
319
319
 
320
+ describe 'varies, with depositor choice' do
321
+ let(:release_period) { '' }
322
+ let(:release_varies) { '' }
323
+
324
+ it_behaves_like 'valid attributes'
325
+ end
326
+
320
327
  describe 'varies, with date selected' do
321
328
  let(:release_date) { Time.zone.today + 2.months }
322
329
  let(:release_varies) { Hyrax::PermissionTemplate::RELEASE_TEXT_VALUE_BEFORE_DATE }
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  RSpec.describe BlacklightHelper, type: :helper do
4
2
  let(:blacklight_config) { CatalogController.blacklight_config }
5
3
  let(:attributes) do
@@ -8,9 +6,10 @@ RSpec.describe BlacklightHelper, type: :helper do
8
6
  'proxy_depositor_ssim' => ['atz@stanford.edu'],
9
7
  'description_tesim' => ['This links to http://example.com/ What about that?'],
10
8
  'date_uploaded_dtsi' => '2013-03-14T00:00:00Z',
11
- 'rights_tesim' => ["http://creativecommons.org/publicdomain/zero/1.0/",
12
- "http://creativecommons.org/publicdomain/mark/1.0/",
13
- "http://www.europeana.eu/portal/rights/rr-r.html"],
9
+ 'license_tesim' => ["http://creativecommons.org/publicdomain/zero/1.0/",
10
+ "http://creativecommons.org/publicdomain/mark/1.0/",
11
+ "http://www.europeana.eu/portal/rights/rr-r.html"],
12
+ 'rights_statement_tesim' => ['http://rightsstatements.org/vocab/InC/1.0/'],
14
13
  'identifier_tesim' => ['65434567654345654'],
15
14
  'keyword_tesim' => ['taco', 'mustache'],
16
15
  'subject_tesim' => ['Awesome'],
@@ -47,8 +46,8 @@ RSpec.describe BlacklightHelper, type: :helper do
47
46
  end
48
47
  end
49
48
 
50
- context "rights_tesim" do
51
- let(:field_name) { 'rights_tesim' }
49
+ context "license_tesim" do
50
+ let(:field_name) { 'license_tesim' }
52
51
 
53
52
  it do
54
53
  is_expected.to eq "<a href=\"http://creativecommons.org/publicdomain/zero/1.0/\">Creative Commons CC0 1.0 Universal</a>, " \
@@ -57,6 +56,14 @@ RSpec.describe BlacklightHelper, type: :helper do
57
56
  end
58
57
  end
59
58
 
59
+ context "rights_statement_tesim" do
60
+ let(:field_name) { 'rights_statement_tesim' }
61
+
62
+ it do
63
+ is_expected.to eq "<a href=\"http://rightsstatements.org/vocab/InC/1.0/\">In Copyright</a>"
64
+ end
65
+ end
66
+
60
67
  context "metadata index links" do
61
68
  let(:search_state) { Hyrax::SearchState.new(params, blacklight_config, controller) }
62
69
 
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  def new_state
4
2
  Blacklight::SearchState.new({}, CatalogController.blacklight_config)
5
3
  end
@@ -352,6 +350,14 @@ RSpec.describe HyraxHelper, type: :helper do
352
350
  end
353
351
  end
354
352
 
353
+ describe "#rights_statment_links" do
354
+ it "maps the url to a link with a label" do
355
+ expect(helper.rights_statement_links(
356
+ value: ["http://rightsstatements.org/vocab/InC/1.0/"]
357
+ )).to eq("<a href=\"http://rightsstatements.org/vocab/InC/1.0/\">In Copyright</a>")
358
+ end
359
+ end
360
+
355
361
  describe "#human_readable_date" do
356
362
  it "ensures that the display of the date is human-readable" do
357
363
  expect(helper.human_readable_date(value: ["2016-08-15T00:00:00Z"])).to eq("08/15/2016")
@@ -169,6 +169,25 @@ describe("VisibilityComponent", function() {
169
169
  expect(target.requireEmbargo).toHaveBeenCalledWith("authenticated", futureDate);
170
170
  });
171
171
  });
172
+ describe("with required past release date, dont restrict visibility", function() {
173
+ beforeEach(function() {
174
+ spyOn(target, 'disableEmbargoAndLease');
175
+ });
176
+ it("disable embargo and lease", function() {
177
+ target.applyRestrictions(undefined, undefined, "2017-01-01", false);
178
+ expect(target.disableEmbargoAndLease).toHaveBeenCalled();
179
+ });
180
+ });
181
+ describe("with required past release date, and required visibility", function() {
182
+ beforeEach(function() {
183
+ spyOn(target, 'selectVisibility');
184
+ });
185
+ it("require visibility", function() {
186
+ var visibility = "authenticated";
187
+ target.applyRestrictions(visibility, undefined, "2017-01-01", false);
188
+ expect(target.selectVisibility).toHaveBeenCalledWith(visibility);
189
+ });
190
+ });
172
191
  });
173
192
 
174
193
  //selectVisibility(visibility)
@@ -416,6 +435,31 @@ describe("VisibilityComponent", function() {
416
435
  expect(target.getVisibilityAfterEmbargoInput()).toHaveProp("name", "generic_work[visibility_after_embargo]");
417
436
  });
418
437
  });
438
+
439
+ //checkEnabledVisibilityOption()
440
+ describe("checkEnabledVisibilityOption", function() {
441
+ describe("with disabled option selected", function() {
442
+ beforeEach(function() {
443
+ target.enableAllOptions();
444
+ element.find("[type='radio'][value='restricted']").prop("checked", true).prop("disabled", true);
445
+ });
446
+ it("selects last enabled radio option", function() {
447
+ target.checkEnabledVisibilityOption();
448
+ expect(element.find("[type='radio'][value='restricted']")).not.toBeChecked();
449
+ expect(element.find("[type='radio'][value='lease']")).toBeChecked();
450
+ });
451
+ });
452
+ describe("with enabled option selected", function() {
453
+ beforeEach(function() {
454
+ target.enableAllOptions();
455
+ element.find("[type='radio'][value='open']").prop("checked", true);
456
+ });
457
+ it("does not change selection", function() {
458
+ target.checkEnabledVisibilityOption();
459
+ expect(element.find("[type='radio'][value='open']")).toBeChecked();
460
+ });
461
+ });
462
+ });
419
463
  });
420
464
 
421
465
  // Generate a form that includes AdminSet selectbox (with a passed in option)
@@ -1,4 +1,4 @@
1
- RSpec.describe Hyrax::RightsStatements do
1
+ RSpec.describe Hyrax::RightsStatementService do
2
2
  let(:service) { described_class.new }
3
3
 
4
4
  describe "#select_active_options" do
@@ -6,7 +6,7 @@ RSpec.describe 'catalog/_index_list_default', type: :view do
6
6
  'description_tesim' => [''],
7
7
  'date_uploaded_dtsi' => 'a date',
8
8
  'date_modified_dtsi' => 'a date',
9
- 'rights_tesim' => [''],
9
+ 'rights_statement_tesim' => [''],
10
10
  'embargo_release_date_dtsi' => 'a date',
11
11
  'lease_expiration_date_dtsi' => 'a date' }
12
12
  end
@@ -33,8 +33,8 @@ RSpec.describe 'catalog/_index_list_default', type: :view do
33
33
  expect(rendered).to include 'Test proxy_depositor_ssim'
34
34
  expect(rendered).to include '<span class="attribute-label h4">Owner:</span>'
35
35
  expect(rendered).to include 'Test depositor_tesim'
36
- expect(rendered).to include '<span class="attribute-label h4">Rights:</span>'
37
- expect(rendered).to include 'Test rights_tesim'
36
+ expect(rendered).to include '<span class="attribute-label h4">Rights Statement:</span>'
37
+ expect(rendered).to include 'Test rights_statement_tesim'
38
38
  expect(rendered).to include '<span class="attribute-label h4">Embargo release date:</span>'
39
39
  expect(rendered).to include 'Test embargo_release_date_dtsi'
40
40
  expect(rendered).to include '<span class="attribute-label h4">Lease expiration date:</span>'
@@ -12,6 +12,7 @@ RSpec.describe 'hyrax/admin/admin_sets/_form_visibility.html.erb', type: :view d
12
12
  it "has the form" do
13
13
  expect(rendered).to have_selector('#visibility input[type=radio][name="permission_template[release_period]"][value=now]')
14
14
  expect(rendered).to have_selector('#visibility input[type=radio][name="permission_template[release_period]"][value=fixed]')
15
+ expect(rendered).to have_selector('#visibility input[type=radio][name="permission_template[release_varies]"][value=""]')
15
16
  expect(rendered).to have_selector('#visibility input[type=radio][name="permission_template[release_varies]"][value=before]')
16
17
  expect(rendered).to have_selector('#visibility input[type=radio][name="permission_template[release_varies]"][value=embargo]')
17
18
  expect(rendered).to have_selector('#visibility select[name="permission_template[release_embargo]"]')
data/template.rb CHANGED
@@ -1,4 +1,4 @@
1
- gem 'hyrax', '2.0.0.beta5'
1
+ gem 'hyrax', '2.0.0.rc1'
2
2
  run 'bundle install'
3
3
  generate 'hyrax:install', '-f'
4
4
  rails_command 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta5
4
+ version: 2.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-10-10 00:00:00.000000000 Z
17
+ date: 2017-10-11 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -1489,7 +1489,7 @@ files:
1489
1489
  - app/services/hyrax/repository_fixity_check_service.rb
1490
1490
  - app/services/hyrax/resource_types_service.rb
1491
1491
  - app/services/hyrax/restriction_service.rb
1492
- - app/services/hyrax/rights_statements.rb
1492
+ - app/services/hyrax/rights_statement_service.rb
1493
1493
  - app/services/hyrax/statistics/collections/over_time.rb
1494
1494
  - app/services/hyrax/statistics/depositors/summary.rb
1495
1495
  - app/services/hyrax/statistics/file_sets/by_format.rb
@@ -2496,7 +2496,7 @@ files:
2496
2496
  - spec/services/hyrax/quick_classification_query_spec.rb
2497
2497
  - spec/services/hyrax/repository_fixity_check_service_spec.rb
2498
2498
  - spec/services/hyrax/resource_types_service_spec.rb
2499
- - spec/services/hyrax/rights_statements_spec.rb
2499
+ - spec/services/hyrax/rights_statement_service_spec.rb
2500
2500
  - spec/services/hyrax/statistics/collections/over_time_spec.rb
2501
2501
  - spec/services/hyrax/statistics/depositors/summary_spec.rb
2502
2502
  - spec/services/hyrax/statistics/file_sets/by_format_spec.rb
@@ -3131,7 +3131,7 @@ test_files:
3131
3131
  - spec/services/hyrax/quick_classification_query_spec.rb
3132
3132
  - spec/services/hyrax/repository_fixity_check_service_spec.rb
3133
3133
  - spec/services/hyrax/resource_types_service_spec.rb
3134
- - spec/services/hyrax/rights_statements_spec.rb
3134
+ - spec/services/hyrax/rights_statement_service_spec.rb
3135
3135
  - spec/services/hyrax/statistics/collections/over_time_spec.rb
3136
3136
  - spec/services/hyrax/statistics/depositors/summary_spec.rb
3137
3137
  - spec/services/hyrax/statistics/file_sets/by_format_spec.rb