Skip to content

Commit

Permalink
Merge pull request #3451 from projectblacklight/rm-bs4-data-attr
Browse files Browse the repository at this point in the history
Remove Bootstrap 4 data attributes
  • Loading branch information
taylor-steve authored Feb 21, 2025
2 parents dff28e6 + 5eb0cca commit b161706
Show file tree
Hide file tree
Showing 30 changed files with 82 additions and 87 deletions.
19 changes: 9 additions & 10 deletions app/assets/javascripts/spotlight/spotlight.esm.js

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

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.esm.js.map

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions app/assets/javascripts/spotlight/spotlight.js

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

2 changes: 1 addition & 1 deletion app/assets/javascripts/spotlight/spotlight.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/components/spotlight/bulk_action_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= button %>
<div class="dropdown-menu" aria-labelledby="bulk-actions-button">
<% bulk_actions.each do |key, _config| %>
<%= link_to t("spotlight.bulk_actions.#{key}.heading"), '#', class: 'dropdown-item', data: { toggle: "modal", "bs-toggle": "modal", target: "##{key.to_s.dasherize}-modal", "bs-target": "##{key.to_s.dasherize}-modal" } %>
<%= link_to t("spotlight.bulk_actions.#{key}.heading"), '#', class: 'dropdown-item', data: { "bs-toggle": "modal", "bs-target": "##{key.to_s.dasherize}-modal" } %>
<% end %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/components/spotlight/bulk_action_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(bulk_actions:, button_classes: 'btn btn-primary dropdown-toggle')

def button
button_tag t(:'spotlight.bulk_actions.label'), id: 'bulk-actions-button', class: button_classes,
data: { toggle: 'dropdown', 'bs-toggle': 'dropdown' },
data: { 'bs-toggle': 'dropdown' },
aria: { haspopup: true, expanded: false }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/components/spotlight/save_search_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(button_classes: 'btn btn-outline-primary')

def button
button_tag t(:'spotlight.saved_search.label'), id: 'save-this-search', class: button_classes,
data: { toggle: 'modal', 'bs-toggle': 'modal', target: '#save-modal', 'bs-target': '#save-modal' }
data: { 'bs-toggle': 'modal', 'bs-target': '#save-modal' }
end

def form_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ SirTrevor.Blocks.SolrDocumentsCarousel = (function(){
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || $this.attr('data-bs-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
var $target = $($this.attr('data-bs-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to') || $this.attr('data-bs-slide-to')
var slideIndex = $this.attr('data-bs-slide-to')
if (slideIndex) options.interval = false

$.fn.carousel.call($target, options)
Expand All @@ -91,8 +91,8 @@ SirTrevor.Blocks.SolrDocumentsCarousel = (function(){
}

$(this.inner).find('.carousel')
.on('click.bs.carousel.data-api', '[data-slide], [data-bs-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to], [data-bs-slide-to]', clickHandler)
.on('click.bs.carousel.data-api', '[data-bs-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-bs-slide-to]', clickHandler)
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ SirTrevor.Blocks.SolrDocumentsFeatures = (function(){
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || $this.attr('data-bs-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
var $target = $($this.attr('data-bs-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to') || $this.attr('data-bs-slide-to')
var slideIndex =$this.attr('data-bs-slide-to')
if (slideIndex) options.interval = false

$.fn.carousel.call($target, options)
Expand All @@ -32,8 +32,7 @@ SirTrevor.Blocks.SolrDocumentsFeatures = (function(){
}

$(this.inner).find('.carousel')
.on('click.bs.carousel.data-api', '[data-slide], [data-bs-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to], [data-bs-slide-to]', clickHandler)
.on('click.bs.carousel.data-api', '[data-bs-slide-to]', clickHandler)
}

});
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/spotlight/admin/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class {
function edit_user(event) {
event.preventDefault();
$(this).closest('tr').hide();
const id = $(this).attr('data-target') || $(this).attr('data-bs-target');
const id = $(this).attr('data-target');
const edit_view = $("[data-edit-for='"+id+"']", container).show();
$.each(edit_view.find('input[type="text"], select'), function() {
// Cache original values incase editing is canceled
Expand Down Expand Up @@ -35,7 +35,7 @@ export default class {
}

function destroy_user(event) {
const id = $(this).attr('data-target') || $(this).attr('data-bs-target');
const id = $(this).attr('data-target');
$("[data-destroy-for='"+id+"']", container).val('1');
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_curated_features_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% if published_top_level_feature_pages.present? %>
<% if published_top_level_feature_pages.many? %>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-bs-toggle="dropdown"><%= navigation.label_or_default %></a>
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown"><%= navigation.label_or_default %></a>
<ul class="dropdown-menu">
<% published_top_level_feature_pages.each do |page| %>
<li><%= link_to page.title, [spotlight, page.exhibit, page], class: 'dropdown-item' %></li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_user_util_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<%= render '/spotlight/shared/locale_picker' %>
<% if current_user %>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-bs-toggle="dropdown"><%=current_user%></a>
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown"><%=current_user%></a>
<ul class="dropdown-menu">
<% if can? :manage, Spotlight::Site.instance %>
<li><%= link_to t(:'spotlight.header_links.edit_site'), spotlight.edit_site_path, class: 'dropdown-item' %></li>
Expand Down
8 changes: 4 additions & 4 deletions app/views/spotlight/appearances/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
<ul class="nav nav-tabs" role="tablist">
<% if current_exhibit.themes.many? %>
<li role="presentation" class="nav-item">
<a href="#site-theme" aria-controls="site-theme" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link active"><%= t(:'.site_theme.heading') %></a>
<a href="#site-theme" aria-controls="site-theme" role="tab" data-bs-toggle="tab" class="nav-link active"><%= t(:'.site_theme.heading') %></a>
</li>
<% end %>

<li role="presentation" class="nav-item">
<a href="#site-masthead" aria-controls="site-masthead" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' unless current_exhibit.themes.many? %>"><%= t(:'.site_masthead.heading') %></a>
<a href="#site-masthead" aria-controls="site-masthead" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' unless current_exhibit.themes.many? %>"><%= t(:'.site_masthead.heading') %></a>
</li>

<li role="presentation" class="nav-item">
<a href="#site-thumbnail" aria-controls="site-thumbnail" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.site_thumbnail.heading') %></a>
<a href="#site-thumbnail" aria-controls="site-thumbnail" role="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.site_thumbnail.heading') %></a>
</li>

<li role="presentation" class="nav-item">
<a href="#main-menu" aria-controls="main-menu" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.main_navigation.menu') %></a>
<a href="#main-menu" aria-controls="main-menu" role="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.main_navigation.menu') %></a>
</li>
</ul>
<div class="tab-content">
Expand Down
6 changes: 3 additions & 3 deletions app/views/spotlight/bulk_updates/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="nav-item">
<a href="#overview" aria-controls="overview" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link active"><%= t(:'.overview.heading') %></a>
<a href="#overview" aria-controls="overview" role="tab" data-bs-toggle="tab" class="nav-link active"><%= t(:'.overview.heading') %></a>
</li>
<li role="presentation" class="nav-item">
<a href="#download" aria-controls="download" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.download.heading') %></a>
<a href="#download" aria-controls="download" role="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.download.heading') %></a>
</li>
<li role="presentation" class="nav-item">
<a href="#upload" aria-controls="upload" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.upload.heading') %></a>
<a href="#upload" aria-controls="upload" role="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'.upload.heading') %></a>
</li>
</ul>

Expand Down
12 changes: 6 additions & 6 deletions app/views/spotlight/exhibits/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="nav-item">
<a href="#basic" aria-controls="basic" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab.blank? %>"><%= t(:'.basic_settings.heading') %></a>
<a href="#basic" aria-controls="basic" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab.blank? %>"><%= t(:'.basic_settings.heading') %></a>
</li>
<% if can? :manage, current_exhibit.languages.first_or_initialize %>
<li role="presentation" class="nav-item">
<a href="#language" aria-controls="language" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'language' %>"><%= t(:'spotlight.exhibits.languages.heading') %></a>
<a href="#language" aria-controls="language" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'language' %>"><%= t(:'spotlight.exhibits.languages.heading') %></a>
</li>
<% end %>
<% if can? :edit, current_exhibit.filters.first_or_initialize %>
<li role="presentation" class="nav-item">
<a href="#filter" aria-controls="filter" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'filter' %>"><%= t(:'spotlight.exhibits.filter.heading') %></a>
<a href="#filter" aria-controls="filter" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'filter' %>"><%= t(:'spotlight.exhibits.filter.heading') %></a>
</li>
<% end %>
<% if can? :import, current_exhibit %>
<li role="presentation" class="nav-item">
<a href="#import" aria-controls="import" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'import' %>"><%= t(:'spotlight.exhibits.import.heading') %></a>
<a href="#import" aria-controls="import" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'import' %>"><%= t(:'spotlight.exhibits.import.heading') %></a>
</li>
<% end %>
<% if can? :export, current_exhibit %>
<li role="presentation" class="nav-item">
<a href="#export" aria-controls="export" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'import' %>"><%= t(:'spotlight.exhibits.export.heading') %></a>
<a href="#export" aria-controls="export" role="tab" data-bs-toggle="tab" class="nav-link <%= 'active' if @tab == 'import' %>"><%= t(:'spotlight.exhibits.export.heading') %></a>
</li>
<% end %>
<% if can? :destroy, current_exhibit %>
<li role="presentation" class="nav-item">
<a href="#delete" aria-controls="delete" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'spotlight.exhibits.delete.heading') %></a>
<a href="#delete" aria-controls="delete" role="tab" data-bs-toggle="tab" class="nav-link"><%= t(:'spotlight.exhibits.delete.heading') %></a>
</li>
<% end %>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions app/views/spotlight/exhibits/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if (current_user && current_user.exhibits.any?) || can?(:manage, Spotlight::Exhibit) %>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="nav-item"><a href="#published" aria-controls="published" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link active"><%= t('.published') %></a></li>
<li role="presentation" class="nav-item"><a href="#published" aria-controls="published" role="tab" data-bs-toggle="tab" class="nav-link active"><%= t('.published') %></a></li>
<% if can?(:manage, Spotlight::Exhibit) && @exhibits.unpublished.accessible_by(current_ability).any? %>
<li role="presentation" class="nav-item"><a href="#unpublished" aria-controls="unpublished" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t('.unpublished') %></a></li>
<li role="presentation" class="nav-item"><a href="#unpublished" aria-controls="unpublished" role="tab" data-bs-toggle="tab" class="nav-link"><%= t('.unpublished') %></a></li>
<% end %>
<% if current_user && current_user.exhibits.any? %>
<li role="presentation" class="nav-item"><a href="#user" aria-controls="user" role="tab" data-toggle="tab" data-bs-toggle="tab" class="nav-link"><%= t('.user') %></a></li>
<li role="presentation" class="nav-item"><a href="#user" aria-controls="user" role="tab" data-bs-toggle="tab" class="nav-link"><%= t('.user') %></a></li>
<% end %>
</ul>
<% end %>
Expand Down
Loading

0 comments on commit b161706

Please sign in to comment.