Skip to content

Commit

Permalink
Fix download link and style
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Jul 15, 2016
1 parent 4155962 commit f176427
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
6 changes: 6 additions & 0 deletions client/src/js/components/bhFindDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translat
Document.read(vm.session.patientUuid)
.then(function (documents) {
vm.session.patientDocuments = documents;

vm.session.patientDocuments.forEach(function (doc) {
doc.downloadLink = doc.label + mimeIcon(doc.mimetype).ext;
doc.icon = mimeIcon(doc.mimetype).icon;
doc.type = mimeIcon(doc.mimetype).label;
});
})
.catch(Notify.handleError);
}
Expand Down
22 changes: 11 additions & 11 deletions client/src/partials/templates/bhFindDocument.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@
<ng-switch on="$ctrl.session.display">
<!-- list dispaly mode -->
<div ng-switch-default>
<ul class="media-list">
<li class="document media col-xs-12"
<div>
<div class="document media col-xs-12"
ng-repeat="doc in $ctrl.session.patientDocuments | filter: $ctrl.searchByName">
<a class="media-left">
<i class="fa fa-3x" ng-class="{{ '$ctrl.mimeIcon(doc.mimetype).icon' }}"></i>
<i class="fa fa-3x" ng-class="{{ 'doc.icon' }}"></i>
</a>
<div class="media-body">

<!-- actions buttons -->
<div class="pull-right">
<a
ng-href="/{{ doc.link }}" download="{{ doc.label + $ctrl.mimeIcon(doc.mimetype).ext }}"
ng-href="/{{ doc.link }}" download="{{ doc.downloadLink }}"
title="{{ 'PATIENT_DOCUMENT.DOWNLOAD' | translate }}"
type="button"
class="btn btn-sm btn-default">
Expand All @@ -94,15 +94,15 @@ <h4 class="media-heading">{{ doc.label }}</h4>

<!-- file size -->
<i class="fa fa-file-o"></i>
{{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) |
{{ doc.type }} (~{{ doc.size | bytes }}) |

<!-- date and author -->
<i class="fa fa-calendar-o"></i>
{{ doc.timestamp | date }}, {{ 'FORM.LABELS.BY' | translate }}
{{ doc.first + ' ' + doc.last }}
</div>
</li>
</ul>
</div>
</div>
</div>

<!-- thumbnail display mode -->
Expand All @@ -113,8 +113,8 @@ <h4 class="media-heading">{{ doc.label }}</h4>
<!-- the picture -->
<div class="crop">
<div class="image">
<img ng-show="$ctrl.mimeIcon(doc.mimetype).icon === 'fa-file-image-o'" ng-src="{{ doc.link }}" />
<i ng-hide="$ctrl.mimeIcon(doc.mimetype).icon === 'fa-file-image-o'" class="fa" ng-class="{{ '$ctrl.mimeIcon(doc.mimetype).icon' }}"></i>
<img ng-show="doc.icon === 'fa-file-image-o'" ng-src="{{ doc.link }}" />
<i ng-hide="doc.icon === 'fa-file-image-o'" class="fa" ng-class="{{ 'doc.icon' }}"></i>
</div>
</div>

Expand All @@ -124,7 +124,7 @@ <h4 class="media-heading">{{ doc.label }}</h4>
<!-- actions buttons -->
<div class="pull-right">
<a
ng-href="/{{ doc.link }}" download="{{ doc.label + $ctrl.mimeIcon(doc.mimetype).ext }}"
ng-href="/{{ doc.link }}" download="{{ doc.downloadLink }}"
title="{{ 'PATIENT_DOCUMENT.DOWNLOAD' | translate }}"
type="button"
class="btn btn-sm btn-default">
Expand All @@ -144,7 +144,7 @@ <h4 style="margin:0; padding:0">{{ doc.label }}</h4>

<!-- file size -->
<i class="fa fa-file-o"></i>
{{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) <br>
{{ doc.type }} (~{{ doc.size | bytes }}) <br>

<!-- author -->
<i class="fa fa-calendar-o"></i>
Expand Down

0 comments on commit f176427

Please sign in to comment.