Browse Source

Added file size info on project files page

pull/1/head
Nafies Luthfi 8 years ago
parent
commit
72167a45c6
  1. 5
      app/Entities/Projects/File.php
  2. 3
      resources/lang/id/file.php
  3. 2
      resources/views/projects/files.blade.php

5
app/Entities/Projects/File.php

@ -17,4 +17,9 @@ class File extends Model
{
return $this->morphTo('fileable', Project::class);
}
public function getSize()
{
return \Storage::size('public/files/'.$this->filename);
}
}

3
resources/lang/id/file.php

@ -22,9 +22,10 @@ return [
'undeleteable' => 'Data File tidak dapat dihapus.',
'select' => 'Pilih File',
'upload' => 'Upload File',
'download' => 'Download File',
'download' => 'Download',
// Attributes
'name' => 'Nama File',
'description' => 'Deskripsi File',
'size' => 'Ukuran File',
];

2
resources/views/projects/files.blade.php

@ -20,6 +20,7 @@
<thead>
<th>{{ trans('app.table_no') }}</th>
<th>{{ trans('file.file') }}</th>
<th class="text-right">{{ trans('file.size') }}</th>
<th class="text-center">{{ trans('file.download') }}</th>
<th class="text-center">{{ trans('app.action') }}</th>
</thead>
@ -31,6 +32,7 @@
<strong class="">{{ $file->title }}</strong>
<div class="text-info small">{{ $file->description }}</div>
</td>
<td class="text-right">{{ formatSizeUnits($file->getSize()) }}</td>
<td class="text-center">
{!! html_link_to_route('files.download', '', [$file->id], ['icon' => 'file', 'title' => trans('file.download')]) !!}
</td>

Loading…
Cancel
Save