Extracting conditional logic to make code more readable

This commit is contained in:
Shaunak Kashyap 2015-06-04 14:34:53 -07:00
parent 1c43563653
commit 46aea33811

View file

@ -1,3 +1,13 @@
<td <%= timefield ? 'class="discover-table-timefield" width="1%"' : sourcefield ? 'class="discover-table-sourcefield"' : 'class="discover-table-datafield"' %>>
<%
var attributes = '';
if (timefield) {
attributes='class="discover-table-timefield" width="1%"';
} else if (sourcefield) {
attributes='class="discover-table-sourcefield"';
} else {
attributes='class="discover-table-datafield"';
}
%>
<td <%= attributes %>>
<%= formatted %>
</td>