use render for toast and remove helper function
This commit is contained in:
parent
db1eedf51b
commit
33b9a2b93b
4 changed files with 20 additions and 33 deletions
|
|
@ -11,6 +11,7 @@
|
|||
// GO AFTER THE REQUIRES BELOW.
|
||||
//
|
||||
//= require jquery
|
||||
//= require toastr_rails
|
||||
//= require jquery_ujs
|
||||
//= require jquery.mobile.custom.min
|
||||
//= require jquery.ui.draggable
|
||||
|
|
@ -52,6 +53,23 @@ $(document).ready(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
toastr.options = {
|
||||
'closeButton': false,
|
||||
'debug': false,
|
||||
'newestOnTop': false,
|
||||
'progressBar': true,
|
||||
'positionClass': 'toast-bottom-center',
|
||||
'preventDuplicates': true,
|
||||
'onclick': null,
|
||||
'showDuration': '300',
|
||||
'hideDuration': '100',
|
||||
'timeOut': '5000',
|
||||
'extendedTimeOut': '1000',
|
||||
'showEasing': 'swing',
|
||||
'hideEasing': 'linear',
|
||||
'showMethod': 'fadeIn',
|
||||
'hideMethod': 'fadeOut'
|
||||
};
|
||||
$('body').smoothScroll({
|
||||
delegateSelector: 'a.smoothscroll'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@
|
|||
*= require leaflet
|
||||
*= require bootstrap3-switch
|
||||
*= require osem-payments
|
||||
*= require toastr_rails
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -148,36 +148,6 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def toast_bootstrap_flash
|
||||
flash_messages = []
|
||||
flash.each do |type, message|
|
||||
type = 'success' if type == 'notice'
|
||||
type = 'error' if type == 'alert'
|
||||
text = "<script>
|
||||
toastr.options = {
|
||||
'closeButton': false,
|
||||
'debug': false,
|
||||
'newestOnTop': false,
|
||||
'progressBar': true,
|
||||
'positionClass': 'toast-bottom-center',
|
||||
'preventDuplicates': true,
|
||||
'onclick': null,
|
||||
'showDuration': '300',
|
||||
'hideDuration': '100',
|
||||
'timeOut': '5000',
|
||||
'extendedTimeOut': '1000',
|
||||
'showEasing': 'swing',
|
||||
'hideEasing': 'linear',
|
||||
'showMethod': 'fadeIn',
|
||||
'hideMethod': 'fadeOut'
|
||||
};
|
||||
toastr.#{type}('#{message}');
|
||||
</script>"
|
||||
flash_messages << text.html_safe if message
|
||||
end
|
||||
flash_messages.join("\n").html_safe
|
||||
end
|
||||
|
||||
def label_for(event_state)
|
||||
result = ''
|
||||
case event_state
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
%meta{:content => "", :name => "description"}
|
||||
%meta{:content => "", :name => "author"}
|
||||
= stylesheet_link_tag "application", :media => "all"
|
||||
= stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css"
|
||||
= javascript_include_tag "application"
|
||||
|
||||
= csrf_meta_tags
|
||||
|
|
@ -19,11 +18,10 @@
|
|||
};
|
||||
= content_for(:script_head)
|
||||
= javascript_include_tag "//cdn.transifex.com/live.js"
|
||||
= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"
|
||||
= yield(:head)
|
||||
%body
|
||||
= render 'layouts/navigation'
|
||||
= toast_bootstrap_flash
|
||||
= render 'toastr_rails/flash'
|
||||
-# Admin area
|
||||
- if controller.class.name.split("::").first=="Admin"
|
||||
= render 'layouts/admin'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue