Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jazairi committed Oct 25, 2023
1 parent 1005e23 commit 937f46f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/transfer/_welcome_maintenance.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="well maintenance-message">
<% if ENV.fetch('MAINTENANCE_MESSAGE_TRANSFER', false) %>
<h4 class="hd-5"><%= ENV['MAINTENANCE_MESSAGE_TRANSFER'].to_s %></h4>
<h4 class="hd-5"><%= ENV['MAINTENANCE_MESSAGE_TRANSFER'].html_safe %></h4>
<% else %>
<h4 class="hd-5">The transfer tool is temporarily unavailable while the application is under maintenance. Please
contact us at <a href="mailto:mit-theses <mit-theses@mit.edu>" target="_blank">mit-theses@mit.edu</a> with any
Expand Down
2 changes: 1 addition & 1 deletion app/views/transfer/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@
<% if Flipflop.enabled?(:maintenance_mode) %>
<script type="text/javascript">
$(':input').prop('disabled', true);
$('#new_transfer').hide().find(':input').prop('disabled', true);
</script>
<% end %>
11 changes: 11 additions & 0 deletions test/controllers/transfer_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,17 @@ def create_transfer_with_file
assert_select 'input', disabled: true, count: 5
end

test 'form is hidden when app is in maintenance mode' do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:maintenance_mode, true)

sign_in users(:transfer_submitter)
get '/transfer/new'
assert_select 'form', hidden: true, count: 1
assert_select 'textarea', hidden: true, count: 1
assert_select 'input', hidden: true, count: 5
end

test 'maintenance message renders when app is in maintenance mode' do
test_strategy = Flipflop::FeatureSet.current.test!
test_strategy.switch!(:maintenance_mode, true)
Expand Down

0 comments on commit 937f46f

Please sign in to comment.