sufia 4.0.0.rc1 → 4.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +2 -2
- data/Gemfile +9 -17
- data/README.md +18 -9
- data/Rakefile +10 -5
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/jquery.blacklightTagCloud.js +1 -1
- data/app/assets/javascripts/sufia.js +5 -22
- data/app/assets/javascripts/sufia/batch.js +8 -0
- data/app/assets/javascripts/sufia/batch_edit.js +19 -3
- data/app/assets/javascripts/sufia/dashboard_actions.js +23 -10
- data/app/assets/javascripts/sufia/multiForm.js +2 -2
- data/app/assets/javascripts/sufia/permissions.js +10 -9
- data/app/assets/javascripts/sufia/tabs.js +20 -0
- data/app/assets/stylesheets/catalog.css.scss +5 -0
- data/app/assets/stylesheets/collections.css.scss +40 -0
- data/app/assets/stylesheets/file-listing.css.scss +37 -13
- data/app/assets/stylesheets/generic_files.css.erb +5 -0
- data/app/assets/stylesheets/header.css.scss +1 -4
- data/app/assets/stylesheets/settings.css.scss +6 -0
- data/app/assets/stylesheets/styles.css.scss +4 -3
- data/app/assets/stylesheets/sufia-audio-overrides.css +2 -2
- data/app/assets/stylesheets/sufia.css.scss +27 -5
- data/app/assets/stylesheets/tagcloud.css +5 -1
- data/app/controllers/batch_controller.rb +3 -3
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +14 -1
- data/app/controllers/concerns/sufia/catalog.rb +0 -1
- data/app/controllers/concerns/sufia/controller.rb +5 -0
- data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +2 -9
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +3 -3
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +5 -1
- data/app/controllers/concerns/sufia/homepage_controller.rb +1 -1
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +3 -2
- data/app/helpers/batch_edits_helper.rb +6 -0
- data/app/helpers/generic_file_helper.rb +15 -0
- data/app/helpers/sufia/blacklight_override.rb +19 -3
- data/app/helpers/sufia/dashboard_helper_behavior.rb +25 -3
- data/app/helpers/sufia/records_helper_behavior.rb +13 -5
- data/app/helpers/sufia/sufia_helper_behavior.rb +15 -12
- data/app/models/concerns/sufia/solr_document_behavior.rb +5 -36
- data/app/views/_masthead.html.erb +1 -1
- data/app/views/_user_util_links.html.erb +6 -4
- data/app/views/advanced/_advanced_search_fields.html.erb +4 -4
- data/app/views/advanced/_advanced_search_form.html.erb +14 -17
- data/app/views/advanced/index.html.erb +3 -3
- data/app/views/batch/_metadata.html.erb +22 -24
- data/app/views/batch/_more_metadata.html.erb +1 -1
- data/app/views/batch/edit.html.erb +2 -2
- data/app/views/batch_edits/_check_all.html.erb +7 -9
- data/app/views/batch_edits/_delete_selected.html.erb +1 -0
- data/app/views/batch_edits/edit.html.erb +25 -26
- data/app/views/batch_edits/update_edit.js.erb +1 -1
- data/app/views/catalog/_facet_limit.html.erb +4 -12
- data/app/views/catalog/_search_form.html.erb +8 -13
- data/app/views/collections/_action_menu.html.erb +2 -2
- data/app/views/collections/_collection.html.erb +10 -31
- data/app/views/collections/_document_list.html.erb +1 -1
- data/app/views/collections/_edit_actions.html.erb +2 -2
- data/app/views/collections/_edit_descriptions.html.erb +3 -5
- data/app/views/collections/_form.html.erb +8 -10
- data/app/views/collections/_media_display.html.erb +1 -1
- data/app/views/collections/_show_actions.html.erb +5 -5
- data/app/views/collections/_show_descriptions.html.erb +13 -8
- data/app/views/collections/_show_document_list.html.erb +17 -0
- data/app/views/collections/_show_document_list_menu.html.erb +24 -0
- data/app/views/collections/_show_document_list_row.html.erb +63 -0
- data/app/views/collections/edit.html.erb +2 -2
- data/app/views/collections/show.html.erb +28 -19
- data/app/views/contact_form/new.html.erb +21 -29
- data/app/views/dashboard/_index_partials/_contents.html.erb +14 -0
- data/app/views/dashboard/_index_partials/_heading_actions.html.erb +18 -0
- data/app/views/dashboard/_index_partials/_heading_greetings.html.erb +8 -0
- data/app/views/dashboard/_index_partials/_stats.html.erb +6 -2
- data/app/views/dashboard/index.html.erb +5 -37
- data/app/views/generic_files/_breadcrumbs.html.erb +2 -0
- data/app/views/generic_files/_browse_everything.html.erb +2 -2
- data/app/views/generic_files/_descriptions.html.erb +4 -6
- data/app/views/generic_files/_field_form.html.erb +2 -2
- data/app/views/generic_files/_generic_file.html.erb +8 -29
- data/app/views/generic_files/_groups_description.html.erb +5 -4
- data/app/views/generic_files/_permission.html.erb +2 -2
- data/app/views/generic_files/_permission_form.html.erb +62 -77
- data/app/views/generic_files/_rights_modal.html.erb +0 -2
- data/app/views/generic_files/_share_with.html.erb +14 -0
- data/app/views/generic_files/_show_actions.html.erb +1 -1
- data/app/views/generic_files/_show_collections.html.erb +17 -0
- data/app/views/generic_files/_show_descriptions.html.erb +2 -2
- data/app/views/generic_files/_versioning.html.erb +2 -2
- data/app/views/generic_files/_visibility.html.erb +17 -0
- data/app/views/generic_files/show.html.erb +39 -2
- data/app/views/generic_files/stats.html.erb +1 -1
- data/app/views/generic_files/upload/_form_fields.html.erb +2 -2
- data/app/views/generic_files/upload/_local_file_import_chooser.html.erb +1 -1
- data/app/views/generic_files/upload/_script_templates.html.erb +2 -2
- data/app/views/generic_files/upload/_tos_checkbox.html.erb +3 -3
- data/app/views/homepage/_home_content.html.erb +0 -9
- data/app/views/homepage/_home_header.html.erb +1 -1
- data/app/views/homepage/_recent_document.html.erb +2 -2
- data/app/views/layouts/_head_tag_content.html.erb +7 -1
- data/app/views/layouts/sufia-dashboard.html.erb +4 -2
- data/app/views/layouts/sufia-one-column.html.erb +1 -1
- data/app/views/my/_action_menu.html.erb +1 -1
- data/app/views/my/_collection_action_menu.html.erb +3 -3
- data/app/views/my/_constraints.html.erb +11 -0
- data/app/views/my/_document_list.html.erb +1 -1
- data/app/views/my/_facet_limit.html.erb +4 -12
- data/app/views/my/_facets.html.erb +1 -3
- data/app/views/my/_index_partials/_default_group.html.erb +2 -3
- data/app/views/my/_index_partials/_list_collections.html.erb +17 -11
- data/app/views/my/_index_partials/_list_files.html.erb +20 -24
- data/app/views/my/_search_header.html.erb +5 -0
- data/app/views/my/_sort_and_per_page.html.erb +11 -7
- data/app/views/my/index.html.erb +9 -15
- data/app/views/records/_edit_field.html.erb +14 -10
- data/app/views/records/edit_fields/_default.html.erb +6 -0
- data/app/views/records/edit_fields/_description.html.erb +3 -7
- data/app/views/records/edit_fields/_resource_type.html.erb +4 -6
- data/app/views/records/edit_fields/_rights.html.erb +4 -5
- data/app/views/records/edit_fields/_suffix.html.erb +6 -3
- data/app/views/records/edit_fields/_type.html.erb +7 -12
- data/app/views/{generic_files → records}/show_fields/_based_near.html.erb +1 -1
- data/app/views/{generic_files → records}/show_fields/_contributor.html.erb +2 -2
- data/app/views/records/show_fields/_creator.html.erb +6 -0
- data/app/views/{generic_files → records}/show_fields/_date_created.html.erb +1 -1
- data/app/views/records/show_fields/_default.html.erb +6 -0
- data/app/views/records/show_fields/_description.html.erb +6 -0
- data/app/views/records/show_fields/_identifier.html.erb +4 -0
- data/app/views/{generic_files → records}/show_fields/_language.html.erb +1 -1
- data/app/views/{generic_files → records}/show_fields/_publisher.html.erb +1 -1
- data/app/views/records/show_fields/_related_url.html.erb +6 -0
- data/app/views/{generic_files → records}/show_fields/_resource_type.html.erb +1 -1
- data/app/views/{generic_files → records}/show_fields/_rights.html.erb +1 -1
- data/app/views/{generic_files → records}/show_fields/_subject.html.erb +1 -1
- data/app/views/{generic_files → records}/show_fields/_tag.html.erb +1 -1
- data/app/views/records/show_fields/_title.html.erb +6 -0
- data/app/views/shared/_attributes.html.erb +27 -0
- data/app/views/static/agreement.html.erb +1 -1
- data/app/views/users/_activity_log.html.erb +0 -2
- data/app/views/users/_follower_modal.html.erb +27 -23
- data/app/views/users/_following_modal.html.erb +27 -23
- data/app/views/users/_social_media_info.html.erb +4 -4
- data/app/views/users/_trophy_edit.html.erb +5 -7
- data/app/views/users/_user_info.html.erb +3 -3
- data/app/views/users/_user_util_links_extra.html.erb +4 -0
- data/app/views/users/edit.html.erb +28 -33
- data/app/views/users/index.html.erb +1 -1
- data/app/views/users/show.html.erb +0 -4
- data/config/jetty.yml +1 -1
- data/config/locales/sufia.en.yml +53 -12
- data/lib/generators/sufia/install_generator.rb +89 -0
- data/lib/generators/sufia/templates/catalog_controller.rb +1 -1
- data/lib/generators/sufia/upgrade400_generator.rb +4 -0
- data/lib/sufia.rb +1 -10
- data/lib/sufia/version.rb +1 -1
- data/solr_conf/conf/solrconfig.xml +31 -17
- data/spec/actors/generic_file/actor_spec.rb +17 -0
- data/spec/controllers/batch_controller_spec.rb +2 -2
- data/spec/controllers/batch_edits_controller_spec.rb +24 -19
- data/spec/controllers/catalog_controller_spec.rb +23 -12
- data/spec/controllers/collections_controller_spec.rb +19 -17
- data/spec/controllers/dashboard_controller_spec.rb +5 -19
- data/spec/controllers/generic_files_controller_spec.rb +35 -20
- data/spec/controllers/homepage_controller_spec.rb +25 -2
- data/spec/controllers/users_controller_spec.rb +99 -102
- data/spec/factories/generic_files.rb +2 -2
- data/spec/factories/users.rb +32 -2
- data/spec/features/browse_dashboard_files_spec.rb +14 -2
- data/spec/features/browse_files_spec.rb +5 -1
- data/spec/features/catalog_search_spec.rb +7 -6
- data/spec/features/collection_spec.rb +43 -33
- data/spec/features/display_dashboard_spec.rb +25 -22
- data/spec/features/notifications_spec.rb +9 -4
- data/spec/features/users_spec.rb +34 -25
- data/spec/fixtures/1.5mb-avatar.jpg +0 -0
- data/spec/helpers/batch_edits_helper_spec.rb +38 -0
- data/spec/helpers/dashboard_helper_spec.rb +16 -5
- data/spec/helpers/generic_file_helper_spec.rb +41 -0
- data/spec/helpers/records_helper_spec.rb +12 -0
- data/spec/jobs/active_fedora_pid_based_job_spec.rb +1 -1
- data/spec/jobs/audit_job_spec.rb +2 -3
- data/spec/jobs/batch_update_job_spec.rb +39 -24
- data/spec/jobs/event_jobs_spec.rb +1 -1
- data/spec/lib/sufia/id_service_spec.rb +25 -7
- data/spec/lib/sufia/messages_spec.rb +60 -0
- data/spec/lib/sufia/readable_permissions_spec.rb +56 -0
- data/spec/lib/sufia/writable_permissions_spec.rb +20 -0
- data/spec/models/batch_spec.rb +1 -1
- data/spec/models/collection_spec.rb +24 -2
- data/spec/models/featured_work_spec.rb +2 -2
- data/spec/models/file_content_datastream_spec.rb +5 -5
- data/spec/models/generic_file_spec.rb +149 -133
- data/spec/models/local_authority_spec.rb +1 -1
- data/spec/models/user_spec.rb +33 -6
- data/spec/spec_helper.rb +7 -10
- data/spec/{support → test_app_templates}/lib/generators/test_app_generator.rb +11 -6
- data/spec/views/batch/edit.html.erb_spec.rb +8 -2
- data/spec/views/catalog/index.html.erb_spec.rb +34 -0
- data/spec/views/catalog/{sort_and_per_pange.html.erb_spec.rb → sort_and_per_page.html.erb_spec.rb} +0 -0
- data/spec/views/collections/_form.html.erb_spec.rb +32 -0
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +25 -0
- data/spec/views/dashboard/index_spec.rb +33 -4
- data/spec/views/generic_file/_breadcrumbs.html.erb_spec.rb +32 -0
- data/spec/views/generic_file/show.html.erb_spec.rb +273 -8
- data/spec/views/users/_user_util_links.html.erb_spec.rb +25 -0
- data/sufia-models/app/actors/sufia/generic_file/actor.rb +14 -5
- data/sufia-models/{lib/sufia/models → app}/jobs/active_fedora_pid_based_job.rb +0 -0
- data/sufia-models/{lib/sufia/models → app}/jobs/audit_job.rb +4 -10
- data/sufia-models/{lib/sufia/models → app}/jobs/batch_update_job.rb +22 -18
- data/sufia-models/{lib/sufia/models → app}/jobs/characterize_job.rb +0 -0
- data/sufia-models/{lib/sufia/models → app}/jobs/create_derivatives_job.rb +0 -0
- data/sufia-models/{lib/sufia/models → app}/jobs/import_url_job.rb +0 -0
- data/sufia-models/{lib/sufia/models → app}/jobs/resolrize_job.rb +0 -0
- data/sufia-models/app/models/collection.rb +1 -39
- data/sufia-models/{lib → app/models/concerns}/sufia/ability.rb +0 -0
- data/sufia-models/app/models/concerns/sufia/collection.rb +55 -0
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +5 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/audit.rb +1 -2
- data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +4 -2
- data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +27 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +1 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +2 -49
- data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/model_methods.rb +0 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +8 -1
- data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
- data/sufia-models/app/services/sufia/noid.rb +9 -0
- data/sufia-models/config/locales/sufia.en.yml +1 -0
- data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +27 -0
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +7 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +5 -5
- data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +177 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +3 -1
- data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +7 -0
- data/sufia-models/lib/sufia/messages.rb +67 -0
- data/sufia-models/lib/sufia/models.rb +2 -0
- data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -6
- data/sufia-models/lib/sufia/models/engine.rb +1 -3
- data/sufia-models/lib/sufia/models/resque.rb +1 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/lib/sufia/permissions.rb +9 -0
- data/sufia-models/lib/sufia/permissions/readable.rb +20 -0
- data/sufia-models/lib/sufia/permissions/writable.rb +56 -0
- data/sufia-models/lib/tasks/sufia-models_tasks.rake +58 -2
- data/sufia-models/sufia-models.gemspec +11 -11
- data/sufia.gemspec +19 -9
- data/tasks/jetty.rake +6 -5
- data/tasks/sufia-dev.rake +4 -77
- metadata +235 -72
- data/app/assets/images/folder.png +0 -0
- data/app/views/collections/show_fields/_creator.html.erb +0 -11
- data/app/views/collections/show_fields/_description.html.erb +0 -8
- data/app/views/collections/show_fields/_title.html.erb +0 -8
- data/app/views/generic_files/edit_fields/_default.html.erb +0 -6
- data/app/views/generic_files/edit_fields/_description.html.erb +0 -5
- data/app/views/generic_files/edit_fields/_resource_type.html.erb +0 -6
- data/app/views/generic_files/edit_fields/_rights.html.erb +0 -6
- data/app/views/generic_files/edit_fields/_suffix.html.erb +0 -9
- data/app/views/generic_files/show_fields/_creator.html.erb +0 -7
- data/app/views/generic_files/show_fields/_default.html.erb +0 -6
- data/app/views/generic_files/show_fields/_description.html.erb +0 -7
- data/app/views/generic_files/show_fields/_identifier.html.erb +0 -4
- data/app/views/generic_files/show_fields/_related_url.html.erb +0 -6
- data/app/views/generic_files/show_fields/_title.html.erb +0 -7
- data/lib/generators/sufia/sufia_generator.rb +0 -89
- data/spec/active_fedora/unsaved_digital_object_spec.rb +0 -35
@@ -2,22 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'catalog searching' do
|
4
4
|
|
5
|
-
before
|
6
|
-
@gf1 =
|
7
|
-
f.title = 'title 1'
|
5
|
+
before(:all) do
|
6
|
+
@gf1 = GenericFile.new.tap do |f|
|
7
|
+
f.title = ['title 1']
|
8
8
|
f.tag = ["tag1", "tag2"]
|
9
9
|
f.apply_depositor_metadata('jilluser')
|
10
10
|
f.read_groups = ['public']
|
11
11
|
f.save!
|
12
12
|
end
|
13
|
-
@gf2 =
|
14
|
-
f.title = 'title 2'
|
13
|
+
@gf2 = GenericFile.new.tap do |f|
|
14
|
+
f.title = ['title 2']
|
15
15
|
f.tag = ["tag2", "tag3"]
|
16
16
|
f.apply_depositor_metadata('jilluser')
|
17
17
|
f.read_groups = ['public']
|
18
18
|
f.save!
|
19
19
|
end
|
20
|
-
@col =
|
20
|
+
@col = Collection.new.tap do |f|
|
21
21
|
f.title = 'title 3'
|
22
22
|
f.tag = ["tag3", "tag4"]
|
23
23
|
f.apply_depositor_metadata('jilluser')
|
@@ -33,6 +33,7 @@ describe 'catalog searching' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
before do
|
36
|
+
allow(User).to receive(:find_by_user_key).and_return(stub_model(User, twitter_handle: 'bob'))
|
36
37
|
sign_in :user
|
37
38
|
visit '/'
|
38
39
|
end
|
@@ -6,7 +6,7 @@ describe 'collection' do
|
|
6
6
|
first('#hydra-collection-add').click
|
7
7
|
expect(page).to have_content 'Create New Collection'
|
8
8
|
fill_in('Title', with: title)
|
9
|
-
fill_in('
|
9
|
+
fill_in('Abstract or Summary', with: description)
|
10
10
|
click_button("Create Collection")
|
11
11
|
expect(page).to have_content 'Items in this Collection'
|
12
12
|
expect(page).to have_content title
|
@@ -28,7 +28,7 @@ describe 'collection' do
|
|
28
28
|
@gfs = []
|
29
29
|
(0..12).each do |x|
|
30
30
|
@gfs[x] = GenericFile.new.tap do |f|
|
31
|
-
f.title = "title #{x}"
|
31
|
+
f.title = ["title #{x}"]
|
32
32
|
f.apply_depositor_metadata('archivist1@example.com')
|
33
33
|
f.save!
|
34
34
|
end
|
@@ -57,7 +57,9 @@ describe 'collection' do
|
|
57
57
|
# since there is only one collection, it's not necessary to choose a radio button
|
58
58
|
click_button "Update Collection"
|
59
59
|
expect(page).to have_content "Items in this Collection"
|
60
|
-
|
60
|
+
# There are two rows in the table per document (one for the general info, one for the details)
|
61
|
+
# Make sure we have at least 9 documents (18 table rows)
|
62
|
+
expect(page).to have_selector "table.table-zebra-striped tr:nth-child(18)"
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -93,18 +95,21 @@ describe 'collection' do
|
|
93
95
|
end
|
94
96
|
|
95
97
|
it "should show a collection with a listing of Descriptive Metadata and catalog-style search results" do
|
96
|
-
page.
|
98
|
+
expect(page).to have_content(@collection.title)
|
97
99
|
within('#document_'+@collection.noid) do
|
98
100
|
click_link("collection title")
|
99
101
|
end
|
100
|
-
page.
|
101
|
-
page.
|
102
|
+
expect(page).to have_content(@collection.title)
|
103
|
+
expect(page).to have_content(@collection.description)
|
104
|
+
# Should not show title and description a second time
|
105
|
+
expect(page).to_not have_css('.metadata-collections', text: @collection.title)
|
106
|
+
expect(page).to_not have_css('.metadata-collections', text: @collection.description)
|
102
107
|
# Should not have Collection Descriptive metadata table
|
103
|
-
page.
|
108
|
+
expect(page).to have_content("Descriptions")
|
104
109
|
# Should have search results / contents listing
|
105
|
-
page.
|
106
|
-
page.
|
107
|
-
page.
|
110
|
+
expect(page).to have_content(@gf1.title.first)
|
111
|
+
expect(page).to have_content(@gf2.title.first)
|
112
|
+
expect(page).to_not have_css(".pager")
|
108
113
|
|
109
114
|
click_link "Gallery"
|
110
115
|
expect(page).to have_content(@gf1.title.first)
|
@@ -112,25 +117,26 @@ describe 'collection' do
|
|
112
117
|
end
|
113
118
|
|
114
119
|
it "should hide collection descriptive metadata when searching a collection" do
|
115
|
-
|
120
|
+
# URL: /dashboard/collections
|
121
|
+
expect(page).to have_content(@collection.title)
|
116
122
|
within("#document_#{@collection.noid}") do
|
117
123
|
click_link("collection title")
|
118
124
|
end
|
119
|
-
|
120
|
-
page.
|
121
|
-
page.
|
122
|
-
page.
|
125
|
+
# URL: /collections/collection-id
|
126
|
+
expect(page).to have_content(@collection.title)
|
127
|
+
expect(page).to have_content(@collection.description)
|
128
|
+
expect(page).to have_content(@gf1.title.first)
|
129
|
+
expect(page).to have_content(@gf2.title.first)
|
123
130
|
fill_in('collection_search', with: @gf1.title.first)
|
124
131
|
click_button('collection_submit')
|
125
|
-
# Should not have Collection
|
126
|
-
page.
|
127
|
-
page.
|
128
|
-
page.
|
132
|
+
# Should not have Collection metadata table (only title and description)
|
133
|
+
expect(page).to_not have_content("Total Items")
|
134
|
+
expect(page).to have_content(@collection.title)
|
135
|
+
expect(page).to have_content(@collection.description)
|
129
136
|
# Should have search results / contents listing
|
130
|
-
page.
|
131
|
-
page.
|
132
|
-
|
133
|
-
page.should_not have_content("Visibility")
|
137
|
+
expect(page).to have_content("Search Results")
|
138
|
+
expect(page).to have_content(@gf1.title.first)
|
139
|
+
expect(page).to_not have_content(@gf2.title.first)
|
134
140
|
end
|
135
141
|
end
|
136
142
|
|
@@ -146,27 +152,31 @@ describe 'collection' do
|
|
146
152
|
end
|
147
153
|
|
148
154
|
it "should edit and update collection metadata" do
|
149
|
-
|
155
|
+
# URL: /dashboard/collections
|
156
|
+
expect(page).to have_content(@collection.title)
|
150
157
|
within("#document_#{@collection.noid}") do
|
151
158
|
find('button.dropdown-toggle').click
|
152
159
|
click_link('Edit Collection')
|
153
160
|
end
|
154
|
-
|
155
|
-
page.
|
161
|
+
# URL: /collections/collection-id/edit
|
162
|
+
expect(page).to have_field('collection_title', with: @collection.title)
|
163
|
+
expect(page).to have_field('collection_description', with: @collection.description)
|
156
164
|
new_title = "Altered Title"
|
157
165
|
new_description = "Completely new Description text."
|
158
166
|
creators = ["Dorje Trollo", "Vajrayogini"]
|
159
167
|
fill_in('Title', with: new_title)
|
160
|
-
fill_in('
|
168
|
+
fill_in('Abstract or Summary', with: new_description)
|
161
169
|
fill_in('Creator', with: creators.first)
|
162
|
-
within('.
|
170
|
+
within('.primary-actions') do
|
163
171
|
click_button('Update Collection')
|
164
172
|
end
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
173
|
+
# URL: /collections/collection-id
|
174
|
+
header = find('header')
|
175
|
+
expect(header).to_not have_content(@collection.title)
|
176
|
+
expect(header).to_not have_content(@collection.description)
|
177
|
+
expect(header).to have_content(new_title)
|
178
|
+
expect(header).to have_content(new_description)
|
179
|
+
expect(page).to have_content(creators.first)
|
170
180
|
end
|
171
181
|
|
172
182
|
it "should remove a file from a collection" do
|
@@ -1,35 +1,38 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "The Dashboard" do
|
4
4
|
|
5
5
|
before do
|
6
6
|
sign_in :user_with_fixtures
|
7
|
-
visit "/dashboard"
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
page.should have_content "My Dashboard"
|
12
|
-
page.should have_content "User Activity"
|
13
|
-
page.should have_content "User Notifications"
|
14
|
-
page.should have_content "Your Statistics"
|
15
|
-
end
|
9
|
+
context "upon sign-in" do
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
it "should show the user's information" do
|
12
|
+
page.should have_content "My Dashboard"
|
13
|
+
page.should have_content "User Activity"
|
14
|
+
page.should have_content "User Notifications"
|
15
|
+
page.should have_content "Your Statistics"
|
16
|
+
end
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
it "should let the user upload files" do
|
19
|
+
click_link "Upload"
|
20
|
+
page.should have_content "Upload"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should let the user create collections" do
|
24
|
+
click_link "Create Collection"
|
25
|
+
page.should have_content "Create New Collection"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should let the user view files" do
|
29
|
+
click_link "View Files"
|
30
|
+
page.should have_content "My Files"
|
31
|
+
page.should have_content "My Collections"
|
32
|
+
page.should have_content "My Highlights"
|
33
|
+
page.should have_content "Files Shared with Me"
|
34
|
+
end
|
26
35
|
|
27
|
-
it "should let the user view files" do
|
28
|
-
click_link "View Files"
|
29
|
-
page.should have_content "Files"
|
30
|
-
page.should have_content "Collections"
|
31
|
-
page.should have_content "Highlighted"
|
32
|
-
page.should have_content "Shared with Me"
|
33
36
|
end
|
34
37
|
|
35
38
|
end
|
@@ -4,17 +4,22 @@ describe "Notifications page" do
|
|
4
4
|
|
5
5
|
before do
|
6
6
|
sign_in FactoryGirl.create(:user_with_mail)
|
7
|
+
visit "/notifications"
|
7
8
|
end
|
8
9
|
|
9
10
|
it "should list notifications with date, subject and message" do
|
10
|
-
visit "/notifications"
|
11
11
|
page.should have_content "User Notifications"
|
12
12
|
page.find(:xpath, '//thead/tr').should have_content "Date"
|
13
13
|
page.find(:xpath, '//thead/tr').should have_content "Subject"
|
14
14
|
page.find(:xpath, '//thead/tr').should have_content "Message"
|
15
|
-
page.should have_content "
|
16
|
-
page.should have_content "
|
17
|
-
page.should have_content "You
|
15
|
+
page.should have_content "These files could not be updated. You do not have sufficient privileges to edit them. "
|
16
|
+
page.should have_content "These files have been saved"
|
17
|
+
page.should have_content "File 1 could not be updated. You do not have sufficient privileges to edit it."
|
18
|
+
page.should have_content "File 1 has been saved"
|
19
|
+
page.should have_content "Batch upload permission denied "
|
20
|
+
page.should have_content "Batch upload complete"
|
18
21
|
end
|
19
22
|
|
23
|
+
|
24
|
+
|
20
25
|
end
|
data/spec/features/users_spec.rb
CHANGED
@@ -1,41 +1,50 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
|
3
4
|
describe "User Profile" do
|
4
5
|
|
5
6
|
before do
|
6
7
|
sign_in FactoryGirl.create(:curator)
|
7
8
|
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
context 'when visiting user profile' do
|
11
|
+
it 'should render page properly' do
|
12
|
+
visit '/users/curator1@example-dot-com'
|
13
|
+
expect(page).to have_content('curator1@example.com')
|
14
|
+
expect(page).to have_content('Edit Your Profile')
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
page.should have_content "Your profile has been updated"
|
21
|
-
page.should have_content "curatorOfData"
|
18
|
+
context 'when clicking all users' do
|
19
|
+
it 'should display all users' do
|
20
|
+
visit '/users/curator1@example-dot-com'
|
21
|
+
click_link 'View Users'
|
22
|
+
expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
context 'when visiting user profile' do
|
27
|
+
it 'page should be editable' do
|
28
|
+
visit '/users/curator1@example-dot-com'
|
29
|
+
click_link 'Edit Your Profile'
|
30
|
+
fill_in 'user_twitter_handle', with: 'curatorOfData'
|
31
|
+
click_button 'Save Profile'
|
32
|
+
expect(page).to have_content 'Your profile has been updated'
|
33
|
+
expect(page).to have_content 'curatorOfData'
|
34
|
+
end
|
28
35
|
end
|
29
36
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
context 'user profile' do
|
38
|
+
it 'should be searchable' do
|
39
|
+
@archivist = FactoryGirl.find_or_create(:archivist)
|
40
|
+
visit '/users/curator1@example-dot-com'
|
41
|
+
click_link 'View Users'
|
42
|
+
expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
|
43
|
+
expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
|
44
|
+
fill_in 'user_search', with: 'archivist1@example.com'
|
45
|
+
click_button "user_submit"
|
46
|
+
expect(page).to_not have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
|
47
|
+
expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
Binary file
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BatchEditsHelper do
|
4
|
+
|
5
|
+
describe "#render_check_all" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@document_list = ["doc1", "doc2"]
|
9
|
+
@batch_size_on_other_page = 1
|
10
|
+
@max_batch_size = 10
|
11
|
+
end
|
12
|
+
|
13
|
+
context "with my files" do
|
14
|
+
it "should show the check all dropdown" do
|
15
|
+
allow(helper).to receive(:params).and_return({ controller: "my/files" })
|
16
|
+
allow(helper).to receive(:controller_name).and_return("batch_edits")
|
17
|
+
expect(helper.render_check_all).to have_css("span.glyphicon-cog")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with my collections" do
|
22
|
+
it "should not show the check all dropdown" do
|
23
|
+
allow(helper).to receive(:params).and_return({ controller: "my/collections" })
|
24
|
+
expect(helper.render_check_all).to be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "with select all disabled" do
|
29
|
+
it "should not show the check all dropdown" do
|
30
|
+
allow(helper).to receive(:params).and_return({ controller: "foo" })
|
31
|
+
assign(:disable_select_all, true)
|
32
|
+
expect(helper.render_check_all).to be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -23,18 +23,29 @@ describe DashboardHelper do
|
|
23
23
|
describe "#on_the_dashboard?" do
|
24
24
|
it "should return false for controllers that aren't a part of the dashboard" do
|
25
25
|
allow(helper).to receive(:params).and_return({ controller: "foo" })
|
26
|
-
expect(helper
|
26
|
+
expect(helper).to_not be_on_the_dashboard
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should return true for controllers that are part of the dashboard" do
|
30
30
|
allow(helper).to receive(:params).and_return({ controller: "my/files" })
|
31
|
-
expect(helper
|
31
|
+
expect(helper).to be_on_the_dashboard
|
32
32
|
allow(helper).to receive(:params).and_return({ controller: "my/collections" })
|
33
|
-
expect(helper
|
33
|
+
expect(helper).to be_on_the_dashboard
|
34
34
|
allow(helper).to receive(:params).and_return({ controller: "my/highlights" })
|
35
|
-
expect(helper
|
35
|
+
expect(helper).to be_on_the_dashboard
|
36
36
|
allow(helper).to receive(:params).and_return({ controller: "my/shares" })
|
37
|
-
expect(helper
|
37
|
+
expect(helper).to be_on_the_dashboard
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#on_my_files" do
|
42
|
+
it "should return false when the controller isn't my files" do
|
43
|
+
allow(helper).to receive(:params).and_return({ controller: "my/collections" })
|
44
|
+
expect(helper).to_not be_on_my_files
|
45
|
+
end
|
46
|
+
it "should return true when the controller is my files" do
|
47
|
+
allow(helper).to receive(:params).and_return({ controller: "my/files" })
|
48
|
+
expect(helper).to be_on_my_files
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GenericFileHelper do
|
4
|
+
|
5
|
+
describe "#render_collection_list" do
|
6
|
+
|
7
|
+
context "using a file that is part of a collection" do
|
8
|
+
|
9
|
+
let(:collection) do
|
10
|
+
mock_model(Collection, title: "Foo Collection")
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:gf) do
|
14
|
+
mock_model(GenericFile, { collections: [collection, collection] })
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:link) do
|
18
|
+
"<a href=\"/collections/#{collection.id}\">#{collection.title}</a>"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should display a comma-delimited list of collections" do
|
22
|
+
expect(helper.render_collection_list(gf)).to eq("Is part of: " + [link,link].join(", "))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
context "using a file that is not part of a collection" do
|
28
|
+
|
29
|
+
let(:gf) do
|
30
|
+
mock_model(GenericFile, { collections: [] })
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should render nothing" do
|
34
|
+
expect(helper.render_collection_list(gf)).to be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|