Skip to content

Instantly share code, notes, and snippets.

@andyxmas
Last active August 29, 2015 14:04
Show Gist options
  • Save andyxmas/8faabbdc1686593d68c8 to your computer and use it in GitHub Desktop.
Save andyxmas/8faabbdc1686593d68c8 to your computer and use it in GitHub Desktop.
#if (!$entries.isEmpty())
<table class="pgrList table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Opportunity Title</th>
<th>Primary Supervisor</th>
<th>Application Deadline</th>
</tr>
</thead>
<tbody>
#foreach ($curEntry in $entries)
#set($renderer = $curEntry.getAssetRenderer() )
#set($className = $renderer.getClassName() )
#if( $className == "com.liferay.portlet.journal.model.JournalArticle" )
#set( $journalArticle = $renderer.getArticle() )
#set( $document = $saxReaderUtil.read($journalArticle.getContent()) )
#set( $rootElement = $document.getRootElement() )
#foreach( $dynamicElement in $rootElement.elements() )
#if( "supervisor_name" == $dynamicElement.attributeValue("name") )
#set( $primarySupervisor = $dynamicElement.element("dynamic-content").getText() )
#end
#if( "deadline" == $dynamicElement.attributeValue("name") )
#set( $deadline = $dynamicElement.element("dynamic-content").getData() )
#set( $date_DateObj = $dateUtil.newDate($getterUtil.getLong($deadline)))
#end
#end
#end
<tr class="pgritem">
<td class="pgrTitle"><a href='$assetPublisherHelper.getAssetViewURL($renderRequest, $renderResponse, $curEntry)'>$curEntry.getTitle($locale)</a></td>
<td class="primarySupervisor">$primarySupervisor</td>
<td class="deadline"><span class="hidden">$dateUtil.getDate($date_DateObj, "yyyy-M-d", $locale)</span>$dateUtil.getDate($date_DateObj, "dd MMM yyyy", $locale)</td>
</tr>
#end
</tbody>
</table>
#else
<div class="no-results">
<p>There are no currently no Research Led Opportunities available here.</p>
<a href="https://testwww.uea.ac.uk/pgrprojects" class="btn btn-primary">View all Research Led Opportunities</a>
<a href="https://testwww.uea.ac.uk/" class="btn btn-primary">View all Applicant Led Opportunities</a>
</div>
#end
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
##<script type="text/javascript" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.js"></script>
<link rel="stylesheet" type="text/css" src="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css" />
##<link rel="stylesheet" type="text/css" src="//cdn.datatables.net/plug-ins/be7019ee387/integration/bootstrap/3/dataTables.bootstrap.css" />
<script type="text/javascript">
$(document).ready(function() {
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return null;
else
return results[1];
};
var search_param = gup( 'courseSearchString' );
if (search_param === null){
$('.pgrList').dataTable({
"paging": false,
"columns": [ { "width": "55%" },
{ "width": "29%", "orderable": false },
{ "width": "15%" } ]
});
}
else{
$('.pgrList').dataTable({
"paging": false,
"columns": [ { "width": "55%" },
{ "width": "29%", "orderable": false },
{ "width": "15%" } ],
"search": {"search": search_param }
});
}
/*add bootstrap classes*/
$('#DataTables_Table_0_filter input').addClass('input-medium search-query');
} );
</script>
<style type="text/css">
.dataTables_filter{padding-left: 8px;}
.aui .dataTables_filter input {margin: 10px;}
.aui .dataTables_filter label {margin-bottom: 0;}
.aui table.dataTable{margin-bottom:0;}
.aui div.dataTables_info {margin: 10px 0 10px 8px;}
.no-results{padding:10px;}
/*Styles copied from http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css and edited to override uea stlyes*/
.aui table.dataTable thead .sorting_asc,
.aui table.dataTable thead .sorting_desc,
.aui table.dataTable thead .sorting {
cursor: pointer;
*cursor: hand;
padding-right:15px!important;
}
.aui table.dataTable thead .sorting {
background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_both.png") no-repeat center right!important;
}
.aui table.dataTable thead .sorting_asc {
background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_asc.png") no-repeat center right!important;
}
.aui table.dataTable thead .sorting_desc {
background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_desc.png") no-repeat center right!important;
}
.aui table.dataTable thead .sorting_asc_disabled {
background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_asc_disabled.png") no-repeat center right!important;
}
.aui table.dataTable thead .sorting_desc_disabled {
background: #00597f url("//cdn.datatables.net/1.10.0/images/sort_desc_disabled.png") no-repeat center right!important;
}
.aui table.dataTable thead .sorting_disabled {
background: #00597f!important;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment