json データを取得し、そこからテーブルを作成しています。One Column は優先度に関するもので、取得した数字をアイコンに置き換えたいと考えています。後でjqueryを使用してhtmlを変更するソリューションを見てきましたが、それは私には正しくないようです。代わりに、テーブルの作成中にアイコンを設定したいと思います。
以下の関連するコード スニペット:
行テンプレート:
<script type="text/underscore-template" id="caseTableRow">
<tr><td><a href="https://..."+ ><%=json.id%></a></td>
<td><%=json.title%></td>
<td><%=json.priority_id%></td> // display an icon instead
<td><%=json.refs%></td></tr>
レンダリング中:
$.each(cases, function(index, $testrailcase) {
var casesTable = $('#casesTable');
casesTable.append(that.rowTemplate({testrailcase: $testrailcase}));
});
行テンプレート:
rowTemplate: function(testrailcase) {
return _.template($('#caseTableRow').html())(testrailcase, icon);
},
統合したい Atlassian-Icons は、次のようにフォーマットされています。
<span class="aui-icon aui-icon-small aui-iconfont-arrow-down-circle">Insert meaningful text here for accessibility</span>
私はどんな助けにも満足します:D