sufia 7.0.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -7
  3. data/app/assets/javascripts/sufia.js +3 -4
  4. data/app/assets/javascripts/sufia/app.js +8 -0
  5. data/app/assets/javascripts/sufia/relationships.js +2 -0
  6. data/app/assets/javascripts/sufia/relationships/table.es6 +206 -0
  7. data/app/assets/javascripts/sufia/relationships/table_row.es6 +79 -0
  8. data/app/assets/javascripts/sufia/save_work/save_work_control.es6 +3 -0
  9. data/app/assets/javascripts/sufia/save_work/uploaded_files.es6 +5 -0
  10. data/app/forms/sufia/forms/batch_edit_form.rb +2 -2
  11. data/app/forms/sufia/forms/work_form.rb +13 -1
  12. data/app/presenters/sufia/work_show_presenter.rb +11 -0
  13. data/app/views/curation_concerns/base/_form_child_work_relationships.html.erb +65 -0
  14. data/app/views/curation_concerns/base/_form_progress.html.erb +3 -1
  15. data/app/views/curation_concerns/base/_form_relationships.html.erb +11 -2
  16. data/app/views/curation_concerns/base/_metadata.html.erb +2 -2
  17. data/app/views/curation_concerns/base/_relationships.html.erb +7 -22
  18. data/app/views/curation_concerns/base/_relationships_member_rows.html.erb +24 -0
  19. data/app/views/curation_concerns/base/_relationships_parent_row.html.erb +16 -0
  20. data/app/views/curation_concerns/base/_relationships_parent_row_empty.html.erb +6 -0
  21. data/app/views/curation_concerns/base/_relationships_parent_rows.html.erb +23 -0
  22. data/app/views/curation_concerns/file_sets/_actions.html.erb +1 -1
  23. data/app/views/curation_concerns/file_sets/_show_actions.html.erb +8 -9
  24. data/app/views/curation_concerns/file_sets/_single_use_link_rows.html.erb +19 -0
  25. data/app/views/curation_concerns/file_sets/_single_use_links.html.erb +10 -0
  26. data/app/views/curation_concerns/file_sets/show.html.erb +1 -0
  27. data/app/views/records/edit_fields/_in_works_ids.html.erb +59 -0
  28. data/config/locales/sufia.en.yml +22 -3
  29. data/lib/generators/sufia/templates/config/sufia.rb +5 -0
  30. data/lib/sufia/configuration.rb +6 -0
  31. data/lib/sufia/engine.rb +0 -2
  32. data/lib/sufia/version.rb +1 -1
  33. data/spec/features/search_spec.rb +7 -2
  34. data/spec/forms/sufia/forms/work_form_spec.rb +20 -0
  35. data/spec/javascripts/helpers/test_fixtures.js.coffee +9 -0
  36. data/spec/javascripts/helpers/test_responses.js +10 -5
  37. data/spec/javascripts/relationships_table_spec.js.coffee +83 -0
  38. data/spec/javascripts/save_work_spec.js +4 -2
  39. data/spec/javascripts/support/jasmine.yml +1 -1
  40. data/spec/javascripts/uploaded_files_spec.js +23 -0
  41. data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -1
  42. data/spec/views/catalog/index.html.erb_spec.rb +0 -4
  43. data/spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb +113 -0
  44. data/spec/views/curation_concerns/base/_relationships.html.erb_spec.rb +89 -3
  45. data/spec/views/curation_concerns/file_sets/_single_use_links.html.erb_spec.rb +32 -0
  46. data/spec/views/curation_concerns/file_sets/show.html.erb_spec.rb +4 -0
  47. data/spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb +113 -0
  48. data/sufia.gemspec +1 -2
  49. metadata +35 -21
  50. data/app/assets/javascripts/sufia/single_use_link.js +0 -30
  51. data/spec/javascripts/single_use_link_spec.js.coffee +0 -21
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'curation_concerns/file_sets/_single_use_links.html.erb', type: :view do
4
+ let(:user) { create(:user) }
5
+ let(:file_set) { build(:file_set, user: user, id: "1234") }
6
+ let(:solr_document) { SolrDocument.new(file_set.to_solr) }
7
+ let(:ability) { Ability.new(user) }
8
+ let(:presenter) { Sufia::FileSetPresenter.new(solr_document, ability) }
9
+
10
+ context "with no single-use links" do
11
+ before do
12
+ allow(presenter).to receive(:single_use_links).and_return([])
13
+ render 'curation_concerns/file_sets/single_use_links.html.erb', presenter: presenter
14
+ end
15
+ it "renders a table with no links" do
16
+ expect(rendered).to include("<tr><td>No links have been generated</td></tr>")
17
+ end
18
+ end
19
+
20
+ context "with single use links" do
21
+ let(:link) { SingleUseLink.create(itemId: "1234", downloadKey: "sha2hashb") }
22
+ let(:link_presenter) { CurationConcerns::SingleUseLinkPresenter.new(link) }
23
+ before do
24
+ controller.params = { id: "1234" }
25
+ allow(presenter).to receive(:single_use_links).and_return([link_presenter])
26
+ render 'curation_concerns/file_sets/single_use_links.html.erb', presenter: presenter
27
+ end
28
+ it "renders a table with links" do
29
+ expect(rendered).to include("Link sha2ha expires in 23 hours")
30
+ end
31
+ end
32
+ end
@@ -35,4 +35,8 @@ describe 'curation_concerns/file_sets/show.html.erb', type: :view do
35
35
  expect(rendered).to have_selector 'h1', text: 'My Title'
36
36
  end
37
37
  end
38
+
39
+ it "does not render single-use links" do
40
+ expect(rendered).not_to have_selector('table.single-use-links')
41
+ end
38
42
  end
@@ -0,0 +1,113 @@
1
+ require 'spec_helper'
2
+
3
+ describe "records/edit_fields/_in_works_ids.html.erb", type: :view do
4
+ let(:work) do
5
+ stub_model(GenericWork, id: '456', title: ["MyWork"])
6
+ end
7
+
8
+ let(:work_2) do
9
+ stub_model(GenericWork, id: '567', title: ["Child Work"])
10
+ end
11
+
12
+ let(:ability) { double }
13
+
14
+ let(:form) do
15
+ CurationConcerns::GenericWorkForm.new(work, ability)
16
+ end
17
+
18
+ let(:f) { double(object: form) }
19
+
20
+ let(:page) do
21
+ render
22
+ Capybara::Node::Simple.new(rendered)
23
+ end
24
+
25
+ before do
26
+ view.lookup_context.view_paths.push 'app/views/curation_concerns'
27
+ allow(::ActiveFedora::Base).to receive(:find).and_return(work_2)
28
+ allow(view).to receive(:curation_concern).and_return(work)
29
+ allow(view).to receive(:f).and_return(f)
30
+ allow(view).to receive(:key).and_return(:in_works_ids)
31
+ allow(controller).to receive(:current_user).and_return(stub_model(User))
32
+ assign(:form, form)
33
+ end
34
+
35
+ context "When editing a work" do
36
+ context "and no parents are present" do
37
+ before do
38
+ allow(work).to receive(:in_works).and_return([])
39
+ end
40
+ it "has 1 empty parent work input" do
41
+ expect(page).to have_selector("input[value='']", count: 1)
42
+ end
43
+
44
+ it "does not display the remove button in the actions" do
45
+ expect(page).to have_selector(".btn-remove-row", visible: false)
46
+ end
47
+
48
+ it "displays the add button in the actions" do
49
+ expect(page).to have_selector(".btn-add-row", visible: true, count: 1)
50
+ end
51
+ end
52
+ context "When 1 parent work is present" do
53
+ let(:work_2) do
54
+ stub_model(GenericWork, id: '567', title: ["Test Parent Work"])
55
+ end
56
+
57
+ before do
58
+ allow(work).to receive(:in_works).and_return([work_2])
59
+ end
60
+ it "has 1 empty parent work input with add button" do
61
+ expect(page).to have_selector("input[value='']", count: 1)
62
+ expect(page).to have_selector(".btn-add-row", visible: true, count: 1)
63
+ end
64
+
65
+ it "has an input box that is filled in with the parent id" do
66
+ expect(page).to have_selector("input[value='#{work_2.id}']", count: 1)
67
+ end
68
+
69
+ it "generates a link for the parents first title" do
70
+ expect(page).to have_link("Test Parent Work")
71
+ end
72
+
73
+ it "has an edit and remove button" do
74
+ within ".old-row" do
75
+ expect(page).to have_selector(".btn-remove-row", visible: true, count: 1)
76
+ expect(page).to have_selector(".btn-edit-row", visible: true, count: 1)
77
+ end
78
+ end
79
+ end
80
+ context "When multiple parent works are present" do
81
+ let(:work_2) do
82
+ stub_model(GenericWork, id: '567', title: ["Test Parent Work"])
83
+ end
84
+ let(:work_3) do
85
+ stub_model(GenericWork, id: '789', title: ["Test Parent Work 2"])
86
+ end
87
+ before do
88
+ allow(work).to receive(:in_works).and_return([work_2, work_3])
89
+ end
90
+ it "has 1 empty parent work input with add button" do
91
+ expect(page).to have_selector("input[value='']", count: 1)
92
+ expect(page).to have_selector(".btn-add-row", visible: true, count: 1)
93
+ end
94
+
95
+ it "has an input box that is filled in with the parent ids" do
96
+ expect(page).to have_selector("input[value='#{work_2.id}']", count: 1)
97
+ expect(page).to have_selector("input[value='#{work_3.id}']", count: 1)
98
+ end
99
+
100
+ it "generates a link for the parents first title" do
101
+ expect(page).to have_link("Test Parent Work")
102
+ expect(page).to have_link("Test Parent Work 2")
103
+ end
104
+
105
+ it "has an edit and remove button" do
106
+ within ".old-row" do
107
+ expect(page).to have_selector(".btn-remove-row", visible: true, count: 2)
108
+ expect(page).to have_selector(".btn-edit-row", visible: true, count: 2)
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.version = Sufia::VERSION
19
19
  spec.license = 'Apache2'
20
20
 
21
- spec.add_dependency 'curation_concerns', '~> 1.1'
21
+ spec.add_dependency 'curation_concerns', '~> 1.3', '>= 1.3.3'
22
22
  spec.add_dependency 'hydra-batch-edit', '~> 2.0'
23
23
  spec.add_dependency 'browse-everything', '>= 0.10.3'
24
24
  spec.add_dependency 'blacklight-gallery', '~> 0.1'
@@ -40,7 +40,6 @@ Gem::Specification.new do |spec|
40
40
  spec.add_dependency 'legato', '~> 0.3'
41
41
  spec.add_dependency 'posix-spawn'
42
42
  spec.add_dependency 'jquery-ui-rails', '~> 5.0'
43
- spec.add_dependency 'zeroclipboard-rails', '~> 0.0.13'
44
43
  spec.add_dependency 'redis-namespace', '~> 1.5.2'
45
44
  spec.add_dependency 'flot-rails', '~> 0.0.6'
46
45
  spec.add_dependency 'almond-rails', '~> 0.0.1'
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.0.0
4
+ version: 7.1.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: 2016-08-01 00:00:00.000000000 Z
15
+ date: 2016-08-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: curation_concerns
@@ -20,14 +20,20 @@ dependencies:
20
20
  requirements:
21
21
  - - "~>"
22
22
  - !ruby/object:Gem::Version
23
- version: '1.1'
23
+ version: '1.3'
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.3
24
27
  type: :runtime
25
28
  prerelease: false
26
29
  version_requirements: !ruby/object:Gem::Requirement
27
30
  requirements:
28
31
  - - "~>"
29
32
  - !ruby/object:Gem::Version
30
- version: '1.1'
33
+ version: '1.3'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.3.3
31
37
  - !ruby/object:Gem::Dependency
32
38
  name: hydra-batch-edit
33
39
  requirement: !ruby/object:Gem::Requirement
@@ -334,20 +340,6 @@ dependencies:
334
340
  - - "~>"
335
341
  - !ruby/object:Gem::Version
336
342
  version: '5.0'
337
- - !ruby/object:Gem::Dependency
338
- name: zeroclipboard-rails
339
- requirement: !ruby/object:Gem::Requirement
340
- requirements:
341
- - - "~>"
342
- - !ruby/object:Gem::Version
343
- version: 0.0.13
344
- type: :runtime
345
- prerelease: false
346
- version_requirements: !ruby/object:Gem::Requirement
347
- requirements:
348
- - - "~>"
349
- - !ruby/object:Gem::Version
350
- version: 0.0.13
351
343
  - !ruby/object:Gem::Dependency
352
344
  name: redis-namespace
353
345
  requirement: !ruby/object:Gem::Requirement
@@ -700,6 +692,9 @@ files:
700
692
  - app/assets/javascripts/sufia/permissions/registry_entry.es6
701
693
  - app/assets/javascripts/sufia/permissions/user_controls.es6
702
694
  - app/assets/javascripts/sufia/proxy_rights.js
695
+ - app/assets/javascripts/sufia/relationships.js
696
+ - app/assets/javascripts/sufia/relationships/table.es6
697
+ - app/assets/javascripts/sufia/relationships/table_row.es6
703
698
  - app/assets/javascripts/sufia/save_work.es6
704
699
  - app/assets/javascripts/sufia/save_work/checklist_item.es6
705
700
  - app/assets/javascripts/sufia/save_work/deposit_agreement.es6
@@ -709,7 +704,6 @@ files:
709
704
  - app/assets/javascripts/sufia/save_work/visibility_component.es6
710
705
  - app/assets/javascripts/sufia/search.js
711
706
  - app/assets/javascripts/sufia/select_submit.js
712
- - app/assets/javascripts/sufia/single_use_link.js
713
707
  - app/assets/javascripts/sufia/sorting.js
714
708
  - app/assets/javascripts/sufia/tabs.js
715
709
  - app/assets/javascripts/sufia/trophy.js
@@ -1000,6 +994,7 @@ files:
1000
994
  - app/views/curation_concerns/base/_browse_everything.html.erb
1001
995
  - app/views/curation_concerns/base/_citations.html.erb
1002
996
  - app/views/curation_concerns/base/_form.html.erb
997
+ - app/views/curation_concerns/base/_form_child_work_relationships.html.erb
1003
998
  - app/views/curation_concerns/base/_form_files.html.erb
1004
999
  - app/views/curation_concerns/base/_form_metadata.html.erb
1005
1000
  - app/views/curation_concerns/base/_form_progress.html.erb
@@ -1010,6 +1005,10 @@ files:
1010
1005
  - app/views/curation_concerns/base/_items.html.erb
1011
1006
  - app/views/curation_concerns/base/_metadata.html.erb
1012
1007
  - app/views/curation_concerns/base/_relationships.html.erb
1008
+ - app/views/curation_concerns/base/_relationships_member_rows.html.erb
1009
+ - app/views/curation_concerns/base/_relationships_parent_row.html.erb
1010
+ - app/views/curation_concerns/base/_relationships_parent_row_empty.html.erb
1011
+ - app/views/curation_concerns/base/_relationships_parent_rows.html.erb
1013
1012
  - app/views/curation_concerns/base/_share_with.html.erb
1014
1013
  - app/views/curation_concerns/base/_show_actions.html.erb
1015
1014
  - app/views/curation_concerns/base/_social_media.html.erb
@@ -1033,6 +1032,8 @@ files:
1033
1032
  - app/views/curation_concerns/file_sets/_show_actions.html.erb
1034
1033
  - app/views/curation_concerns/file_sets/_show_characterization_details.html.erb
1035
1034
  - app/views/curation_concerns/file_sets/_show_details.html.erb
1035
+ - app/views/curation_concerns/file_sets/_single_use_link_rows.html.erb
1036
+ - app/views/curation_concerns/file_sets/_single_use_links.html.erb
1036
1037
  - app/views/curation_concerns/file_sets/_versioning.html.erb
1037
1038
  - app/views/curation_concerns/file_sets/edit.html.erb
1038
1039
  - app/views/curation_concerns/file_sets/jq_upload.json.jbuilder
@@ -1087,6 +1088,7 @@ files:
1087
1088
  - app/views/records/edit_fields/_based_near.html.erb
1088
1089
  - app/views/records/edit_fields/_default.html.erb
1089
1090
  - app/views/records/edit_fields/_description.html.erb
1091
+ - app/views/records/edit_fields/_in_works_ids.html.erb
1090
1092
  - app/views/records/edit_fields/_language.html.erb
1091
1093
  - app/views/records/edit_fields/_resource_type.html.erb
1092
1094
  - app/views/records/edit_fields/_rights.html.erb
@@ -1336,6 +1338,7 @@ files:
1336
1338
  - spec/forms/sufia/forms/batch_edit_form_spec.rb
1337
1339
  - spec/forms/sufia/forms/batch_upload_form_spec.rb
1338
1340
  - spec/forms/sufia/forms/collection_form_spec.rb
1341
+ - spec/forms/sufia/forms/work_form_spec.rb
1339
1342
  - spec/helpers/batch_edits_helper_spec.rb
1340
1343
  - spec/helpers/blacklight_helper_spec.rb
1341
1344
  - spec/helpers/content_block_helper_spec.rb
@@ -1349,13 +1352,15 @@ files:
1349
1352
  - spec/javascripts/grant_spec.js
1350
1353
  - spec/javascripts/helpers/jasmine-ajax.js
1351
1354
  - spec/javascripts/helpers/jasmine-jquery.js
1355
+ - spec/javascripts/helpers/test_fixtures.js.coffee
1352
1356
  - spec/javascripts/helpers/test_responses.js
1353
1357
  - spec/javascripts/jasmine_spec.rb
1358
+ - spec/javascripts/relationships_table_spec.js.coffee
1354
1359
  - spec/javascripts/save_work_spec.js
1355
- - spec/javascripts/single_use_link_spec.js.coffee
1356
1360
  - spec/javascripts/support/jasmine.yml
1357
1361
  - spec/javascripts/support/jasmine_helper.rb
1358
1362
  - spec/javascripts/tabs_spec.js.coffee
1363
+ - spec/javascripts/uploaded_files_spec.js
1359
1364
  - spec/jobs/attach_files_to_work_job_spec.rb
1360
1365
  - spec/jobs/batch_create_job_spec.rb
1361
1366
  - spec/jobs/content_delete_event_job_spec.rb
@@ -1470,6 +1475,7 @@ files:
1470
1475
  - spec/views/curation_concerns/base/_browse_everything.html.erb_spec.rb
1471
1476
  - spec/views/curation_concerns/base/_citations.html.erb_spec.rb
1472
1477
  - spec/views/curation_concerns/base/_form.html.erb_spec.rb
1478
+ - spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb
1473
1479
  - spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb
1474
1480
  - spec/views/curation_concerns/base/_relationships.html.erb_spec.rb
1475
1481
  - spec/views/curation_concerns/base/edit.html.erb_spec.rb
@@ -1478,6 +1484,7 @@ files:
1478
1484
  - spec/views/curation_concerns/file_sets/_permission_form.html.erb_spec.rb
1479
1485
  - spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
1480
1486
  - spec/views/curation_concerns/file_sets/_show_characterization_details.html.erb_spec.rb
1487
+ - spec/views/curation_concerns/file_sets/_single_use_links.html.erb_spec.rb
1481
1488
  - spec/views/curation_concerns/file_sets/_versioning.html.erb_spec.rb
1482
1489
  - spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
1483
1490
  - spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb
@@ -1486,6 +1493,7 @@ files:
1486
1493
  - spec/views/my/_list_works.html.erb_spec.rb
1487
1494
  - spec/views/my/facet.html.erb_spec.rb
1488
1495
  - spec/views/records/edit_fields/_based_near.html.erb_spec.rb
1496
+ - spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb
1489
1497
  - spec/views/records/edit_fields/_language.html.erb_spec.rb
1490
1498
  - spec/views/records/edit_fields/_subject.html.erb_spec.rb
1491
1499
  - spec/views/stats_file.html.erb_spec.rb
@@ -1641,6 +1649,7 @@ test_files:
1641
1649
  - spec/forms/sufia/forms/batch_edit_form_spec.rb
1642
1650
  - spec/forms/sufia/forms/batch_upload_form_spec.rb
1643
1651
  - spec/forms/sufia/forms/collection_form_spec.rb
1652
+ - spec/forms/sufia/forms/work_form_spec.rb
1644
1653
  - spec/helpers/batch_edits_helper_spec.rb
1645
1654
  - spec/helpers/blacklight_helper_spec.rb
1646
1655
  - spec/helpers/content_block_helper_spec.rb
@@ -1654,13 +1663,15 @@ test_files:
1654
1663
  - spec/javascripts/grant_spec.js
1655
1664
  - spec/javascripts/helpers/jasmine-ajax.js
1656
1665
  - spec/javascripts/helpers/jasmine-jquery.js
1666
+ - spec/javascripts/helpers/test_fixtures.js.coffee
1657
1667
  - spec/javascripts/helpers/test_responses.js
1658
1668
  - spec/javascripts/jasmine_spec.rb
1669
+ - spec/javascripts/relationships_table_spec.js.coffee
1659
1670
  - spec/javascripts/save_work_spec.js
1660
- - spec/javascripts/single_use_link_spec.js.coffee
1661
1671
  - spec/javascripts/support/jasmine.yml
1662
1672
  - spec/javascripts/support/jasmine_helper.rb
1663
1673
  - spec/javascripts/tabs_spec.js.coffee
1674
+ - spec/javascripts/uploaded_files_spec.js
1664
1675
  - spec/jobs/attach_files_to_work_job_spec.rb
1665
1676
  - spec/jobs/batch_create_job_spec.rb
1666
1677
  - spec/jobs/content_delete_event_job_spec.rb
@@ -1775,6 +1786,7 @@ test_files:
1775
1786
  - spec/views/curation_concerns/base/_browse_everything.html.erb_spec.rb
1776
1787
  - spec/views/curation_concerns/base/_citations.html.erb_spec.rb
1777
1788
  - spec/views/curation_concerns/base/_form.html.erb_spec.rb
1789
+ - spec/views/curation_concerns/base/_form_child_work_relationships.html.erb_spec.rb
1778
1790
  - spec/views/curation_concerns/base/_form_progress.html.erb_spec.rb
1779
1791
  - spec/views/curation_concerns/base/_relationships.html.erb_spec.rb
1780
1792
  - spec/views/curation_concerns/base/edit.html.erb_spec.rb
@@ -1783,6 +1795,7 @@ test_files:
1783
1795
  - spec/views/curation_concerns/file_sets/_permission_form.html.erb_spec.rb
1784
1796
  - spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
1785
1797
  - spec/views/curation_concerns/file_sets/_show_characterization_details.html.erb_spec.rb
1798
+ - spec/views/curation_concerns/file_sets/_single_use_links.html.erb_spec.rb
1786
1799
  - spec/views/curation_concerns/file_sets/_versioning.html.erb_spec.rb
1787
1800
  - spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
1788
1801
  - spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb
@@ -1791,6 +1804,7 @@ test_files:
1791
1804
  - spec/views/my/_list_works.html.erb_spec.rb
1792
1805
  - spec/views/my/facet.html.erb_spec.rb
1793
1806
  - spec/views/records/edit_fields/_based_near.html.erb_spec.rb
1807
+ - spec/views/records/edit_fields/_in_works_ids.html.erb_spec.rb
1794
1808
  - spec/views/records/edit_fields/_language.html.erb_spec.rb
1795
1809
  - spec/views/records/edit_fields/_subject.html.erb_spec.rb
1796
1810
  - spec/views/stats_file.html.erb_spec.rb
@@ -1,30 +0,0 @@
1
- function getSingleUse(item, fn) {
2
- var url = $(item).data('generate-single-use-link-url');
3
- if (!url) {
4
- alert("No url was provided for generating a single use link");
5
- return;
6
- }
7
-
8
- $.post(url, null, null, 'text').done(function(data) { fn(data) })
9
- }
10
-
11
- // A Turbolinks-enabled link has been clicked
12
- document.addEventListener("page:before-change", function(){
13
- ZeroClipboard.destroy();
14
- });
15
-
16
- Blacklight.onLoad(function() {
17
- $.each($(".copypaste"), function(idx, item) {
18
- var clip = new ZeroClipboard(this);
19
-
20
- clip.on("dataRequested", function(client, args) {
21
- getSingleUse(item, function(data) {
22
- client.setText(data)
23
- });
24
- });
25
-
26
- clip.on("complete", function(client, args) {
27
- alert("A single use link to " + args.text + " was copied to your clipboard.");
28
- });
29
- });
30
- });
@@ -1,21 +0,0 @@
1
- describe "single use link", ->
2
-
3
- beforeEach ->
4
- # setup two inputs for us to attach auto complete to
5
- setFixtures '<a id="test_link" data-generate-single-use-link-url="/single_use_link/generate_show/abc123" />'
6
- jasmine.Ajax.install();
7
-
8
- # call ajax to get a link
9
- it "calls for the expected link", ->
10
- onSuccess = jasmine.createSpy('onSuccess')
11
- # get the single use link
12
- getSingleUse $('#test_link'), onSuccess
13
-
14
- request = jasmine.Ajax.requests.mostRecent()
15
- request.respondWith(TestResponses.single_use_link.success)
16
-
17
-
18
- # verify the correct request was made
19
- expect(request.url).toBe('/single_use_link/generate_show/abc123')
20
- expect(request.method).toBe('POST')
21
- expect(onSuccess).toHaveBeenCalledWith('http://test.host/single_use_linkabc123')