1

Updating legacy Rails application to the new version of Foundation (gem foundation-rails from 5.5.3.2 to current version 6.1.2.0). Removed specification of gems versions for sass, sass-rails, and foundation-rails. Ran rails g foundation:install.

Not working rails-assets-foundation-datepicker gem, used with datagrid, and chrome developer tools shows an error:

foundation.core-fcefb93….js?body=1:282 Uncaught TypeError: We're sorry, 'object' is not a valid parameter. You must use a string representing the method you wish to invoke.

application.js

    //= require jquery
    //= require jquery_ujs
    //= require foundation
    //= require evil-blocks
    //= require chosen-jquery
    //= require foundation-datepicker
    //= require_tree .

    $(function(){ $(document).foundation(); });

application.css

    /*
     *= require_self
     *= require normalize-rails
     *= require chosen
     *= require foundation_and_overrides
     *= require foundation-datepicker
     *= require_directory .
    */

libs.js.coffee

    $ ->
        $(document).foundation
            equalizer:
                equalize_on_stack: false

        $('#filter select').chosen
            allow_single_deselect: true

        $('.date-picker').fdatepicker
            language: 'ru'
            weekStart: 1
            closeButton: false
            format: 'yyyy-mm-dd'

Datepicker usage example:

    filter :start_date, :date, header: I18n.t('date_start'),
      html_options: {class: 'date-picker'} do |value, scope|
        scope.where('notices.created_at > ?', value)
    end

Excuse my bad English.

amik0
  • 11
  • 1
  • 2

1 Answers1

0

Found the solution here.

     $(document).foundation
        equalizer:
            equalize_on_stack: false

This was the the old code not working with Foundation 6. You need add data-equalize-on-stack="false" in elements like so

     <div class="box-group" data-equalizer data-equalize-on-stack="false">
Community
  • 1
  • 1
amik0
  • 11
  • 1
  • 2