Gih's Blog

只言片语
Archive for March 2014

Ruby on Rails 人门前必看

2014-03-30 by gihnius, tagged as ruby
传送门:

https://www.codefellows.org/blogs/this-is-why-learning-rails-is-hard

rails

踩到 Bootstrap3 popover 的一个坑

2014-03-30 by gihnius, tagged as web

在实现显示投票用户的功能的时候(看这里(过期)) , 想把用户名直接用 bootstrap3 的 popover 展示. 需要在 popover 里面动态加载用户名列表.

开始时这么干的: 

html:

<a href="javascript:void(0);" class="voted-users-popover" ....>显示该选项用户</a>
<a href="javascript:void(0);" class="voted-users-popover" ....>显示该选项用户</a>
<a href="javascript:void(0);" class="voted-users-popover" ....>显示该选项用户</a>

js:

// setup popover
$("a.voted-users-popover").each(function() {
    var el = $(this);
    el.popover({
       html: true,
       content: function() {
           // call ajax and return the content html.
           // 这里 ajax call 应该是设置 async = false.
       },
    });
});

Read more »