Skip to content

Commit

Permalink
AO3-4536 Minor HTML adjustments to email blacklist admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
sarken committed Apr 9, 2016
1 parent 23df5fa commit ef2a2f0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
45 changes: 22 additions & 23 deletions app/views/admin/blacklisted_emails/index.html.erb
@@ -1,57 +1,56 @@
<div class="admin">
<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= t('admin.admin_email_blacklist.index.page_heading', default: "Manage Email Blacklist") %></h2>

<p> <%= ts("Blacklisted email addresses cannot be used in guest comments. They will not affect users who share the same email address or prevent invitations from being sent or used by those email addresses. All emails are stored in a single canonical format and common variants of the same address are not allowed (for instance, foo+whatever@bar.com will not be allowed if foo@bar.com is blacklisted).") %></p>

<ul class="notes">
<li><%= ts("Blacklisted email addresses cannot be used in guest comments.") %></li>
<li><%= ts("They will not affect users who share the same email address or prevent invitations from being sent to or used by those email addresses.") %></li>
<li><%= ts("All emails are stored in a single canonical format and common variants of the same address are not allowed (for instance, foo+whatever@bar.com will not be allowed if foo@bar.com is blacklisted).") %></li>
</ul>
<!--/descriptions-->

<!--main content-->
<h3 class="heading"><%= ts("Add email address to blacklist")%></h3>
<%= form_for(@admin_blacklisted_email) do |f| %>
<h3 class="heading"><%= ts("Add email address to blacklist") %></h3>

<%= form_for(@admin_blacklisted_email, html: { class: "simple post" }) do |f| %>
<%= error_messages_for @admin_blacklisted_email %>
<fieldset>
<p>
<%= f.label :email, ts("Email") %>
<%= f.label :email, ts("Email to add") %>
<%= f.text_field :email %>
<span class="submit actions">
<%= f.submit ts("Add To Blacklist") %>
</span>
<%= f.submit ts("Add To Blacklist") %>
</p>
</fieldset>
<% end %>

<h3 class="heading"><%= ts("Find blacklisted emails")%></h3>

<!-- search form -->
<%= form_tag url_for(controller: "admin/blacklisted_emails", action: "index"), method: :get, class: "search", role: "search" do %>
<%= form_tag url_for(controller: "admin/blacklisted_emails", action: "index"), method: :get, class: "simple search", role: "search" do %>
<fieldset>
<p>
<%= label_tag "query", ts("Find Email") %>
<%= label_tag "query", ts("Email to find") %>
<%= text_field_tag "query", params[:query] %>
<span class="submit actions">
<%= submit_tag ts("Find") %>
</span>
<%= submit_tag ts("Search Blacklist") %>
</p>
</fieldset>
<% end %>

<!-- list of search results -->
<div id="search results">
<% if @admin_blacklisted_emails %>
<% if @admin_blacklisted_emails %>
<div class="results module">
<h3 class="heading"><%= t('admin.blacklist.emails_found', count: @admin_blacklisted_emails.count) %></h3>
<% if @admin_blacklisted_emails.count > 0 %>
<ul class="index group">
<ol class="emails index group">
<% @admin_blacklisted_emails.each do |blacklisted_email| %>
<li>
[<%= link_to "Remove", blacklisted_email, class: "actions", method: :delete %>]
<%= blacklisted_email.email %>
<%= link_to ts("Remove %{email}", email: blacklisted_email.email), blacklisted_email, method: :delete, confirm: ts("Are you sure you want to remove %{email} from the blacklist?", email: blacklisted_email.email) %>
</li>
<% end %>
</ul>
<%= will_paginate @admin_blacklisted_emails %>
<% end %>
<% end %>
</div>
</div>
<% end %>
<!--/content-->
</div>
</div>
5 changes: 2 additions & 3 deletions features/admins/admin_email_blacklist.feature
Expand Up @@ -20,8 +20,8 @@ Scenario: Remove email address from blacklist
Given I am logged in as an admin
And I have blacklisted the address "foo@bar.com"
When I follow "Blacklist"
And I fill in "Find Email" with "bar"
And I press "Find"
And I fill in "Email to find" with "bar"
And I press "Search Blacklist"
Then I should see "email found"
And I should see "foo@bar.com"
When I follow "Remove"
Expand Down Expand Up @@ -58,4 +58,3 @@ Scenario: Blacklisting a user's email should not affect their ability to post co
And I post the work "New Work"
And I post a comment "here's a great comment"
Then I should see "Comment created!"

10 changes: 5 additions & 5 deletions features/step_definitions/admin_steps.rb
Expand Up @@ -369,21 +369,21 @@ def update_settings(settings)
Given(/^I have blacklisted the address for user "([^"]*)"$/) do |user|
visit admin_blacklisted_emails_url
u = User.find_by_login(user)
fill_in("Email", with: u.email)
fill_in("admin_blacklisted_email_email", with: u.email)
click_button("Add To Blacklist")
end

Then(/^the address "([^"]*)" should be in the blacklist$/) do |email|
visit admin_blacklisted_emails_url
fill_in("Find Email", with: email)
click_button("Find")
fill_in("Email to find", with: email)
click_button("Search Blacklist")
assert page.should have_content(email)
end

Then(/^the address "([^"]*)" should not be in the blacklist$/) do |email|
visit admin_blacklisted_emails_url
fill_in("Find Email", with: email)
click_button("Find")
fill_in("Email to find", with: email)
click_button("Search Blacklist")
step %{I should see "0 emails found"}
end

Expand Down
4 changes: 4 additions & 0 deletions public/stylesheets/site/2.0/07-interactions.css
Expand Up @@ -558,6 +558,10 @@ form.simple span.actions {
float: none;
}

.simple input[type="submit"] {
margin: 0;
}

/* WIDGET: TOGGLED FORMS (SHOW/HIDE bookmark and collection - hidden with jS) */

.toggled form dd, .dynamic form dd {
Expand Down

0 comments on commit ef2a2f0

Please sign in to comment.