1{% macro changelog_pager(currentpage, pagecount) %} 2 <ul class="pagination pagination-centered"> 3 {% if currentpage > 1 %} 4 <li><a href="?page=1"><i style="font-weight: bold" class="fa fa-angle-double-left"></i></a></li> 5 <li><a href="?page={{ currentpage - 1 }}"><i style="font-weight: bold" class="fa fa-angle-left"></i></a></li> 6 {% else %} 7 <li class="disabled"><span><i style="font-weight: bold" class="fa fa-angle-double-left"></i></span></li> 8 <li class="disabled"><span><i style="font-weight: bold" class="fa fa-angle-left"></i></span></li> 9 {% endif %} 10 11 <li><span>{{ __('component.changelog-pager.page') }} {{ currentpage }} / {{ pagecount }}</span></li> 12 13 {% if currentpage < pagecount %} 14 <li><a href="?page={{ currentpage + 1 }}"><i style="font-weight: bold" class="fa fa-angle-right"></i></a></li> 15 <li><a href="?page={{ pagecount }}"><i style="font-weight: bold" class="fa fa-angle-double-right"></i></a></li> 16 {% else %} 17 <li class="disabled"><span><i style="font-weight: bold" class="fa fa-angle-right"></i></span></li> 18 <li class="disabled"><span><i style="font-weight: bold" class="fa fa-angle-double-right"></i></span></li> 19 {% endif %} 20 </ul> 21 22{% endmacro %} 23 24{% macro changelog_details(entry) %} 25 {% import '_macro/_macro.twig' as macro %} 26 27 {% set preview_w = 200 %} 28 {% set preview_h = 150 %} 29 30 <h3> 31 "{{ entry.title }}" 32 {{ _self.changelog_mutation(entry.mutation_type) }} 33 {{ __('component.changelog-detail.by') }} <strong>{{ entry.username }}</strong> 34 </h3> 35 36 <div class="changelog-details"> 37 <div class="user"> 38 <i class="icon icon-user"></i> 39 </div> 40 41 <div class="body"> 42 <div class="time"> 43 <p> 44 <span>{{ _self.changelog_mutation(entry.mutation_type) }} {{ macro.datetime(entry.date) }}</span> 45 {{ __('component.changelog-detail.by') }} <strong>{{ entry.username }}</strong> 46 </p> 47 {% if ischangelogenabled() %} 48 {% if entry.comment|default(false) %}<h4><strong>Comment</strong>: {{ entry.comment }}</h4>{% endif %} 49 {% endif %} 50 </div> 51 52 53 <table class="table table-bordered table-condensed table-changelog-details"> 54 <thead> 55 <tr> 56 <th>{{ __('component.changelog-detail.field') }}</th> 57 <th>{{ __('component.changelog-detail.value-old') }}</th> 58 <th>{{ __('component.changelog-detail.value-new') }}</th> 59 </tr> 60 </thead> 61 <tbody> 62 {% for key, field in entry.changedfields %} 63 <tr> 64 <td><strong>{{ field.label }}</strong></td> 65 66 {% if field.type == 'normal' %} 67 <td class="change-log-item"> 68 {{ field.before.render }} 69 </td> 70 <td class="change-log-item"> 71 {{ field.after.render }} 72 </td> 73 {% elseif field.type == 'html' %} 74 <td class="change-log-item"> 75 {{ field.before.render|raw }} 76 </td> 77 <td class="change-log-item"> 78 {{ field.after.render|raw }} 79 </td> 80 {% elseif field.type == 'filelist' %} 81 <td class="change-log-item"> 82 {% for file in field.before.render %} 83 <strong>File:</strong> {{ file.filename }}<br> 84 <strong>Title:</strong> {{ file.title }} 85 86 {% if not loop.last %} 87 <br><br> 88 {% endif %} 89 {% endfor %} 90 </td> 91 <td class="change-log-item"> 92 {% for file in field.after.render %} 93 <strong>File:</strong> {{ file.filename }}<br> 94 <strong>Title:</strong> {{ file.title }} 95 96 {% if not loop.last %} 97 <br><br> 98 {% endif %} 99 {% endfor %} 100 </td> 101 {% elseif field.type == 'geolocation' %} 102 <td class="change-log-item"> 103 <strong>Address:</strong> {{ field.before.render.address }}<br> 104 <strong>Latitude:</strong> {{ field.before.render.latitude }}<br> 105 <strong>Longitude:</strong> {{ field.before.render.longitude }}<br> 106 <strong>Matched address:</strong> {{ field.before.render.formatted_address }} 107 </td> 108 <td class="change-log-item"> 109 <strong>Address:</strong> {{ field.after.render.address }}<br> 110 <strong>Latitude:</strong> {{ field.after.render.latitude }}<br> 111 <strong>Longitude:</strong> {{ field.after.render.longitude }}<br> 112 <strong>Matched address:</strong> {{ field.after.render.formatted_address }} 113 </td> 114 {% elseif field.type == 'image' %} 115 <td class="change-log-item"> 116 <strong>File:</strong> {{ field.before.render.file }}<br> 117 <strong>Title:</strong> {{ field.before.render.title }}<br> 118 <div class="content-preview imageholder" id="thumbnail-{{ key }}"> 119 {% if field.before.render.file != '' %} 120 {% set preview_path = field.before.render.file|thumbnail(preview_w, preview_h, 'c') %} 121 <img src="{{ preview_path }}" alt="Preview" width="{{ preview_w }}" height="{{ preview_h }}"> 122 {% endif %} 123 </div> 124 </td> 125 <td class="change-log-item"> 126 <strong>File:</strong> {{ field.after.render.file }}<br> 127 <strong>Title:</strong> {{ field.after.render.title }}<br> 128 <div class="content-preview imageholder" id="thumbnail-{{ key }}"> 129 {% if field.after.render.file != '' %} 130 {% set preview_path = field.after.render.file|thumbnail(preview_w, preview_h, 'c') %} 131 <img src="{{ preview_path }}" alt="Preview" width="{{ preview_w }}" height="{{ preview_h }}"> 132 {% endif %} 133 </div> 134 </td> 135 {% elseif field.type == 'imagelist' %} 136 <td class="change-log-item"> 137 {% for image in field.before.render %} 138 <strong>File:</strong> {{ image.filename }}<br> 139 <strong>Title:</strong> {{ image.title }}<br> 140 <div class="content-preview imageholder" id="thumbnail-{{ key }}"> 141 {% if image.filename != '' %} 142 {% set preview_path = image.filename|thumbnail(preview_w, preview_h, 'c') %} 143 <img src="{{ preview_path }}" alt="Preview" width="{{ preview_w }}" height="{{ preview_h }}"> 144 {% endif %} 145 </div> 146 147 {% if not loop.last %} 148 <br> 149 {% endif %} 150 {% endfor %} 151 </td> 152 <td class="change-log-item"> 153 {% for image in field.after.render %} 154 <strong>File:</strong> {{ image.filename }}<br> 155 <strong>Title:</strong> {{ image.title }}<br> 156 <div class="content-preview imageholder" id="thumbnail-{{ key }}"> 157 {% if image.filename != '' %} 158 {% set preview_path = image.filename|thumbnail(preview_w, preview_h, 'c') %} 159 <img src="{{ preview_path }}" alt="Preview" width="{{ preview_w }}" height="{{ preview_h }}"> 160 {% endif %} 161 </div> 162 163 {% if not loop.last %} 164 <br> 165 {% endif %} 166 {% endfor %} 167 </td> 168 {% elseif field.type == 'markdown' or field.type == 'textarea' %} 169 <td class="change-log-item"> 170 <pre style="white-space: pre-wrap; background-color: inherit; border: 0;">{{ field.before.render }}</pre> 171 </td> 172 <td class="change-log-item"> 173 <pre style="white-space: pre-wrap; background-color: inherit; border: 0;">{{ field.after.render }}</pre> 174 </td> 175 {% elseif field.type == 'select' %} 176 <td class="change-log-item"> 177 {% if field.before.render is iterable %} 178 <ul> 179 {% for select in field.before.render %} 180 <li>{{ select }}</li> 181 {% endfor %} 182 </ul> 183 {% else %} 184 {{ field.before.render }} 185 {% endif %} 186 </td> 187 <td class="change-log-item"> 188 {% if field.after.render is iterable %} 189 <ul> 190 {% for select in field.after.render %} 191 <li>{{ select }}</li> 192 {% endfor %} 193 </ul> 194 {% else %} 195 {{ field.after.render }} 196 {% endif %} 197 </td> 198 {% elseif field.type == 'video' %} 199 <td class="change-log-item"> 200 <strong>Title:</strong> {{ field.before.render.title }}<br> 201 <strong>URL:</strong> {{ field.before.render.url }}<br> 202 <strong>Size:</strong> {{ field.before.render.width }} x {{ field.before.render.height }}<br> 203 <div class="imageholder" id="thumbnail-{{ key }}"> 204 {% if field.before.render.thumbnail|default('') %} 205 <img src="{{ field.before.render.thumbnail }}" width="200" height="150"> 206 {% endif %} 207 </div> 208 <div class="hidden video" id="{{ key }}">{{ field.after.render.html|raw }}</div> 209 </td> 210 <td class="change-log-item"> 211 <strong>Title:</strong> {{ field.after.render.title }}<br> 212 <strong>URL:</strong> {{ field.after.render.url }}<br> 213 <strong>Size:</strong> {{ field.after.render.width }} x {{ field.after.render.height }}<br> 214 <div class="imageholder" id="thumbnail-{{ key }}"> 215 {% if field.after.render.thumbnail|default('') %} 216 <img src="{{ field.after.render.thumbnail }}" width="{{ preview_w }}" height="{{ preview_h }}"> 217 {% endif %} 218 </div> 219 <div class="hidden video" id="{{ key }}">{{ field.after.render.html|raw }}</div> 220 </td> 221 {% endif %} 222 </tr> 223 {% endfor %} 224 </tbody> 225 </table> 226 </div> 227 </div> 228{% endmacro %} 229 230 231{% macro changelog_mutation(raw) %} 232 {% set mapping = {'UPDATE': 'changed', 'INSERT': 'created', 'DELETE': 'deleted', 'HOLD': 'put on hold', 'PUBLISH': 'published', 'DRAFT': 'depublished'} %} 233 {% if mapping[raw] is defined %}{{ mapping[raw] }}{% else %}{{ raw }}{% endif %} 234{% endmacro %} 235