forked from storypioneers/kirby-selector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.php
80 lines (75 loc) · 4.48 KB
/
template.php
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
<input class="[ js-selector-storage ]" type="hidden" name="<?= $field->name() ?>" id="<?= $field->name() ?>" value="<?= implode(',', $field->value()) ?>" />
<?php if ($field->files()->count() > 0): ?>
<div class="input input-with-items">
<?php foreach ($field->files() as $file): ?>
<div id="<?= $field->itemId($file) ?>" class="item item-with-image [ selector-item js-selector-item ]" data-file="<?= $file->filename() ?>" <?= r($field->isInValue($file), 'data-checked="true"') ?> >
<div class="item-content">
<?php if ($file->type() == 'image'): ?>
<figure class="item-image">
<?php if (version_compare(panel()->version(), '2.2', '>=')): ?>
<a class="btn btn-with-icon" data-context="<?= purl($file, 'context') ?>" href="#options" title="<?= l('pages.show.subpages.edit') ?>">
<?= thumb($file, array('width' => 48, 'height' => 48, 'crop' => true)) ?>
</a>
<?php else: ?>
<a class="btn btn-with-icon" href="<?= purl($file, 'show') ?>" title="<?= l('pages.show.subpages.edit') ?>">
<?= thumb($file, array('width' => 48, 'height' => 48, 'crop' => true)) ?>
</a>
<?php endif ?>
</figure>
<?php else: ?>
<figure class="item-image item-filetype">
<a class="btn btn-with-icon" href="<?= purl($file, 'show') ?>" title="<?= l('pages.show.subpages.edit') ?>">
<?= strtoupper($file->extension()) ?>
</a>
</figure>
<?php endif ?>
<div class="item-info">
<div class="fix">
<strong class="item-title">
<?= $file->filename() ?>
</strong>
<small class="item-meta marginalia">
<?= $file->type() ?> / <?= $file->niceSize() ?>
<?php if (($file->type() == 'image') and ($file->extension() != 'svg')): ?>
/ <?= $file->width() ?> x <?= $file->height() ?>
<?php endif ?>
</small>
</div>
</div>
</div>
<nav class="item-options">
<ul class="nav nav-bar">
<li>
<?php if (version_compare(panel()->version(), '2.2', '>=')): ?>
<a class="btn btn-with-icon" data-context="<?= purl($file, 'context') ?>" href="#options" title="<?= l('pages.show.subpages.edit') ?>">
<i class="icon icon-left fa fa-pencil"></i>
<span><?= l('pages.show.subpages.edit') ?></span>
</a>
<?php else: ?>
<a class="btn btn-with-icon" href="<?= purl($file, 'show') ?>" title="<?= l('pages.show.subpages.edit') ?>">
<i class="icon icon-left fa fa-pencil"></i>
<span><?= l('pages.show.subpages.edit') ?></span>
</a>
<?php endif ?>
</li>
<li>
<a class="btn btn-with-icon [ selector-checkbox js-selector-checkbox ]" href="#" title="<?= l::get('selector.select') ?>">
<i class="icon icon-left fa fa-circle-o"></i>
<span><?= l::get('selector.select') ?></span>
</a>
</li>
</ul>
</nav>
</div>
<?php endforeach ?>
</div>
<?php else: ?>
<div class="field field-is-readonly field-with-icon">
<div class="field-content">
<input class="input input-is-readonly" type="text" readonly placeholder="" value="<?= l::get('selector.empty', 'No matching files yet.') ?>">
<div class="field-icon">
<i class="icon fa fa-info"></i>
</div>
</div>
</div>
<?php endif ?>