带有Rails 3.2的github预览功能 [英] github preview feature with rails 3.2

查看:90
本文介绍了带有Rails 3.2的github预览功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap Tabbable:

I'm using twitter bootstrap tabbable:

http://twitter.github.com/bootstrap/components.html#tab3

,我想知道,当用户在github上打开一个新期刊并按预览"标签时,如何复制预览效果.我要先预览实际商品,然后再发布该商品.

and I would like to know, how can I replicate the preview effect when a user open a new issue on github and press on preview tab. I want preview the actual item before post this item.

例如,您可以看到

https://github.com/samwillis/pagedown-bootstrap/issues/new

您可以单击预览并预览您的问题.

You can click on preview and preview your issue.

我想如果存在一些插件或库来使用jquery来实现此功能,或者为此目的而存在一些gem,因为github是用ruby制作的.

I would like if exist some plugin or library to make this feature with jquery, or exist some gem for this purpose because github is made with ruby on rails.

非常感谢!

推荐答案

给预览"选项卡链接一个ID,并使用该选项卡的show事件更新内容.您如何访问提供给标签内容的数据取决于您使用的所见即所得

Give the preview tab link an ID and use the show event of the tab to update the content. How you access the data to provide to tab content will depend on WYSIWYG you are using

$('#preview_tab').on('show',function(){
    var preview=$('#comment').val();
    preview= preview.length ? preview : 'No Comment provided'
    $('#preview_pane').html(preview)
});

演示: http://jsfiddle.net/hrXCC/

API参考(有关标签,请参见事件): http://twitter.github.com/bootstrap/javascript.html#tabs

API Reference (see Events for tabs) : http://twitter.github.com/bootstrap/javascript.html#tabs

这篇关于带有Rails 3.2的github预览功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆