materialize-sass | Materializecss rubygem for Rails Asset Pipeline / Sprockets
kandi X-RAY | materialize-sass Summary
kandi X-RAY | materialize-sass Summary
materialize-sass is a Sass powered version of Materialize, a modern responsive front-end framework based on Material Design.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Renders the flash message to flash .
- Generates the browser text from the server
- takes the away one or more than the text .
materialize-sass Key Features
materialize-sass Examples and Code Snippets
Community Discussions
Trending Discussions on materialize-sass
QUESTION
I've just started developing a webpage with a Navbar that has a drop-down menu to the right so as one has to click on the trigger to display the drop-down content, the problem is none of the content items is been displayed.
I'm using materialize for the front-end design, but I have also tried bootstrap for the same Navbar purpose but it also didn't display the items
(app/views/layouts/application.html.erb)
...ANSWER
Answered 2019-Sep-13 at 02:54As the docs for jquery-rails
say, if you're using rails 5.1+ I believe you need to add this before requiring jquery:
QUESTION
I am trying to create a form so a user can save a setting
which has their default teams
(multiple) and their professions
(single). I can do this using simple_form
and the lines of code below, but I am trying to use autocomplete as the dropdown lists do not work well with my design.
<%= f.association :profession %>
<%= f.association :team, input_html: { multiple: true } %>
I am loading the JSON from a collection into an attribute data-autocomplete-source
within my inputs
, a short bit of jquery
then cycles through each of these and then initialises the materialize .autocomplete
, I also need to do this with .chips
for many associations.
The UI element is working as I would like, but I cannot work out how to save a new record. I have two problems:
Unpermitted parameters: :team_name, :profession_name
- I've been trying to adapt this tutorial and believed that Step 11 would effectively translate this within the model, but am clearly not understanding something..."setting"=>{"team_name"=>"", "profession_name"=>"Consultant Doctor"}
- theteam_name
values (i.e. thechips
) are not being recognised when attempting to save the record. I've got some nasty jquery that transfers theid
from thediv
to the generatedinput
which I was hoping would work...
I've also checked many previous questions on Stack Overflow (some of which seem to be similar to this question, generally using jqueryui) but cannot work out how to adapt the answers.
How can I use the names from a model in a materialize chip
and autocomplete
input and save the selections by their associated id
into a record?
Any help or guidance would be much appreciated.
setting.rb
...ANSWER
Answered 2018-Dec-30 at 14:32This is almost certainly not the best way of doing this, but it does work. Please offer suggestions and I will update this, or if someone adds a better answer I will happily mark it as correct. This solution doesn't require much in the way of controller/model changes and is largely done with a (comparatively) short bit of jquery/JS so can be easily repeated within a project.
I've managed to get both autocomplete and chips working with Ruby on Rails, utilising simple_form form helpers where possible.
Effectively I am storing the JSON into a custom attribute for each case and then parsing this with some jquery/javascript when the view is loaded before using this to initialise either autocomplete
or chips
.
Autocomplete values are translated from name to id within the controller.
Chip values are recognised client side with some JS, and inputs created with the correct name
and id
for simpleform to automatically save the values as an array to the hash.
Full explaination and code is below.
Thank you to Tom for his helpful comments and input.
autocomplete
Requires you to create an input under variable_name and then add additional functions in the model to translate the name into an id for saving. Effectively following this tutorial.
QUESTION
I've updated my app to rails 5.1
and spree to spree 3.5
this caused several problems with the latest being.
ANSWER
Answered 2018-Jun-08 at 19:21This fixed the problem for me: I just removed the line
QUESTION
I'm using Spree on my Ruby on Rails app, and I'm having the following error
...ANSWER
Answered 2018-Jun-08 at 08:35I removed spree_globalize
from my Gemfile.lock
file and then removed spree_globalize
Error stopped occurring.
QUESTION
I'm trying to install PostgreSQL on my Ruby app, and am running into a problem. Whenever I'm trying to start my server I get an error stating:
rescue in spec': Specified 'postgresql' for database adapter, but the gem is not loaded. Add gem 'pg' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
which is weird because I've already added it to my Gemfile and ran bundle install
and ran bundle list
to check if it's been installed (which it is).
To run you through to what I've done.
I've started my PostgreSQL database, created a database and gave it a name & password.
Then I've changed the database.yml to:
...ANSWER
Answered 2018-Jan-31 at 16:30Please try to remove this one:
QUESTION
I am using materialize-sass gem on a form. Using autocomplete feature to get Vendor names. other fields on the form are item names and quantity which are a nested resource. For this I am using cocoon gem
For some reason the very first time the page loads, all seems to work fine. But adding more fields does not seem to be working. I tried using drop down select and that does not show the list of items. I replaced it with another autocomplete and the main field does show however the auto complete feature does not work. Any idea what may be wrong?
Please see my code below.
purchase_orders _forms.html.erb
...ANSWER
Answered 2017-Nov-13 at 15:34Checking out the demo-project they use, and more specifically the init.js they use I notice two things: if you are using turbolinks you will have to do the same, and when using cocoon you will have to do something like:
QUESTION
First, I removed gem 'turbolinks'
and removed the code requiring Turbolinks in the application.js
file. So, I successfully disabled Turbolinks in my local machine. Then, I pushed my changes to Heroku, but Turbolinks is still working in production.
How can I disable Turbolinks in Heroku?
When I ran this code:
...ANSWER
Answered 2017-May-20 at 06:31Basically straight from here. It's for Rails 4, but I believe the steps are the same.
1) Remove the gem 'turbolinks' line from your Gemfile.
2) Remove the //= require turbolinks from your app/assets/javascripts/application.js .
3) Remove the two "data-turbolinks-track" => true hash key/value pairs from your app/views/layouts/application.html.erb .
QUESTION
I have a Rails 5
app with turbolinks
+ Materialize css
via gem.
I have strange behaviour with "double autofocus" on input:
...ANSWER
Answered 2017-May-20 at 15:55When revisiting a page, Turbolinks will display a "preview" of it (if it has a version of that page in its cache). It then loads a fresh page from the server and replaces the preview. So what you're seeing is the field being focussed on the preview, and then refocussed when the fresh copy gets loaded. (There is an argument that Turbolinks should not auto-focus a field in a preview, but here are some possible solutions.)
Opting out of previewsTurbolinks provides a way to customise caching behaviour. By adding the following meta tag to the head of your page, Turbolinks will not display the preview and will prevent the flickering:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install materialize-sass
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page