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.
|
// GO AFTER THE REQUIRES BELOW.
|
||||||
//
|
//
|
||||||
//= require jquery
|
//= require jquery
|
||||||
|
//= require toastr_rails
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require jquery.mobile.custom.min
|
//= require jquery.mobile.custom.min
|
||||||
//= require jquery.ui.draggable
|
//= require jquery.ui.draggable
|
||||||
|
|
@ -52,6 +53,23 @@ $(document).ready(function() {
|
||||||
return false;
|
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({
|
$('body').smoothScroll({
|
||||||
delegateSelector: 'a.smoothscroll'
|
delegateSelector: 'a.smoothscroll'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,5 @@
|
||||||
*= require leaflet
|
*= require leaflet
|
||||||
*= require bootstrap3-switch
|
*= require bootstrap3-switch
|
||||||
*= require osem-payments
|
*= require osem-payments
|
||||||
|
*= require toastr_rails
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -148,36 +148,6 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
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)
|
def label_for(event_state)
|
||||||
result = ''
|
result = ''
|
||||||
case event_state
|
case event_state
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
%meta{:content => "", :name => "description"}
|
%meta{:content => "", :name => "description"}
|
||||||
%meta{:content => "", :name => "author"}
|
%meta{:content => "", :name => "author"}
|
||||||
= stylesheet_link_tag "application", :media => "all"
|
= 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"
|
= javascript_include_tag "application"
|
||||||
|
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
|
@ -19,11 +18,10 @@
|
||||||
};
|
};
|
||||||
= content_for(:script_head)
|
= content_for(:script_head)
|
||||||
= javascript_include_tag "//cdn.transifex.com/live.js"
|
= 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)
|
= yield(:head)
|
||||||
%body
|
%body
|
||||||
= render 'layouts/navigation'
|
= render 'layouts/navigation'
|
||||||
= toast_bootstrap_flash
|
= render 'toastr_rails/flash'
|
||||||
-# Admin area
|
-# Admin area
|
||||||
- if controller.class.name.split("::").first=="Admin"
|
- if controller.class.name.split("::").first=="Admin"
|
||||||
= render 'layouts/admin'
|
= render 'layouts/admin'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue