<eg-grid-field label="[% l('Barcode') %]" path='barcode' visible></eg-grid-field>
<eg-grid-field label="[% l('Call Number') %]" path="call_number.label" visible></eg-grid-field>
<eg-grid-field label="[% l('Location') %]" path="location.name" visible></eg-grid-field>
- <eg-grid-field label="[% l('Title') %]" path="call_number.record.simple_record.title" visible></eg-grid-field>
+
+ <!-- linkpath value must be a quoted string to avoid compile-time
+ interpolation, hence the "'s -->
+ <eg-grid-field label="[% l('Title') %]"
+ path="call_number.record.simple_record.title" visible
+ linkpath=""[% ctx.base_path %]/opac/record/{{item['call_number.record.id']}}"">
+ </eg-grid-field>
</eg-grid>
items-provider="gridDataProvider"
persist-key="circ.patron.items_out">
<eg-grid-field label="[% l('Circ ID') %]" path='id' visible></eg-grid-field>
- <eg-grid-field label="[% l('Barcode') %]" path='target_copy.barcode' visible></eg-grid-field>
+ <eg-grid-field label="[% l('Barcode') %]" path='target_copy.barcode'
+ visible linkpath="'./cat/item/{{item.target_copy().id()}}'">
+ </eg-grid-field>
<eg-grid-field label="[% l('Due Date') %]" path='due_date' visible></eg-grid-field>
<eg-grid-field label="[% l('Checkout / Renewal Library') %]" path='circ_lib.shortname' visible></eg-grid-field>
<eg-grid-field label="[% l('Renewals Remaining') %]" path='renewal_remaining' visible></eg-grid-field>
<eg-grid-field label="[% l('Fines Stopped') %]" path='stop_fines' visible></eg-grid-field>
- <eg-grid-field label="[% l('Title') %]" path='target_copy.call_number.record.simple_record.title' visible></eg-grid-field>
+ <eg-grid-field label="[% l('Title') %]"
+ path='target_copy.call_number.record.simple_record.title' visible
+ linkpath="'[% ctx.base_path %]/opac/record/{{item.target_copy().call_number().record().id()}}'">
+ </eg-grid-field>
</eg-grid>
ng-repeat="col in columns"
style="flex:{{col.flex}}"
ng-show="col.visible">
- {{itemFieldValue(item, col)}}
+
+ <!-- TODO: add support for configurable intra-app routing via
+ linkpath. i.e. don't always assume target=_self -->
+ <a ng-if="col.linkpath" target="_self"
+ ng-href="{{generateLinkPath(col, item)}}">
+ {{itemFieldValue(item, col)}}
+ </a>
+ <span ng-if="!col.linkpath">
+ {{itemFieldValue(item, col)}}
+ </span>
</div>
</div>
</div>
return csvStr;
}
+ // Interpolate the value for column.linkpath within the context
+ // of the row item to generate the final link URL.
+ $scope.generateLinkPath = function(col, item) {
+ return egCore.strings.$replace(col.linkpath, {item : item});
+ }
+
$scope.collect = function() { grid.collect() }
// asks the dataProvider for a page of data
return {
require : '^egGrid',
restrict : 'AE',
- transclude : true,
scope : {
name : '@', // required; unique name
path : '@', // optional; flesh path
label : '@', // optional; display label
- flex : '@' // optional; default flex width
+ flex : '@', // optional; default flex width
+
+ // optional: url path string for generating links from grid cells.
+ // The path must be a quoted string and may include interpolation
+ // expressions. e.g.
+ // linkpath="'./cat/item/{{item.id()}}'"
+ linkpath : '=',
+
},
link : function(scope, element, attrs, egGridCtrl) {
flex : Number(colSpec.flex) || 2,
sort : Number(colSpec.sort) || 0,
required : colSpec.required,
+ linkpath : colSpec.linkpath,
visible : colSpec.visible,
hidden : colSpec.hidden,
datatype : colSpec.datatype,