sufia 3.7.2 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +3 -0
- data/README.md +88 -11
- data/SUFIA_VERSION +1 -1
- data/app/assets/images/old_main_tulips.jpg +0 -0
- data/app/assets/javascripts/contact_form.js +0 -16
- data/app/assets/javascripts/jquery.blacklightTagCloud.js +44 -0
- data/app/assets/javascripts/jquery.tagcloud.js +116 -0
- data/app/assets/javascripts/jquery.tinysort.min.js +7 -0
- data/app/assets/javascripts/sufia.js +41 -44
- data/app/assets/javascripts/sufia/edit_metadata.js +1 -1
- data/app/assets/javascripts/sufia/editor.js +12 -0
- data/app/assets/javascripts/sufia/featured_works.js +64 -0
- data/app/assets/javascripts/sufia/fileupload.js +1 -1
- data/app/assets/javascripts/sufia/multiForm.js +1 -1
- data/app/assets/javascripts/sufia/permissions.js +4 -8
- data/app/assets/javascripts/sufia/single_use_link.js +1 -2
- data/app/assets/javascripts/sufia/trophy.js +42 -27
- data/app/assets/javascripts/terms_of_service.js +1 -1
- data/app/assets/stylesheets/dashboard.css.scss +81 -40
- data/app/assets/stylesheets/featured.css.scss +16 -0
- data/app/assets/stylesheets/fileupload/{jquery.fileupload-ui.css → jquery.fileupload-ui.css.erb} +2 -2
- data/app/assets/stylesheets/{generic_files.css → generic_files.css.erb} +6 -7
- data/app/assets/stylesheets/header.css.scss +93 -0
- data/app/assets/stylesheets/home-page.css.scss +50 -0
- data/app/assets/stylesheets/nestable.css.scss +111 -0
- data/app/assets/stylesheets/styles.css.scss +106 -0
- data/app/assets/stylesheets/sufia.css.scss +13 -8
- data/app/assets/stylesheets/tagcloud.css +83 -0
- data/app/assets/stylesheets/usage-stats.css +30 -0
- data/app/controllers/batch_controller.rb +0 -1
- data/app/controllers/concerns/sufia/catalog.rb +64 -0
- data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +16 -13
- data/app/controllers/content_blocks_controller.rb +8 -0
- data/app/controllers/featured_work_lists_controller.rb +16 -0
- data/app/controllers/featured_works_controller.rb +26 -0
- data/app/controllers/mailbox_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +7 -0
- data/app/controllers/single_use_links_viewer_controller.rb +2 -5
- data/app/controllers/tinymce_assets_controller.rb +12 -0
- data/app/helpers/content_block_helper.rb +21 -0
- data/app/helpers/generic_file_helper.rb +2 -2
- data/app/helpers/sufia_helper.rb +8 -4
- data/app/helpers/trophy_helper.rb +15 -7
- data/app/models/content_block.rb +2 -0
- data/app/models/featured_work_list.rb +42 -0
- data/app/models/tinymce_asset.rb +3 -0
- data/app/uploaders/tinymce_asset_uploader.rb +51 -0
- data/app/views/_add_assets_links.html.erb +0 -16
- data/app/views/_controls.html.erb +17 -0
- data/app/views/_flash_msg.html.erb +2 -18
- data/app/views/_footer.html.erb +10 -15
- data/app/views/_ga.html.erb +0 -16
- data/app/views/_logo.html.erb +2 -2
- data/app/views/_masthead.html.erb +9 -36
- data/app/views/_user_util_links.html.erb +16 -11
- data/app/views/advanced/_advanced_search_facets.html.erb +0 -16
- data/app/views/advanced/_advanced_search_fields.html.erb +0 -16
- data/app/views/advanced/_advanced_search_help.html.erb +0 -16
- data/app/views/advanced/_facet_layout.html.erb +0 -16
- data/app/views/advanced/_facet_limit.html.erb +0 -16
- data/app/views/advanced/index.html.erb +2 -18
- data/app/views/batch/_metadata.html.erb +3 -3
- data/app/views/batch/edit.html.erb +4 -21
- data/app/views/catalog/_facet_limit.html.erb +11 -12
- data/app/views/catalog/_featured_researcher.html.erb +2 -0
- data/app/views/catalog/_home.html.erb +6 -2
- data/app/views/catalog/_home_content.html.erb +36 -0
- data/app/views/catalog/_home_header.html.erb +15 -0
- data/app/views/catalog/_recent_document.html.erb +1 -1
- data/app/views/catalog/_recents.html.erb +3 -4
- data/app/views/catalog/_search_form.html.erb +13 -9
- data/app/views/catalog/_tagcloud.html.erb +7 -0
- data/app/views/catalog/index.html.erb +4 -10
- data/app/views/contact_form/create.html.erb +0 -16
- data/app/views/contact_form/new.html.erb +0 -16
- data/app/views/dashboard/_constraints.html.erb +3 -19
- data/app/views/dashboard/_did_you_mean.html.erb +0 -16
- data/app/views/dashboard/_document_list.html.erb +0 -16
- data/app/views/dashboard/_facet_layout.html.erb +1 -17
- data/app/views/dashboard/_facet_limit.html.erb +5 -5
- data/app/views/dashboard/_facet_selected.html.erb +1 -17
- data/app/views/dashboard/_facets.html.erb +0 -18
- data/app/views/dashboard/_heading.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_default_group.html.erb +7 -23
- data/app/views/dashboard/_index_partials/_list_files.html.erb +62 -57
- data/app/views/dashboard/_search_form.html.erb +10 -7
- data/app/views/dashboard/_show_partials/_default.html.erb +0 -18
- data/app/views/dashboard/_show_partials/_default_details.html.erb +0 -16
- data/app/views/dashboard/_show_partials/_facets.html.erb +0 -16
- data/app/views/dashboard/_sort_and_per_page.html.erb +10 -9
- data/app/views/dashboard/facet.html.erb +4 -19
- data/app/views/dashboard/index.html.erb +27 -49
- data/app/views/error/401.html.erb +1 -17
- data/app/views/error/404.html.erb +0 -16
- data/app/views/error/500.html.erb +0 -16
- data/app/views/error/single_use_error.html.erb +1 -17
- data/app/views/generic_files/_asset_deleted_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_permissions_denial_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_saved_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_updated_flash.html.erb +0 -16
- data/app/views/generic_files/_breadcrumbs.html.erb +0 -16
- data/app/views/generic_files/_browse_everything.html.erb +24 -0
- data/app/views/generic_files/_descriptions.html.erb +1 -1
- data/app/views/generic_files/_field_form.html.erb +5 -5
- data/app/views/generic_files/_media_display.html.erb +3 -3
- data/app/views/generic_files/_permission_form.html.erb +5 -5
- data/app/views/generic_files/_rights_modal.html.erb +13 -29
- data/app/views/generic_files/_show_actions.html.erb +13 -1
- data/app/views/generic_files/_versioning.html.erb +14 -10
- data/app/views/generic_files/citation.html.erb +0 -16
- data/app/views/generic_files/edit.html.erb +10 -12
- data/app/views/generic_files/edit_fields/_default.html.erb +1 -1
- data/app/views/generic_files/edit_fields/_description.html.erb +1 -1
- data/app/views/generic_files/edit_fields/_resource_type.html.erb +2 -3
- data/app/views/generic_files/edit_fields/_rights.html.erb +1 -1
- data/app/views/generic_files/new.html.erb +11 -26
- data/app/views/generic_files/show.html.erb +7 -25
- data/app/views/generic_files/stats.html.erb +141 -0
- data/app/views/homepage/_featured.html.erb +11 -0
- data/app/views/homepage/_featured_fields.html.erb +18 -0
- data/app/views/homepage/_featured_works.html.erb +17 -0
- data/app/views/homepage/_sortable_featured.html.erb +26 -0
- data/app/views/layouts/_head_tag_content.html.erb +1 -1
- data/app/views/layouts/_homepage_sidebar2.html.erb +14 -0
- data/app/views/layouts/error.html.erb +3 -21
- data/app/views/layouts/homepage.html.erb +8 -37
- data/app/views/layouts/sufia-dashboard.html.erb +46 -0
- data/app/views/layouts/sufia-one-column.html.erb +8 -24
- data/app/views/layouts/sufia-two-column.html.erb +9 -8
- data/app/views/pages/show.html.erb +4 -0
- data/app/views/single_use_links_viewer/show.html.erb +2 -2
- data/app/views/static/agreement.html.erb +0 -17
- data/app/views/static/help.html.erb +0 -17
- data/app/views/static/mendeley.html.erb +0 -16
- data/app/views/static/subject_libraries.html.erb +0 -17
- data/app/views/static/terms.html.erb +0 -16
- data/app/views/static/zotero.html.erb +0 -16
- data/app/views/users/_activity_log.html.erb +2 -2
- data/app/views/users/_contributions.html.erb +6 -2
- data/app/views/users/_follower_modal.html.erb +2 -2
- data/app/views/users/_following_modal.html.erb +2 -2
- data/app/views/users/_left_sidebar.html.erb +1 -1
- data/app/views/users/_notify_link.html.erb +1 -1
- data/app/views/users/_notify_number.html.erb +1 -1
- data/app/views/users/_profile_actions.html.erb +3 -3
- data/app/views/users/_profile_tabs.html.erb +1 -1
- data/app/views/users/_search_form.html.erb +3 -2
- data/app/views/users/_social_media_info.html.erb +3 -3
- data/app/views/users/_trophy_edit.html.erb +2 -2
- data/app/views/users/_user_info.html.erb +27 -27
- data/app/views/users/_vitals.html.erb +2 -2
- data/app/views/users/edit.html.erb +39 -39
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +7 -9
- data/config/locales/sufia.en.yml +15 -7
- data/config/routes.rb +12 -9
- data/lib/generators/sufia/sufia_generator.rb +18 -15
- data/lib/generators/sufia/templates/catalog_controller.rb +11 -73
- data/lib/generators/sufia/templates/config/tinymce.yml +7 -0
- data/lib/sufia.rb +7 -0
- data/lib/sufia/downloads_controller_behavior.rb +3 -4
- data/lib/sufia/files_controller_behavior.rb +38 -27
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/batch_controller_spec.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +5 -5
- data/spec/controllers/catalog_controller_spec.rb +37 -58
- data/spec/controllers/content_blocks_controller_spec.rb +37 -0
- data/spec/controllers/downloads_controller_spec.rb +3 -11
- data/spec/controllers/featured_work_lists_controller_spec.rb +20 -0
- data/spec/controllers/featured_works_controller_spec.rb +50 -0
- data/spec/controllers/generic_files_controller_spec.rb +74 -9
- data/spec/controllers/mailbox_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +25 -0
- data/spec/controllers/single_use_links_controller_spec.rb +1 -1
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -1
- data/spec/controllers/tinymce_assets_controller_spec.rb +39 -0
- data/spec/controllers/users_controller_spec.rb +3 -8
- data/spec/factories/content_blocks.rb +4 -0
- data/spec/factories/featured_works.rb +4 -0
- data/spec/factories/generic_files.rb +46 -39
- data/spec/factories/users.rb +18 -18
- data/spec/features/browse_dashboard_files_spec.rb +6 -7
- data/spec/features/browse_files_spec.rb +9 -6
- data/spec/features/cloud_upload_spec.rb +18 -0
- data/spec/features/single_use_links_spec.rb +2 -3
- data/spec/helpers/content_block_helper_spec.rb +31 -0
- data/spec/helpers/generic_file_helper_spec.rb +3 -3
- data/spec/helpers/sufia_helper_spec.rb +13 -81
- data/spec/helpers/trophy_helper_spec.rb +39 -0
- data/spec/jobs/import_url_job_spec.rb +1 -1
- data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
- data/spec/lib/sufia/usage_statistics_spec.rb +75 -0
- data/spec/models/ability_spec.rb +31 -0
- data/spec/models/active_fedora_pid_based_job_spec.rb +1 -1
- data/spec/models/audit_job_spec.rb +1 -1
- data/spec/models/batch_spec.rb +1 -1
- data/spec/models/batch_update_job_spec.rb +1 -1
- data/spec/models/event_jobs_spec.rb +1 -1
- data/spec/models/featured_work_list_spec.rb +23 -0
- data/spec/models/featured_work_spec.rb +42 -0
- data/spec/models/fits_datastream_spec.rb +2 -2
- data/spec/models/generic_file/reload_on_save_spec.rb +1 -1
- data/spec/models/generic_file/web_form_spec.rb +4 -4
- data/spec/models/generic_file_spec.rb +41 -40
- data/spec/models/pageview.rb +19 -0
- data/spec/models/properties_datastream_spec.rb +2 -2
- data/spec/models/solr_document_spec.rb +9 -0
- data/spec/models/user_spec.rb +2 -2
- data/spec/routing/featured_works_route_spec.rb +16 -0
- data/spec/routing/route_spec.rb +10 -15
- data/spec/spec_helper.rb +3 -0
- data/spec/support/lib/generators/test_app_generator.rb +19 -8
- data/spec/views/dashboard/facet_limit.html.erb_spec.rb +2 -2
- data/spec/views/generic_file/show.html.erb_spec.rb +44 -0
- data/spec/views/generic_file/stats.html.erb_spec.rb +47 -0
- data/spec/views/users/_follower_modal.html.erb_spec.rb +18 -0
- data/spec/views/users/_following_modal.html.erb_spec.rb +18 -0
- data/spec/views/users/index.html.erb_spec.rb +1 -1
- data/sufia-models/app/models/batch.rb +1 -1
- data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +30 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +1 -1
- data/sufia-models/app/models/datastreams/batch_rdf_datastream.rb +4 -7
- data/sufia-models/app/models/datastreams/fits_datastream.rb +3 -0
- data/sufia-models/app/models/datastreams/generic_file_rdf_datastream.rb +53 -51
- data/sufia-models/app/models/datastreams/properties_datastream.rb +1 -15
- data/sufia-models/app/models/featured_work.rb +22 -0
- data/sufia-models/app/models/sufia/pageview.rb +9 -0
- data/sufia-models/{lib/sufia/models → app/services/sufia}/id_service.rb +0 -0
- data/sufia-models/{lib/sufia/models → app/services/sufia}/noid.rb +0 -0
- data/sufia-models/app/services/sufia/usage_statistics.rb +73 -0
- data/sufia-models/config/locales/sufia.en.yml +3 -4
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +23 -8
- data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +9 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +6 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +11 -2
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +10 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +12 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +8 -0
- data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +19 -0
- data/sufia-models/lib/sufia/ability.rb +34 -0
- data/sufia-models/lib/sufia/models/engine.rb +5 -3
- data/sufia-models/lib/sufia/models/generic_file.rb +4 -2
- data/sufia-models/lib/sufia/models/generic_file/export.rb +3 -3
- data/sufia-models/lib/sufia/models/generic_file/featured.rb +14 -0
- data/sufia-models/lib/sufia/models/solr_document_behavior.rb +11 -4
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/sufia-models.gemspec +6 -5
- data/sufia.gemspec +6 -4
- data/tasks/release.rake +1 -0
- data/tasks/sufia-dev.rake +5 -1
- data/vendor/assets/javascripts/flot/excanvas.js +1428 -0
- data/vendor/assets/javascripts/flot/jquery.flot.js +3137 -0
- data/vendor/assets/javascripts/flot/jquery.flot.selection.js +360 -0
- data/vendor/assets/javascripts/flot/jquery.flot.time.js +431 -0
- data/vendor/assets/javascripts/nestable.js +647 -0
- data/vendor/assets/javascripts/video.js +135 -126
- data/{app → vendor}/assets/stylesheets/video-js.css.erb +7 -6
- metadata +155 -33
- data/app/assets/stylesheets/application-bootstrap.css.erb +0 -295
- data/app/assets/stylesheets/audio-js.css +0 -3
- data/app/assets/stylesheets/blacklight_more_facets.css +0 -427
- data/app/assets/stylesheets/bootstrap.min.css.erb +0 -1433
- data/app/assets/stylesheets/contact_form.css +0 -4
- data/app/assets/stylesheets/reset_body.css +0 -4
- data/app/assets/stylesheets/trophy.css +0 -7
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +0 -84
- data/app/helpers/facets_helper.rb +0 -3
- data/app/helpers/sufia/facets_helper_behavior.rb +0 -23
- data/app/views/catalog/_home_text.html.erb +0 -10
- data/app/views/generic_files/_dropbox_import.html.erb +0 -3
- data/app/views/generic_files/upload/_dropbox_chooser.html.erb +0 -39
- data/app/views/static/about.html.erb +0 -21
- data/spec/helpers/render_constraints_helper_behavior_spec.rb +0 -42
@@ -0,0 +1,30 @@
|
|
1
|
+
/*
|
2
|
+
* For usage statistics
|
3
|
+
*/
|
4
|
+
|
5
|
+
.stats-container {
|
6
|
+
box-sizing: border-box;
|
7
|
+
width: 850px;
|
8
|
+
height: 450px;
|
9
|
+
padding: 20px 15px 15px 15px;
|
10
|
+
margin: 15px auto 30px auto;
|
11
|
+
border: 1px solid #ddd;
|
12
|
+
background: #fff;
|
13
|
+
background: linear-gradient(#f6f6f6 0, #fff 50px);
|
14
|
+
background: -o-linear-gradient(#f6f6f6 0, #fff 50px);
|
15
|
+
background: -ms-linear-gradient(#f6f6f6 0, #fff 50px);
|
16
|
+
background: -moz-linear-gradient(#f6f6f6 0, #fff 50px);
|
17
|
+
background: -webkit-linear-gradient(#f6f6f6 0, #fff 50px);
|
18
|
+
box-shadow: 0 3px 10px rgba(0,0,0,0.15);
|
19
|
+
-o-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
|
20
|
+
-ms-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
|
21
|
+
-moz-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
|
22
|
+
-webkit-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
|
23
|
+
}
|
24
|
+
|
25
|
+
.stats-placeholder {
|
26
|
+
width: 100%;
|
27
|
+
height: 100%;
|
28
|
+
font-size: 14px;
|
29
|
+
line-height: 1.2em;
|
30
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Sufia
|
2
|
+
module Catalog
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
self.solr_search_params_logic += [:only_generic_files]
|
6
|
+
end
|
7
|
+
|
8
|
+
def index
|
9
|
+
setup_front_page unless has_search_parameters?
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
def setup_front_page
|
15
|
+
@featured_researcher = ContentBlock.find_or_create_by(name: 'featured_researcher')
|
16
|
+
@featured_work_list = FeaturedWorkList.new
|
17
|
+
recent
|
18
|
+
recent_me # also grab my recent docs too
|
19
|
+
end
|
20
|
+
|
21
|
+
def recent
|
22
|
+
if user_signed_in?
|
23
|
+
# grab other people's documents
|
24
|
+
(_, @recent_documents) = get_search_results(:q =>filter_not_mine,
|
25
|
+
:sort=>sort_field, :rows=>4)
|
26
|
+
else
|
27
|
+
# grab any documents we do not know who you are
|
28
|
+
(_, @recent_documents) = get_search_results(:q =>'', :sort=>sort_field, :rows=>4)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def recent_me
|
33
|
+
if user_signed_in?
|
34
|
+
(_, @recent_user_documents) = get_search_results(:q =>filter_mine,
|
35
|
+
:sort=>sort_field, :rows=>4)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def filter_not_mine
|
40
|
+
"{!lucene q.op=AND df=#{depositor}}-#{current_user.user_key}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def filter_mine
|
44
|
+
"{!lucene q.op=AND df=#{depositor}}#{current_user.user_key}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def depositor
|
48
|
+
Solrizer.solr_name('depositor', :stored_searchable, type: :string)
|
49
|
+
end
|
50
|
+
|
51
|
+
def sort_field
|
52
|
+
"#{Solrizer.solr_name('system_create', :sortable)} desc"
|
53
|
+
end
|
54
|
+
|
55
|
+
# Limits search results just to GenericFiles
|
56
|
+
# @param solr_parameters the current solr parameters
|
57
|
+
# @param user_parameters the current user-subitted parameters
|
58
|
+
def only_generic_files(solr_parameters, user_parameters)
|
59
|
+
solr_parameters[:fq] ||= []
|
60
|
+
solr_parameters[:fq] << "#{Solrizer.solr_name("has_model", :symbol)}:\"info:fedora/afmodel:GenericFile\""
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -7,24 +7,22 @@ module Sufia
|
|
7
7
|
include Blacklight::Catalog
|
8
8
|
|
9
9
|
included do
|
10
|
-
include Blacklight::Configurable
|
10
|
+
include Blacklight::Configurable
|
11
11
|
include ActionView::Helpers::DateHelper
|
12
|
-
|
12
|
+
|
13
13
|
self.copy_blacklight_config_from(CatalogController)
|
14
14
|
|
15
15
|
include BlacklightAdvancedSearch::ParseBasicQ
|
16
16
|
include BlacklightAdvancedSearch::Controller
|
17
|
-
|
18
|
-
|
17
|
+
|
19
18
|
before_filter :authenticate_user!
|
20
19
|
before_filter :enforce_show_permissions, :only=>:show
|
21
20
|
before_filter :enforce_viewing_context_for_show_requests, :only=>:show
|
22
|
-
|
21
|
+
|
23
22
|
# This applies appropriate access controls to all solr queries (the internal method of this is overidden bellow to only include edit files)
|
24
23
|
self.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
25
|
-
# This filters out objects that you want to exclude from search results, like FileAssets
|
26
|
-
self.solr_search_params_logic += [:exclude_unwanted_models]
|
27
24
|
|
25
|
+
layout 'sufia-dashboard'
|
28
26
|
end
|
29
27
|
|
30
28
|
def index
|
@@ -33,13 +31,13 @@ module Sufia
|
|
33
31
|
@events = @user.events(100)
|
34
32
|
@last_event_timestamp = @user.events.first[:timestamp].to_i || 0 rescue 0
|
35
33
|
@filters = params[:f] || []
|
36
|
-
|
34
|
+
|
37
35
|
respond_to do |format|
|
38
36
|
format.html { }
|
39
37
|
format.rss { render :layout => false }
|
40
38
|
format.atom { render :layout => false }
|
41
39
|
end
|
42
|
-
|
40
|
+
|
43
41
|
# set up some parameters for allowing the batch controls to show appropiately
|
44
42
|
@max_batch_size = 80
|
45
43
|
count_on_page = @document_list.count {|doc| batch.index(doc.id)}
|
@@ -50,9 +48,9 @@ module Sufia
|
|
50
48
|
@all_checked = (count_on_page == @document_list.count)
|
51
49
|
@entire_result_set_selected = @response.response["numFound"] == batch_size
|
52
50
|
@batch_size_on_other_page = batch_size - count_on_page
|
53
|
-
@batch_part_on_other_page = (@batch_size_on_other_page) > 0
|
51
|
+
@batch_part_on_other_page = (@batch_size_on_other_page) > 0
|
54
52
|
end
|
55
|
-
|
53
|
+
|
56
54
|
def activity
|
57
55
|
# reverse events since we're prepending rows. without reverse, old events wind up first
|
58
56
|
events = current_user.events.reverse
|
@@ -61,13 +59,18 @@ module Sufia
|
|
61
59
|
# return the event, a formatted date string, and a numerical timestamp
|
62
60
|
render :json => events.map { |event| [event[:action], "#{time_ago_in_words(Time.at(event[:timestamp].to_i))} ago", event[:timestamp].to_i] }
|
63
61
|
rescue
|
64
|
-
render :json => []
|
62
|
+
render :json => []
|
63
|
+
end
|
64
|
+
|
65
|
+
def search_action_url *args
|
66
|
+
sufia.dashboard_index_path *args
|
65
67
|
end
|
66
|
-
|
68
|
+
|
67
69
|
protected
|
68
70
|
# show only files with edit permissions in lib/hydra/access_controls_enforcement.rb apply_gated_discovery
|
69
71
|
def discovery_permissions
|
70
72
|
["edit"]
|
71
73
|
end
|
74
|
+
|
72
75
|
end
|
73
76
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class FeaturedWorkListsController < ApplicationController
|
2
|
+
def create
|
3
|
+
authorize! :update, FeaturedWork
|
4
|
+
FeaturedWorkList.new.featured_works_attributes = list_params[:featured_works_attributes]
|
5
|
+
respond_to do |format|
|
6
|
+
format.html { redirect_to root_path }
|
7
|
+
format.json { head :no_content }
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
def list_params
|
13
|
+
params.require(:featured_work_list).permit(:featured_works_attributes => [:id, :order])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class FeaturedWorksController < ApplicationController
|
2
|
+
|
3
|
+
def create
|
4
|
+
authorize! :create, FeaturedWork
|
5
|
+
@featured_work = FeaturedWork.new(generic_file_id: params[:id])
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
if @featured_work.save
|
9
|
+
format.json { render json: @featured_work, status: :created }
|
10
|
+
else
|
11
|
+
format.json { render json: @featured_work.errors, status: :unprocessable_entity }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
authorize! :destroy, FeaturedWork
|
18
|
+
@featured_work = FeaturedWork.find_by(generic_file_id: params[:id])
|
19
|
+
@featured_work.destroy
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.json { head :no_content }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -20,7 +20,7 @@ class MailboxController < ApplicationController
|
|
20
20
|
|
21
21
|
def destroy
|
22
22
|
if current_user
|
23
|
-
msg = Conversation.find(params[:id])
|
23
|
+
msg = Mailboxer::Conversation.find(params[:id])
|
24
24
|
if (msg.participants[0] == current_user) || (msg.participants[1] == current_user)
|
25
25
|
delete_message(msg)
|
26
26
|
empty_trash(msg.participants[0])
|
@@ -7,8 +7,6 @@ class SingleUseLinksViewerController < ApplicationController
|
|
7
7
|
skip_filter :normalize_identifier
|
8
8
|
skip_before_filter :load_datastream, :except => :download
|
9
9
|
|
10
|
-
before_filter :authorize_single_use_link!
|
11
|
-
|
12
10
|
class Ability
|
13
11
|
include CanCan::Ability
|
14
12
|
|
@@ -31,11 +29,10 @@ class SingleUseLinksViewerController < ApplicationController
|
|
31
29
|
rescue_from CanCan::AccessDenied, :with => :render_single_use_error
|
32
30
|
rescue_from ActiveRecord::RecordNotFound, :with => :render_single_use_error
|
33
31
|
|
34
|
-
|
35
32
|
def download
|
36
33
|
# send the data content
|
37
34
|
raise not_found_exception unless single_use_link.path == sufia.download_path(:id => @asset)
|
38
|
-
send_content
|
35
|
+
send_content
|
39
36
|
end
|
40
37
|
|
41
38
|
def show
|
@@ -51,7 +48,7 @@ class SingleUseLinksViewerController < ApplicationController
|
|
51
48
|
|
52
49
|
protected
|
53
50
|
|
54
|
-
def
|
51
|
+
def authorize_download!
|
55
52
|
authorize! :read, @asset
|
56
53
|
end
|
57
54
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ContentBlockHelper
|
2
|
+
|
3
|
+
def editable_content_block(content_block)
|
4
|
+
return raw(content_block.value) unless can? :update, content_block
|
5
|
+
capture do
|
6
|
+
concat content_tag(:div, id: dom_id(content_block, 'preview')) {
|
7
|
+
concat raw(content_block.value)
|
8
|
+
concat button_tag "Edit", class: "btn btn-primary", data: {
|
9
|
+
behavior: 'reveal-editor', target: '#' + dom_id(content_block, 'edit')
|
10
|
+
}
|
11
|
+
}
|
12
|
+
concat form_for([sufia, content_block] ) { |f|
|
13
|
+
concat f.text_area :value, class: "tinymce", rows: 20, cols: 120
|
14
|
+
concat f.submit 'Save', class: "btn btn-primary"
|
15
|
+
}
|
16
|
+
|
17
|
+
concat tinymce_assets
|
18
|
+
concat tinymce
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,7 +16,7 @@ module GenericFileHelper
|
|
16
16
|
link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover',
|
17
17
|
'data-content' => metadata_help(key),
|
18
18
|
'data-original-title' => get_label(key) do
|
19
|
-
content_tag 'i', '', class: "
|
19
|
+
content_tag 'i', '', class: "glyphicon glyphicon-question-sign icon-large"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -75,7 +75,7 @@ module GenericFileHelper
|
|
75
75
|
# TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
|
76
76
|
content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do
|
77
77
|
(symbol +
|
78
|
-
content_tag('span', class: '
|
78
|
+
content_tag('span', class: 'sr-only') do
|
79
79
|
"add another #{key.to_s}"
|
80
80
|
end).html_safe
|
81
81
|
end
|
data/app/helpers/sufia_helper.rb
CHANGED
@@ -32,10 +32,14 @@ module SufiaHelper
|
|
32
32
|
link_to(field, add_facet_params(field_string, field).merge!({"controller" => "catalog", :action=> "index"}))
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
# @param values [Array] The values to display
|
36
|
+
# @param solr_field [String] The name of the solr field to link to without its suffix (:facetable)
|
37
|
+
# @param empty_message [String] ('No value entered') The message to display if no values are passed in.
|
38
|
+
# @param separator [String] (', ') The value to join with.
|
39
|
+
def link_to_facet_list(values, solr_field, empty_message="No value entered", separator=", ")
|
40
|
+
return empty_message if values.blank?
|
41
|
+
facet_field = Solrizer.solr_name(solr_field, :facetable)
|
42
|
+
safe_join(values.map{ |item| link_to_facet(item, facet_field) }, separator)
|
39
43
|
end
|
40
44
|
|
41
45
|
|
@@ -1,12 +1,20 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module TrophyHelper
|
3
|
-
def display_trophy_link(user, noid)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
def display_trophy_link(user, noid, args={}, &block)
|
4
|
+
trophy = user.trophies.where(generic_file_id: noid).first
|
5
|
+
trophyclass = trophy ? "trophy-on" : "trophy-off"
|
6
|
+
|
7
|
+
args[:add_text] ||= "Highlight File on Profile"
|
8
|
+
args[:remove_text] ||= "Unhighlight File"
|
9
|
+
text = trophy ? args[:remove_text] : args[:add_text]
|
10
|
+
args[:class] = [args[:class], "trophy-class #{trophyclass}"].compact.join(' ')
|
11
|
+
args[:data] ||= {}
|
12
|
+
args[:data]['add-text'] = args[:add_text]
|
13
|
+
args[:data]['remove-text'] = args[:remove_text]
|
9
14
|
|
10
|
-
|
15
|
+
args[:data][:url] = sufia.trophy_profile_path(user, file_id: noid)
|
16
|
+
link_to '#', class: args[:class], data: args[:data] do
|
17
|
+
yield(text)
|
18
|
+
end
|
11
19
|
end
|
12
20
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class FeaturedWorkList
|
2
|
+
include ActiveModel::Model
|
3
|
+
|
4
|
+
def featured_works_attributes=(attributes_collection)
|
5
|
+
attributes_collection = attributes_collection.sort_by { |i, _| i.to_i }.map { |_, attributes| attributes } if attributes_collection.is_a? Hash
|
6
|
+
attributes_collection.each do |attributes|
|
7
|
+
attributes = attributes.with_indifferent_access
|
8
|
+
raise "Missing id" if attributes['id'].blank?
|
9
|
+
existing_record = FeaturedWork.find(attributes['id'])
|
10
|
+
existing_record.update(attributes.except('id'))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
delegate :query, :construct_query_for_pids, to: ActiveFedora::SolrService
|
15
|
+
|
16
|
+
def featured_works
|
17
|
+
return @works if @works
|
18
|
+
@works = FeaturedWork.all
|
19
|
+
add_solr_document_to_works
|
20
|
+
@works
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def add_solr_document_to_works
|
25
|
+
solr_docs.each do |doc|
|
26
|
+
work_with_pid(doc['id']).generic_file_solr_document = SolrDocument.new(doc)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def pids
|
31
|
+
@works.pluck(:generic_file_id).map { |noid| Sufia::Noid.namespaceize(noid) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def solr_docs
|
35
|
+
query(construct_query_for_pids(pids))
|
36
|
+
end
|
37
|
+
|
38
|
+
def work_with_pid(pid)
|
39
|
+
@works.find { |w| Sufia::Noid.namespaceize(w.generic_file_id) == pid}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|