Skip to content
Snippets Groups Projects
Commit 344d0cb2 authored by Johannes Frenzel's avatar Johannes Frenzel
Browse files

Merge branch 'bug_fix/461-accessibility-of-complex-objects' into 'develop'

Fixes for accessibility of complex objects

Closes FDM/rdm-system/antleaf-projectmanagement#461

See merge request !356
parents 606d00f6 7ba86f83
No related branches found
No related tags found
1 merge request!356Fixes for accessibility of complex objects
Pipeline #18840 passed
......@@ -2,21 +2,23 @@ $(document).on('ready', function() {
if ($('#agreementModal').length > 0){
$('#agreementModal').modal('show');
}
let scrollTimeout;
$('#agreementModal .modal-body').on('scroll', function() {
action_buttons = $('#agreementModal .modal-footer > a')
if ($(this)[0].scrollTop + $(this)[0].clientHeight >= $(this)[0].scrollHeight) {
// Enable the buttons when user reaches the bottom
action_buttons.attr('disabled', false);
action_buttons.each(function(){
$(this).attr('href', $(this).data('url'))
})
}
else{
action_buttons.attr('disabled', 'disabled');
action_buttons.attr('href', "javascript:void(0)")
}
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(() => {
if (($(this)[0].scrollTop + $(this)[0].clientHeight + 10) >= $(this)[0].scrollHeight) {
// Enable the buttons when user reaches the bottom
action_buttons.attr('disabled', false);
action_buttons.each(function(){
$(this).attr('href', $(this).data('url'))
})
}
else{
action_buttons.attr('disabled', 'disabled');
action_buttons.attr('href', "javascript:void(0)")
}
}, 500);
});
});
......@@ -4,11 +4,11 @@ module Hyrax
module CrcDatasets
class ComplexModalitiesController < ApplicationController
include ComplexHelper
before_action :set_crc_dataset, except: %i[validate_modality_title]
before_action :set_crc_dataset
before_action :set_complex_session, only: %i[new create validate_modality_title]
before_action :set_complex_modality, only: %i[show edit update]
before_action :check_tombstone, except: %i[validate_modality_title]
before_action :authorize, only: [:new, :edit]
before_action :authorize
with_themed_layout :decide_layout
def new
......@@ -108,10 +108,6 @@ module Hyrax
redirect_to main_app.polymorphic_path(@crc_dataset)
end
end
def authorize
redirect_to main_app.polymorphic_path(@crc_dataset) unless current_user.can?(:edit, @crc_dataset)
end
end
end
end
......@@ -5,11 +5,11 @@ module Hyrax
class ComplexSessionsController < ApplicationController
include HyraxHelper
include ComplexHelper
before_action :set_crc_dataset, except: %i[validate_session_title]
before_action :set_crc_dataset
before_action :set_complex_subject, only: %i[new create validate_session_title]
before_action :set_complex_session, only: %i[show edit update]
before_action :check_tombstone, except: %i[validate_session_title]
before_action :authorize, only: [:new, :edit]
before_action :authorize
with_themed_layout :decide_layout
def new
......@@ -110,10 +110,6 @@ module Hyrax
redirect_to main_app.polymorphic_path(@crc_dataset)
end
end
def authorize
redirect_to main_app.polymorphic_path(@crc_dataset) unless current_user.can?(:edit, @crc_dataset)
end
end
end
end
......@@ -8,7 +8,7 @@ module Hyrax
before_action :set_crc_dataset
before_action :set_complex_subject, only: %i[show edit update]
before_action :check_tombstone, except: %i[validate_subject_title]
before_action :authorize, only: [:new, :edit]
before_action :authorize
with_themed_layout :decide_layout
def new
......@@ -101,10 +101,6 @@ module Hyrax
redirect_to main_app.polymorphic_path(@crc_dataset)
end
end
def authorize
redirect_to main_app.polymorphic_path(@crc_dataset) unless current_user.can?(:edit, @crc_dataset)
end
end
end
end
......@@ -30,4 +30,15 @@ module ComplexHelper
title.sub!(/-s3alias\z/i, '')
title
end
private
def authorize
case action_name
when 'show'
authorize! :show, @crc_dataset
else
authorize! :edit, @crc_dataset
end
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment