小编Raj*_*jat的帖子

Rake Pipeline或Rails Asset Pipeline

试图理解有关rails的一些事情:

我过去成功地使用rake-pipelinerake-pipeline-web-filters作为我的前端项目.

最近,使用rails后端,我的前端资产正在使用Rails Asset管道生成.我认为它们都很相似但是我没有在脑海中对齐它如何映射到资源文件在rake管道中做事的方式.

所以,问题:

  1. Rake Pipeline是Rails Asset管道的替代品吗?如果是,为什么以及这两种解决方案的历史和优点/缺点是什么?如果没有,它们如何相关?

  2. 使用Rake管道,您可以添加优秀的rake-pipeline-web-filters来获得所有连接,缩小,预处理,如scss,minispade等.使用Asset Pipeline,似乎很难配置.一个直接的限制是我的所有JS都立即被评估,我在Assset Pipeline中不支持minispade.替代方案是minispade-rails gem.

一般来说,我试图了解如何在Rails Asset管道中使用rake管道Assetfile获得类似的构建过程.

有人可以澄清这两个构建过程以及如何一般地考虑它们吗?

build-process ruby-on-rails asset-pipeline rake-pipeline

3
推荐指数
1
解决办法
996
查看次数

如何使用 Firebase 向 Facebook 登录添加范围

我正在尝试从 Facebook 添加范围并访问登录用户的更多属性。但是,Firebase 3 sdk 似乎并不清楚。

provider = new firebase.auth.FacebookAuthProvider();
provider.addScope('public_profile, email, gender, user_birthday');
firebase.auth().signInWithPopup(provider).then((result) => {
      var token = result.credential.accessToken;
      var user = result.user; // doesn't have any extra information
});
Run Code Online (Sandbox Code Playgroud)

有没有人想出如何访问额外的范围?

javascript facebook-login firebase firebase-authentication

3
推荐指数
1
解决办法
1641
查看次数

观察者不会在创建的对象上触发

我试图用观察者观察XHR后模型的变化.这是因为不再允许扩展fn和调用super的早期方法.

遇到这个奇怪的问题,我的观察者不会发射:

App = Ember.Application.create({
    ready: function () {
        console.log('Ember Application ready');
        this.topCampaignsController = Ember.ArrayController.create({
            content: null
        });

        App.TopCampaignsModel.create({
            // Calling super is no longer allowed in object instances
            //success: function () {
            //  this._super();
            //  App.topCampaignsController.set('content', this.get('data'));
            //},
            onDataChange: function () {
                console.log('data property on the object changed');
                App.topCampaignsController.set('content', this.get('data'));
            }.observes('data')
        });
    }
});

App.TopCampaignsModel = Ember.Object.extend({
    data: null,

    // this will be actually called from an XHR request
    success: function () {
        this.set('data', [5,10]);
    },

    init: function () …
Run Code Online (Sandbox Code Playgroud)

ember.js

2
推荐指数
1
解决办法
975
查看次数

Emberjs Modals在一条路线上

所以我想弄清楚如何最好地在路线上放置模态,这样你就可以通过网址导航到它们.

application.hbs

{{outlet}}

{{outlet modal}}
Run Code Online (Sandbox Code Playgroud)

有一个讨论,在这里和emberjs食谱提供了另一个例子,但没有涵盖了你怎么能有一个特定的路线上情态动词.

我所看到的最接近的是Stack Overflow这个问题,但它有两个问题:

  1. 访问模态路径时,主插座中的视图会被破坏.所以在你的用户界面中,模态下面的东西会被消灭掉.
  2. history.back()是你基本上重新访问该路由导致该视图被重绘并感觉非常hackish.

这是我觉得解决方案存在但不确定究竟是什么的地方:

App.MyModalRoute = Ember.Route.extend({

renderTemplate: function(controller, model) {

  /**
   * When my modal route is visited, render it in the outlet
   * called 'modal' but somehow also persist the default outlet.
   **/
   this.render({ outlet: 'modal' });   
} 
Run Code Online (Sandbox Code Playgroud)

});

ember.js ember-router

2
推荐指数
1
解决办法
1321
查看次数

将TextArea换行符绑定到html

我有一个textarea绑定到div,这样你在textarea中输入的任何内容都会更新div.

绑定不受尊重的唯一事情是textarea中的换行符,所以如果你在textarea中点击'enter',那么div就不会中断.

小提琴:http://jsfiddle.net/lifeinafolder/Ajkyw/19/

我正在使用帮助器,但它不起作用.

根据此链接上的第4点:http://codebrief.com/2012/03/eight-ember-dot-js-gotchas-with-workarounds/,它不应该工作.但即使有关于该链接的解决方案,我也无法让它发挥作用.

有关如何使用<br/>textarea中的换行符上的标签更新div的任何想法?

ember.js

1
推荐指数
1
解决办法
1787
查看次数

观察整个ArrayProxy

示例代码:

var Day = Ember.Object.extend({
  date:null,
  activities:null, // is set to an Em.ArrayProxy in instantiation
  historicalSection:function(){
    return this.get('activities').filterProperty('inHistoricalSection', true);
  }.property('activities').cacheable()
});
Run Code Online (Sandbox Code Playgroud)

当'activities'设置为ArrayProxy时,会计算'historicalSection'计算属性.但是,当'activities'中的ArrayProxy更新(即其长度发生变化)时,'historicalSection'属性不会更新.

有什么想法吗?

ember.js

1
推荐指数
1
解决办法
268
查看次数