我正在开发一个Rails项目,我需要一个用户友好的WYSIWYG.我会说使用它的人的类型:无论你认为用户友好,或许想到下面一步(不是侮辱,只是一种实现).
理想情况下,我想要一些可以具有基本功能(列表,链接,粗体,斜体)并实时查看的内容.有点像OH我的GOSH它在这里因为我创建这个帖子而在堆叠溢出.
所以,嗯,是的:这样的事情会非常好(虽然我更喜欢窗户并排而不是这种编辑器在顶部的情况,但我不会挑剔).
那么自3.1以来CoffeeScript已经附带了Rails?太棒了!我正在进入语法.我喜欢简单.
然而,我似乎无法弄清楚如何将它包含在我的网站上.我试过把它包括在内,但是没有用.
我有一个.erb文件我想要这个,new.html.erb(显然,这是一个Rails应用程序):
<script type="text/coffeescript">
# Countdown to date script provided by JavaScriptKit.com
# http://www.javascriptkit.com/script/script2/count.shtml
montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
countdown(yr,m,d) ->
today=new Date()
todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
todaym=today.getMonth()
todayd=today.getDate()
todaystring=montharray[todaym]+" "+todayd+", "+todayy
futurestring=montharray[m-1]+" "+d+", "+yr
difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
if (difference==0) and document.write(current)
elseif (difference>0) document.write("ONLY "+difference+" DAYS LEFT!")
countdown(2012,4,30)
</script>?
Run Code Online (Sandbox Code Playgroud)
它根本没有显示出来.想法?