sufia 6.0.0.rc2 → 6.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -5
- data/History.md +14 -0
- data/LICENSE +15 -0
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia/batch_edit.js +1 -1
- data/app/assets/javascripts/sufia/permissions.js +8 -12
- data/app/assets/stylesheets/sufia.css.scss +1 -1
- data/app/assets/stylesheets/sufia/_multi_value_fields.css.scss +67 -0
- data/app/assets/stylesheets/sufia/_settings.scss +1 -0
- data/app/assets/stylesheets/sufia/_styles.scss +4 -0
- data/app/assets/stylesheets/sufia/_tinymce.scss +14 -0
- data/app/controllers/batch_controller.rb +11 -2
- data/app/controllers/concerns/sufia/breadcrumbs.rb +2 -3
- data/app/controllers/concerns/sufia/collections_controller_behavior.rb +0 -1
- data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +1 -2
- data/app/controllers/concerns/sufia/controller.rb +1 -7
- data/app/controllers/concerns/sufia/downloads_controller_behavior.rb +3 -8
- data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +2 -3
- data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -2
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +27 -14
- data/app/controllers/concerns/sufia/homepage_controller.rb +3 -2
- data/app/controllers/content_blocks_controller.rb +17 -1
- data/app/controllers/downloads_controller.rb +0 -1
- data/app/controllers/my/shares_controller.rb +1 -0
- data/app/controllers/single_use_links_controller.rb +0 -1
- data/app/controllers/single_use_links_viewer_controller.rb +3 -8
- data/app/forms/sufia/forms/generic_file_edit_form.rb +1 -8
- data/app/helpers/content_block_helper.rb +30 -10
- data/app/helpers/generic_file_helper.rb +4 -4
- data/app/helpers/sufia/dashboard_helper_behavior.rb +2 -2
- data/app/helpers/sufia/sufia_helper_behavior.rb +4 -4
- data/app/helpers/trophy_helper.rb +3 -3
- data/app/jobs/content_delete_event_job.rb +1 -2
- data/app/jobs/content_deposit_event_job.rb +1 -1
- data/app/jobs/content_depositor_change_event_job.rb +1 -1
- data/app/jobs/content_new_version_event_job.rb +1 -1
- data/app/jobs/content_restored_version_event_job.rb +1 -1
- data/app/jobs/content_update_event_job.rb +1 -1
- data/app/models/concerns/sufia/solr_document_behavior.rb +5 -9
- data/app/models/content_block.rb +20 -0
- data/app/models/featured_work_list.rb +4 -0
- data/app/presenters/sufia/collection_presenter.rb +14 -2
- data/app/presenters/sufia/generic_file_presenter.rb +16 -0
- data/app/presenters/sufia/version_list_presenter.rb +1 -1
- data/app/views/batch/_metadata.html.erb +4 -4
- data/app/views/batch_edits/edit.html.erb +1 -1
- data/app/views/collections/_action_menu.html.erb +4 -5
- data/app/views/collections/_show_descriptions.html.erb +1 -5
- data/app/views/collections/_show_document_list.html.erb +0 -2
- data/app/views/collections/_show_document_list_menu.html.erb +5 -6
- data/app/views/collections/_show_document_list_row.html.erb +9 -9
- data/app/views/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/collections/_view_type_group.html.erb +1 -1
- data/app/views/collections/show.html.erb +3 -3
- data/app/views/generic_files/_asset_permissions_denial_flash.html.erb +1 -1
- data/app/views/generic_files/_asset_saved_flash.html.erb +1 -1
- data/app/views/generic_files/_asset_updated_flash.html.erb +1 -1
- data/app/views/generic_files/_browse_everything.html.erb +4 -4
- data/app/views/generic_files/_media_display.html.erb +9 -9
- data/app/views/generic_files/_permission_form.html.erb +1 -1
- data/app/views/generic_files/_show_actions.html.erb +1 -1
- data/app/views/generic_files/_show_collections.html.erb +2 -2
- data/app/views/generic_files/_show_details.html.erb +1 -1
- data/app/views/generic_files/_versioning.html.erb +9 -5
- data/app/views/generic_files/jq_upload.json.jbuilder +1 -1
- data/app/views/generic_files/new.html.erb +2 -3
- data/app/views/generic_files/show.html.erb +13 -16
- data/app/views/generic_files/upload/_alerts.html.erb +2 -2
- data/app/views/generic_files/upload/_form_fields.html.erb +1 -1
- 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/homepage/_featured.html.erb +2 -4
- data/app/views/homepage/_featured_researcher.html.erb +1 -1
- data/app/views/homepage/_featured_works.html.erb +5 -3
- data/app/views/homepage/_home_content.html.erb +1 -1
- data/app/views/homepage/_recent_document.html.erb +2 -2
- data/app/views/homepage/_sortable_featured.html.erb +1 -2
- data/app/views/my/_action_menu.html.erb +8 -8
- data/app/views/my/_collection_action_menu.html.erb +4 -4
- data/app/views/my/_index_partials/_list_collections.html.erb +9 -12
- data/app/views/my/_index_partials/_list_files.html.erb +9 -9
- data/app/views/my/index.html.erb +0 -1
- data/app/views/records/_rights_modal.html.erb +1 -0
- data/app/views/users/_contributions.html.erb +2 -3
- data/app/views/users/_edit_primary.html.erb +68 -0
- data/app/views/users/_edit_secondary.html.erb +1 -0
- data/app/views/users/_trophy_edit.html.erb +1 -3
- data/app/views/users/edit.html.erb +4 -78
- data/config/initializers/simple_form.rb +167 -0
- data/config/initializers/simple_form_bootstrap.rb +137 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/locales/sufia.en.yml +7 -4
- data/config/routes.rb +1 -1
- data/lib/generators/sufia/templates/catalog_controller.rb +1 -1
- data/lib/sufia/single_use_error.rb +1 -1
- data/lib/sufia/version.rb +1 -1
- data/spec/actors/generic_file/actor_spec.rb +5 -5
- data/spec/controllers/batch_controller_spec.rb +15 -0
- data/spec/controllers/collections_controller_spec.rb +1 -1
- data/spec/controllers/content_blocks_controller_spec.rb +23 -3
- data/spec/controllers/downloads_controller_spec.rb +5 -5
- data/spec/controllers/generic_files_controller_spec.rb +12 -12
- data/spec/controllers/homepage_controller_spec.rb +19 -6
- data/spec/controllers/my/files_controller_spec.rb +8 -10
- data/spec/controllers/my/shares_controller_spec.rb +34 -23
- data/spec/controllers/single_use_links_controller_spec.rb +2 -3
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +19 -20
- data/spec/controllers/users_controller_spec.rb +8 -8
- data/spec/factories/generic_files.rb +4 -4
- data/spec/factories/users.rb +2 -3
- data/spec/features/browse_dashboard_files_spec.rb +8 -8
- data/spec/features/collection_spec.rb +15 -8
- data/spec/features/edit_file_spec.rb +26 -0
- data/spec/features/single_use_links_spec.rb +3 -3
- data/spec/forms/generic_file_edit_form_spec.rb +8 -1
- data/spec/helpers/content_block_helper_spec.rb +10 -0
- data/spec/helpers/dashboard_helper_spec.rb +42 -0
- data/spec/helpers/sufia_helper_spec.rb +34 -7
- data/spec/helpers/trophy_helper_spec.rb +6 -6
- data/spec/inputs/select_with_help_input_spec.rb +16 -0
- data/spec/jobs/audit_job_spec.rb +1 -1
- data/spec/jobs/characterize_job_spec.rb +2 -7
- data/spec/jobs/create_derivatives_job_spec.rb +27 -38
- data/spec/jobs/import_url_job_spec.rb +2 -2
- data/spec/jobs/ingest_local_file_job_spec.rb +6 -8
- data/spec/lib/sufia/id_service_spec.rb +0 -7
- data/spec/lib/sufia/messages_spec.rb +16 -13
- data/spec/models/ability_spec.rb +3 -0
- data/spec/models/checksum_audit_log_spec.rb +1 -1
- data/spec/models/content_block_spec.rb +41 -0
- data/spec/models/featured_work_list_spec.rb +23 -9
- data/spec/models/file_content_datastream_spec.rb +4 -4
- data/spec/models/file_usage_spec.rb +1 -1
- data/spec/models/fits_datastream_spec.rb +4 -4
- data/spec/models/generic_file_spec.rb +31 -15
- data/spec/models/single_use_link_spec.rb +2 -2
- data/spec/models/solr_document_spec.rb +8 -5
- data/spec/models/user_spec.rb +3 -3
- data/spec/presenters/sufia/collection_presenter_spec.rb +34 -0
- data/spec/presenters/sufia/generic_file_presenter_spec.rb +41 -1
- data/spec/presenters/sufia/version_list_presenter_spec.rb +12 -2
- data/spec/services/generic_file_audit_service_spec.rb +3 -3
- data/spec/services/noid_spec.rb +4 -11
- data/spec/services/repository_audit_service_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/fixture_helpers.rb +2 -3
- data/spec/support/selectors.rb +7 -7
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/views/batch/edit.html.erb_spec.rb +14 -17
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/_permission_form.html.erb_spec.rb +29 -7
- data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/show.html.erb_spec.rb +69 -151
- data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
- data/spec/views/homepage/_featured_works.html.erb_spec.rb +29 -0
- data/spec/views/users/show.html.erb_spec.rb +1 -1
- data/sufia-models/app/actors/sufia/generic_file/actor.rb +12 -8
- data/sufia-models/app/jobs/batch_update_job.rb +2 -2
- data/sufia-models/app/jobs/import_url_job.rb +5 -3
- data/sufia-models/app/jobs/ingest_local_file_job.rb +46 -0
- data/sufia-models/app/jobs/resolrize_job.rb +1 -8
- data/sufia-models/app/models/batch.rb +0 -7
- data/sufia-models/app/models/concerns/sufia/ability.rb +1 -1
- data/sufia-models/app/models/concerns/sufia/{collection.rb → collection_behavior.rb} +1 -13
- data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +3 -4
- data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +1 -1
- data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +1 -4
- data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +7 -7
- data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +1 -2
- data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +16 -11
- data/sufia-models/app/models/concerns/sufia/model_methods.rb +1 -14
- data/sufia-models/app/models/concerns/sufia/user.rb +5 -0
- data/sufia-models/app/models/file_usage.rb +1 -1
- data/sufia-models/app/models/file_view_stat.rb +1 -1
- data/sufia-models/app/models/sufia/collection.rb +5 -0
- data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +1 -1
- data/sufia-models/app/services/sufia/id_service.rb +1 -2
- data/sufia-models/app/services/sufia/noid.rb +4 -24
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +6 -1
- data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +2 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +1 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +46 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +9 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +6 -0
- data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +18 -0
- data/sufia-models/lib/sufia/messages.rb +11 -12
- data/sufia-models/lib/sufia/models/engine.rb +2 -1
- data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +9 -5
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/sufia-models.gemspec +5 -5
- data/sufia.gemspec +15 -15
- data/tasks/sufia-dev.rake +0 -16
- metadata +86 -64
- data/LICENSE.md +0 -14
- data/app/jobs/ingest_local_file_job.rb +0 -39
- data/sufia-models/app/models/collection.rb +0 -3
- data/sufia-models/app/services/sufia/indexing_service.rb +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a67f16943a8f2a6992d93cd1b9a2f55a983864f9
|
|
4
|
+
data.tar.gz: a1ded0b6d953e9821b63b8662e4ade6d28444e93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbc993658fa74c21bf7413c5339aed88aa1235f7b3d964005182a1395d3c767dfa06679225f7ae964c75086b076837e064d0b0288c8d5dbd84768d8700c4a0de
|
|
7
|
+
data.tar.gz: 182feec8e0a68c2a11eecfbcd3f896d43018e891151be4b491e23b127c49511e7efe6bbdd39a095f18aeaef2391a68a5924f34b936f16f0222dcd916c3986320
|
data/.travis.yml
CHANGED
|
@@ -2,7 +2,11 @@ language: ruby
|
|
|
2
2
|
cache: bundler
|
|
3
3
|
sudo: false
|
|
4
4
|
rvm:
|
|
5
|
-
- 2.
|
|
5
|
+
- 2.2
|
|
6
|
+
matrix:
|
|
7
|
+
include:
|
|
8
|
+
- rvm: 2.1
|
|
9
|
+
env: "RAILS_VERSION=4.1.8"
|
|
6
10
|
env:
|
|
7
11
|
global:
|
|
8
12
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
@@ -11,10 +15,6 @@ env:
|
|
|
11
15
|
- "RAILS_VERSION=4.1.8"
|
|
12
16
|
- "RAILS_VERSION=4.2.0"
|
|
13
17
|
|
|
14
|
-
matrix:
|
|
15
|
-
allow_failures:
|
|
16
|
-
- env: "RAILS_VERSION=4.2.0"
|
|
17
|
-
|
|
18
18
|
notifications:
|
|
19
19
|
email:
|
|
20
20
|
recipients:
|
data/History.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# History of Sufia releases
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
* Update README to be more specific about dependency versions [Michael J. Giarlo]
|
|
6
|
+
* Pulled in code from curate to manage add/remove fields on edit forms. Also story #3978 [Carolyn Cole]
|
|
7
|
+
* Changing the file query to be a solr query for loading the file id, so we do not wait large file content to load. This speed up the runs significantly on systems with large file. [Carolyn Cole]
|
|
8
|
+
* Users controller should not call an undefined method. Fixes #532. [Michael J. Giarlo]
|
|
9
|
+
* Fix problem where batch edit forms weren't expanding. Fixes #820 [Carolyn Cole]
|
|
10
|
+
* Update and rename LICENSE.md to LICENSE per community convention. [Michael J. Giarlo]
|
|
11
|
+
* Brings some of the fixes in fedora-4/master into master. [Michael J. Giarlo]
|
|
12
|
+
* Adds condition to make the version of sass-rails dependent on the value of RAILS_VERSION [Michael J. Giarlo]
|
|
13
|
+
* Merge travis config change to speed up the build [Michael J. Giarlo]
|
|
14
|
+
* Adding the browse view link into the bread crumbs so it shows on both the edit and the stats page. [Carolyn Cole]
|
|
15
|
+
|
|
16
|
+
|
|
3
17
|
## 4.3.1
|
|
4
18
|
|
|
5
19
|
* Adds an ORCID field to the user model. [Michael J. Giarlo]
|
data/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
##########################################################################
|
|
2
|
+
# Copyright 2012 Penn State University
|
|
3
|
+
# Additional copyright may be held by others, as reflected in the commit log
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
data/SUFIA_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.0.0.
|
|
1
|
+
6.0.0.rc3
|
|
@@ -136,30 +136,26 @@ Blacklight.onLoad(function() {
|
|
|
136
136
|
return $('#file_permissions').parent().children().size() - 1;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
$('.remove_perm').on('click', function() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
$('.remove_perm').on('click', function(evt) {
|
|
140
|
+
evt.preventDefault();
|
|
141
|
+
var top = $(this).parent().parent();
|
|
142
|
+
top.addClass('hidden'); // do not show the block
|
|
143
|
+
addDestroyField(top, $(this).attr('data-index'));
|
|
144
|
+
showPermissionNote();
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
function showPermissionNote() {
|
|
148
148
|
$('#save_perm_note').removeClass('hidden');
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
function addDestroyField(element) {
|
|
151
|
+
function addDestroyField(element, index) {
|
|
152
152
|
$('<input>').attr({
|
|
153
153
|
type: 'hidden',
|
|
154
|
-
name: 'generic_file[permissions_attributes][' +
|
|
154
|
+
name: 'generic_file[permissions_attributes][' + index + '][_destroy]',
|
|
155
155
|
value: 'true'
|
|
156
156
|
}).appendTo(element);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
function indexOf(element) {
|
|
160
|
-
return $('#file_permissions').parent().children().index(element) - 1;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
159
|
});
|
|
164
160
|
|
|
165
161
|
// return the files visibility level (institution, open, restricted);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
@import 'sufia/settings', 'sufia/header', 'sufia/styles', 'sufia/file-listing',
|
|
19
19
|
'sufia/collections', 'sufia/batch-edit', 'sufia/dashboard', 'sufia/home-page',
|
|
20
20
|
'sufia/featured', 'sufia/tagcloud', 'sufia/usage-stats', 'sufia/catalog', 'sufia/buttons',
|
|
21
|
-
'sufia/proxy-rights';
|
|
21
|
+
'sufia/tinymce', 'sufia/proxy-rights';
|
|
22
22
|
@import 'hydra-editor/multi_value_fields';
|
|
23
23
|
|
|
24
24
|
#browse-everything {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.multi_value, .single_value {
|
|
2
|
+
.field-wrapper {
|
|
3
|
+
list-style-type:none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.listing {
|
|
7
|
+
margin-left: 0;
|
|
8
|
+
max-width: 40em;
|
|
9
|
+
padding-left: 0px;
|
|
10
|
+
.input-group {
|
|
11
|
+
margin-bottom: 1px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.field-controls span {
|
|
16
|
+
margin-left:.2em;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.field-controls {
|
|
20
|
+
margin-left: 2em;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.message{
|
|
24
|
+
background-size: 40px 40px;
|
|
25
|
+
background-image: linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
|
|
26
|
+
transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
|
|
27
|
+
transparent 75%, transparent);
|
|
28
|
+
box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);
|
|
29
|
+
width: 100%;
|
|
30
|
+
border: 1px solid;
|
|
31
|
+
color: #fff;
|
|
32
|
+
padding: 10px;
|
|
33
|
+
text-shadow: 0 1px 0 rgba(0,0,0,.5);
|
|
34
|
+
animation: animate-bg 5s linear infinite;
|
|
35
|
+
border-radius: $border-radius-base;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.has-error{
|
|
39
|
+
background-color: #de4343;
|
|
40
|
+
border-color: #c43d3d;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.has-warning{
|
|
44
|
+
background-color: #eaaf51;
|
|
45
|
+
border-color: #d99a36;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// The contributor listing needs some normalization
|
|
50
|
+
#contributors .listing {
|
|
51
|
+
max-width:20em;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#collection_title.listing {
|
|
55
|
+
max-width:37em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.collection_description .listing {
|
|
59
|
+
max-width:35.5em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#descriptions_display {
|
|
63
|
+
.form-group, .batch-group {
|
|
64
|
+
margin-left: 0;
|
|
65
|
+
margin-bottom: 0.5em;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -3,7 +3,6 @@ class BatchController < ApplicationController
|
|
|
3
3
|
layout "sufia-one-column"
|
|
4
4
|
|
|
5
5
|
before_filter :has_access?
|
|
6
|
-
prepend_before_filter :normalize_identifier, only: [:edit, :show, :update, :destroy]
|
|
7
6
|
|
|
8
7
|
def edit
|
|
9
8
|
@batch = Batch.find_or_create(params[:id])
|
|
@@ -18,7 +17,11 @@ class BatchController < ApplicationController
|
|
|
18
17
|
file_attributes = Sufia::Forms::BatchEditForm.model_attributes(params[:generic_file])
|
|
19
18
|
Sufia.queue.push(BatchUpdateJob.new(current_user.user_key, params[:id], params[:title], file_attributes, params[:visibility]))
|
|
20
19
|
flash[:notice] = 'Your files are being processed by ' + t('sufia.product_name') + ' in the background. The metadata and access controls you specified are being applied. Files will be marked <span class="label label-danger" title="Private">Private</span> until this process is complete (shouldn\'t take too long, hang in there!). You may need to refresh your dashboard to see these updates.'
|
|
21
|
-
|
|
20
|
+
if uploading_on_behalf_of? @batch
|
|
21
|
+
redirect_to sufia.dashboard_shares_path
|
|
22
|
+
else
|
|
23
|
+
redirect_to sufia.dashboard_files_path
|
|
24
|
+
end
|
|
22
25
|
end
|
|
23
26
|
|
|
24
27
|
protected
|
|
@@ -33,5 +36,11 @@ class BatchController < ApplicationController
|
|
|
33
36
|
file.initialize_fields
|
|
34
37
|
end
|
|
35
38
|
|
|
39
|
+
def uploading_on_behalf_of? batch
|
|
40
|
+
file = batch.generic_files.first
|
|
41
|
+
return false if file.nil? || file.on_behalf_of.blank?
|
|
42
|
+
current_user.user_key != file.on_behalf_of
|
|
43
|
+
end
|
|
44
|
+
|
|
36
45
|
ActiveSupport::Deprecation.deprecate_methods(BatchController, :initialize_fields)
|
|
37
46
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
5
|
def build_breadcrumbs
|
|
6
|
-
if request.referer
|
|
6
|
+
if request.referer
|
|
7
7
|
trail_from_referer
|
|
8
8
|
else
|
|
9
9
|
default_trail
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
def add_breadcrumb_for_action
|
|
40
40
|
if /edit|stats/ =~ action_name && controller_name == "generic_files"
|
|
41
|
-
add_breadcrumb I18n.t("sufia.generic_file.browse_view"), sufia.generic_file_path(
|
|
41
|
+
add_breadcrumb I18n.t("sufia.generic_file.browse_view"), sufia.generic_file_path(params["id"])
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
-
|
|
45
44
|
end
|
|
46
45
|
end
|
|
@@ -9,7 +9,6 @@ module Sufia
|
|
|
9
9
|
include BlacklightAdvancedSearch::Controller
|
|
10
10
|
include Sufia::Breadcrumbs
|
|
11
11
|
|
|
12
|
-
prepend_before_filter :normalize_identifier, except: [:index, :create, :new]
|
|
13
12
|
before_filter :filter_docs_with_read_access!, except: :show
|
|
14
13
|
before_filter :has_access?, except: :show
|
|
15
14
|
before_filter :build_breadcrumbs, only: [:edit, :show]
|
|
@@ -8,8 +8,7 @@ module Sufia
|
|
|
8
8
|
@contact_form = ContactForm.new(params[:contact_form])
|
|
9
9
|
@contact_form.request = request
|
|
10
10
|
# not spam and a valid form
|
|
11
|
-
|
|
12
|
-
if @contact_form.deliver
|
|
11
|
+
if @contact_form.respond_to?(:deliver_now) ? @contact_form.deliver_now : @contact_form.deliver
|
|
13
12
|
flash.now[:notice] = 'Thank you for your message!'
|
|
14
13
|
after_deliver
|
|
15
14
|
render :new
|
|
@@ -12,12 +12,6 @@ module Sufia::Controller
|
|
|
12
12
|
user_signed_in? ? current_user.ability : super
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def normalize_identifier
|
|
16
|
-
# nop
|
|
17
|
-
# If you want to override you can do something like this:
|
|
18
|
-
# params[:id] = Sufia::Noid.namespaceize(params[:id])
|
|
19
|
-
end
|
|
20
|
-
|
|
21
15
|
def render_404(exception)
|
|
22
16
|
logger.error("Rendering 404 page due to exception: #{exception.inspect} - #{exception.backtrace if exception.respond_to? :backtrace}")
|
|
23
17
|
render template: '/error/404', layout: "error", formats: [:html], status: 404
|
|
@@ -39,7 +33,7 @@ module Sufia::Controller
|
|
|
39
33
|
return if action_name == "index" && controller_name == "mailbox"
|
|
40
34
|
if user_signed_in?
|
|
41
35
|
@notify_number = current_user.mailbox.inbox(unread: true).count
|
|
42
|
-
@batches = current_user.mailbox.inbox.map { |msg| msg.last_message.body[/<span id="(.*)"><a (href=|data-content=)(.*)/,1] }.select{ |val| !val.blank? }
|
|
36
|
+
@batches = current_user.mailbox.inbox.map { |msg| msg.last_message.body[/<span id="(.*)"><a (href=|data-content=|rel=)(.*)/,1] }.select{ |val| !val.blank? }
|
|
43
37
|
end
|
|
44
38
|
end
|
|
45
39
|
|
|
@@ -3,16 +3,11 @@ module Sufia
|
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
include Hydra::Controller::DownloadBehavior
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
prepend_before_filter :normalize_identifier
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def datastream_name
|
|
12
|
-
if !params[:datastream_id] || params[:datastream_id] == self.class.default_content_dsid
|
|
6
|
+
def file_name
|
|
7
|
+
if !params[:file] || params[:file] == self.class.default_file_path
|
|
13
8
|
params[:filename] || asset.label
|
|
14
9
|
else
|
|
15
|
-
params[:
|
|
10
|
+
params[:file]
|
|
16
11
|
end
|
|
17
12
|
end
|
|
18
13
|
end
|
|
@@ -10,9 +10,9 @@ module Sufia
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
private
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def perform_local_ingest
|
|
17
17
|
if Sufia.config.enable_local_ingest && current_user.respond_to?(:directory)
|
|
18
18
|
if ingest_local_file
|
|
@@ -61,6 +61,5 @@ module Sufia
|
|
|
61
61
|
Sufia.queue.push(IngestLocalFileJob.new(gf.id, current_user.directory, filename, current_user.user_key))
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
-
|
|
65
64
|
end # /FilesController::LocalIngestBehavior
|
|
66
65
|
end # /Sufia
|
|
@@ -38,21 +38,18 @@ module Sufia
|
|
|
38
38
|
before_filter :authenticate_user!, except: [:show, :citation, :stats]
|
|
39
39
|
before_filter :has_access?, except: [:show]
|
|
40
40
|
before_filter :build_breadcrumbs, only: [:show, :edit, :stats]
|
|
41
|
-
prepend_before_filter :normalize_identifier, except: [:index, :create, :new]
|
|
42
41
|
load_resource only: [:audit]
|
|
43
42
|
load_and_authorize_resource except: [:index, :audit]
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
# routed to /files/new
|
|
47
46
|
def new
|
|
48
|
-
@
|
|
47
|
+
@batch_id = Batch.create.id
|
|
49
48
|
end
|
|
50
49
|
|
|
51
50
|
# routed to /files/:id/edit
|
|
52
51
|
def edit
|
|
53
|
-
|
|
54
|
-
@groups = current_user.groups
|
|
55
|
-
@version_list = version_list
|
|
52
|
+
set_variables_for_edit_form
|
|
56
53
|
end
|
|
57
54
|
|
|
58
55
|
# routed to /files/:id/stats
|
|
@@ -119,7 +116,7 @@ module Sufia
|
|
|
119
116
|
def update
|
|
120
117
|
success = if wants_to_revert?
|
|
121
118
|
update_version
|
|
122
|
-
elsif
|
|
119
|
+
elsif wants_to_upload_new_version?
|
|
123
120
|
update_file
|
|
124
121
|
elsif params.has_key? :generic_file
|
|
125
122
|
update_metadata
|
|
@@ -131,16 +128,20 @@ module Sufia
|
|
|
131
128
|
redirect_to sufia.edit_generic_file_path(tab: params[:redirect_tab]), notice:
|
|
132
129
|
render_to_string(partial: 'generic_files/asset_updated_flash', locals: { generic_file: @generic_file })
|
|
133
130
|
else
|
|
131
|
+
flash[:error] ||= 'Update was unsuccessful.'
|
|
132
|
+
set_variables_for_edit_form
|
|
134
133
|
render action: 'edit'
|
|
135
134
|
end
|
|
136
|
-
rescue => error
|
|
137
|
-
flash[:error] = error.message
|
|
138
|
-
logger.error "GenericFilesController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
|
|
139
|
-
render action: 'edit'
|
|
140
135
|
end
|
|
141
136
|
|
|
142
137
|
protected
|
|
143
138
|
|
|
139
|
+
def set_variables_for_edit_form
|
|
140
|
+
@form = edit_form
|
|
141
|
+
@groups = current_user.groups
|
|
142
|
+
@version_list = version_list
|
|
143
|
+
end
|
|
144
|
+
|
|
144
145
|
def presenter
|
|
145
146
|
Sufia::GenericFilePresenter.new(@generic_file)
|
|
146
147
|
end
|
|
@@ -161,6 +162,13 @@ module Sufia
|
|
|
161
162
|
params.has_key?(:revision) && params[:revision] != @generic_file.content.latest_version.label
|
|
162
163
|
end
|
|
163
164
|
|
|
165
|
+
def wants_to_upload_new_version?
|
|
166
|
+
has_file_data = params.has_key?(:filedata)
|
|
167
|
+
on_version_tab = params[:redirect_tab] == 'versions'
|
|
168
|
+
|
|
169
|
+
has_file_data || (on_version_tab && !wants_to_revert?)
|
|
170
|
+
end
|
|
171
|
+
|
|
164
172
|
def actor
|
|
165
173
|
@actor ||= Sufia::GenericFile::Actor.new(@generic_file, current_user)
|
|
166
174
|
end
|
|
@@ -170,7 +178,12 @@ module Sufia
|
|
|
170
178
|
end
|
|
171
179
|
|
|
172
180
|
def update_file
|
|
173
|
-
|
|
181
|
+
if params[:filedata]
|
|
182
|
+
actor.update_content(params[:filedata], file_path)
|
|
183
|
+
else
|
|
184
|
+
flash[:error] = 'Please select a file.'
|
|
185
|
+
false
|
|
186
|
+
end
|
|
174
187
|
end
|
|
175
188
|
|
|
176
189
|
# this is provided so that implementing application can override this behavior and map params to different attributes
|
|
@@ -196,7 +209,7 @@ module Sufia
|
|
|
196
209
|
def process_file(file)
|
|
197
210
|
update_metadata_from_upload_screen
|
|
198
211
|
actor.create_metadata(params[:batch_id])
|
|
199
|
-
if actor.create_content(file, file.original_filename,
|
|
212
|
+
if actor.create_content(file, file.original_filename, file_path, file.content_type)
|
|
200
213
|
respond_to do |format|
|
|
201
214
|
format.html {
|
|
202
215
|
render 'jq_upload', formats: 'json', content_type: 'text/html'
|
|
@@ -225,8 +238,8 @@ module Sufia
|
|
|
225
238
|
|
|
226
239
|
ActiveSupport::Deprecation.deprecate_methods(FilesControllerBehavior, :initialize_fields)
|
|
227
240
|
|
|
228
|
-
# The
|
|
229
|
-
def
|
|
241
|
+
# The path of the fedora node where we store the file data
|
|
242
|
+
def file_path
|
|
230
243
|
'content'
|
|
231
244
|
end
|
|
232
245
|
|