diff --git a/app/assets/javascripts/admin/plugins/notyf.js b/app/assets/javascripts/admin/plugins/notyf.js index 68499577b5c1695a8ec1a79dc9659ebb2c3f0909..894daa6deb76e1f4cb4a2c07272dffe45b152222 100644 --- a/app/assets/javascripts/admin/plugins/notyf.js +++ b/app/assets/javascripts/admin/plugins/notyf.js @@ -1,31 +1,34 @@ /*global Notyf */ -var notyfAlerts = document.getElementsByClassName('js-notyf-alert'), - notyfNotices = document.getElementsByClassName('js-notyf-notice'), - notyf = new Notyf(); +window.addEventListener('DOMContentLoaded', function () { + 'use strict'; + var notyfAlerts = document.getElementsByClassName('js-notyf-alert'), + notyfNotices = document.getElementsByClassName('js-notyf-notice'), + notyf = new Notyf(); -if (notyfAlerts.length > 0) { - notyf.open({ - type: 'error', - position: { - x: 'center', - y: 'bottom' - }, - message: notyfAlerts[0].innerText, - duration: 9000, - ripple: true, - dismissible: true - }); -} -if (notyfNotices.length > 0) { - notyf.open({ - type: 'success', - position: { - x: 'center', - y: 'bottom' - }, - message: notyfNotices[0].innerText, - duration: 9000, - ripple: true, - dismissible: true - }); -} + if (notyfAlerts.length > 0) { + notyf.open({ + type: 'error', + position: { + x: 'center', + y: 'bottom' + }, + message: notyfAlerts[0].innerText, + duration: 9000, + ripple: true, + dismissible: true + }); + } + if (notyfNotices.length > 0) { + notyf.open({ + type: 'success', + position: { + x: 'center', + y: 'bottom' + }, + message: notyfNotices[0].innerText, + duration: 9000, + ripple: true, + dismissible: true + }); + } +}); diff --git a/app/assets/javascripts/devise.js b/app/assets/javascripts/devise.js new file mode 100644 index 0000000000000000000000000000000000000000..039f2a362b970798517eef9480ca4f656f29d731 --- /dev/null +++ b/app/assets/javascripts/devise.js @@ -0,0 +1,13 @@ +//= require activestorage +//= require jquery3 +//= require jquery_ujs +//= require notyf/notyf.min +//= require simple_form_password_with_hints +//= require simple_form_bs5_file_input +//= require cropperjs/dist/cropper +//= require jquery-cropper/dist/jquery-cropper +//= require gdpr/cookie_consent +//= require_self +//= require_tree ./admin/plugins + +window.osuny = {}; diff --git a/app/views/extranet/layouts/devise.html.erb b/app/views/extranet/layouts/devise.html.erb index 99338798244982206be52a840118584286e7d74d..dc9c6b8abb5b7f13a93a51c23e4a5097d537d1cd 100644 --- a/app/views/extranet/layouts/devise.html.erb +++ b/app/views/extranet/layouts/devise.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= stylesheet_link_tag 'admin', media: 'all' %> - <%= javascript_include_tag 'admin' %> + <%= javascript_include_tag 'devise' %> <%= favicon_link_tag 'favicon.png' %> </head> <body class="<%= body_classes %>"> diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index 1d4c61febad03503e020267c100bfca43418091a..ad40226ca8467fd3cd9691242cccb72b41a670ab 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -7,7 +7,7 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= stylesheet_link_tag 'admin', media: 'all' %> - <%= javascript_include_tag 'admin' %> + <%= javascript_include_tag 'devise' %> <%= favicon_link_tag 'favicon.png' %> </head> <body class="<%= body_classes %>">