rails3.2でbackbone.js使ってるオプンソースを分析してます。
構造は以下の通りで
rails_root
├── app
│ ├── assets
│ │ ├── javascripts
│ │ ├── templates
│ │ │ ├──note
│ │ │ │ ├──detail.jst.ejs
│ │ │ │ ├──footer.jst.ejs
私は
detail.jst.ejsファイルの一部を別のjst.ejsにして条件によってインクルードしたいと考えてます。
※detail.jst.ejsの中身は以下リンクを三個ください。
https://github.com/negabaro/nevernote/blob/master/app/assets/templates/notes/detail.jst.ejs
そしてdetail.jst.ejs
の<header>下の部分だけを同じディレクトリ配下にfooter.jst.ejs
に以下のように貼り付けました。
footer.jst.ejs
<div class="note-content-wrapper"> <section class="note-content"> <% var title = note.escape('title') %> <div class="note-title"> <h2><%= title %></h2> <input type="text" name="title" value="<%= title %>" class="input hide"> </div> <% var content = note.get('content') %> <div class="note-body"> <p><%= content %></p> <p name="content" class="input hide" contenteditable="true"> <%= content %> </p> </div> </section> </div>
そしてdetail.jst.ejsには
<% this.JST["footer"] %>
or
<% JST["footer"] %>
or
<% this.JST["footer.jst"] %>
or
<% this.JST["footer.jst.ejs"] %>
or
<% this.JST["footer.jst.ejs] %>
or
<% include footer %>
とかでインクルードをしようしていますが、
Uncaught TypeError: JST.notes/detail is not a function
ブラウザから上記のエラーが出てます。
jst.ejsファイルから別のjst.ejsをインクルードしたい時、単純なインクルード
操作で読み込まれないですか?もしくはパスの指定がわるいでしょうか。
ヒントになることありましたら教えていただければ助かります。
あなたの回答
tips
プレビュー