diff --git a/app/assets/javascripts/sufia/batch.js b/app/assets/javascripts/sufia/batch.js index a484351f70..159866f82b 100644 --- a/app/assets/javascripts/sufia/batch.js +++ b/app/assets/javascripts/sufia/batch.js @@ -1,7 +1,12 @@ Blacklight.onLoad(function() { - $('#add_descriptions').click(function() { + $('#show_addl_descriptions').click(function() { $('#more_descriptions').show(); - $('#add_descriptions').hide(); + $('#show_addl_descriptions').hide(); + return false; + }); + $('#hide_addl_descriptions').click(function() { + $('#more_descriptions').hide(); + $('#show_addl_descriptions').show(); return false; }); $('#more_descriptions').hide(); diff --git a/app/assets/stylesheets/batch-edit.css.scss b/app/assets/stylesheets/batch-edit.css.scss new file mode 100644 index 0000000000..9f452c4dcb --- /dev/null +++ b/app/assets/stylesheets/batch-edit.css.scss @@ -0,0 +1,21 @@ +.help-icon { + @extend .glyphicon; + @extend .glyphicon-question-sign; + @extend .large-icon; + top: 5px; +} + +.form-horizontal .batch-group { + @extend .form-group; + margin-left: 0px; + margin-right: 0px; +} + +#hide_addl_descriptions { + margin-bottom: 10px; +} + +#additional_title_clone { + padding-top: 5px; +} + diff --git a/app/assets/stylesheets/sufia.css.scss b/app/assets/stylesheets/sufia.css.scss index 16f225b848..bf58e28647 100644 --- a/app/assets/stylesheets/sufia.css.scss +++ b/app/assets/stylesheets/sufia.css.scss @@ -23,6 +23,7 @@ @import 'styles'; @import 'file-listing'; @import 'collections'; +@import 'batch-edit'; #browse-everything { top:10%; diff --git a/app/helpers/sufia/records_helper_behavior.rb b/app/helpers/sufia/records_helper_behavior.rb index e2ea4496a6..4496984432 100644 --- a/app/helpers/sufia/records_helper_behavior.rb +++ b/app/helpers/sufia/records_helper_behavior.rb @@ -13,16 +13,16 @@ def help_icon(key, content = nil, title = nil) title = title || get_label(key) link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover', 'data-content' => content, - 'data-original-title' => title do - content_tag(:span, "help", class: "sr-only") + - content_tag('i', '', "aria-hidden" => true, class: "glyphicon glyphicon-question-sign large-icon") + 'data-original-title' => title, + 'aria-label' => get_aria_label(key) do + content_tag 'i', '', "aria-hidden" => true, class: "help-icon" end end def help_icon_modal(modal_id) - link_to '#' + modal_id, id: "generic_file_#{modal_id}_help_modal", rel: 'button', data: { toggle: 'modal' } do - content_tag(:span, "help", class: "sr-only") + - content_tag('i', '', "aria-hidden" => true, class: 'glyphicon glyphicon-question-sign large-icon') + link_to '#' + modal_id, id: "generic_file_#{modal_id}_help_modal", rel: 'button', + data: { toggle: 'modal' }, 'aria-label' => get_aria_label(modal_id) do + content_tag 'i', '', "aria-hidden" => true, class: 'help-icon' end end @@ -33,16 +33,28 @@ def metadata_help(key) def get_label(key) I18n.t("sufia.field_label.#{key}", default: key.to_s.humanize) end + + def get_aria_label(key) + I18n.t("sufia.aria_label.#{key}", default: default_aria_label(key.to_s.humanize)) + end private def more_or_less_button(key, html_class, symbol) # TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it. content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do - (symbol + content_tag('span', class: 'sr-only') do + (sr_hidden(symbol) + content_tag('span', class: 'sr-only') do "add another #{key.to_s}" end).html_safe end end + + def sr_hidden text + content_tag :span, text, "aria-hidden" => true + end + + def default_aria_label text + I18n.t("sufia.aria_label.default", title: text) + end end end diff --git a/app/views/batch/_metadata.html.erb b/app/views/batch/_metadata.html.erb index 6f42ca931c..4746e07f0a 100644 --- a/app/views/batch/_metadata.html.erb +++ b/app/views/batch/_metadata.html.erb @@ -1,16 +1,15 @@ -
- Filename will be the default title. Please provide a more meaningful title, and filenames will still be preserved by the system. -
You may select multiple types to apply to all files
- <%= f.select "resource_type", Sufia::Engine::config.resource_types, {}, { multiple: true, size: 7 } %> <%= help_icon(:resource_type) %> + <%= content_tag :p, t('sufia.batch.help.resource_type'), class: "help-block" %> + <%= f.select "resource_type", Sufia::Engine::config.resource_types, {}, { multiple: true, size: 7, "aria-label" => "Rights combo box" } %>
The information you provide for Title will be applied to the corresponding file only; however all other information you provide will be applied to the entire batch of files you have just deposited into <%= t('sufia.product_name') %>. You may edit individual files from <%= link_to " #{t('sufia.bread_crumb.file_list')}".html_safe, sufia.dashboard_files_path %> - once this step is finished. -