hyrax 2.0.0.beta2 → 2.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_fixme.yml +32 -0
- data/.solr_wrapper +2 -0
- data/README.md +4 -2
- data/app/assets/javascripts/hyrax/app.js.erb +3 -0
- data/app/channels/hyrax/application_cable/connection.rb +2 -0
- data/app/jobs/stream_notifications_job.rb +2 -0
- data/app/presenters/hyrax/presents_attributes.rb +1 -0
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +8 -2
- data/app/views/layouts/_head_tag_content.html.erb +6 -1
- data/config/routes.rb +5 -3
- data/hyrax.gemspec +17 -5
- data/lib/generators/hyrax/templates/config/hyrax.rb +3 -0
- data/lib/hyrax/configuration.rb +16 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/channels/hyrax/application_cable/connection_spec.rb +6 -0
- data/spec/jobs/import_url_job_spec.rb +7 -1
- data/spec/jobs/stream_notifications_job_spec.rb +15 -0
- data/spec/lib/hyrax/configuration_spec.rb +2 -0
- data/spec/renderers/hyrax/renderers/attribute_renderer_spec.rb +24 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/tasks/rake_spec.rb +3 -3
- data/spec/views/hyrax/base/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/homepage/index.html.erb_spec.rb +50 -6
- data/spec/views/pages/show.html.erb_spec.rb +1 -0
- data/template.rb +1 -1
- metadata +10 -11
- data/app/assets/javascripts/hyrax/channels/notifications.js +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27103abf150fd3dd2b63b38050aef6931771f425
|
4
|
+
data.tar.gz: 0c4d916191c24c29f57d8c592d347b3b1d6d1ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b216a95f0c59c6b2c89c967766a13130836d5d2bfba53033527f16d8ae6ff7fe4e6699467a9aa5a30e294749e48d66cc760894ed6b733df37c388b6944ba56e2
|
7
|
+
data.tar.gz: 51e8e2356363bbb696144a0c84b9241cb7f8a40f8846878d80dda8385c728f191f6c42a741d31f7aa6203137322150c83d128bb8e66d9d90732771949c2788f9
|
data/.rubocop_fixme.yml
CHANGED
@@ -148,3 +148,35 @@ RSpec/AnyInstance:
|
|
148
148
|
- 'spec/services/hyrax/workflow/sipity_actions_generator_spec.rb'
|
149
149
|
- 'spec/services/hyrax/workflow/state_machine_generator_spec.rb'
|
150
150
|
- 'spec/services/hyrax/workflow/workflow_permissions_generator_spec.rb'
|
151
|
+
|
152
|
+
# Offense count: 51
|
153
|
+
RSpec/ExpectInHook:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
# Offense count: 31
|
157
|
+
RSpec/LetBeforeExamples:
|
158
|
+
Exclude:
|
159
|
+
- 'spec/forms/hyrax/forms/collection_form_spec.rb'
|
160
|
+
- 'spec/presenters/hyrax/collection_presenter_spec.rb'
|
161
|
+
- 'spec/presenters/hyrax/trophy_presenter_spec.rb'
|
162
|
+
- 'spec/services/hyrax/query_service_spec.rb'
|
163
|
+
- 'spec/services/hyrax/workflow/action_taken_service_spec.rb'
|
164
|
+
- 'spec/services/hyrax/workflow/notification_service_spec.rb'
|
165
|
+
|
166
|
+
# Offense count: 27
|
167
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
168
|
+
# SupportedStyles: and_return, block
|
169
|
+
RSpec/ReturnFromStub:
|
170
|
+
Exclude:
|
171
|
+
- 'spec/controllers/hyrax/api/items_controller_spec.rb'
|
172
|
+
- 'spec/controllers/hyrax/file_sets_controller_spec.rb'
|
173
|
+
- 'spec/lib/hyrax/arkivo/create_subscription_job_spec.rb'
|
174
|
+
- 'spec/models/file_set_spec.rb'
|
175
|
+
- 'spec/presenters/hyrax/admin_set_options_presenter_spec.rb'
|
176
|
+
- 'spec/routing/api_route_spec.rb'
|
177
|
+
- 'spec/views/_user_util_links.html.erb_spec.rb'
|
178
|
+
- 'spec/views/hyrax/base/_attributes.html.erb_spec.rb'
|
179
|
+
- 'spec/views/hyrax/base/_form.html.erb_spec.rb'
|
180
|
+
- 'spec/views/hyrax/base/file_manager.html.erb_spec.rb'
|
181
|
+
- 'spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb'
|
182
|
+
- 'spec/views/hyrax/users/_user_info.html.erb_spec.rb'
|
data/.solr_wrapper
CHANGED
data/README.md
CHANGED
@@ -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.
|
66
|
+
v2.0.0.beta3__. 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.5_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0.
|
163
|
+
rails _5.0.5_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0.beta3/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:
|
@@ -255,6 +255,8 @@ development:
|
|
255
255
|
url: redis://localhost:6379
|
256
256
|
```
|
257
257
|
|
258
|
+
Note that the Hyrax Management Guide contains additional information on [how to configure ActionCable in production environments](https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide#notifications).
|
259
|
+
|
258
260
|
# Managing a Hyrax-based app
|
259
261
|
|
260
262
|
The [Hyrax Management Guide](https://github.com/samvera/hyrax/wiki/Hyrax-Management-Guide) provides tips for how to manage, customize, and enhance your Hyrax application, including guidance specific to:
|
@@ -88,6 +88,9 @@ Hyrax = {
|
|
88
88
|
|
89
89
|
// ActionCable for user notifications. This is displayed in the navbar.
|
90
90
|
notifications: function() {
|
91
|
+
// Do not create a consumer if user is not logged in
|
92
|
+
if ($("meta[name='current-user']").length === 0)
|
93
|
+
return;
|
91
94
|
var consumer = ActionCable.createConsumer("<%= Hyrax::Engine.routes.url_helpers.notifications_endpoint_path %>");
|
92
95
|
consumer.subscriptions.create("Hyrax::NotificationsChannel", {
|
93
96
|
connected: function(data) {
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class StreamNotificationsJob < Hyrax::ApplicationJob
|
2
2
|
def perform(users)
|
3
|
+
# Do not use the ActionCable machinery if the feature is disabled
|
4
|
+
return unless Hyrax.config.realtime_notifications?
|
3
5
|
Array.wrap(users).each do |user|
|
4
6
|
mailbox = UserMailbox.new(user)
|
5
7
|
Hyrax::NotificationsChannel.broadcast_to(user,
|
@@ -11,6 +11,7 @@ module Hyrax
|
|
11
11
|
# you can explicitly set the URL's search field name
|
12
12
|
# @option options [String] :label The default label for the field if no translation is found
|
13
13
|
# @option options [TrueClass, FalseClass] :include_empty should we display a row if there are no values?
|
14
|
+
# @option options [String] :work_type name of work type class (e.g., "GenericWork")
|
14
15
|
def attribute_to_html(field, options = {})
|
15
16
|
unless respond_to?(field)
|
16
17
|
Rails.logger.warn("#{self.class} attempted to render #{field}, but no method exists with that name.")
|
@@ -38,8 +38,10 @@ module Hyrax
|
|
38
38
|
# name. Can be overridden if more complicated logic is needed.
|
39
39
|
def label
|
40
40
|
translate(
|
41
|
-
:"blacklight.search.fields.show.#{field}",
|
42
|
-
default: [:"blacklight.search.fields.#{field}",
|
41
|
+
:"blacklight.search.fields.#{work_type_label_key}.show.#{field}",
|
42
|
+
default: [:"blacklight.search.fields.show.#{field}",
|
43
|
+
:"blacklight.search.fields.#{field}",
|
44
|
+
options.fetch(:label, field.to_s.humanize)]
|
43
45
|
)
|
44
46
|
end
|
45
47
|
|
@@ -65,6 +67,10 @@ module Hyrax
|
|
65
67
|
def li_value(value)
|
66
68
|
auto_link(ERB::Util.h(value))
|
67
69
|
end
|
70
|
+
|
71
|
+
def work_type_label_key
|
72
|
+
options[:work_type] ? options[:work_type].underscore : nil
|
73
|
+
end
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
<%= csrf_meta_tag %>
|
2
2
|
<meta charset="utf-8" />
|
3
|
-
|
3
|
+
<%# Only display meta tag, which enables creation of the ActionCable
|
4
|
+
consumer, when realtime notifications are enabled and the user is
|
5
|
+
signed in %>
|
6
|
+
<% if Hyrax.config.realtime_notifications? && signed_in? %>
|
7
|
+
<%= tag :meta, name: 'current-user', data: { user_key: current_user.user_key } %>
|
8
|
+
<% end %>
|
4
9
|
<!-- added for use on small devices like phones -->
|
5
10
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
6
11
|
<link rel="resourcesync" href="<%= hyrax.capability_list_url %>"/>
|
data/config/routes.rb
CHANGED
@@ -92,9 +92,11 @@ Hyrax::Engine.routes.draw do
|
|
92
92
|
delete 'delete_all'
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
if Hyrax.config.realtime_notifications?
|
96
|
+
namespace :notifications do
|
97
|
+
# WebSocket for notifications
|
98
|
+
mount ActionCable.server => 'endpoint', as: :endpoint
|
99
|
+
end
|
98
100
|
end
|
99
101
|
|
100
102
|
# User profile
|
data/hyrax.gemspec
CHANGED
@@ -40,8 +40,8 @@ EOF
|
|
40
40
|
spec.add_dependency 'blacklight-gallery', '~> 0.7'
|
41
41
|
spec.add_dependency 'tinymce-rails', '~> 4.1'
|
42
42
|
spec.add_dependency 'font-awesome-rails', '~> 4.2'
|
43
|
-
spec.add_dependency 'select2-rails', '~> 3.5
|
44
|
-
spec.add_dependency 'json-schema' # for
|
43
|
+
spec.add_dependency 'select2-rails', '~> 3.5'
|
44
|
+
spec.add_dependency 'json-schema' # for Arkivo
|
45
45
|
spec.add_dependency 'nest', '~> 2.0'
|
46
46
|
spec.add_dependency 'mailboxer', '~> 0.12'
|
47
47
|
spec.add_dependency 'carrierwave', '~> 1.0'
|
@@ -51,18 +51,20 @@ EOF
|
|
51
51
|
spec.add_dependency 'legato', '~> 0.3'
|
52
52
|
spec.add_dependency 'posix-spawn'
|
53
53
|
spec.add_dependency 'jquery-ui-rails', '~> 5.0'
|
54
|
-
spec.add_dependency 'redis-namespace', '~> 1.5
|
54
|
+
spec.add_dependency 'redis-namespace', '~> 1.5'
|
55
|
+
# Pin more tightly because 0.x gems are potentially unstable
|
55
56
|
spec.add_dependency 'flot-rails', '~> 0.0.6'
|
56
57
|
spec.add_dependency 'almond-rails', '~> 0.1'
|
57
58
|
spec.add_dependency 'qa', '~> 1.0' # questioning_authority
|
58
59
|
spec.add_dependency 'flipflop', '~> 2.3'
|
59
|
-
spec.add_dependency 'jquery-datatables-rails', '~> 3.4
|
60
|
+
spec.add_dependency 'jquery-datatables-rails', '~> 3.4'
|
60
61
|
spec.add_dependency 'rdf-rdfxml' # controlled vocabulary importer
|
61
62
|
spec.add_dependency 'clipboard-rails', '~> 1.5'
|
62
63
|
spec.add_dependency 'rails_autolink', '~> 1.1'
|
63
64
|
spec.add_dependency 'active_fedora-noid', '~> 2.0', '>= 2.0.2'
|
64
65
|
spec.add_dependency 'awesome_nested_set', '~> 3.1'
|
65
66
|
spec.add_dependency 'breadcrumbs_on_rails', '~> 3.0'
|
67
|
+
# Pin more tightly because 0.x gems are potentially unstable
|
66
68
|
spec.add_dependency 'kaminari_route_prefix', '~> 0.1.1'
|
67
69
|
spec.add_dependency 'power_converter', '~> 0.1', '>= 0.1.2'
|
68
70
|
spec.add_dependency 'dry-validation', '~> 0.9'
|
@@ -88,8 +90,18 @@ EOF
|
|
88
90
|
spec.add_development_dependency "factory_girl_rails", '~> 4.4'
|
89
91
|
spec.add_development_dependency "equivalent-xml", '~> 0.5'
|
90
92
|
spec.add_development_dependency "jasmine", '~> 2.3'
|
93
|
+
# Pin rubocop and rubocop-rspec tightly. Minor-level version bumps
|
94
|
+
# in these gems cause Rubocop violations, and those violations cause
|
95
|
+
# continuous integration builds to fail, and those failures prevent
|
96
|
+
# us from merging pull requests. As a community, we have decided
|
97
|
+
# that it is not reasonable to manage style violations to be dealt
|
98
|
+
# with in a pull request *unless* said pull request's intent is to
|
99
|
+
# bring the codebase in further alignment with community style
|
100
|
+
# conventions. This allows us to take a managed approach to code
|
101
|
+
# style -- we choose to update style when we wish, not when a
|
102
|
+
# minor-level version bump in a dependency comes out.
|
91
103
|
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
92
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.
|
104
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.16.0'
|
93
105
|
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
94
106
|
spec.add_development_dependency 'rails-controller-testing', '~> 0'
|
95
107
|
spec.add_development_dependency 'webmock'
|
@@ -89,6 +89,9 @@ Hyrax.config do |config|
|
|
89
89
|
# of Zotero-managed research items.
|
90
90
|
# config.arkivo_api = false
|
91
91
|
|
92
|
+
# Stream realtime notifications to users in the browser
|
93
|
+
# config.realtime_notifications = true
|
94
|
+
|
92
95
|
# Location autocomplete uses geonames to search for named regions
|
93
96
|
# Username for connecting to geonames
|
94
97
|
# config.geonames_username = ''
|
data/lib/hyrax/configuration.rb
CHANGED
@@ -271,6 +271,22 @@ module Hyrax
|
|
271
271
|
@arkivo_api ||= false
|
272
272
|
end
|
273
273
|
|
274
|
+
# rubocop:disable Metrics/LineLength
|
275
|
+
attr_writer :realtime_notifications
|
276
|
+
def realtime_notifications?
|
277
|
+
# Coerce @realtime_notifications to false if server software
|
278
|
+
# does not support WebSockets, and warn the user that we are
|
279
|
+
# overriding the value in their config unless it's already
|
280
|
+
# flipped to false
|
281
|
+
if ENV.fetch('SERVER_SOFTWARE', '').match(/Apache.*Phusion_Passenger/).present?
|
282
|
+
Rails.logger.warn('Cannot enable realtime notifications atop Passenger + Apache. Coercing `Hyrax.config.realtime_notifications` to `false`. Set this value to `false` in config/initializers/hyrax.rb to stop seeing this warning.') unless @realtime_notifications == false
|
283
|
+
@realtime_notifications = false
|
284
|
+
end
|
285
|
+
return @realtime_notifications unless @realtime_notifications.nil?
|
286
|
+
@realtime_notifications = true
|
287
|
+
end
|
288
|
+
# rubocop:enable Metrics/LineLength
|
289
|
+
|
274
290
|
def geonames_username=(username)
|
275
291
|
Qa::Authorities::Geonames.username = username
|
276
292
|
end
|
data/lib/hyrax/version.rb
CHANGED
@@ -21,6 +21,12 @@ RSpec.describe Hyrax::ApplicationCable::Connection, no_clean: true do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when user is not found' do
|
24
|
+
# rubocop:disable RSpec/SubjectStub
|
25
|
+
before do
|
26
|
+
allow(subject).to receive(:session).and_raise(NoMethodError)
|
27
|
+
end
|
28
|
+
# rubocop:enable RSpec/SubjectStub
|
29
|
+
|
24
30
|
let(:user_id) { nil }
|
25
31
|
|
26
32
|
it 'rejects the unauthorized connection' do
|
@@ -17,8 +17,14 @@ RSpec.describe ImportUrlJob do
|
|
17
17
|
before do
|
18
18
|
allow(Hyrax::Actors::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
|
19
19
|
|
20
|
+
response_headers = { 'Content-Type' => 'image/png', 'Content-Length' => File.size(File.expand_path(file_path, __FILE__)) }
|
21
|
+
|
22
|
+
stub_request(:head, "http://example.org#{file_hash}").to_return(
|
23
|
+
body: "", status: 200, headers: response_headers
|
24
|
+
)
|
25
|
+
|
20
26
|
stub_request(:get, "http://example.org#{file_hash}").to_return(
|
21
|
-
body: File.open(File.expand_path(file_path, __FILE__)).read, status: 200, headers:
|
27
|
+
body: File.open(File.expand_path(file_path, __FILE__)).read, status: 200, headers: response_headers
|
22
28
|
)
|
23
29
|
end
|
24
30
|
|
@@ -1,4 +1,10 @@
|
|
1
1
|
RSpec.describe StreamNotificationsJob do
|
2
|
+
let(:realtime_notifications) { true }
|
3
|
+
|
4
|
+
before do
|
5
|
+
allow(Hyrax.config).to receive(:realtime_notifications?).and_return(realtime_notifications)
|
6
|
+
end
|
7
|
+
|
2
8
|
describe '#perform' do
|
3
9
|
context 'with zero users' do
|
4
10
|
let(:users) { nil }
|
@@ -25,6 +31,15 @@ RSpec.describe StreamNotificationsJob do
|
|
25
31
|
notifications_label: "You've got mail!")
|
26
32
|
described_class.perform_now(users)
|
27
33
|
end
|
34
|
+
|
35
|
+
context 'when realtime notifications feature is disabled' do
|
36
|
+
let(:realtime_notifications) { false }
|
37
|
+
|
38
|
+
it 'does not broadcast' do
|
39
|
+
expect(Hyrax::NotificationsChannel).not_to receive(:broadcast_to)
|
40
|
+
described_class.perform_now(users)
|
41
|
+
end
|
42
|
+
end
|
28
43
|
end
|
29
44
|
end
|
30
45
|
end
|
@@ -50,6 +50,8 @@ RSpec.describe Hyrax::Configuration do
|
|
50
50
|
it { is_expected.to respond_to(:permission_levels) }
|
51
51
|
it { is_expected.to respond_to(:permission_options) }
|
52
52
|
it { is_expected.to respond_to(:persistent_hostpath) }
|
53
|
+
it { is_expected.to respond_to(:realtime_notifications?) }
|
54
|
+
it { is_expected.to respond_to(:realtime_notifications=) }
|
53
55
|
it { is_expected.to respond_to(:redis_namespace) }
|
54
56
|
it { is_expected.to respond_to(:subject_prefix) }
|
55
57
|
it { is_expected.to respond_to(:translate_id_to_uri) }
|
@@ -72,4 +72,28 @@ RSpec.describe Hyrax::Renderers::AttributeRenderer do
|
|
72
72
|
it { expect(subject).to be_equivalent_to(expected) }
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
describe "#label" do
|
77
|
+
subject { renderer }
|
78
|
+
|
79
|
+
context 'with work type option' do
|
80
|
+
let(:work_type) { "GenericWork".underscore }
|
81
|
+
let(:renderer) { described_class.new(field, ['Bob', 'Jessica'], work_type: work_type) }
|
82
|
+
|
83
|
+
context 'no work type specific label' do
|
84
|
+
it { expect(subject.label).to eq(field.to_s.humanize) }
|
85
|
+
end
|
86
|
+
context 'work type specific label' do
|
87
|
+
let(:work_type_name_label) { "Appellation" }
|
88
|
+
|
89
|
+
before do
|
90
|
+
allow(I18n).to receive(:translate).and_call_original
|
91
|
+
allow(I18n).to receive(:translate).with(:"blacklight.search.fields.#{work_type}.show.#{field}", Hash) do
|
92
|
+
work_type_name_label
|
93
|
+
end
|
94
|
+
end
|
95
|
+
it { expect(subject.label).to eq(work_type_name_label) }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
75
99
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -140,7 +140,7 @@ RSpec.configure do |config|
|
|
140
140
|
Hyrax.config.enable_noids = false
|
141
141
|
end
|
142
142
|
|
143
|
-
config.before
|
143
|
+
config.before do |example|
|
144
144
|
if example.metadata[:type] == :feature && Capybara.current_driver != :rack_test
|
145
145
|
DatabaseCleaner.strategy = :truncation
|
146
146
|
else
|
data/spec/tasks/rake_spec.rb
CHANGED
@@ -11,15 +11,15 @@ RSpec.describe "Rake tasks" do
|
|
11
11
|
|
12
12
|
it "creates a file" do
|
13
13
|
run_task "hyrax:user:list_emails"
|
14
|
-
expect(File.exist
|
14
|
+
expect(File).to exist("user_emails.txt")
|
15
15
|
expect(IO.read("user_emails.txt")).to include(user1.email, user2.email)
|
16
16
|
File.delete("user_emails.txt")
|
17
17
|
end
|
18
18
|
|
19
19
|
it "creates a file I give it" do
|
20
20
|
run_task "hyrax:user:list_emails", "abc123.txt"
|
21
|
-
expect(File.exist
|
22
|
-
expect(File.exist
|
21
|
+
expect(File).not_to exist("user_emails.txt")
|
22
|
+
expect(File).to exist("abc123.txt")
|
23
23
|
expect(IO.read("abc123.txt")).to include(user1.email, user2.email)
|
24
24
|
File.delete("abc123.txt")
|
25
25
|
end
|
@@ -49,6 +49,7 @@ RSpec.describe 'hyrax/base/show.html.erb', type: :view do
|
|
49
49
|
allow(controller).to receive(:current_user).and_return(depositor)
|
50
50
|
allow(User).to receive(:find_by_user_key).and_return(depositor.user_key)
|
51
51
|
allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
|
52
|
+
allow(view).to receive(:signed_in?)
|
52
53
|
allow(view).to receive(:on_the_dashboard?).and_return(false)
|
53
54
|
stub_template 'hyrax/base/_metadata.html.erb' => ''
|
54
55
|
stub_template 'hyrax/base/_relationships.html.erb' => ''
|
@@ -4,15 +4,59 @@ RSpec.describe "hyrax/homepage/index.html.erb", type: :view do
|
|
4
4
|
let(:presenter) { instance_double(Hyrax::HomepagePresenter) }
|
5
5
|
let(:type_presenter) { instance_double(Hyrax::SelectTypeListPresenter, many?: true) }
|
6
6
|
|
7
|
-
|
7
|
+
before do
|
8
|
+
allow(view).to receive(:create_work_presenter).and_return(type_presenter)
|
9
|
+
allow(view).to receive(:signed_in?).and_return(signed_in)
|
10
|
+
allow(controller).to receive(:current_ability).and_return(ability)
|
11
|
+
assign(:presenter, presenter)
|
12
|
+
stub_template "hyrax/homepage/_marketing.html.erb" => "marketing"
|
13
|
+
stub_template "hyrax/homepage/_home_content.html.erb" => "home content"
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'meta tag with current user info' do
|
17
|
+
let(:realtime_notifications) { true }
|
18
|
+
|
8
19
|
before do
|
9
|
-
allow(
|
10
|
-
allow(view).to receive(:
|
11
|
-
|
20
|
+
allow(Hyrax.config).to receive(:realtime_notifications?).and_return(realtime_notifications)
|
21
|
+
allow(view).to receive(:on_the_dashboard?).and_return(false)
|
22
|
+
allow(controller).to receive(:current_user).and_return(current_user)
|
12
23
|
allow(controller).to receive(:current_ability).and_return(ability)
|
24
|
+
allow(presenter).to receive(:display_share_button?).and_return(true)
|
25
|
+
stub_template "_controls.html.erb" => "controls"
|
26
|
+
stub_template "_masthead.html.erb" => "masthead"
|
27
|
+
render template: 'hyrax/homepage/index', layout: 'layouts/homepage'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when signed in' do
|
31
|
+
let(:signed_in) { true }
|
32
|
+
let(:current_user) { create(:user) }
|
33
|
+
|
34
|
+
it 'renders' do
|
35
|
+
expect(rendered).to have_selector('meta[name="current-user"]', visible: false)
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when realtime notifications are disabled' do
|
39
|
+
let(:realtime_notifications) { false }
|
40
|
+
|
41
|
+
it 'does not render' do
|
42
|
+
expect(rendered).not_to have_selector('meta[name="current-user"]', visible: false)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when not signed in' do
|
48
|
+
let(:signed_in) { false }
|
49
|
+
let(:current_user) { nil }
|
50
|
+
|
51
|
+
it 'does not render' do
|
52
|
+
expect(rendered).not_to have_selector('meta[name="current-user"]', visible: false)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "share your work button" do
|
58
|
+
before do
|
13
59
|
allow(presenter).to receive(:display_share_button?).and_return(display_share_button)
|
14
|
-
stub_template "hyrax/homepage/_marketing.html.erb" => "marketing"
|
15
|
-
stub_template "hyrax/homepage/_home_content.html.erb" => "home content"
|
16
60
|
render
|
17
61
|
end
|
18
62
|
|
@@ -3,6 +3,7 @@ RSpec.describe "hyrax/pages/show", type: :view do
|
|
3
3
|
|
4
4
|
before do
|
5
5
|
assign(:page, content_block)
|
6
|
+
allow(view).to receive(:signed_in?)
|
6
7
|
allow(view).to receive(:displayable_content_block)
|
7
8
|
allow(view).to receive(:can?).and_return(false)
|
8
9
|
stub_template 'catalog/_search_form.html.erb' => ''
|
data/template.rb
CHANGED
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.
|
4
|
+
version: 2.0.0.beta3
|
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-09-
|
17
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rails
|
@@ -162,14 +162,14 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 3.5
|
165
|
+
version: '3.5'
|
166
166
|
type: :runtime
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: 3.5
|
172
|
+
version: '3.5'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: json-schema
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,14 +316,14 @@ dependencies:
|
|
316
316
|
requirements:
|
317
317
|
- - "~>"
|
318
318
|
- !ruby/object:Gem::Version
|
319
|
-
version: 1.5
|
319
|
+
version: '1.5'
|
320
320
|
type: :runtime
|
321
321
|
prerelease: false
|
322
322
|
version_requirements: !ruby/object:Gem::Requirement
|
323
323
|
requirements:
|
324
324
|
- - "~>"
|
325
325
|
- !ruby/object:Gem::Version
|
326
|
-
version: 1.5
|
326
|
+
version: '1.5'
|
327
327
|
- !ruby/object:Gem::Dependency
|
328
328
|
name: flot-rails
|
329
329
|
requirement: !ruby/object:Gem::Requirement
|
@@ -386,14 +386,14 @@ dependencies:
|
|
386
386
|
requirements:
|
387
387
|
- - "~>"
|
388
388
|
- !ruby/object:Gem::Version
|
389
|
-
version: 3.4
|
389
|
+
version: '3.4'
|
390
390
|
type: :runtime
|
391
391
|
prerelease: false
|
392
392
|
version_requirements: !ruby/object:Gem::Requirement
|
393
393
|
requirements:
|
394
394
|
- - "~>"
|
395
395
|
- !ruby/object:Gem::Version
|
396
|
-
version: 3.4
|
396
|
+
version: '3.4'
|
397
397
|
- !ruby/object:Gem::Dependency
|
398
398
|
name: rdf-rdfxml
|
399
399
|
requirement: !ruby/object:Gem::Requirement
|
@@ -858,14 +858,14 @@ dependencies:
|
|
858
858
|
requirements:
|
859
859
|
- - "~>"
|
860
860
|
- !ruby/object:Gem::Version
|
861
|
-
version: 1.
|
861
|
+
version: 1.16.0
|
862
862
|
type: :development
|
863
863
|
prerelease: false
|
864
864
|
version_requirements: !ruby/object:Gem::Requirement
|
865
865
|
requirements:
|
866
866
|
- - "~>"
|
867
867
|
- !ruby/object:Gem::Version
|
868
|
-
version: 1.
|
868
|
+
version: 1.16.0
|
869
869
|
- !ruby/object:Gem::Dependency
|
870
870
|
name: shoulda-matchers
|
871
871
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1011,7 +1011,6 @@ files:
|
|
1011
1011
|
- app/assets/javascripts/hyrax/batch_select.es6
|
1012
1012
|
- app/assets/javascripts/hyrax/batch_select_all.js
|
1013
1013
|
- app/assets/javascripts/hyrax/browse_everything.js
|
1014
|
-
- app/assets/javascripts/hyrax/channels/notifications.js
|
1015
1014
|
- app/assets/javascripts/hyrax/collections.js
|
1016
1015
|
- app/assets/javascripts/hyrax/collections/editor.es6
|
1017
1016
|
- app/assets/javascripts/hyrax/config.js.erb
|
File without changes
|