GithubHelp home page GithubHelp logo

jamesfwz / materialize-form Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 13.0 302 KB

This gem includes a generator for SimpleForm configuration with Materialize.

Home Page: http://materialize-form.herokuapp.com/

License: MIT License

Ruby 89.31% JavaScript 9.34% Shell 1.35%

materialize-form's People

Contributors

gemfarmer avatar jamesfwz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

materialize-form's Issues

as : select not working

= f.association :tutor, collection: Tutor.all, label_method: :name, value_method: :id, as: :select

When I use this the field disappears completely. However, if I do the same code with check_box it works. How can I use the select menu? Is this a bug or am I doing something incorrect.

Wrapper generates incorrect html.

in the generator the following line:

ba.use :tag, tag: 'span', class: 'lever'

end up generating

<span tag="span" class="lever boolean optional"></span>

which is incorrect. Not sure how we can correct this?

Add support for Turbolinks

Please support Turbolinks replacing

$(document).ready(function() {
  if($('form').length > 0) {
    window.materializeForm.init()
  }
});

by

$(document).on('turbolinks:load', function() {
  if($('form').length > 0) {
    window.materializeForm.init()
  }
});

Checkboxes doesn't work in modal

Hello there!

I had this problem (Dogfalo/materialize#1440), but the trick proposed wasn't enough (thanks to simple form, the 'ids' and 'for' attributes were already filled).

I finally figured out it was because I had several modals with several forms (ex: edit_task_1 ; edit_task_2, etc) and the 'id' of inputs and the attribute 'for' of the labels where the same in the forms (task_user_ids for all of them) and that's why they could not be checked.

I ended up doing something like this:

// In my shared.js.coffee
// Fix for simple form + materialize checkboxes in several modals

$('p.checkbox').each () ->
    form_id  = $(this).closest('form').attr('id')
    input = $(this).children('input')
    label = $(this).children('label')

    input_value = input.val()
    current_input_id = input.attr('id')

    new_name = "#{form_id}_#{current_input_id}_#{input_value}"

    $(input).attr('id', new_name)
    $(label).attr('for', new_name)

Hope it can help someone in the future! :) Would be perfect if we could have it in this gem too! :)

Thanks!

Allow choice of filled in checkbox

There should be an option to choose for checkboxes to be filled in.
Right now I have just removed //= require material-form from application.js and just written my own version without $('input[type=checkbox]').addClass('filled-in')

Translating datepicker

Hello!

I am trying to translate the datepicker component of materialize and it is not working. I am using this code inside application.js:

$(document).on('turbolinks:load', function() {
  window.materializeForm.init();
  Materialize.updateTextFields();
  $('select').material_select();
  ...
  $('.date').pickadate({
    labelMonthNext: 'Próximo mês',
    labelMonthPrev: 'Mês anterior',
    labelMonthSelect: 'Selecione um mês',
    labelYearSelect: 'Selecione um ano',
    monthsFull: [ 'Janeiro', 'Feveiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ],
    monthsShort: [ 'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez' ],
    weekdaysFull: [ 'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado' ],
    weekdaysShort: [ 'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb' ],
    weekdaysLetter: [ 'D', 'S', 'T', 'Q', 'Q', 'S', 'S' ],
    today: 'Hoje',
    clear: 'Limpar',
    close: 'Fechar'
  });
  ...
});

I think it is not working because materialize-form is calling $('.date').pickadate(...) somewhere after my code run.

Can anybody help me with this?

Radio button is not updated for Materialize CSS v1.0.0

When using radio button input within a Simple Form as below

= f.input :options, as: :radio_buttons

The generated HTML follows the old format,

<input name="group1" type="radio" id="test1" />
<label for="test1">Red</label>

while it should be look something like below in version 1.0.0

<label>
  <input name="group1" type="radio" checked />
  <span>Red</span>
</label>

As a result, the radio buttons are not displayed correctly. They are not visible actually.

Upload css v1 support to RubyGems

the published version in RubyGems doesn't have the last changes related to css v1 support. would you mind to update the version ? Thnx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.