2012-10-30 23 views
0

我加入默認一些文本到文本區域如何在textarea的

%textarea.email_copy 
    Hi <awesome friend>, 

    I am using this site called XXXX, and you should check it out. It is for smart and thoughtful people to share about their experiences and ideas around topics they care about, and I think you are perfect for it. 

    I generated a special invite for you: 

    http://some_link 

    <%= current_user.getFirstName() %> 

然而,當我在加載頁面我看到這個

enter image description here

如何可以格式化文本我在段落之間添加了段落或間距?

+3

您是否在構建垃圾郵件引擎? –

+1

@AlexisPigeon這是寫得很好的方式垃圾 – climbage

+0

@AlexisPigeon,不,不,我沒有在這裏建立任何引擎,事實上,我只是要求用戶複製並粘貼此電子郵件副本,如果他們想邀請他們的朋友使用網站。但我認爲添加一點格式將有助於 – Zhen

回答

1

textarea不能包含標記。如果你只想要演示和沒有輸入,一個div應該沒問題。如果你想要演示和輸入,你應該看看RTE。

+0

我希望用戶能夠輕鬆地將文本複製並粘貼到他們自己的電子郵件作曲者 – Zhen

2

入住這裏:http://cheat.errtheblog.com/s/haml/

~ - Ruby expression preserving whitespace, e.g. %pre~ @content.body 
    Works just like =, but calls the find_and_preserve helper to keep 
    line breaks intact in the output. 

希望有所幫助。