lib/cm_admin/view_helpers.rb in cm-admin-2.3.4 vs lib/cm_admin/view_helpers.rb in cm-admin-2.4.0
- old
+ new
@@ -81,9 +81,20 @@
def humanized_ar_collection_count(count, model_name)
table_name = count == 1 ? model_name.singularize : model_name.pluralize
"#{count} #{table_name.humanize.downcase} found"
end
+ def toast_message(message, toast_type)
+ tag.div class: 'position-fixed bottom-0 end-0 p-3', style: 'z-index: 11' do
+ tag.div class: "toast #{toast_type == 'alert' ? 'text-white bg-danger' : ''}", role: 'alert', 'aria-live': 'assertive', 'aria-atomic': 'true', data: { behaviour: 'toast' } do
+ tag.div class: 'd-flex' do
+ concat tag.div message.html_safe, class: 'toast-body'
+ concat tag.button '', type: 'button', class: "btn-close me-2 m-auto #{toast_type == 'alert' ? 'btn-close-white' : ''}", data: { 'bs-dismiss': 'toast' }, 'aria-label': 'Close'
+ end
+ end
+ end
+ end
+
def project_name_with_env
return CmAdmin.config.project_name if Rails.env.production?
env = if Rails.env.development?
'DEV'