sufia 6.0.0.rc3 → 6.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.md +2 -18
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +1 -0
- data/app/assets/javascripts/sufia/featured_researcher.js +14 -0
- data/app/assets/javascripts/sufia/user_search.js +5 -2
- data/app/assets/stylesheets/sufia/_buttons.scss +68 -8
- data/app/assets/stylesheets/sufia/_dashboard.scss +20 -2
- data/app/assets/stylesheets/sufia/_featured.scss +4 -0
- data/app/assets/stylesheets/sufia/_file-listing.scss +4 -0
- data/app/assets/stylesheets/sufia/_header.scss +31 -35
- data/app/assets/stylesheets/sufia/_settings.scss +40 -3
- data/app/assets/stylesheets/sufia/_styles.scss +2 -14
- data/app/controllers/batch_controller.rb +1 -44
- data/app/controllers/concerns/sufia/batch_controller_behavior.rb +55 -0
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +7 -3
- data/app/controllers/concerns/sufia/single_use_links_controller_behavior.rb +51 -0
- data/app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb +58 -0
- data/app/controllers/content_blocks_controller.rb +10 -1
- data/app/controllers/single_use_links_controller.rb +2 -41
- data/app/controllers/single_use_links_viewer_controller.rb +1 -50
- data/app/helpers/content_block_helper.rb +5 -1
- data/app/views/batch/edit.html.erb +1 -1
- data/app/views/batch_edits/_delete_selected.html.erb +2 -2
- data/app/views/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/content_blocks/_featured_researcher.html.erb +3 -0
- data/app/views/content_blocks/index.html.erb +7 -0
- data/app/views/dashboard/_index_partials/_user_info.html.erb +2 -2
- data/app/views/generic_files/_permission.html.erb +1 -1
- data/app/views/generic_files/show.html.erb +1 -1
- data/app/views/generic_files/upload/_form_fields.html.erb +3 -3
- data/app/views/homepage/_featured_researcher.html.erb +1 -0
- data/app/views/my/_sort_and_per_page.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/generators/sufia/install_generator.rb +16 -0
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/content_blocks_controller_spec.rb +14 -0
- data/spec/jobs/sufia_resque_queue_spec.rb +49 -0
- data/spec/models/ability_spec.rb +3 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -10
- data/spec/views/dashboard/index_spec.rb +2 -2
- data/spec/views/generic_file/show.html.erb_spec.rb +14 -2
- data/sufia-models/app/models/concerns/sufia/ability.rb +1 -0
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +5 -10
- data/sufia-models/lib/sufia/models/resque.rb +8 -0
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- metadata +13 -5
@@ -27,7 +27,7 @@
|
|
27
27
|
<% end %>
|
28
28
|
<%= render_hash_as_hidden_fields params_for_search().except(:per_page, :sort, :utf8) %>
|
29
29
|
|
30
|
-
<button class="btn btn-
|
30
|
+
<button class="btn btn-info" id="dashboard_sort_submit"><i class="glyphicon glyphicon-refresh"></i> Refresh</button>
|
31
31
|
<% end %>
|
32
32
|
<% end unless sort_fields.empty? %>
|
33
33
|
</div>
|
data/config/routes.rb
CHANGED
@@ -118,6 +118,7 @@ Sufia::Engine.routes.draw do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
resources :content_blocks, only: ['create', 'update']
|
121
|
+
get 'featured_researchers' => 'content_blocks#index', as: :featured_researchers
|
121
122
|
post '/tinymce_assets' => 'tinymce_assets#create'
|
122
123
|
|
123
124
|
get 'about' => 'pages#show', id: 'about_page'
|
@@ -15,6 +15,7 @@ module Sufia
|
|
15
15
|
3. Adds controller behavior to the application controller
|
16
16
|
4. Copies the catalog controller into the local app
|
17
17
|
5. Adds Sufia::SolrDocumentBehavior to app/models/solr_document.rb
|
18
|
+
6. Installs Blacklight gallery
|
18
19
|
"""
|
19
20
|
|
20
21
|
def run_required_generators
|
@@ -60,6 +61,16 @@ module Sufia
|
|
60
61
|
remove_file 'app/assets/stylesheets/blacklight.css.scss'
|
61
62
|
end
|
62
63
|
|
64
|
+
def add_sufia_assets
|
65
|
+
insert_into_file 'app/assets/stylesheets/application.css', after: ' *= require_self' do
|
66
|
+
"\n *= require sufia"
|
67
|
+
end
|
68
|
+
|
69
|
+
gsub_file 'app/assets/javascripts/application.js',
|
70
|
+
'//= require_tree .', '//= require sufia'
|
71
|
+
end
|
72
|
+
|
73
|
+
|
63
74
|
def tinymce_config
|
64
75
|
copy_file "config/tinymce.yml", "config/tinymce.yml"
|
65
76
|
end
|
@@ -89,5 +100,10 @@ module Sufia
|
|
89
100
|
puts " \e[31mFailure\e[0m Sufia requires a SolrDocument object. This generators assumes that the model is defined in the file #{file_path}, which does not exist."
|
90
101
|
end
|
91
102
|
end
|
103
|
+
|
104
|
+
def install_blacklight_gallery
|
105
|
+
generate "blacklight_gallery:install"
|
106
|
+
end
|
107
|
+
|
92
108
|
end
|
93
109
|
end
|
data/lib/sufia/version.rb
CHANGED
@@ -15,6 +15,20 @@ describe ContentBlocksController, :type => :controller do
|
|
15
15
|
post :create, content_block: { name: 'NNN', value: 'VVV' }
|
16
16
|
expect(response).to redirect_to main_app.new_user_session_path
|
17
17
|
end
|
18
|
+
|
19
|
+
context "get INDEX" do
|
20
|
+
let!(:current_researcher) { ContentBlock.create(name: ContentBlock::RESEARCHER, created_at: Time.now) }
|
21
|
+
let!(:old_researcher) { ContentBlock.create(name: ContentBlock::RESEARCHER, created_at: 2.hours.ago) }
|
22
|
+
let!(:market_text) { ContentBlock.create(name: ContentBlock::MARKETING) }
|
23
|
+
|
24
|
+
before { get :index }
|
25
|
+
|
26
|
+
it "displays the list of featured researchers" do
|
27
|
+
expect(response).to be_successful
|
28
|
+
expect(response).to render_template(:index)
|
29
|
+
expect(assigns(:content_blocks)).to eq [current_researcher, old_researcher]
|
30
|
+
end
|
31
|
+
end
|
18
32
|
end
|
19
33
|
|
20
34
|
context "when logged in" do
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sufia::Resque::Queue do
|
4
|
+
let(:subject) { Sufia::Resque::Queue.new "test_queue" }
|
5
|
+
let(:job) { double('job') }
|
6
|
+
|
7
|
+
context "with no retries" do
|
8
|
+
it "queues the job" do
|
9
|
+
expect(::Resque).to receive(:enqueue_to).once.and_return(true)
|
10
|
+
subject.push(job)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when one run times out' do
|
15
|
+
before do
|
16
|
+
call_count = 0
|
17
|
+
allow(::Resque).to receive(:enqueue_to) do
|
18
|
+
call_count += 1
|
19
|
+
call_count == 1 ? raise(Redis::TimeoutError) : true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'retries the job' do
|
24
|
+
expect(::Resque).to receive(:enqueue_to).twice
|
25
|
+
subject.push(job)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when a job times out three times' do
|
30
|
+
before do
|
31
|
+
allow(::Resque).to receive(:enqueue_to).exactly(3).times.and_raise(Redis::TimeoutError)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raises an error' do
|
35
|
+
expect { subject.push(job) }.to raise_error Redis::TimeoutError
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with no connection to Redis' do
|
40
|
+
before do
|
41
|
+
allow(::Resque).to receive(:enqueue_to).once.and_raise(Redis::CannotConnectError)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'logs an error' do
|
45
|
+
expect(ActiveFedora::Base.logger).to receive(:error).with("Redis is down!")
|
46
|
+
subject.push(job)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/spec/models/ability_spec.rb
CHANGED
@@ -9,6 +9,7 @@ describe Sufia::Ability, :type => :model do
|
|
9
9
|
it { is_expected.not_to be_able_to(:create, TinymceAsset) }
|
10
10
|
it { is_expected.not_to be_able_to(:create, ContentBlock) }
|
11
11
|
it { is_expected.not_to be_able_to(:update, ContentBlock) }
|
12
|
+
it { is_expected.to be_able_to(:read, ContentBlock) }
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "a registered user" do
|
@@ -18,6 +19,7 @@ describe Sufia::Ability, :type => :model do
|
|
18
19
|
it { is_expected.not_to be_able_to(:create, TinymceAsset) }
|
19
20
|
it { is_expected.not_to be_able_to(:create, ContentBlock) }
|
20
21
|
it { is_expected.not_to be_able_to(:update, ContentBlock) }
|
22
|
+
it { is_expected.to be_able_to(:read, ContentBlock) }
|
21
23
|
end
|
22
24
|
|
23
25
|
describe "a user in the admin group" do
|
@@ -28,6 +30,7 @@ describe Sufia::Ability, :type => :model do
|
|
28
30
|
it { is_expected.to be_able_to(:create, TinymceAsset) }
|
29
31
|
it { is_expected.to be_able_to(:create, ContentBlock) }
|
30
32
|
it { is_expected.to be_able_to(:update, ContentBlock) }
|
33
|
+
it { is_expected.to be_able_to(:read, ContentBlock) }
|
31
34
|
end
|
32
35
|
|
33
36
|
|
@@ -27,14 +27,4 @@ class TestAppGenerator < Rails::Generators::Base
|
|
27
27
|
gsub_file "config/initializers/sufia.rb",
|
28
28
|
"config.analytics = false", "config.analytics = true"
|
29
29
|
end
|
30
|
-
|
31
|
-
def add_sufia_assets
|
32
|
-
insert_into_file 'app/assets/stylesheets/application.css', after: ' *= require_self' do
|
33
|
-
"\n *= require sufia"
|
34
|
-
end
|
35
|
-
|
36
|
-
gsub_file 'app/assets/javascripts/application.js',
|
37
|
-
'//= require_tree .', '//= require sufia'
|
38
|
-
end
|
39
|
-
|
40
30
|
end
|
@@ -54,8 +54,8 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should have links to view and edit the user's profile" do
|
57
|
-
expect(@sidebar).to include '<a class="btn btn-default
|
58
|
-
expect(@sidebar).to include '<a class="btn btn-default
|
57
|
+
expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.profile_path(@user) + '">View Profile</a>'
|
58
|
+
expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.edit_profile_path(@user) + '">Edit Profile</a>'
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should display user statistics" do
|
@@ -28,9 +28,9 @@ describe 'generic_files/show.html.erb', :type => :view do
|
|
28
28
|
subject: ['Biology', 'Physiology', 'Ethnography'])
|
29
29
|
end
|
30
30
|
|
31
|
-
let(:presenter)
|
31
|
+
let(:presenter) do
|
32
32
|
Sufia::GenericFilePresenter.new(generic_file)
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
35
|
before do
|
36
36
|
allow(generic_file).to receive(:content).and_return(content)
|
@@ -45,6 +45,18 @@ describe 'generic_files/show.html.erb', :type => :view do
|
|
45
45
|
assign(:notify_number, 0)
|
46
46
|
end
|
47
47
|
|
48
|
+
describe 'title heading' do
|
49
|
+
before do
|
50
|
+
render template: 'generic_files/show.html.erb', layout: 'layouts/sufia-one-column'
|
51
|
+
end
|
52
|
+
let(:doc) { Nokogiri::HTML(rendered) }
|
53
|
+
|
54
|
+
it 'shows the first title' do
|
55
|
+
h1 = doc.xpath("//h1[@class='visibility']").text
|
56
|
+
expect(h1).to start_with 'My Title'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
48
60
|
describe 'schema.org' do
|
49
61
|
let(:item) { Mida::Document.new(rendered).items.first }
|
50
62
|
describe 'descriptive metadata' do
|
@@ -10,12 +10,11 @@ This generator makes the following changes to your application:
|
|
10
10
|
3. Creates the sufia.rb configuration file
|
11
11
|
4. Generates mailboxer
|
12
12
|
5. Generates usage stats config
|
13
|
-
6.
|
14
|
-
7. Runs
|
15
|
-
8. Runs
|
16
|
-
9. Runs
|
17
|
-
10. Runs
|
18
|
-
11. Runs user stats generator
|
13
|
+
6. Runs full-text generator
|
14
|
+
7. Runs proxies generator
|
15
|
+
8. Runs cached stats generator
|
16
|
+
9. Runs ORCID field generator
|
17
|
+
10. Runs user stats generator
|
19
18
|
"""
|
20
19
|
def banner
|
21
20
|
say_status("warning", "GENERATING SUFIA MODELS", :yellow)
|
@@ -80,10 +79,6 @@ This generator makes the following changes to your application:
|
|
80
79
|
generate 'sufia:models:usagestats'
|
81
80
|
end
|
82
81
|
|
83
|
-
def install_blacklight_gallery
|
84
|
-
generate "blacklight_gallery:install"
|
85
|
-
end
|
86
|
-
|
87
82
|
# Sets up full-text indexing (Solr config + jars)
|
88
83
|
def full_text_indexing
|
89
84
|
generate "sufia:models:fulltext"
|
@@ -10,11 +10,19 @@ module Sufia
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def push(job)
|
13
|
+
push_tries = 0
|
13
14
|
queue = job.respond_to?(:queue_name) ? job.queue_name : default_queue_name
|
14
15
|
begin
|
15
16
|
::Resque.enqueue_to queue, MarshaledJob, Base64.encode64(Marshal.dump(job))
|
16
17
|
rescue Redis::CannotConnectError
|
17
18
|
ActiveFedora::Base.logger.error "Redis is down!"
|
19
|
+
rescue Redis::TimeoutError => error
|
20
|
+
ActiveFedora::Base.logger.warn "Redis Timed out. Trying again! #{job.inspect}"
|
21
|
+
push_tries+=1
|
22
|
+
# fail for good if the tries is greater than 3
|
23
|
+
raise error if push_tries >=3
|
24
|
+
sleep 0.01
|
25
|
+
retry
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sufia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sufia-models
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 6.0.0.
|
20
|
+
version: 6.0.0.rc4
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 6.0.0.
|
27
|
+
version: 6.0.0.rc4
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: blacklight_advanced_search
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -493,6 +493,7 @@ files:
|
|
493
493
|
- app/assets/javascripts/sufia/dashboard_actions.js
|
494
494
|
- app/assets/javascripts/sufia/edit_metadata.js
|
495
495
|
- app/assets/javascripts/sufia/editor.js
|
496
|
+
- app/assets/javascripts/sufia/featured_researcher.js
|
496
497
|
- app/assets/javascripts/sufia/featured_works.js
|
497
498
|
- app/assets/javascripts/sufia/fileupload.js
|
498
499
|
- app/assets/javascripts/sufia/ga_events.js
|
@@ -538,6 +539,7 @@ files:
|
|
538
539
|
- app/controllers/batch_controller.rb
|
539
540
|
- app/controllers/batch_edits_controller.rb
|
540
541
|
- app/controllers/collections_controller.rb
|
542
|
+
- app/controllers/concerns/sufia/batch_controller_behavior.rb
|
541
543
|
- app/controllers/concerns/sufia/batch_edits_controller_behavior.rb
|
542
544
|
- app/controllers/concerns/sufia/breadcrumbs.rb
|
543
545
|
- app/controllers/concerns/sufia/catalog.rb
|
@@ -553,6 +555,8 @@ files:
|
|
553
555
|
- app/controllers/concerns/sufia/files_controller_behavior.rb
|
554
556
|
- app/controllers/concerns/sufia/homepage_controller.rb
|
555
557
|
- app/controllers/concerns/sufia/my_controller_behavior.rb
|
558
|
+
- app/controllers/concerns/sufia/single_use_links_controller_behavior.rb
|
559
|
+
- app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb
|
556
560
|
- app/controllers/concerns/sufia/transfers_controller_behavior.rb
|
557
561
|
- app/controllers/concerns/sufia/users_controller_behavior.rb
|
558
562
|
- app/controllers/contact_form_controller.rb
|
@@ -678,6 +682,8 @@ files:
|
|
678
682
|
- app/views/contact_form/_directions.html.erb
|
679
683
|
- app/views/contact_form/create.html.erb
|
680
684
|
- app/views/contact_form/new.html.erb
|
685
|
+
- app/views/content_blocks/_featured_researcher.html.erb
|
686
|
+
- app/views/content_blocks/index.html.erb
|
681
687
|
- app/views/dashboard/_index_partials/_contents.html.erb
|
682
688
|
- app/views/dashboard/_index_partials/_heading_actions.html.erb
|
683
689
|
- app/views/dashboard/_index_partials/_heading_greetings.html.erb
|
@@ -961,6 +967,7 @@ files:
|
|
961
967
|
- spec/jobs/event_jobs_spec.rb
|
962
968
|
- spec/jobs/import_url_job_spec.rb
|
963
969
|
- spec/jobs/ingest_local_file_job_spec.rb
|
970
|
+
- spec/jobs/sufia_resque_queue_spec.rb
|
964
971
|
- spec/lib/sufia/analytics_spec.rb
|
965
972
|
- spec/lib/sufia/breadcrumbs_spec.rb
|
966
973
|
- spec/lib/sufia/id_service_spec.rb
|
@@ -1238,7 +1245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1238
1245
|
version: 1.3.1
|
1239
1246
|
requirements: []
|
1240
1247
|
rubyforge_project:
|
1241
|
-
rubygems_version: 2.
|
1248
|
+
rubygems_version: 2.4.5
|
1242
1249
|
signing_key:
|
1243
1250
|
specification_version: 4
|
1244
1251
|
summary: Sufia was extracted from ScholarSphere developed by Penn State University
|
@@ -1343,6 +1350,7 @@ test_files:
|
|
1343
1350
|
- spec/jobs/event_jobs_spec.rb
|
1344
1351
|
- spec/jobs/import_url_job_spec.rb
|
1345
1352
|
- spec/jobs/ingest_local_file_job_spec.rb
|
1353
|
+
- spec/jobs/sufia_resque_queue_spec.rb
|
1346
1354
|
- spec/lib/sufia/analytics_spec.rb
|
1347
1355
|
- spec/lib/sufia/breadcrumbs_spec.rb
|
1348
1356
|
- spec/lib/sufia/id_service_spec.rb
|