-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtile.scala.html
More file actions
90 lines (87 loc) · 4.42 KB
/
tile.scala.html
File metadata and controls
90 lines (87 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@(file: models.File, classes: String, redirect: Call, showFollow: Boolean, showAuthor: Boolean = true)(implicit user: Option[models.User])
@import _root_.util.Formatters.humanReadableByteCount
@import api.Permission
<div class="post-box @classes" id="@file.id-tile">
<div class="panel panel-default file-panel">
<div class="pull-left">
<span class="glyphicon glyphicon-file"></span>
</div>
@if(user.isDefined) {
<a href="javascript: void(0)" title="Click to mark file for bulk actions" class="pull-right fileselect" data-id="@file.id">
<span class="glyphicon glyphicon-plus"></span>
</a>
}
<div class="panel-body">
@if(!file.thumbnail_id.isEmpty){
<a href="@(routes.Files.file(file.id))">
<img class="img-responsive fit-in-space" src="@(routes.Files.thumbnail(UUID(file.thumbnail_id.toString().substring(5,file.thumbnail_id.toString().length-1))))" alt="Thumbnail of @(file.filename)">
</a>
} else {
<h4><a href="@(routes.Files.file(file.id))">@file.filename</a></h4>
}
<!-- <div class="caption break-word"> -->
<ul class="list-unstyled">
@if(showAuthor){
<li>Author: <strong>@file.author.fullName</strong></li>
}
<!-- <li>Uploaded: <strong>@file.uploadDate.format("dd MMM, yyyy")</strong></li> -->
<!-- <li>Size: <strong>@humanReadableByteCount(file.length)</strong></li> -->
<li>
<span>
@if(!file.thumbnail_id.isEmpty){
<a href="@(routes.Files.file(file.id))">@file.filename</a>
}
</span>
</li>
</ul>
<!-- </div> -->
</div>
<ul class="list-group">
<li class="list-group-item file-panel-footer">
<span class="glyphicon glyphicon glyphicon-list" title="@(file.metadataCount) metadata fields"></span> @(file.metadataCount)
<span class="glyphicon glyphicon-eye-open" title="@file.stats.views views"></span> @file.stats.views
<span class="glyphicon glyphicon-circle-arrow-down" title="@file.stats.downloads downloads"></span> @file.stats.downloads
@if(user.isDefined) {
@if(user.get.id.equals(file.author.id) || Permission.checkPermission(Permission.DeleteFile, ResourceRef(ResourceRef.file, file.id))){
<button onclick="confirmDeleteResource('file','file','@(file.id)','@(file.filename.replace("'","'"))', false, '@redirect')" class="btn btn-link" title="Delete the file">
<span class="glyphicon glyphicon-trash"></span></button>
} else {
<div class="inline" title="No permission to delete the file">
<button disabled class="btn btn-link"><span class="glyphicon glyphicon-trash"></span></button>
</div>
}
}
</li>
</ul>
@if(showFollow) {
@user match {
case Some(viewer) => {
<ul class="list-group center-margin">
<a
id="followButton"
type="button"
class="btn-link"
data-toggle="button"
aria-pressed="
@if(viewer.followedEntities.filter(x => (x.id == file.id)).nonEmpty) {
true
} else {
false
}
"
autocomplete="off"
objectType="file"
objectId="@file.id.stringify"
>
@if(viewer.followedEntities.filter(x => (x.id == file.id)).nonEmpty) {
<span class='glyphicon glyphicon-star-empty'></span>Unfollow
} else {
<span class='glyphicon glyphicon-star'></span>Follow
}
</a>
</ul>
}
}
}
</div>
</div>