1

HTML の小さなチャンクをレンダリングする grails render タグがあります。HTMl でテキストを表示する必要がある場合もあれば、テキストとリンクを表示する必要がある場合もあります。

このコードのチャンクは正常に動作しています:

                <g:render template='accountInfo' model="[
                        'accountStatus':subscription.status,
                        'subscription':subscription.plan.name,
                        'msg':g.message (code: 'stripe.plan.info', args:'${[periodStatus, endDate]}')]"/>

しかし、モデルの 'msg' 変数に HTML を渡して、次のようにテキストとリンクを出力できるようにしたいと考えています。

                <g:render template='accountInfo' model="[
                        'accountStatus':profile.profileState,
                        'subscription':'None selected yet',
                        'msg':<a href="${createLink(controller: 'charge', action: 'basicPlanList')}" title="Start your Subscription">Your profile is currently inactive, select a plan now to publish your profile.</a>]"/>

そのコードは機能しません。リンクをtaglibに追加しようとしましたが、taglibを「msg」に渡す方法もわかりません。

                <g:render template='accountInfo' model="[
                        'accountStatus':profile.profileState,
                        'subscription':'None selected yet',
                        'msg':<abc:showThatLink/>]"/>

テキストのみを渡す最善の方法、テキストと grails の createLink クロージャー、およびリンク用のテキストについての提案をお待ちしています。

4

1 に答える 1