小编Cha*_*use的帖子

将字体图标附加到文本字符串中的最后一个单词并防止换行

我想将一个Font Awesome图标附加到文本字符串中的最后一个单词:

foo bar?
Run Code Online (Sandbox Code Playgroud)

但是如果需要换行,我希望图标附加到最后一个单词并将它们包装在一起:

foo
bar?
Run Code Online (Sandbox Code Playgroud)

我的问题非常类似于: 阻止:从包装到下一行的元素之后

但是,解决方案假设我可以访问最后一个单词.就我而言,文本将动态生成.是否有一种css/html-only方式来确保图标包含最后一个单词?

这是一个jsfiddle.

html css word-wrap pseudo-element font-awesome

14
推荐指数
2
解决办法
8254
查看次数

如何在渲染上从反应数据源正确设置复选框选中的属性

我有多个复选框,其checked属性表示集合中的布尔值.我的代码正确跟踪复选框上的click事件并更新集合中的值.但是,当页面首次加载时,以及当用户离开页面时,尽管会话和集合值正确,但未正确设置checked属性.

HTML

<input type="checkbox" id="feedEmailSubscribe" checked={{isChecked}}>
Run Code Online (Sandbox Code Playgroud)

助手JS

Template.layout.isChecked = function () {
  var id = $this.id;
  return Session.get(id) ? "checked" : "";
};
Run Code Online (Sandbox Code Playgroud)

我首先下拉集合并通过'邀请'路线为复选框设置会话变量

// invites
  this.route('invites', {
    path: ':_id/invited-guest/VIP',
    waitOn : function () {
      return Meteor.subscribe('guests', this.params._id);
    },
    data: function () {
      Session.set('guestId', this.params._id)
      return Guests.findOne({_id: this.params._id});
    },
    action : function () {
      var q = Guests.findOne({_id: this.params._id});
      if (this.ready()) {
        Session.set('guestName', q.name);
        Session.set('feedEmailSubscribe', q.feedEmailSubscribe);
        //...I then redirect the user
      }
    },
  });
Run Code Online (Sandbox Code Playgroud)

我可以验证会话设置.这是我对设置路线(复选框存在的位置)的所有内容

// settings page
  this.route('settings', { …
Run Code Online (Sandbox Code Playgroud)

meteor iron-router

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

通过Codeship为Meteor.com托管部署脚本

我正在使用Meteor的内置主机进行暂存,Codeship处理持续部署.所有测试和通知都在Codeship中按预期成功完成,但没有任何部署.

我的剧本:

expect -c "set timeout 60; spawn meteor deploy staging.myapp.com; expect “Email:” { send $METEOR_DEPLOY_EMAIL\r; expect eof } expect "Password:" { send $METEOR_DEPLOY_PASSWORD\r; expect eof }"
Run Code Online (Sandbox Code Playgroud)

当该脚本在构建过程中运行时,我看到以下内容:

spawn meteor deploy staging.myapp.com
=> Running Meteor from a checkout -- overrides project version (0.8.1)
To instantly deploy your app on a free testing server, just enter your
email address!
ail:
Run Code Online (Sandbox Code Playgroud)

ail:不是拼写错误......这就是Codeship所展示的.虽然没有显示任何错误,但它最终会超时并继续前进.

首次设置CI服务器(并使用Expect),所以提前感谢您的帮助!

continuous-deployment meteor

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

流星,模数和安全的websockets

试图在Meteor - > Modulus上下文中绕过websockets和xhr.我有时会注意到很长的响应时间,显然是因为当无法连接时,websockets会回落到xhr ...我正在尝试诊断原因.

生产应用程序正在Modulus上托管.已启用SSL.

到目前为止我做过/检查过的事情

  1. 升级所有内容:该应用程序一直在1.0.2.1(最新)运行,但最初是在~0.65天内创建的.作为第一项业务,我将标准app-packages升级到meteor-platform软件包并重新启动服务器.没变.
  2. 模数:检查...模数不需要任何显式命令来启用安全的websockets
  3. Meteor:Check ... 默认情况下启用Meteor 0.6.3.1 websockets.
  4. 出版物大小:我确信在我的出版物中我可能会更加节俭,但这些似乎总共大约1.4kb.
  5. 浏览器安全策略:合理地确定这是可以的(见下文)

相对新手在这里,所以任何关于下一步检查的想法或建议都非常感谢.

PS - 这里这里有类似的,未解答的问题

  BrowserPolicy.content.disallowConnect();

  //
  //Allow Meteor DDP Connections
  //
  var rootUrl = __meteor_runtime_config__.ROOT_URL;
  console.log('ROOT_URL: ' + rootUrl);

  //Allow DDP connections for local development
  if (rootUrl == 'http://localhost:3000/') {
    BrowserPolicy.content.allowConnectOrigin(rootUrl);
    BrowserPolicy.content.allowConnectOrigin(rootUrl.replace(/http(s?)/, 'ws$1'));
  }

  //Allow DDP connections for staging server currently using Meteor's free hosting
  if (rootUrl == 'http://staging.example.com') {
    BrowserPolicy.content.allowConnectOrigin('https://*.meteor.com');
    BrowserPolicy.content.allowConnectOrigin('wss://*.meteor.com');
  }

  //Allow DDP connections for Modulus
  if (rootUrl …
Run Code Online (Sandbox Code Playgroud)

javascript websocket meteor sockjs modulus.io

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