2017-05-15 9 views
0

私は、レールサーバーのmailer.html.erbのMSO条件にルビーコンテンツを埋め込むようにしています。MSO条件とERBタグ

msoの場合、hrefは「www.example.com/edit/ <% = @user [:id]%>/<%= @user [:reset_digest]%>」のように動作しないようです。

<!--[if mso]> 
      <table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;"> 
       <tr> 
       <td style="padding-right: 10px; padding-left: 10px; padding-top:10px; padding-bottom:10px;" align="center"> 
        <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://www.example.com/doctores/edit/<%= @user[:id] %>/<%= @user[:reset_digest] %>" style="height:42px; v-text-anchor:middle; width:170px;" arcsize="15%" strokecolor="#3AAEE0" fillcolor="#3AAEE0"> 
        <w:anchorlock/> 
        <center style="color:#ffffff; font-family:'Helvetica Neue', Helvetica, Arial, sans-serif; font-size:16px;"> 
<![endif]--> 
      <a href="https://www.example.com/doctores/edit/<%= @user[:id] %>/<%= @user[:reset_digest] %>" target="_blank" style="display: inline-block;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #ffffff; background-color: #3AAEE0; border-radius: 6px; -webkit-border-radius: 6px; -moz-border-radius: 6px; max-width: 150px; width: 110px; width: auto; border-top: 0px solid transparent; border-right: 0px solid transparent; border-bottom: 0px solid transparent; border-left: 0px solid transparent; padding-top: 5px; padding-right: 20px; padding-bottom: 5px; padding-left: 20px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;mso-border-alt: none"> 
       <span style="font-size:12px;line-height:24px;"><span style="font-size: 16px; line-height: 32px;" data-mce-style="font-size: 16px;">Corregir Datos</span></span> 
      </a> 

おかげ

+0

は、あなたが送ったメールに何を参照してくださいということですか? – Syfer

+0

RubyMineとは異なり、テキストとして解釈します。私は本当にそれを検証するフォームがありません – HFR1994

+0

それは同様にテストで同じように見えるのですか?また、あなたは '>'と '<'のHTMLコードを試しましたか? – Syfer

答えて

0

あなたのルビーは、あなたのケースでとても好きならブロックし、出力全体MSO条件、何かにvarsはCONCAT私が見つけた唯一の解決策は、文字列にある:

<%== '<!--[if mso]> 
     <table width="100%" ...> 
      <tr> 
      <td style="..."> 
       <v:roundrect ... href="https://www.example.com/doctores/edit/' + @user[:id] + '/' + @user[:reset_digest] + '" style="..." ...> 
       <w:anchorlock/> 
       <center style="..."> 
     <![endif]-->' %> 

<%== '生の' erbタグの使用に注意してください。私は通常のエスケープ<%=タグで矛盾した結果を出しました。

率直に醜い、ハックのソリューションですが、その後、そのことはかなり電子メールをMSOタグを使用しているような;)

関連する問題