mkhairi / materialize-sass

Materializecss rubygem for Rails Asset Pipeline / Sprockets
http://materialize.labs.my/
MIT License
806 stars 243 forks source link

A flash message can be indicated for a toast. #161

Closed gr8distance closed 6 years ago

gr8distance commented 6 years ago

Purpose

I think Materialize.toast is very beautifully, functionally and conveniently. I want to show the Flash messages on Materialize.toast. because I created this PullRequest.

Screen Shots

2017-09-23 15 13 42 2017-09-23 15 15 49

Approach

Usage

1, insert 'notice methods' in application.html.erb

# applcation.html.erb
<body>
  <%= yield %>
  <div class="flash_message"><%= notice %></div>
</body>

2, insert 'Materialize.flash_message' in application.js

# application.js
$(function(){
  // If you use callbacks. you can use it that same the Materialize.toast()
  Materialize.flash_message("flash_message", 3000);
});

Sorry for my poor English. thank you for reading

mkhairi commented 6 years ago

hi @aimerald, thanks for you idea and pr. unfortunately, i am using different approach for ease of use, without amend or add extra function to original assets.

see https://github.com/mkhairi/materialize-sass/blob/master/lib/materialize-sass/helpers.rb example can be found on demo app.