Change submit button on block edit page when can only revoke
This commit is contained in:
parent
11a7bf7e0e
commit
76736bab4f
4 changed files with 14 additions and 5 deletions
|
@ -21,6 +21,8 @@
|
|||
<%= f.form_group :needs_view do %>
|
||||
<%= f.check_box :needs_view %>
|
||||
<% end %>
|
||||
|
||||
<%= f.primary %>
|
||||
<% else %>
|
||||
<div class="alert alert-info">
|
||||
<% if @user_block.active? %>
|
||||
|
@ -32,7 +34,11 @@
|
|||
|
||||
<%= hidden_field_tag "user_block_period", 0 %>
|
||||
<%= hidden_field_tag "user_block[needs_view]", false %>
|
||||
<% end %>
|
||||
|
||||
<%= f.primary %>
|
||||
<% if @user_block.active? %>
|
||||
<%= f.submit t(".revoke"), :class => "btn btn-danger" %>
|
||||
<% else %>
|
||||
<%= f.primary %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -2943,6 +2943,7 @@ en:
|
|||
title: "Editing block on %{name}"
|
||||
heading_html: "Editing block on %{name}"
|
||||
period: "How long, starting now, the user will be blocked from the API for."
|
||||
revoke: "Revoke block"
|
||||
filter:
|
||||
block_period: "The blocking period must be one of the values selectable in the drop-down list."
|
||||
create:
|
||||
|
|
|
@ -278,9 +278,10 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "textarea#user_block_reason", :count => 1
|
||||
assert_select "select#user_block_period", :count => 0
|
||||
assert_select "input#user_block_needs_view[type='checkbox']", :count => 0
|
||||
assert_select "input[type='submit'][value='Update block']", :count => 0
|
||||
assert_select "input#user_block_period[type='hidden']", :count => 1
|
||||
assert_select "input#user_block_needs_view[type='hidden']", :count => 1
|
||||
assert_select "input[type='submit'][value='Update block']", :count => 1
|
||||
assert_select "input[type='submit'][value='Revoke block']", :count => 1
|
||||
end
|
||||
|
||||
# Login as the block creator
|
||||
|
@ -294,9 +295,10 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_select "textarea#user_block_reason", :count => 1
|
||||
assert_select "select#user_block_period", :count => 1
|
||||
assert_select "input#user_block_needs_view[type='checkbox']", :count => 1
|
||||
assert_select "input[type='submit'][value='Update block']", :count => 1
|
||||
assert_select "input#user_block_period[type='hidden']", :count => 0
|
||||
assert_select "input#user_block_needs_view[type='hidden']", :count => 0
|
||||
assert_select "input[type='submit'][value='Update block']", :count => 1
|
||||
assert_select "input[type='submit'][value='Revoke block']", :count => 0
|
||||
end
|
||||
|
||||
# We should get an error if the user doesn't exist
|
||||
|
|
|
@ -111,7 +111,7 @@ class UserBlocksSystemTest < ApplicationSystemTestCase
|
|||
assert_no_field "Needs view"
|
||||
|
||||
fill_in "Reason", :with => "Revoking 0-hour blocks works"
|
||||
click_on "Update block"
|
||||
click_on "Revoke block"
|
||||
assert_text(/Revoker:\s+#{Regexp.escape other_moderator_user.display_name}/)
|
||||
assert_text(/Status:\s+Ended/)
|
||||
assert_text(/Reason for block:\s+Revoking 0-hour blocks works/)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue