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