Skip to content
Snippets Groups Projects
Commit 7ba86f83 authored by Gyan Gupta's avatar Gyan Gupta
Browse files

fixes for accessibility of complex objects

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