sufia 7.3.0.rc3 → 7.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/.eslintrc +6 -5
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -8
- data/README.md +10 -5
- data/app/actors/sufia/actors/attach_members_actor.rb +70 -0
- data/app/actors/sufia/apply_permission_template_actor.rb +4 -4
- data/app/actors/sufia/default_admin_set_actor.rb +10 -7
- data/app/assets/javascripts/sufia.js +3 -1
- data/app/assets/javascripts/sufia/app.js +7 -18
- data/app/assets/javascripts/sufia/autocomplete.es6 +56 -57
- data/app/assets/javascripts/sufia/autocomplete/language.es6 +1 -2
- data/app/assets/javascripts/sufia/autocomplete/location.es6 +1 -1
- data/app/assets/javascripts/sufia/autocomplete/subject.es6 +1 -3
- data/app/assets/javascripts/sufia/autocomplete/work.es6 +31 -22
- data/app/assets/javascripts/sufia/{editor.js → content_blocks.js} +0 -0
- data/app/assets/javascripts/sufia/editor.es6 +47 -0
- data/app/assets/javascripts/sufia/editor/admin_set_widget.es6 +39 -0
- data/app/assets/javascripts/sufia/notifications.es6 +13 -13
- data/app/assets/javascripts/sufia/permissions/control.es6 +3 -3
- data/app/assets/javascripts/sufia/permissions/group_controls.es6 +2 -2
- data/app/assets/javascripts/sufia/permissions/user_controls.es6 +3 -3
- data/app/assets/javascripts/sufia/relationships.js +4 -2
- data/app/assets/javascripts/sufia/relationships/control.es6 +83 -0
- data/app/assets/javascripts/sufia/relationships/registry.es6 +60 -0
- data/app/assets/javascripts/sufia/relationships/registry_entry.es6 +38 -0
- data/app/assets/javascripts/sufia/relationships/work.es6 +7 -0
- data/app/assets/javascripts/sufia/save_work/required_fields.es6 +1 -1
- data/app/assets/javascripts/sufia/save_work/save_work_control.es6 +19 -11
- data/app/assets/javascripts/sufia/save_work/visibility_component.es6 +19 -10
- data/app/assets/javascripts/sufia/select_work_type.es6 +8 -6
- data/app/controllers/concerns/sufia/batch_uploads_controller_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/works_controller_behavior.rb +7 -0
- data/app/controllers/sufia/admin/admin_sets_controller.rb +5 -2
- data/app/forms/sufia/forms/batch_edit_form.rb +2 -1
- data/app/forms/sufia/forms/work_form.rb +19 -17
- data/app/models/concerns/sufia/admin_set_behavior.rb +38 -0
- data/app/presenters/sufia/admin_set_options_presenter.rb +51 -0
- data/app/presenters/sufia/admin_set_presenter.rb +11 -0
- data/app/search_builders/sufia/find_works_search_builder.rb +1 -0
- data/app/services/sufia/actor_factory.rb +1 -0
- data/app/services/sufia/admin_set_create_service.rb +9 -9
- data/app/services/sufia/admin_set_service.rb +0 -28
- data/app/services/sufia/workflow/abstract_notification.rb +14 -1
- data/app/services/sufia/workflow/changes_required_notification.rb +2 -2
- data/app/services/sufia/workflow/deposited_notification.rb +1 -1
- data/app/services/sufia/workflow/pending_review_notification.rb +1 -1
- data/app/views/curation_concerns/base/_find_work_widget.html.erb +10 -16
- data/app/views/curation_concerns/base/_form.html.erb +5 -1
- data/app/views/curation_concerns/base/_form_child_work_relationships.html.erb +22 -32
- data/app/views/curation_concerns/base/_form_relationships.html.erb +4 -7
- data/app/views/curation_concerns/base/_guts4form.html.erb +7 -1
- data/app/views/sufia/admin/admin_sets/_form_participants.html.erb +3 -3
- data/app/views/sufia/admin/admin_sets/show.html.erb +10 -2
- data/config/initializers/monkey_patch_admin_set.rb +2 -0
- data/config/locales/sufia.en.yml +2 -0
- data/db/migrate/20170317141521_permission_template_change_column_workflow_name.rb +5 -0
- data/lib/generators/sufia/templates/workflow.json.erb +1 -0
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/migrate.rake +1 -1
- data/spec/actors/sufia/actors/attach_members_actor_spec.rb +68 -0
- data/spec/actors/sufia/apply_permission_template_actor_spec.rb +7 -3
- data/spec/actors/sufia/default_admin_set_actor_spec.rb +1 -1
- data/spec/controllers/sufia/admin/admin_sets_controller_spec.rb +21 -6
- data/spec/controllers/sufia/admin/permission_templates_controller_spec.rb +1 -1
- data/spec/controllers/sufia/batch_uploads_controller_spec.rb +24 -2
- data/spec/factories/permission_templates.rb +1 -0
- data/spec/factories/workflows.rb +1 -1
- data/spec/forms/curation_concerns/generic_work_form_spec.rb +5 -2
- data/spec/forms/sufia/forms/batch_edit_form_spec.rb +1 -1
- data/spec/forms/sufia/forms/work_form_spec.rb +32 -19
- data/spec/javascripts/autocomplete_spec.js.coffee +12 -33
- data/spec/javascripts/helpers/test_fixtures.js.coffee +10 -1
- data/spec/javascripts/relationships_control_spec.js.coffee +27 -0
- data/spec/javascripts/save_work_spec.js +9 -6
- data/spec/javascripts/visibility_component_spec.js +17 -8
- data/spec/models/admin_set_spec.rb +69 -0
- data/spec/presenters/sufia/admin_set_options_presenter_spec.rb +73 -0
- data/spec/presenters/sufia/admin_set_presenter_spec.rb +31 -2
- data/spec/services/sufia/actor_factory_spec.rb +2 -0
- data/spec/services/sufia/admin_set_create_service_spec.rb +4 -2
- data/spec/services/sufia/admin_set_service_spec.rb +0 -72
- data/spec/services/sufia/workflow/changes_required_notification_spec.rb +1 -1
- data/spec/services/sufia/workflow/deposited_notification_spec.rb +1 -1
- data/spec/services/sufia/workflow/pending_review_notification_spec.rb +1 -1
- data/spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb +1 -2
- data/spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb +27 -62
- data/spec/views/curation_concerns/base/_form_relationships.html.erb_spec.rb +4 -2
- data/spec/views/sufia/admin/admin_sets/_form_participants.html.erb_spec.rb +1 -1
- data/spec/views/sufia/admin/admin_sets/_form_visibility.html.erb_spec.rb +3 -1
- data/spec/views/sufia/admin/admin_sets/show.html.erb_spec.rb +59 -0
- data/sufia.gemspec +3 -2
- data/template.rb +1 -1
- metadata +34 -19
- data/app/assets/javascripts/sufia/relationships/table.es6 +0 -206
- data/app/assets/javascripts/sufia/relationships/table_row.es6 +0 -79
- data/app/views/curation_concerns/base/_form_parent_work_relationships.html.erb +0 -43
- data/app/views/records/edit_fields/_in_works_ids.html.erb +0 -59
- data/spec/javascripts/helpers/test_responses.js +0 -13
- data/spec/javascripts/relationships_table_spec.js.coffee +0 -83
- data/spec/views/curation_concerns/base/_form_parent_work_relationships.html.erb_spec.rb +0 -114
- data/spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb +0 -113
@@ -2,11 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe 'sufia/admin/admin_sets/_form_visibility.html.erb', type: :view do
|
4
4
|
let(:admin_set) { create(:admin_set) }
|
5
|
-
let(:permission_template) {
|
5
|
+
let(:permission_template) { create(:permission_template, admin_set_id: admin_set.id) }
|
6
|
+
|
6
7
|
before do
|
7
8
|
@form = Sufia::Forms::AdminSetForm.new(admin_set, permission_template)
|
8
9
|
render
|
9
10
|
end
|
11
|
+
|
10
12
|
it "has the release form" do
|
11
13
|
expect(rendered).to have_selector('#visibility input[type=radio][name="sufia_permission_template[release_period]"][value=now]')
|
12
14
|
expect(rendered).to have_selector('#visibility input[type=radio][name="sufia_permission_template[release_period]"][value=fixed]')
|
@@ -0,0 +1,59 @@
|
|
1
|
+
describe "sufia/admin/admin_sets/show.html.erb", type: :view do
|
2
|
+
let(:solr_document) { SolrDocument.new(admin_set.to_solr) }
|
3
|
+
let(:ability) { double }
|
4
|
+
let(:presenter) { Sufia::AdminSetPresenter.new(solr_document, ability) }
|
5
|
+
let(:blacklight_config) { CatalogController.blacklight_config }
|
6
|
+
let(:blacklight_configuration_context) do
|
7
|
+
Blacklight::Configuration::Context.new(controller)
|
8
|
+
end
|
9
|
+
before do
|
10
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
11
|
+
allow(view).to receive(:blacklight_configuration_context).and_return(blacklight_configuration_context)
|
12
|
+
|
13
|
+
# Stub route because view specs don't handle engine routes
|
14
|
+
allow(view).to receive(:edit_admin_admin_set_path).and_return("/admin/admin_sets/123/edit")
|
15
|
+
allow(view).to receive(:admin_admin_set_path).and_return("/admin/admin_sets/123")
|
16
|
+
|
17
|
+
stub_template '_collection_description.html.erb' => ''
|
18
|
+
stub_template '_show_descriptions.erb' => ''
|
19
|
+
stub_template '_sort_and_per_page.html.erb' => 'sort and per page'
|
20
|
+
stub_template '_document_list.html.erb' => 'document list'
|
21
|
+
stub_template '_paginate.html.erb' => 'paginate'
|
22
|
+
|
23
|
+
assign(:presenter, presenter)
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with non-empty admin set" do
|
27
|
+
let(:admin_set) { build(:admin_set, id: '123') }
|
28
|
+
let(:work) { build(:work, title: ['Example Work Title']) }
|
29
|
+
before do
|
30
|
+
admin_set.members = [work]
|
31
|
+
admin_set.save!
|
32
|
+
render
|
33
|
+
end
|
34
|
+
it "displays a disabled delete button" do
|
35
|
+
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "with empty admin set" do
|
40
|
+
let(:admin_set) { build(:admin_set, id: '345') }
|
41
|
+
before do
|
42
|
+
render
|
43
|
+
end
|
44
|
+
it "displays an enabled delete button" do
|
45
|
+
expect(rendered).to have_selector(:css, "a.btn-danger")
|
46
|
+
expect(rendered).not_to have_selector(:css, "a.btn-danger.disabled")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "with default admin set" do
|
51
|
+
let(:admin_set) { build(:admin_set, id: AdminSet::DEFAULT_ID) }
|
52
|
+
before do
|
53
|
+
render
|
54
|
+
end
|
55
|
+
it "displays a disabled delete button" do
|
56
|
+
expect(rendered).to have_selector(:css, "a.btn-danger.disabled")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/sufia.gemspec
CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.license = 'Apache2'
|
20
20
|
|
21
21
|
spec.add_dependency 'hydra-works', '~> 0.16'
|
22
|
-
spec.add_dependency 'curation_concerns', '~> 1.7.
|
22
|
+
spec.add_dependency 'curation_concerns', '~> 1.7.6'
|
23
23
|
spec.add_dependency 'hydra-head', '>= 10.4.0'
|
24
24
|
spec.add_dependency 'hydra-batch-edit', '~> 2.0'
|
25
25
|
spec.add_dependency 'browse-everything', '>= 0.10.3'
|
26
|
-
|
26
|
+
# Workaround for https://github.com/projecthydra-labs/hyrax/issues/546
|
27
|
+
spec.add_dependency 'blacklight', '~> 6.6', '< 6.8.0'
|
27
28
|
spec.add_dependency 'blacklight-gallery', '~> 0.7'
|
28
29
|
spec.add_dependency 'tinymce-rails', '~> 4.1'
|
29
30
|
spec.add_dependency 'tinymce-rails-imageupload', '~> 4.0.16.beta'
|
data/template.rb
CHANGED
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: 7.3.0
|
4
|
+
version: 7.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-03-
|
15
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: hydra-works
|
@@ -34,14 +34,14 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - "~>"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.7.
|
37
|
+
version: 1.7.6
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
requirements:
|
42
42
|
- - "~>"
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.7.
|
44
|
+
version: 1.7.6
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: hydra-head
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +91,9 @@ dependencies:
|
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '6.6'
|
94
|
+
- - "<"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 6.8.0
|
94
97
|
type: :runtime
|
95
98
|
prerelease: false
|
96
99
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -98,6 +101,9 @@ dependencies:
|
|
98
101
|
- - "~>"
|
99
102
|
- !ruby/object:Gem::Version
|
100
103
|
version: '6.6'
|
104
|
+
- - "<"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 6.8.0
|
101
107
|
- !ruby/object:Gem::Dependency
|
102
108
|
name: blacklight-gallery
|
103
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -708,6 +714,7 @@ files:
|
|
708
714
|
- LICENSE
|
709
715
|
- README.md
|
710
716
|
- Rakefile
|
717
|
+
- app/actors/sufia/actors/attach_members_actor.rb
|
711
718
|
- app/actors/sufia/apply_permission_template_actor.rb
|
712
719
|
- app/actors/sufia/create_with_files_actor.rb
|
713
720
|
- app/actors/sufia/create_with_remote_files_actor.rb
|
@@ -737,8 +744,10 @@ files:
|
|
737
744
|
- app/assets/javascripts/sufia/batch_edit.js
|
738
745
|
- app/assets/javascripts/sufia/batch_select_all.js
|
739
746
|
- app/assets/javascripts/sufia/browse_everything.js
|
747
|
+
- app/assets/javascripts/sufia/content_blocks.js
|
740
748
|
- app/assets/javascripts/sufia/dashboard_actions.js
|
741
|
-
- app/assets/javascripts/sufia/editor.
|
749
|
+
- app/assets/javascripts/sufia/editor.es6
|
750
|
+
- app/assets/javascripts/sufia/editor/admin_set_widget.es6
|
742
751
|
- app/assets/javascripts/sufia/facets.js
|
743
752
|
- app/assets/javascripts/sufia/featured_researcher.js
|
744
753
|
- app/assets/javascripts/sufia/featured_works.js
|
@@ -758,8 +767,10 @@ files:
|
|
758
767
|
- app/assets/javascripts/sufia/permissions/user_controls.es6
|
759
768
|
- app/assets/javascripts/sufia/proxy_rights.js
|
760
769
|
- app/assets/javascripts/sufia/relationships.js
|
761
|
-
- app/assets/javascripts/sufia/relationships/
|
762
|
-
- app/assets/javascripts/sufia/relationships/
|
770
|
+
- app/assets/javascripts/sufia/relationships/control.es6
|
771
|
+
- app/assets/javascripts/sufia/relationships/registry.es6
|
772
|
+
- app/assets/javascripts/sufia/relationships/registry_entry.es6
|
773
|
+
- app/assets/javascripts/sufia/relationships/work.es6
|
763
774
|
- app/assets/javascripts/sufia/save_work.es6
|
764
775
|
- app/assets/javascripts/sufia/save_work/checklist_item.es6
|
765
776
|
- app/assets/javascripts/sufia/save_work/deposit_agreement.es6
|
@@ -918,6 +929,7 @@ files:
|
|
918
929
|
- app/mailers/sufia/contact_mailer.rb
|
919
930
|
- app/models/batch_upload_item.rb
|
920
931
|
- app/models/concerns/sufia/ability.rb
|
932
|
+
- app/models/concerns/sufia/admin_set_behavior.rb
|
921
933
|
- app/models/concerns/sufia/content_block_behavior.rb
|
922
934
|
- app/models/concerns/sufia/file_set_behavior.rb
|
923
935
|
- app/models/concerns/sufia/proxy_deposit.rb
|
@@ -956,6 +968,7 @@ files:
|
|
956
968
|
- app/models/user_stat.rb
|
957
969
|
- app/models/work_view_stat.rb
|
958
970
|
- app/presenters/sufia/admin_dashboard_presenter.rb
|
971
|
+
- app/presenters/sufia/admin_set_options_presenter.rb
|
959
972
|
- app/presenters/sufia/admin_set_presenter.rb
|
960
973
|
- app/presenters/sufia/admin_stats_presenter.rb
|
961
974
|
- app/presenters/sufia/collection_presenter.rb
|
@@ -1086,7 +1099,6 @@ files:
|
|
1086
1099
|
- app/views/curation_concerns/base/_form_child_work_relationships.html.erb
|
1087
1100
|
- app/views/curation_concerns/base/_form_files.html.erb
|
1088
1101
|
- app/views/curation_concerns/base/_form_metadata.html.erb
|
1089
|
-
- app/views/curation_concerns/base/_form_parent_work_relationships.html.erb
|
1090
1102
|
- app/views/curation_concerns/base/_form_progress.html.erb
|
1091
1103
|
- app/views/curation_concerns/base/_form_relationships.html.erb
|
1092
1104
|
- app/views/curation_concerns/base/_form_share.html.erb
|
@@ -1179,7 +1191,6 @@ files:
|
|
1179
1191
|
- app/views/records/edit_fields/_based_near.html.erb
|
1180
1192
|
- app/views/records/edit_fields/_default.html.erb
|
1181
1193
|
- app/views/records/edit_fields/_description.html.erb
|
1182
|
-
- app/views/records/edit_fields/_in_works_ids.html.erb
|
1183
1194
|
- app/views/records/edit_fields/_language.html.erb
|
1184
1195
|
- app/views/records/edit_fields/_resource_type.html.erb
|
1185
1196
|
- app/views/records/edit_fields/_rights.html.erb
|
@@ -1282,6 +1293,7 @@ files:
|
|
1282
1293
|
- app/views/users/show.html.erb
|
1283
1294
|
- config/features.rb
|
1284
1295
|
- config/initializers/curation_concern_events.rb
|
1296
|
+
- config/initializers/monkey_patch_admin_set.rb
|
1285
1297
|
- config/locales/simple_form.en.yml
|
1286
1298
|
- config/locales/sufia.en.yml
|
1287
1299
|
- config/routes.rb
|
@@ -1313,6 +1325,7 @@ files:
|
|
1313
1325
|
- db/migrate/20161021175854_create_permission_template.rb
|
1314
1326
|
- db/migrate/20161021180154_create_permission_template_access.rb
|
1315
1327
|
- db/migrate/20161116222307_add_release_to_permission_templates.rb
|
1328
|
+
- db/migrate/20170317141521_permission_template_change_column_workflow_name.rb
|
1316
1329
|
- lib/generators/sufia/arkivo_api_generator.rb
|
1317
1330
|
- lib/generators/sufia/assets_generator.rb
|
1318
1331
|
- lib/generators/sufia/config_generator.rb
|
@@ -1373,6 +1386,7 @@ files:
|
|
1373
1386
|
- solr/config/xslt/example_rss.xsl
|
1374
1387
|
- solr/config/xslt/luke.xsl
|
1375
1388
|
- spec/.gitignore
|
1389
|
+
- spec/actors/sufia/actors/attach_members_actor_spec.rb
|
1376
1390
|
- spec/actors/sufia/apply_permission_template_actor_spec.rb
|
1377
1391
|
- spec/actors/sufia/create_with_files_actor_spec.rb
|
1378
1392
|
- spec/actors/sufia/create_with_remote_files_actor_spec.rb
|
@@ -1506,9 +1520,8 @@ files:
|
|
1506
1520
|
- spec/javascripts/helpers/jasmine-ajax.js
|
1507
1521
|
- spec/javascripts/helpers/jasmine-jquery.js
|
1508
1522
|
- spec/javascripts/helpers/test_fixtures.js.coffee
|
1509
|
-
- spec/javascripts/helpers/test_responses.js
|
1510
1523
|
- spec/javascripts/jasmine_spec.rb
|
1511
|
-
- spec/javascripts/
|
1524
|
+
- spec/javascripts/relationships_control_spec.js.coffee
|
1512
1525
|
- spec/javascripts/required_field_spec.js
|
1513
1526
|
- spec/javascripts/save_work_spec.js
|
1514
1527
|
- spec/javascripts/support/jasmine.yml
|
@@ -1543,6 +1556,7 @@ files:
|
|
1543
1556
|
- spec/lib/sufia/resource_sync/source_description_writer_spec.rb
|
1544
1557
|
- spec/lib/sufia/zotero/config_spec.rb
|
1545
1558
|
- spec/lib/sufia/zotero_spec.rb
|
1559
|
+
- spec/models/admin_set_spec.rb
|
1546
1560
|
- spec/models/collection_spec.rb
|
1547
1561
|
- spec/models/content_block_spec.rb
|
1548
1562
|
- spec/models/featured_work_list_spec.rb
|
@@ -1564,6 +1578,7 @@ files:
|
|
1564
1578
|
- spec/models/user_spec.rb
|
1565
1579
|
- spec/models/work_view_stat_spec.rb
|
1566
1580
|
- spec/presenters/sufia/admin_dashboard_presenter_spec.rb
|
1581
|
+
- spec/presenters/sufia/admin_set_options_presenter_spec.rb
|
1567
1582
|
- spec/presenters/sufia/admin_set_presenter_spec.rb
|
1568
1583
|
- spec/presenters/sufia/admin_stats_presenter_spec.rb
|
1569
1584
|
- spec/presenters/sufia/collection_presenter_spec.rb
|
@@ -1653,7 +1668,6 @@ files:
|
|
1653
1668
|
- spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb
|
1654
1669
|
- spec/views/curation_concerns/base/_form.html.erb_spec.rb
|
1655
1670
|
- spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb
|
1656
|
-
- spec/views/curation_concerns/base/_form_parent_work_relationships.html.erb_spec.rb
|
1657
1671
|
- spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb
|
1658
1672
|
- spec/views/curation_concerns/base/_form_relationships.html.erb_spec.rb
|
1659
1673
|
- spec/views/curation_concerns/base/_items.html.erb_spec.rb
|
@@ -1679,7 +1693,6 @@ files:
|
|
1679
1693
|
- spec/views/my/facet.html.erb_spec.rb
|
1680
1694
|
- spec/views/records/edit_fields/_based_near.html.erb_spec.rb
|
1681
1695
|
- spec/views/records/edit_fields/_description.html.erb_spec.rb
|
1682
|
-
- spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb
|
1683
1696
|
- spec/views/records/edit_fields/_language.html.erb_spec.rb
|
1684
1697
|
- spec/views/records/edit_fields/_subject.html.erb_spec.rb
|
1685
1698
|
- spec/views/shared/select_work_type_modal.html.erb_spec.rb
|
@@ -1688,6 +1701,7 @@ files:
|
|
1688
1701
|
- spec/views/sufia/admin/admin_sets/_form_participants.html.erb_spec.rb
|
1689
1702
|
- spec/views/sufia/admin/admin_sets/_form_visibility.html.erb_spec.rb
|
1690
1703
|
- spec/views/sufia/admin/admin_sets/index.html.erb_spec.rb
|
1704
|
+
- spec/views/sufia/admin/admin_sets/show.html.erb_spec.rb
|
1691
1705
|
- spec/views/sufia/admin/features/index.html.erb_spec.rb
|
1692
1706
|
- spec/views/sufia/admin/stats/show.html.erb_spec.rb
|
1693
1707
|
- spec/views/sufia/batch_uploads/_form.html.erb_spec.rb
|
@@ -1736,9 +1750,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1736
1750
|
version: '0'
|
1737
1751
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1738
1752
|
requirements:
|
1739
|
-
- - "
|
1753
|
+
- - ">="
|
1740
1754
|
- !ruby/object:Gem::Version
|
1741
|
-
version:
|
1755
|
+
version: '0'
|
1742
1756
|
requirements: []
|
1743
1757
|
rubyforge_project:
|
1744
1758
|
rubygems_version: 2.6.10
|
@@ -1748,6 +1762,7 @@ summary: Sufia was originally extracted from ScholarSphere developed by Penn Sta
|
|
1748
1762
|
University. It's now used and maintained by an active community of adopters.
|
1749
1763
|
test_files:
|
1750
1764
|
- spec/.gitignore
|
1765
|
+
- spec/actors/sufia/actors/attach_members_actor_spec.rb
|
1751
1766
|
- spec/actors/sufia/apply_permission_template_actor_spec.rb
|
1752
1767
|
- spec/actors/sufia/create_with_files_actor_spec.rb
|
1753
1768
|
- spec/actors/sufia/create_with_remote_files_actor_spec.rb
|
@@ -1881,9 +1896,8 @@ test_files:
|
|
1881
1896
|
- spec/javascripts/helpers/jasmine-ajax.js
|
1882
1897
|
- spec/javascripts/helpers/jasmine-jquery.js
|
1883
1898
|
- spec/javascripts/helpers/test_fixtures.js.coffee
|
1884
|
-
- spec/javascripts/helpers/test_responses.js
|
1885
1899
|
- spec/javascripts/jasmine_spec.rb
|
1886
|
-
- spec/javascripts/
|
1900
|
+
- spec/javascripts/relationships_control_spec.js.coffee
|
1887
1901
|
- spec/javascripts/required_field_spec.js
|
1888
1902
|
- spec/javascripts/save_work_spec.js
|
1889
1903
|
- spec/javascripts/support/jasmine.yml
|
@@ -1918,6 +1932,7 @@ test_files:
|
|
1918
1932
|
- spec/lib/sufia/resource_sync/source_description_writer_spec.rb
|
1919
1933
|
- spec/lib/sufia/zotero/config_spec.rb
|
1920
1934
|
- spec/lib/sufia/zotero_spec.rb
|
1935
|
+
- spec/models/admin_set_spec.rb
|
1921
1936
|
- spec/models/collection_spec.rb
|
1922
1937
|
- spec/models/content_block_spec.rb
|
1923
1938
|
- spec/models/featured_work_list_spec.rb
|
@@ -1939,6 +1954,7 @@ test_files:
|
|
1939
1954
|
- spec/models/user_spec.rb
|
1940
1955
|
- spec/models/work_view_stat_spec.rb
|
1941
1956
|
- spec/presenters/sufia/admin_dashboard_presenter_spec.rb
|
1957
|
+
- spec/presenters/sufia/admin_set_options_presenter_spec.rb
|
1942
1958
|
- spec/presenters/sufia/admin_set_presenter_spec.rb
|
1943
1959
|
- spec/presenters/sufia/admin_stats_presenter_spec.rb
|
1944
1960
|
- spec/presenters/sufia/collection_presenter_spec.rb
|
@@ -2028,7 +2044,6 @@ test_files:
|
|
2028
2044
|
- spec/views/curation_concerns/base/_find_work_widget.html.erb_spec.rb
|
2029
2045
|
- spec/views/curation_concerns/base/_form.html.erb_spec.rb
|
2030
2046
|
- spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb
|
2031
|
-
- spec/views/curation_concerns/base/_form_parent_work_relationships.html.erb_spec.rb
|
2032
2047
|
- spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb
|
2033
2048
|
- spec/views/curation_concerns/base/_form_relationships.html.erb_spec.rb
|
2034
2049
|
- spec/views/curation_concerns/base/_items.html.erb_spec.rb
|
@@ -2054,7 +2069,6 @@ test_files:
|
|
2054
2069
|
- spec/views/my/facet.html.erb_spec.rb
|
2055
2070
|
- spec/views/records/edit_fields/_based_near.html.erb_spec.rb
|
2056
2071
|
- spec/views/records/edit_fields/_description.html.erb_spec.rb
|
2057
|
-
- spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb
|
2058
2072
|
- spec/views/records/edit_fields/_language.html.erb_spec.rb
|
2059
2073
|
- spec/views/records/edit_fields/_subject.html.erb_spec.rb
|
2060
2074
|
- spec/views/shared/select_work_type_modal.html.erb_spec.rb
|
@@ -2063,6 +2077,7 @@ test_files:
|
|
2063
2077
|
- spec/views/sufia/admin/admin_sets/_form_participants.html.erb_spec.rb
|
2064
2078
|
- spec/views/sufia/admin/admin_sets/_form_visibility.html.erb_spec.rb
|
2065
2079
|
- spec/views/sufia/admin/admin_sets/index.html.erb_spec.rb
|
2080
|
+
- spec/views/sufia/admin/admin_sets/show.html.erb_spec.rb
|
2066
2081
|
- spec/views/sufia/admin/features/index.html.erb_spec.rb
|
2067
2082
|
- spec/views/sufia/admin/stats/show.html.erb_spec.rb
|
2068
2083
|
- spec/views/sufia/batch_uploads/_form.html.erb_spec.rb
|
@@ -1,206 +0,0 @@
|
|
1
|
-
import { RelationshipsTableRow } from './table_row'
|
2
|
-
|
3
|
-
export class RelationshipsTable {
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Initializes the class in the context of an individual table element
|
7
|
-
* @param {jQuery} element the table element that this class represents
|
8
|
-
*/
|
9
|
-
constructor(element) {
|
10
|
-
this.$element = element;
|
11
|
-
this.form_action = this.$element.parents("form").attr("action");
|
12
|
-
this.query_url = this.$element.data('query-url');
|
13
|
-
this.existing_related_works_values = this.$element.find("input.related_works_ids:not(.new-form-control)").map(function(i, e){ return e.value; });
|
14
|
-
|
15
|
-
// TODO: Fall back to just cloning rows and removing rows for form posting
|
16
|
-
if (!this.query_url)
|
17
|
-
return;
|
18
|
-
|
19
|
-
this.bindAddButton();
|
20
|
-
this.bindRemoveButton();
|
21
|
-
this.bindKeyEvents();
|
22
|
-
}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Handle click events by the "Add" button in the table, setting a warning
|
26
|
-
* message if the input is empty or calling the server to handle the request
|
27
|
-
*/
|
28
|
-
bindAddButton() {
|
29
|
-
let $this = this;
|
30
|
-
|
31
|
-
$this.$element.on("click", ".btn-add-row", function(event) {
|
32
|
-
let $row = $(this).parents("tr:first");
|
33
|
-
let $input = $row.find("input.new-form-control");
|
34
|
-
|
35
|
-
// Display an error when the input field is empty, or if the work ID is already related,
|
36
|
-
// otherwise clone the row and set appropriate styles
|
37
|
-
if ($input.val() == "") {
|
38
|
-
$this.setWarningMessage($row, "ID cannot be empty.");
|
39
|
-
} else if ($.inArray($input.val(), $this.existing_related_works_values) > -1) {
|
40
|
-
$this.setWarningMessage($row, "Work is already related.");
|
41
|
-
} else {
|
42
|
-
|
43
|
-
let query_url = $this.query_url.replace('$id', $input.val());
|
44
|
-
$this.hideWarningMessage($row);
|
45
|
-
$this.callAjax({
|
46
|
-
row: $row,
|
47
|
-
table: $this.$element,
|
48
|
-
input: $input,
|
49
|
-
url: $this.form_action,
|
50
|
-
query_url: query_url,
|
51
|
-
on_error: $this.handleError,
|
52
|
-
on_success: $this.handleAddRowSuccess
|
53
|
-
});
|
54
|
-
}
|
55
|
-
});
|
56
|
-
}
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Find and fire off the click event for the "Add" button
|
60
|
-
* @param {jQuery} $row the row containing the add button to click
|
61
|
-
*/
|
62
|
-
clickAddbutton($row) {
|
63
|
-
$row.find(".btn-add-row").click();
|
64
|
-
}
|
65
|
-
|
66
|
-
/**
|
67
|
-
* Handle click events by the "Remove" buttons in the table, and calling the
|
68
|
-
* server to handle the request
|
69
|
-
*/
|
70
|
-
bindRemoveButton() {
|
71
|
-
let $this = this;
|
72
|
-
|
73
|
-
$this.$element.on("click", ".btn-remove-row", function(event) {
|
74
|
-
let $row = $(this).parents("tr:first");
|
75
|
-
let $input = $row.find("input.related_works_ids:first");
|
76
|
-
|
77
|
-
// Track which input is attemping to be removed, to provide an easy way
|
78
|
-
// for the ajax call to exclude it when making the call to the server
|
79
|
-
$input.addClass("removing");
|
80
|
-
$this.callAjax({
|
81
|
-
row: $row,
|
82
|
-
table: $this.$element,
|
83
|
-
input: $input,
|
84
|
-
url: $this.form_action,
|
85
|
-
on_error: $this.handleError,
|
86
|
-
on_success: $this.handleRemoveRowSuccess
|
87
|
-
});
|
88
|
-
});
|
89
|
-
}
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Handle keyup and keypress events at the form level to prevent the ENTER key
|
93
|
-
* from submitting the form. ENTER key within a relationships table should
|
94
|
-
* click the "Add" button instead. ESC key should clear the input and hide the
|
95
|
-
* error message.
|
96
|
-
*/
|
97
|
-
bindKeyEvents() {
|
98
|
-
let $this = this;
|
99
|
-
let $form = this.$element.parents("form");
|
100
|
-
|
101
|
-
$form.on("keyup keypress", "input.related_works_ids", function(event) {
|
102
|
-
let $row = $(this).parents("tr:first");
|
103
|
-
let key_code = event.keyCode || event.which;
|
104
|
-
|
105
|
-
// ENTER key was pressed, wait for keyup to click the Add button
|
106
|
-
if (key_code === 13) {
|
107
|
-
if (event.type == "keyup") {
|
108
|
-
$this.clickAddbutton($row);
|
109
|
-
}
|
110
|
-
event.preventDefault();
|
111
|
-
return false;
|
112
|
-
}
|
113
|
-
|
114
|
-
// ESC key was pressed, clear the input field and hide the error
|
115
|
-
if (key_code === 27 && event.type == "keyup") {
|
116
|
-
$(this).val("");
|
117
|
-
$this.hideWarningMessage($row);
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}
|
121
|
-
|
122
|
-
/**
|
123
|
-
* Set the warning message related to the appropriate row in the table
|
124
|
-
* @param {jQuery} $row the row containing the warning message to display
|
125
|
-
* @param {String} message the warning message text to set
|
126
|
-
*/
|
127
|
-
setWarningMessage($row, message) {
|
128
|
-
$row.find(".message.has-warning").text(message).removeClass("hidden");
|
129
|
-
}
|
130
|
-
|
131
|
-
/**
|
132
|
-
* Hide the warning message on the appropriate row
|
133
|
-
* @param {jQuery} $row the row containing the warning message to hide
|
134
|
-
*/
|
135
|
-
hideWarningMessage($row){
|
136
|
-
$row.find(".message").addClass("hidden");
|
137
|
-
}
|
138
|
-
|
139
|
-
/**
|
140
|
-
* Call the server, then call the appropriate callbacks to handle success and errors
|
141
|
-
* @param {Object} args the table, row, input, url, and callbacks
|
142
|
-
*/
|
143
|
-
callAjax(args) {
|
144
|
-
let $this = this;
|
145
|
-
// Send only the IDs in this table that aren't in the midst of being "removed"
|
146
|
-
let data = args.table.find("input.related_works_ids:not('.removing')").serialize();
|
147
|
-
$.ajax({
|
148
|
-
type: 'patch',
|
149
|
-
url: args.url,
|
150
|
-
dataType: 'json',
|
151
|
-
data: data
|
152
|
-
})
|
153
|
-
.done(function(json) {
|
154
|
-
args.on_success($this, args, json);
|
155
|
-
})
|
156
|
-
.fail(function(jqxhr, status, err) {
|
157
|
-
args.on_error($this, args, jqxhr, status, err);
|
158
|
-
});
|
159
|
-
}
|
160
|
-
|
161
|
-
/**
|
162
|
-
* Set a warning message to alert the user on an error
|
163
|
-
* @param {jQuery} $this the RelationshipsTable class instance
|
164
|
-
* @param {Object} args the table, row, input, url, and callbacks
|
165
|
-
* @param {Object} jqxhr the jQuery XHR response object
|
166
|
-
* @param {String} status the HTTP error status
|
167
|
-
* @param {String} err the HTTP error
|
168
|
-
*/
|
169
|
-
handleError($this, args, jqxhr, status, err) {
|
170
|
-
args.row.find('input.removing').removeClass('removing');
|
171
|
-
let message = jqxhr.statusText;
|
172
|
-
if(jqxhr.responseJSON){
|
173
|
-
message = jqxhr.responseJSON.description;
|
174
|
-
}
|
175
|
-
$this.setWarningMessage(args.row, message);
|
176
|
-
}
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Remove the row when the API returns this type of success
|
180
|
-
* @param {jQuery} $this the RelationshipsTable class instance
|
181
|
-
* @param {Object} args the table, row, input, url, and callbacks
|
182
|
-
* @param {String} json the returned JSON string
|
183
|
-
*/
|
184
|
-
handleRemoveRowSuccess($this, args, json) {
|
185
|
-
args.row.remove();
|
186
|
-
}
|
187
|
-
|
188
|
-
/**
|
189
|
-
* Add a new row to the table, query the server for details about the work to
|
190
|
-
* set the title and link for the new work that was added. Hide the input
|
191
|
-
* field and display the title and edit button
|
192
|
-
* @param {jQuery} $this the RelationshipsTable class instance
|
193
|
-
* @param {Object} args the table, row, input, url, and callbacks
|
194
|
-
* @param {String} json the returned JSON string
|
195
|
-
*/
|
196
|
-
handleAddRowSuccess($this, args, json) {
|
197
|
-
let new_row = new RelationshipsTableRow(args.table);
|
198
|
-
new_row.clone(args.row);
|
199
|
-
new_row.callAjaxQuery(args.query_url);
|
200
|
-
|
201
|
-
// finally, empty the "add" row input value
|
202
|
-
args.row.find("input.new-form-control").val("");
|
203
|
-
// synch the related_works_values to include the new work relationship
|
204
|
-
$this.existing_related_works_values = $this.$element.find("input.related_works_ids:not(.new-form-control)").map(function(i, e){ return e.value; });
|
205
|
-
}
|
206
|
-
}
|