Активы Heroku для Twipsy и Tablesorter не работают, локально да - PullRequest
1 голос
/ 19 января 2012

Мне было интересно, сталкивался ли кто-нибудь еще с проблемой, когда скрипты jQuery, такие как Twipsy (из начальной загрузки Twitter) и Tablesorter, работают локально, но не на Heroku.

Каждый раз, когда я очищал свою папку public / assets и предварительно компилировал для среды развертывания.

Сценарий фактически отображается в предварительно скомпилированном JS на heroku, но, похоже, он не распознается ....

Странная часть в том, что первая функция jQuery / Ajax длявыпадающий список отлично работает на Heroku.

Я использую Rails 3.1 на стеке кедра heroku

Вот мои активы / application.js

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.tablesorter.min
//= require bootstrap-twipsy
//= require bootstrap-alerts
//= require bootstrap-dropdown
//= require bootstrap-modal
//= require bootstrap-popover
//= require bootstrap-scrollspy
//= require bootstrap-tabs


jQuery(function($) {
// when the #region_id field changes
  $("#contact_country_id").live('change', function() {
    // make a POST call and replace the content
    var country = $('select#contact_country_id :selected').val();
    if(country == "") country="0";
    jQuery.get('/countries/update_city_select/' + country, function(data){
        $("#cities").html(data);
    })
    return false;
  });
});

jQuery(function($) {
    $("#sortTable").tablesorter({
        headers : {
            5: {
                sorter: false
            },
            8: {
                sorter: false
            },
            9: {
                sorter: false
            }
        },
        sortList: [[0,0]] 
    });
});

 jQuery(function($) {
  $('.action-icon').twipsy();
  $("a[rel=twipsy]").twipsy({
    live: true
  });
 });
//= require_tree .

Также изменение настроек конфигурации сделалоработа!

Ваша помощь будет очень признательна.

Aurelien

1 Ответ

2 голосов
/ 31 января 2012

Была похожая проблема.Размещение кода начальной загрузки перед строкой //= require_tree . решило эту проблему для меня.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...