mkhairi / materialize-sass

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

From datetime_select render ugly #86

Closed JeromeDesseaux closed 8 years ago

JeromeDesseaux commented 8 years ago

Hi :)

First: thanks for this awesome gem! I noticed that datetime_select are rendering ugly on my pages (I can't use it or even select a single field).

I'm looking for a workaround or something :)

Thanks for the help!

mkhairi commented 8 years ago

hi, @JeromeDesseaux, there is no exact workaround solution for this problem at this moment. If you use simple_form, you can build you own simple_form wrapper to fix this. see this solution but base on bootstrap framework. i suggest, you should use materialize datepicker or other external datetimepicker plugin .

lebart commented 8 years ago

hi, For my datetime_selectors I use a combination of a date_selector with the date picker and a datetime_selector (basically it's just a dropdown select) with the option ignore date set to true. Then in the controller I grab the params and refactor them to make them the 'rails way'

With slim the view code is looking like:

   .input-field.col.s6
      =f.text_field :start, value: @activity.start.to_date, class: "datepicker"
      =f.label :start

    .input-field.col.s6.timeSelectorContainer
      =f.time_select :start, ignore_date: true
      =f.label :start, "HH:MM"

It shows up like this

capture d ecran 2016-02-15 a 11 58 01

mkhairi commented 8 years ago

:+1:

lebart commented 8 years ago

Have you tried the suggested solution? If so can we close this issue ?

JeromeDesseaux commented 8 years ago

I've finally used a JQuery datetime selector. I can explain here how did I integrate it within my website if needed. If not, you can close the issue :)

Thanks for the help :D

alexventuraio commented 8 years ago

I just have adjusted some params and I got something a little bit pretty by doing:

<div class="input-field col s12">
    <%= f.datetime_select :talk_schedule, { ampm: true, time_separator: '', start_year: DateTime.now.year, order: [:day, :month, :year] }, { class: 'datepicker col s2' } %>
    <%= f.label :talk_schedule, 'Fecha y hora de la ponencia', class: 'active' %>
</div>

I got this:

screen shot 2016-11-01 at 17 15 57

It may not be the better but it looks more usable.

BTW: I don't know how to quit the - symbol which is the separator between Date-Time parts of the attribute. Any help will come in handy.

dizo1 commented 7 years ago

When i try to use that it get me an error