I have a webapp using principally jquery and rails. Currently tabTemplate is used to construct the tab when adding a tab dynamically. However when reloading the page, the already loaded tabs are rendered via an html.erb file. You can see how similar these code snippets are. I would like to DRY the code up and remove tabTemplate and simply inject the rendered tab header. Is this possible?
tabTemplate: '<li><a href="\#{href}" title="\#{label}">\#{label}</a><span class="ui-icon ui-icon-close">Remove Tab</span></li>',
<li id="<%= tab_show.html_id %>-tab">
<a href="/cg_author/works/<%= @work.id %>/editions/<%= @edition.id %>/<%=tab_show.path %>" title=<%= tab_show.name %> ><%= tab_show.name %></a>
<span class="ui-icon ui-icon-close">Remove Tab</span>
<div class="clear"></div>
</li>