sufia 6.2.0 → 6.3.0
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/.rubocop.yml +146 -0
- data/.travis.yml +4 -7
- data/Gemfile +2 -0
- data/History.md +29 -1
- data/README.md +25 -9
- data/SUFIA_VERSION +1 -1
- data/app/assets/stylesheets/sufia/_collections.scss +15 -0
- data/app/assets/stylesheets/sufia/_file-listing.scss +7 -0
- data/app/assets/stylesheets/sufia/_home-page.scss +10 -0
- data/app/builders/sufia/bootstrap_breadcrumbs_builder.rb +3 -5
- data/app/controllers/admin/stats_controller.rb +1 -76
- data/app/controllers/api/items_controller.rb +4 -6
- data/app/controllers/api/zotero_controller.rb +5 -5
- data/app/controllers/authorities_controller.rb +5 -1
- data/app/controllers/batch_edits_controller.rb +3 -3
- data/app/controllers/concerns/sufia/admin/depositor_stats.rb +41 -0
- data/app/controllers/concerns/sufia/admin/stats_behavior.rb +94 -0
- data/app/controllers/concerns/sufia/batch_controller_behavior.rb +16 -18
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +54 -56
- data/app/controllers/concerns/sufia/breadcrumbs.rb +3 -6
- data/app/controllers/concerns/sufia/collections_controller_behavior.rb +39 -39
- data/app/controllers/concerns/sufia/controller.rb +10 -10
- data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +17 -18
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +9 -12
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +6 -7
- data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +39 -40
- data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +109 -110
- data/app/controllers/concerns/sufia/homepage_controller.rb +8 -8
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +13 -10
- data/app/controllers/concerns/sufia/single_use_links_controller_behavior.rb +11 -14
- data/app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb +27 -21
- data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +17 -17
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +54 -54
- data/app/controllers/contact_form_controller.rb +1 -1
- data/app/controllers/content_blocks_controller.rb +11 -12
- data/app/controllers/directory_controller.rb +2 -3
- data/app/controllers/featured_work_lists_controller.rb +1 -1
- data/app/controllers/featured_works_controller.rb +2 -4
- data/app/controllers/homepage_controller.rb +1 -2
- data/app/controllers/mailbox_controller.rb +12 -32
- data/app/controllers/my/collections_controller.rb +3 -4
- data/app/controllers/my/files_controller.rb +4 -6
- data/app/controllers/my/highlights_controller.rb +4 -6
- data/app/controllers/my/shares_controller.rb +3 -5
- data/app/controllers/pages_controller.rb +1 -3
- data/app/controllers/single_use_links_controller.rb +0 -1
- data/app/controllers/single_use_links_viewer_controller.rb +0 -1
- data/app/controllers/static_controller.rb +1 -0
- data/app/forms/sufia/forms/collection_edit_form.rb +2 -2
- data/app/helpers/batch_edits_helper.rb +1 -3
- data/app/helpers/content_block_helper.rb +7 -8
- data/app/helpers/generic_file_helper.rb +23 -24
- data/app/helpers/sufia/blacklight_override.rb +6 -7
- data/app/helpers/sufia/dashboard_helper_behavior.rb +4 -7
- data/app/helpers/sufia/permissions_helper.rb +3 -4
- data/app/helpers/sufia/sufia_helper_behavior.rb +30 -29
- data/app/helpers/trophy_helper.rb +15 -15
- data/app/inputs/select_with_modal_help_input.rb +3 -3
- data/app/inputs/with_help_icon.rb +4 -4
- data/app/jobs/content_delete_event_job.rb +0 -1
- data/app/jobs/content_depositor_change_event_job.rb +1 -2
- data/app/jobs/event_job.rb +0 -1
- data/app/jobs/user_unfollow_event_job.rb +1 -0
- data/app/models/concerns/sufia/solr_document_behavior.rb +1 -2
- data/app/models/contact_form.rb +6 -6
- data/app/models/content_block.rb +1 -2
- data/app/models/featured_work_list.rb +3 -5
- data/app/models/user_mailbox.rb +44 -0
- data/app/presenters/sufia/collection_presenter.rb +6 -8
- data/app/presenters/sufia/generic_file_presenter.rb +2 -2
- data/app/presenters/sufia/presenter_renderer.rb +2 -2
- data/app/presenters/sufia/version_list_presenter.rb +1 -1
- data/app/presenters/sufia/version_presenter.rb +3 -6
- data/app/search_builders/deposit_search_builder.rb +19 -0
- data/app/search_builders/sufia/my_search_builder_behavior.rb +1 -2
- data/app/search_builders/sufia/search_builder.rb +1 -3
- data/app/uploaders/tinymce_asset_uploader.rb +0 -2
- data/app/views/_controls.html.erb +5 -5
- data/app/views/admin/stats/_deposits.html.erb +19 -0
- data/app/views/admin/stats/index.html.erb +2 -0
- data/app/views/batch_edits/edit.html.erb +2 -2
- data/app/views/collections/_edit_actions.html.erb +3 -3
- data/app/views/collections/_form_for_select_collection.html.erb +2 -2
- data/app/views/collections/_sort_and_per_page.html.erb +12 -9
- data/app/views/collections/_view_type_group.html.erb +1 -1
- data/app/views/collections/edit.html.erb +5 -5
- data/app/views/collections/show.html.erb +7 -6
- data/app/views/homepage/_announcement.html.erb +5 -0
- data/app/views/homepage/_home.html.erb +1 -0
- data/app/views/my/_sort_and_per_page.html.erb +14 -10
- data/app/views/my/index.html.erb +1 -1
- data/app/views/pages/show.html.erb +0 -2
- data/app/views/single_use_links/new_download.html.erb +1 -1
- data/app/views/single_use_links_viewer/show.html.erb +1 -1
- data/app/views/users/_notify_link.html.erb +1 -1
- data/app/views/users/_notify_number.html.erb +2 -2
- data/config/initializers/simple_form.rb +1 -1
- data/config/initializers/simple_form_bootstrap.rb +1 -1
- data/config/locales/sufia.en.yml +4 -0
- data/config/routes.rb +2 -3
- data/lib/generators/sufia/admin_stat_generator.rb +0 -3
- data/lib/generators/sufia/install_generator.rb +8 -9
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -3
- data/lib/generators/sufia/templates/config/action_dispatch_http_upload_monkey_patch.rb +1 -0
- data/lib/generators/sufia/upgrade400_generator.rb +9 -9
- data/lib/generators/sufia/upgrade600_generator.rb +1 -4
- data/lib/sufia.rb +2 -2
- data/lib/sufia/arkivo/actor.rb +1 -1
- data/lib/sufia/arkivo/create_subscription_job.rb +30 -30
- data/lib/sufia/arkivo/metadata_munger.rb +7 -7
- data/lib/sufia/arkivo/schema_validator.rb +1 -1
- data/lib/sufia/single_use_error.rb +0 -1
- data/lib/sufia/version.rb +1 -1
- data/lib/sufia/zotero/config.rb +13 -13
- data/spec/actors/generic_file/actor_spec.rb +17 -18
- data/spec/controllers/admin_stats_controller_spec.rb +56 -5
- data/spec/controllers/api/zotero_controller_spec.rb +10 -9
- data/spec/controllers/authorities_controller_spec.rb +8 -8
- data/spec/controllers/batch_controller_spec.rb +19 -20
- data/spec/controllers/batch_edits_controller_spec.rb +8 -9
- data/spec/controllers/catalog_controller_spec.rb +7 -9
- data/spec/controllers/collections_controller_spec.rb +30 -32
- data/spec/controllers/content_blocks_controller_spec.rb +4 -4
- data/spec/controllers/dashboard_controller_spec.rb +12 -12
- data/spec/controllers/depositors_controller_spec.rb +8 -8
- data/spec/controllers/downloads_controller_spec.rb +10 -11
- data/spec/controllers/featured_work_lists_controller_spec.rb +4 -4
- data/spec/controllers/featured_works_controller_spec.rb +11 -12
- data/spec/controllers/generic_files_controller_spec.rb +154 -125
- data/spec/controllers/homepage_controller_spec.rb +22 -15
- data/spec/controllers/mailbox_controller_spec.rb +20 -36
- data/spec/controllers/my/collections_controller_spec.rb +4 -5
- data/spec/controllers/my/files_controller_spec.rb +10 -11
- data/spec/controllers/my/highlights_controller_spec.rb +4 -5
- data/spec/controllers/my/shares_controller_spec.rb +12 -14
- data/spec/controllers/my_controller_spec.rb +1 -3
- data/spec/controllers/pages_controller_spec.rb +4 -4
- data/spec/controllers/single_use_links_controller_spec.rb +1 -3
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -2
- data/spec/controllers/static_controller_spec.rb +1 -1
- data/spec/controllers/tinymce_assets_controller_spec.rb +8 -9
- data/spec/controllers/transfers_controller_spec.rb +19 -19
- data/spec/controllers/users_controller_spec.rb +33 -35
- data/spec/factories/api_items.rb +2 -2
- data/spec/factories/content_blocks.rb +1 -1
- data/spec/factories/featured_works.rb +1 -1
- data/spec/factories/generic_files.rb +3 -3
- data/spec/factories/users.rb +7 -8
- data/spec/features/browse_dashboard_files_spec.rb +14 -18
- data/spec/features/browse_files_spec.rb +3 -4
- data/spec/features/catalog_search_spec.rb +3 -5
- data/spec/features/cloud_upload_spec.rb +2 -2
- data/spec/features/collection_spec.rb +21 -21
- data/spec/features/contact_form_spec.rb +10 -11
- data/spec/features/display_dashboard_spec.rb +5 -9
- data/spec/features/edit_file_spec.rb +8 -9
- data/spec/features/featured_item_spec.rb +1 -1
- data/spec/features/ingest_upload_files_spec.rb +5 -5
- data/spec/features/notifications_spec.rb +2 -6
- data/spec/features/ownership_transfer_spec.rb +2 -2
- data/spec/features/proxy_spec.rb +2 -2
- data/spec/features/search_spec.rb +3 -4
- data/spec/features/single_use_links_spec.rb +1 -1
- data/spec/features/users_spec.rb +4 -5
- data/spec/forms/collection_edit_form_spec.rb +2 -2
- data/spec/forms/generic_file_edit_form_spec.rb +6 -7
- data/spec/helpers/batch_edits_helper_spec.rb +9 -13
- data/spec/helpers/content_block_helper_spec.rb +3 -3
- data/spec/helpers/dashboard_helper_spec.rb +19 -24
- data/spec/helpers/generic_file_helper_spec.rb +5 -7
- data/spec/helpers/sufia_helper_spec.rb +43 -54
- data/spec/helpers/trophy_helper_spec.rb +5 -5
- data/spec/inputs/multi_value_with_help_input_spec.rb +1 -2
- data/spec/inputs/select_with_help_input_spec.rb +19 -15
- data/spec/javascripts/jasmine_spec.rb +4 -5
- data/spec/javascripts/support/jasmine_helper.rb +9 -9
- data/spec/jobs/active_fedora_id_based_job_spec.rb +7 -5
- data/spec/jobs/audit_job_spec.rb +7 -7
- data/spec/jobs/batch_update_job_spec.rb +5 -6
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/jobs/content_depositor_change_event_job_spec.rb +1 -1
- data/spec/jobs/create_derivatives_job_spec.rb +5 -5
- data/spec/jobs/event_jobs_spec.rb +16 -16
- data/spec/jobs/import_url_job_spec.rb +36 -5
- data/spec/jobs/ingest_local_file_job_spec.rb +31 -20
- data/spec/jobs/sufia_resque_queue_spec.rb +1 -1
- data/spec/lib/sufia/analytics_spec.rb +0 -1
- data/spec/lib/sufia/arkivo/actor_spec.rb +6 -6
- data/spec/lib/sufia/arkivo/schema_validator_spec.rb +18 -18
- data/spec/lib/sufia/breadcrumbs_spec.rb +5 -6
- data/spec/lib/sufia/messages_spec.rb +11 -12
- data/spec/lib/sufia/readable_permissions_spec.rb +8 -10
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +6 -7
- data/spec/lib/sufia/user_stat_importer_spec.rb +30 -33
- data/spec/lib/sufia/writable_permissions_spec.rb +1 -3
- data/spec/lib/sufia/zotero/config_spec.rb +4 -6
- data/spec/models/ability_spec.rb +11 -9
- data/spec/models/batch_spec.rb +13 -13
- data/spec/models/characterization_spec.rb +2 -3
- data/spec/models/checksum_audit_log_spec.rb +18 -19
- data/spec/models/collection_spec.rb +11 -12
- data/spec/models/content_block_spec.rb +33 -22
- data/spec/models/download_spec.rb +3 -5
- data/spec/models/featured_work_list_spec.rb +3 -3
- data/spec/models/featured_work_spec.rb +12 -14
- data/spec/models/file_content_datastream_spec.rb +9 -7
- data/spec/models/file_download_stat_spec.rb +34 -40
- data/spec/models/file_usage_spec.rb +46 -52
- data/spec/models/file_view_stat_spec.rb +35 -41
- data/spec/models/fits_datastream_spec.rb +23 -25
- data/spec/models/generic_file/visibility_spec.rb +10 -5
- data/spec/models/generic_file_spec.rb +86 -88
- data/spec/models/geo_names_resource_spec.rb +3 -5
- data/spec/models/local_authority_spec.rb +30 -33
- data/spec/models/pageview_spec.rb +3 -3
- data/spec/models/proxy_deposit_request_spec.rb +3 -3
- data/spec/models/single_use_link_spec.rb +36 -36
- data/spec/models/solr_document_spec.rb +3 -6
- data/spec/models/trophy_spec.rb +8 -9
- data/spec/models/user_mailbox_spec.rb +62 -0
- data/spec/models/user_spec.rb +28 -29
- data/spec/presenters/presenter_renderer_spec.rb +1 -1
- data/spec/presenters/sufia/generic_file_presenter_spec.rb +5 -5
- data/spec/presenters/sufia/version_list_presenter_spec.rb +2 -2
- data/spec/presenters/sufia/version_presenter_spec.rb +1 -1
- data/spec/routing/featured_works_route_spec.rb +4 -4
- data/spec/routing/ownership_transfers_route_spec.rb +1 -1
- data/spec/routing/route_spec.rb +89 -89
- data/spec/services/generic_file_audit_service_spec.rb +8 -8
- data/spec/services/repository_audit_service_spec.rb +7 -3
- data/spec/spec_helper.rb +5 -4
- data/spec/support/features/session_helpers.rb +1 -1
- data/spec/support/input_support.rb +1 -2
- data/spec/support/rake.rb +1 -1
- data/spec/support/selectors.rb +1 -6
- data/spec/support/statistic_helper.rb +1 -1
- data/spec/support/uploaded_file_monkeypatch.rb +1 -1
- data/spec/tasks/rake_spec.rb +3 -5
- data/spec/views/admin/stats/index.html.erb_spec.rb +16 -16
- data/spec/views/batch/edit.html.erb_spec.rb +1 -3
- data/spec/views/batch_edits/check_all_spec.rb +5 -5
- data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -3
- data/spec/views/catalog/index.html.erb_spec.rb +1 -3
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +4 -5
- data/spec/views/collections/_form.html.erb_spec.rb +5 -3
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +7 -8
- data/spec/views/collections/_show_document_list.erb_spec.rb +4 -6
- data/spec/views/dashboard/index_spec.rb +14 -21
- data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +2 -2
- data/spec/views/generic_file/_permission_form.html.erb_spec.rb +8 -9
- data/spec/views/generic_file/edit.html.erb_spec.rb +7 -7
- data/spec/views/generic_file/show.html.erb_spec.rb +24 -25
- data/spec/views/generic_file/stats.html.erb_spec.rb +19 -19
- data/spec/views/homepage/_announcement.html.erb_spec.rb +51 -0
- data/spec/views/homepage/_featured_works.html.erb_spec.rb +5 -9
- data/spec/views/homepage/_home_header.html.erb_spec.rb +2 -2
- data/spec/views/my/facet.html.erb_spec.rb +4 -4
- data/spec/views/single_use_links/new_download.html.erb_spec.rb +28 -0
- data/spec/views/single_use_links_viewer/show.html.erb_spec.rb +29 -0
- data/spec/views/users/_follower_modal.html.erb_spec.rb +7 -8
- data/spec/views/users/_following_modal.html.erb_spec.rb +4 -5
- data/spec/views/users/_notify_number.html.erb_spec.rb +2 -5
- data/spec/views/users/_user_util_links.html.erb_spec.rb +5 -8
- data/spec/views/users/index.html.erb_spec.rb +4 -6
- data/spec/views/users/show.html.erb_spec.rb +4 -7
- data/tasks/sufia-dev.rake +19 -3
- metadata +20 -5
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
class DirectoryController < ApplicationController
|
|
2
|
-
|
|
3
2
|
# Stub method. Override this in your application if you want directory lookups
|
|
4
3
|
def user
|
|
5
|
-
#render json: User.directory_attributes(params[:uid])
|
|
4
|
+
# render json: User.directory_attributes(params[:uid])
|
|
6
5
|
render json: ''
|
|
7
6
|
end
|
|
8
7
|
|
|
@@ -25,7 +24,7 @@ class DirectoryController < ApplicationController
|
|
|
25
24
|
|
|
26
25
|
# Stub method. Override this in your application if you want directory lookups
|
|
27
26
|
def group
|
|
28
|
-
#render json: Group.exists?(params[:cn])
|
|
27
|
+
# render json: Group.exists?(params[:cn])
|
|
29
28
|
render json: false
|
|
30
29
|
end
|
|
31
30
|
end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
class FeaturedWorksController < ApplicationController
|
|
2
|
-
|
|
3
2
|
def create
|
|
4
3
|
authorize! :create, FeaturedWork
|
|
5
4
|
@featured_work = FeaturedWork.new(generic_file_id: params[:id])
|
|
@@ -9,7 +8,7 @@ class FeaturedWorksController < ApplicationController
|
|
|
9
8
|
format.json { render json: @featured_work, status: :created }
|
|
10
9
|
else
|
|
11
10
|
format.json { render json: @featured_work.errors, status: :unprocessable_entity }
|
|
12
|
-
end
|
|
11
|
+
end
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
|
|
@@ -17,10 +16,9 @@ class FeaturedWorksController < ApplicationController
|
|
|
17
16
|
authorize! :destroy, FeaturedWork
|
|
18
17
|
@featured_work = FeaturedWork.find_by(generic_file_id: params[:id])
|
|
19
18
|
@featured_work.destroy
|
|
20
|
-
|
|
19
|
+
|
|
21
20
|
respond_to do |format|
|
|
22
21
|
format.json { head :no_content }
|
|
23
22
|
end
|
|
24
23
|
end
|
|
25
|
-
|
|
26
24
|
end
|
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
class MailboxController < ApplicationController
|
|
2
|
-
|
|
2
|
+
before_action :authenticate_user!
|
|
3
3
|
|
|
4
4
|
def index
|
|
5
|
-
|
|
6
|
-
@messages = current_user.mailbox.inbox
|
|
7
|
-
@messages.each{|m| m.mark_as_read(current_user)}
|
|
8
|
-
else
|
|
9
|
-
@messages =[]
|
|
10
|
-
end
|
|
5
|
+
@messages = user_mailbox.inbox
|
|
11
6
|
end
|
|
12
7
|
|
|
13
|
-
def delete_all
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
end
|
|
17
|
-
empty_trash(current_user)
|
|
18
|
-
redirect_to sufia.notifications_path
|
|
8
|
+
def delete_all
|
|
9
|
+
alert = user_mailbox.delete_all
|
|
10
|
+
redirect_to sufia.notifications_path, alert: alert
|
|
19
11
|
end
|
|
20
12
|
|
|
21
13
|
def destroy
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
delete_message(msg)
|
|
26
|
-
empty_trash(msg.participants[0])
|
|
27
|
-
end
|
|
28
|
-
else
|
|
29
|
-
flash[:alert] = "You do not have privileges to delete the notification..."
|
|
30
|
-
end
|
|
31
|
-
redirect_to sufia.notifications_path
|
|
14
|
+
message_id = params[:id]
|
|
15
|
+
alert = user_mailbox.destroy(message_id)
|
|
16
|
+
redirect_to sufia.notifications_path, alert: alert
|
|
32
17
|
end
|
|
33
18
|
|
|
34
|
-
private
|
|
19
|
+
private
|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def empty_trash (user)
|
|
42
|
-
user.mailbox.trash.each { |conv| conv.messages.each {|notify| notify.receipts.each { |receipt| receipt.delete}; notify.delete}; conv.delete}
|
|
43
|
-
end
|
|
21
|
+
def user_mailbox
|
|
22
|
+
UserMailbox.new(current_user)
|
|
23
|
+
end
|
|
44
24
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module My
|
|
2
2
|
class CollectionsController < MyController
|
|
3
|
-
|
|
4
3
|
self.search_params_logic += [
|
|
5
4
|
:show_only_resources_deposited_by_current_user,
|
|
6
5
|
:show_only_collections
|
|
@@ -13,8 +12,8 @@ module My
|
|
|
13
12
|
|
|
14
13
|
protected
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
def search_action_url(*args)
|
|
16
|
+
sufia.dashboard_collections_url(*args)
|
|
17
|
+
end
|
|
19
18
|
end
|
|
20
19
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module My
|
|
2
2
|
class FilesController < MyController
|
|
3
|
-
|
|
4
3
|
self.search_params_logic += [
|
|
5
4
|
:show_only_resources_deposited_by_current_user,
|
|
6
5
|
:show_only_generic_files
|
|
@@ -12,10 +11,9 @@ module My
|
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
protected
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
|
|
15
|
+
def search_action_url(*args)
|
|
16
|
+
sufia.dashboard_files_url(*args)
|
|
17
|
+
end
|
|
20
18
|
end
|
|
21
19
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module My
|
|
2
2
|
class HighlightsController < MyController
|
|
3
|
-
|
|
4
3
|
self.search_params_logic += [
|
|
5
4
|
:show_only_highlighted_files
|
|
6
5
|
]
|
|
@@ -9,12 +8,11 @@ module My
|
|
|
9
8
|
super
|
|
10
9
|
@selected_tab = :highlighted
|
|
11
10
|
end
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
protected
|
|
14
|
-
|
|
15
|
-
def search_action_url *args
|
|
16
|
-
sufia.dashboard_highlights_url *args
|
|
17
|
-
end
|
|
18
13
|
|
|
14
|
+
def search_action_url(*args)
|
|
15
|
+
sufia.dashboard_highlights_url(*args)
|
|
16
|
+
end
|
|
19
17
|
end
|
|
20
18
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module My
|
|
2
2
|
class SharesController < MyController
|
|
3
|
-
|
|
4
3
|
self.search_params_logic += [
|
|
5
4
|
:show_only_shared_files,
|
|
6
5
|
:show_only_generic_files
|
|
@@ -13,9 +12,8 @@ module My
|
|
|
13
12
|
|
|
14
13
|
protected
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
def search_action_url(*args)
|
|
16
|
+
sufia.dashboard_shares_url(*args)
|
|
17
|
+
end
|
|
20
18
|
end
|
|
21
19
|
end
|
|
@@ -4,13 +4,13 @@ module Sufia
|
|
|
4
4
|
include HydraEditor::Form
|
|
5
5
|
self.model_class = ::Collection
|
|
6
6
|
self.terms = [:resource_type, :title, :creator, :contributor, :description, :tag, :rights,
|
|
7
|
-
|
|
7
|
+
:publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
|
8
8
|
|
|
9
9
|
# Test to see if the given field is required
|
|
10
10
|
# @param [Symbol] key a field
|
|
11
11
|
# @return [Boolean] is it required or not
|
|
12
12
|
def required?(key)
|
|
13
|
-
model_class.validators_on(key).any?{|v| v.
|
|
13
|
+
model_class.validators_on(key).any? { |v| v.is_a? ActiveModel::Validations::PresenceValidator }
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -6,8 +6,6 @@ module BatchEditsHelper
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def render_check_all
|
|
9
|
-
unless params[:controller].match("my/collections")
|
|
10
|
-
render partial: 'batch_edits/check_all'
|
|
11
|
-
end
|
|
9
|
+
render partial: 'batch_edits/check_all' unless params[:controller].match("my/collections")
|
|
12
10
|
end
|
|
13
11
|
end
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
module ContentBlockHelper
|
|
2
|
-
|
|
3
|
-
def editable_content_block(content_block, show_new=false)
|
|
2
|
+
def editable_content_block(content_block, show_new = false)
|
|
4
3
|
return raw(content_block.value) unless can? :update, content_block
|
|
5
4
|
capture do
|
|
6
5
|
concat content_tag(:div, id: dom_id(content_block, 'preview'), class: 'content_block_preview') {
|
|
7
|
-
concat raw(content_block.value)
|
|
6
|
+
concat raw(content_block.value)
|
|
8
7
|
concat edit_button(content_block)
|
|
9
8
|
concat new_button(content_block) if show_new
|
|
10
|
-
}
|
|
9
|
+
}
|
|
11
10
|
concat edit_form(content_block)
|
|
12
11
|
concat new_form(content_block.name) if show_new
|
|
13
12
|
end
|
|
@@ -17,19 +16,19 @@ module ContentBlockHelper
|
|
|
17
16
|
button_tag "Edit", class: 'btn btn-primary', data: { behavior: 'reveal-editor', target: '#' + dom_id(content_block, 'edit') }
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
def new_button(
|
|
19
|
+
def new_button(_content_block)
|
|
21
20
|
button_tag "New", class: 'btn btn-primary', data: { behavior: 'reveal-editor', target: '#' + 'new_content_block' }
|
|
22
21
|
end
|
|
23
22
|
|
|
24
|
-
def edit_form(content_block, editing_field_id=nil)
|
|
23
|
+
def edit_form(content_block, editing_field_id = nil)
|
|
25
24
|
editing_field_id ||= "text_area_#{content_block.name}"
|
|
26
|
-
form_for([sufia, content_block], html: { class: 'tinymce-form' })
|
|
25
|
+
form_for([sufia, content_block], html: { class: 'tinymce-form' }) do |f|
|
|
27
26
|
concat hidden_field_tag 'content_block[name]', content_block.name
|
|
28
27
|
concat f.text_area :value, id: editing_field_id, class: "tinymce", rows: 20, cols: 120
|
|
29
28
|
concat f.label :external_key, content_block.external_key_name
|
|
30
29
|
concat f.text_field :external_key, class: key_field_class(content_block.name)
|
|
31
30
|
concat content_tag(:div) { f.submit 'Save', class: "btn btn-primary" }
|
|
32
|
-
|
|
31
|
+
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
def key_field_class(content_block_type)
|
|
@@ -4,49 +4,48 @@ module GenericFileHelper
|
|
|
4
4
|
gf.to_s
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
def present_terms(presenter, terms
|
|
7
|
+
def present_terms(presenter, terms = :all, &block)
|
|
8
8
|
terms = presenter.terms if terms == :all
|
|
9
9
|
Sufia::PresenterRenderer.new(presenter, self).fields(terms, &block)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def render_download_icon
|
|
12
|
+
def render_download_icon(title = nil)
|
|
13
13
|
if title.nil?
|
|
14
|
-
link_to download_image_tag, sufia.download_path(@generic_file),
|
|
14
|
+
link_to download_image_tag, sufia.download_path(@generic_file), target: "_blank", title: "Download the document", id: "file_download", data: { label: @generic_file.id }
|
|
15
15
|
else
|
|
16
|
-
|
|
16
|
+
label = download_image_tag(title) + title
|
|
17
|
+
link_to label, sufia.download_path(@generic_file), target: "_blank", title: title, id: "file_download", data: { label: @generic_file.id }
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
def render_download_link
|
|
21
|
-
|
|
21
|
+
def render_download_link(text = nil)
|
|
22
|
+
label = text || 'Download'
|
|
23
|
+
link_to label, sufia.download_path(@generic_file), id: "file_download", target: "_new", data: { label: @generic_file.id }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
def render_collection_list
|
|
25
|
-
unless gf.collections.empty?
|
|
26
|
-
("Is part of: " + gf.collections.map { |c| link_to(c.title, collections.collection_path(c)) }.join(", ")).html_safe
|
|
27
|
-
end
|
|
26
|
+
def render_collection_list(gf)
|
|
27
|
+
("Is part of: " + gf.collections.map { |c| link_to(c.title, collections.collection_path(c)) }.join(", ")).html_safe unless gf.collections.empty?
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def display_multiple
|
|
30
|
+
def display_multiple(value)
|
|
31
31
|
auto_link(value.join(" | "))
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
def download_image_tag(title = nil)
|
|
37
|
+
if title.nil?
|
|
38
|
+
image_tag "default.png", alt: "No preview available", class: "img-responsive"
|
|
39
|
+
else
|
|
40
|
+
image_tag sufia.download_path(@generic_file, file: 'thumbnail'), class: "img-responsive", alt: "#{title} of #{@generic_file.title.first}"
|
|
41
|
+
end
|
|
41
42
|
end
|
|
42
|
-
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
def render_visibility_badge
|
|
45
|
+
if can? :edit, @generic_file
|
|
46
|
+
render_visibility_link @generic_file
|
|
47
|
+
else
|
|
48
|
+
render_visibility_label @generic_file
|
|
49
|
+
end
|
|
49
50
|
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
51
|
end
|
|
@@ -4,24 +4,23 @@ module Sufia
|
|
|
4
4
|
false
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
-
def url_for_document
|
|
8
|
-
if
|
|
7
|
+
def url_for_document(doc, _options = {})
|
|
8
|
+
if doc.is_a?(SolrDocument) && doc.hydra_model == 'Collection'
|
|
9
9
|
[collections, doc]
|
|
10
10
|
else
|
|
11
11
|
[sufia, doc]
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
def render_constraints_query(localized_params = params)
|
|
16
16
|
# So simple don't need a view template, we can just do it here.
|
|
17
17
|
scope = localized_params.delete(:route_set) || self
|
|
18
18
|
return "".html_safe if localized_params[:q].blank?
|
|
19
19
|
|
|
20
20
|
render_constraint_element(constraint_query_label(localized_params),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
localized_params[:q],
|
|
22
|
+
classes: ["query"],
|
|
23
|
+
remove: scope.url_for(localized_params.merge(q: nil, action: 'index')))
|
|
24
24
|
end
|
|
25
|
-
|
|
26
25
|
end
|
|
27
26
|
end
|
|
@@ -20,7 +20,7 @@ module Sufia
|
|
|
20
20
|
if @activity.empty?
|
|
21
21
|
t('sufia.dashboard.no_activity')
|
|
22
22
|
else
|
|
23
|
-
render partial: 'users/activity_log', locals: {events: @activity}
|
|
23
|
+
render partial: 'users/activity_log', locals: { events: @activity }
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -40,11 +40,11 @@ module Sufia
|
|
|
40
40
|
params[:controller].match(/^my\/files/)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def number_of_files
|
|
43
|
+
def number_of_files(user = current_user)
|
|
44
44
|
::GenericFile.where(Solrizer.solr_name('depositor', :symbol) => user.user_key).count
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def number_of_collections
|
|
47
|
+
def number_of_collections(user = current_user)
|
|
48
48
|
::Collection.where(Solrizer.solr_name('depositor', :symbol) => user.user_key).count
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -53,10 +53,7 @@ module Sufia
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def link_to_additional_notifications
|
|
56
|
-
if @notifications.count > Sufia.config.max_notifications_for_dashboard
|
|
57
|
-
link_to t('sufia.dashboard.additional_notifications'), sufia.notifications_path
|
|
58
|
-
end
|
|
56
|
+
link_to t('sufia.dashboard.additional_notifications'), sufia.notifications_path if @notifications.count > Sufia.config.max_notifications_for_dashboard
|
|
59
57
|
end
|
|
60
|
-
|
|
61
58
|
end
|
|
62
59
|
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module Sufia
|
|
2
2
|
module PermissionsHelper
|
|
3
|
-
|
|
4
3
|
def visibility_help
|
|
5
4
|
help_link('generic_files/visibility', 'Visibility', 'Useage information for visibility')
|
|
6
5
|
end
|
|
@@ -12,8 +11,8 @@ module Sufia
|
|
|
12
11
|
private
|
|
13
12
|
|
|
14
13
|
def help_link(file, title, aria_label)
|
|
15
|
-
link_to help_icon, '#', rel: 'popover',
|
|
16
|
-
|
|
14
|
+
link_to help_icon, '#', rel: 'popover', 'data-content' => capture_content(file),
|
|
15
|
+
'data-original-title' => title, 'aria-label' => aria_label
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
def capture_content(file)
|
|
@@ -23,7 +22,7 @@ module Sufia
|
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
def help_icon
|
|
26
|
-
content_tag 'i', '',
|
|
25
|
+
content_tag 'i', '', 'aria-hidden' => true, class: 'help-icon'
|
|
27
26
|
end
|
|
28
27
|
end
|
|
29
28
|
end
|