%
var data = _preloadData;
var model = data.nodeValue;
var books = data.books;
var children = data.childNodes;
var collection = data.nodeValue.collectionCode ? data.nodeValue.collectionCode.toLowerCase(): "";
var entireIssueFound = "0";
var digitizedPPP = false;
if(model.hasDocumentResults == true && model.collectionCode == 'PPP' && model.hasOwnProperty('digitizedFR') && model.digitizedFR == true) {
digitizedPPP = true;
}
if(model.hasDocumentResults === true) {
if(model.collectionCode.toLowerCase() === "cdir" || model.collectionCode.toLowerCase() === "fr") {
var previousfp = "";
var previoussection = "";
_.each(children, function(item){
if(item.nodeValue["firstpage"] === previousfp) {
previousfp = item.nodeValue['firstpage'];
item.nodeValue["firstpage"] = "";
} else {
previousfp = item.nodeValue['firstpage'];
}
if(item.nodeValue["section"] === previoussection) {
previoussection = item.nodeValue['section'];
item.nodeValue["section"] = "";
} else {
previoussection = item.nodeValue['section'];
item.nodeValue["section"] = this.uiprops.docresultsmapping[model.collectionCode.toLowerCase()][item.nodeValue["section"]];
}
},_this);
}
if(model.collectionCode.toLowerCase() === "statute") {
if(model.value === "BILLNUMBERLIST") {
// sort by lastpage for billnumberlist order as follows (hjres,house,senate,sjres)
children = _.sortBy(children, function(item) {return item.nodeValue.lastpage;});
var previouslp = "";
_.each(children, function(item){
if(item.nodeValue["lastpage"] === previouslp) {
previouslp = item.nodeValue['lastpage'];
item.nodeValue["lastpage"] = "";
} else {
previouslp = item.nodeValue['lastpage'];
}
},_this);
} else if(model.value === "CONRES") {
// sort by section
children = _.sortBy(children, function(item) {return item.nodeValue.section});
var previouslp = "";
_.each(children, function(item){
if(item.nodeValue["lastpage"] === previouslp) {
previouslp = item.nodeValue['lastpage'];
item.nodeValue["lastpage"] = "";
} else {
previouslp = item.nodeValue['lastpage'];
}
},_this);
} else if(model.value === "POPULARNAMELIST") {
// sort by shorttitle and title
children = _.sortBy(children, function(item) {return (item.nodeValue.shorttitle !== "") ? item.nodeValue.shorttitle : item.nodeValue.title});
_.each(children, function(item){
item.nodeValue["lastpage"] = "";
},_this);
} else {
_.each(children, function(item){
item.nodeValue["lastpage"] = "";
},_this);
}
}
}
%>
<% if(model.hasOwnProperty("entireIssueDetails")) { %>
<%if(( model.collectionCode == 'CREC' && books && books.length >1) || digitizedPPP) { %>
<% } else {%>
<% entireIssueFound = "1"; %>
<%=_this.snippet('entireissue', { _preloadData : model }) %>
<%}%>
<%}%>
<% if(model.collectionCode == 'CREC' && books && books.length> 0) {%>
<% if(model.collectionCode == 'CREC' && books && books.length> 1) {%>
<%=_this.snippet('entireissue', { _preloadData : model }) %>
<%}%>
<%= _this.snippet('crecbooks' , {data: books}) %>
<%}%>
<% if(children.length === 0) { %>
<% if(entireIssueFound === "0") { %>
<%=_this.snippet('noresults')%>
<% } %>
<%} else {%>
<% if(data.nodeValue.hasDocumentResults === true) { %>
<% if(digitizedPPP == true) { %>
<%= _this.snippet('pppleaf', { _preloadData : children[0],digitizedFR : model.digitizedFR })%>
<%} else {%>
<% if((children && children.length > 1) && !_this.dic) { %>
<% if(_this.paginationenabledleaf === true) { %>
<%= _this.snippet('pagination', { _preloadData : _preloadData,_this :_this}) %>
<% } %>
Sort " >
<%} %>
<% for(var i=0,l=children.length;i
<% var cc = children[i].nodeValue.collectionCode ? children[i].nodeValue.collectionCode.toLowerCase():'c0b' %>
<%= _this.snippet(cc + 'leaf', { _preloadData : children[i] }) %>
<%} %>
<%} %>
<%} else { %>
<% for(var i=0,l=children.length;i
<% var cc = children[i].nodeValue.collectionCode ? children[i].nodeValue.collectionCode.toLowerCase():'c0b' %>
<%=_this.snippet(cc + 'node', { _preloadData : children[i]}) %>
<%} %>
<% } %>
<%} %>