Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% if @user == current_user && @user.preference.try(:first_login) %>
<!-- pseudoflash because putting it in a real one was making for some ugly code -->
<div class="flash notice" id="first-login-help-banner">
<div class="notice" id="first-login-help-banner">
<p>
<%= t(".login_banner.welcome_html",
new_user_tips_link: link_to_modal(t(".login_banner.new_user_tips"), for: help_first_login_path, title: t(".login_banner.help_title")),
Expand Down
15 changes: 15 additions & 0 deletions features/tags_and_wrangling/favorite_tags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,18 @@ Feature: Favorite Tags
When the tag "Rebecca Sutter" is decanonized
And I go to the homepage
Then I should not see "Rebecca Sutter"

@javascript
Scenario: Favoriting a tag only shows one AJAX notice when another flash is already present
Given a canonical fandom "Dallas (TV 2012)"
And the user "bourbon" exists and is activated
And I am a visitor
When I view the "Dallas (TV 2012)" works index
And I follow "Log In" within "#header"
And I fill in "Username or email:" with "bourbon" within "#login"
And I fill in "Password:" with "password" within "#login"
And I press "Log In" within "#login"
Then I should see "Successfully logged in"
And I should see a "Favorite Tag" button
When I press "Favorite Tag"
Then I should see "You have successfully added Dallas (TV 2012) to your favorite tags." exactly 1 time
7 changes: 6 additions & 1 deletion public/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ $j(document).ready(function() {
// data-destroy-value: text of button for destroying, e.g. Unfavorite, Unsubscribe
// controller needs item_id and item_success_message for save success and
// item_success_message for destroy success
// Limit AJAX flash messages to #main > .flash so they don't get duplicated
// when other flash-like banners are present
$j(document).ready(function() {
$j('form.ajax-create-destroy').on("click", function(event) {
event.preventDefault();
Expand All @@ -470,7 +472,10 @@ $j(document).ready(function() {
var formSubmit = form.find('[type="submit"]');
var createValue = form.data('create-value');
var destroyValue = form.data('destroy-value');
var flashContainer = $j('.flash');
var flashContainer = $j('#main > .flash').first();
if (flashContainer.length === 0) {
return;
}

$j.ajax({
type: 'POST',
Expand Down
Loading