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
7 changes: 4 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ def text_byline(creation, options={})
def link_to_modal(content = "", options = {})
options[:class] ||= ""
options[:for] ||= ""
options[:title] ||= options[:for]

html_options = { class: "#{options[:class]} modal", title: options[:title] }
html_options[:"aria-label"] = options[:aria_label] if options[:aria_label]

link_to content, options[:for], html_options
end

Expand All @@ -183,12 +184,12 @@ def link_to_help(help_entry, link = '<span class="symbol question"><span>?</span
help_file = "#{ArchiveConfig.HELP_DIRECTORY}/#{help_entry}.html"
end

" ".html_safe + link_to_modal(link, for: help_file, title: help_entry.split('-').join(' ').capitalize, class: "help symbol question").html_safe
" ".html_safe + link_to_modal(link, for: help_file, aria_label: help_entry.split("-").join(" ").capitalize, class: "help symbol question").html_safe
end

def link_to_help_modal(help_path, title)
link = tag.span(tag.span(t("application_helper.help_modal.help_symbol")), class: %w[symbol question])
" ".html_safe + link_to_modal(link, for: help_path, title: title, class: "help symbol question")
" ".html_safe + link_to_modal(link, for: help_path, aria_label: title, class: "help symbol question")
end

# Inserts the flash alert messages for flash[:key] wherever
Expand Down
2 changes: 1 addition & 1 deletion config/locales/views/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ en:
legend: Display
show_adult_content: Show me adult content without checking.
show_whole_work_default: Show the whole work by default.
locale_help_title: Locale preferences
locale_help_title: Locale preferences help
misc:
heading: Misc
legend: Misc
Expand Down
4 changes: 2 additions & 2 deletions features/other_a/help.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Help
Given I am logged in as "first_user"
When I go to the collections page
When I follow "New Collection"
And I follow "Collection moderated"
And I open help modal "Collection moderated"
Then I should see "By default, collections are not moderated"

Scenario: view the help popup for chapter title
Expand All @@ -29,7 +29,7 @@ Feature: Help
And I fill in "content" with "Well, maybe not so epic."
And I press "Post"
And I follow "Add Chapter"
And I follow "Chapter title"
And I open help modal "Chapter title"
Then I should see "You can add a chapter title"

Scenario: Asked to log in if trying to access the first login page as guest
Expand Down
4 changes: 4 additions & 0 deletions features/step_definitions/help_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
When /^(?:|I )open help modal "([^"]*)"$/ do |link| # rubocop:disable Cucumber/RegexStepName
Capybara.enable_aria_label = true
step %{I follow "#{link}"}
end
2 changes: 1 addition & 1 deletion public/javascripts/ao3modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jQuery(document).ready(function() {
.filter(function() {
return $(this).closest('.userstuff').length === 0;
}).click(function(event){
_show($(this).attr('href'), $(this).attr('title'));
_show($(this).attr('href'), $(this).attr('title') ? $(this).attr('title') : $(this).attr('aria-label'));
event.preventDefault();
});

Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/ao3modal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading