Skip to content

Commit

Permalink
Fix page unlock page icon replacement (#1816)
Browse files Browse the repository at this point in the history
Without this strong selector it happens that more icons get appended than necessary.

Also rewritten in VanillaJS
  • Loading branch information
tvdeyen committed May 5, 2020
1 parent c7261e8 commit 8b7cd55
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/views/alchemy/admin/pages/unlock.js.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
(function($) {
$('#locked_page_<%= @page.id -%>').remove();
$('#page_<%= @page.id -%> .sitemap_left_images .with-hint').remove();
$('#page_<%= @page.id -%> .sitemap_left_images').append('<%= j render_icon(:file, style: 'regular', size: 'lg') %>');
Alchemy.growl('<%= flash[:notice] -%>');
})(jQuery);
(function() {
var locked_page_tab = document.querySelector('#locked_page_<%= @page.id -%>')
var locked_page_icon = document.querySelector(
'#page_<%= @page.id -%> > .sitemap_page > .sitemap_left_images .with-hint'
)
if (locked_page_tab) {
locked_page_tab.remove()
}
if (locked_page_icon) {
locked_page_icon.innerHTML = '<%= j render_icon(:file, style: 'regular', size: 'lg') %>'
}
Alchemy.growl('<%= flash[:notice] -%>')
})()

0 comments on commit 8b7cd55

Please sign in to comment.