68 lines
2.4 KiB
Plaintext
68 lines
2.4 KiB
Plaintext
<div class="i-member index-member-1">
|
||
<h3 class="i-annc__page-title"><span>{{page-title}}</span></h3>
|
||
<div class="i-member-group" data-list="roles" data-level="0">
|
||
<div class="index-member-status" data-level="1" data-list="status-list">
|
||
<h3 class="i-member__status-title">{{status-title}}</h3>
|
||
<div class="index-member-list" >
|
||
<div class="i-member-title-img">照片</div>
|
||
|
||
<table class="i-member__table table table-striped">
|
||
<thead data-level="2" data-list="members">
|
||
<tr class="i-member-tr-head" data-list="profile_data" data-level="3">
|
||
<th class="i-member-title {{title_class}}">{{title}}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody data-level="2" data-list="members">
|
||
<div class="i-member-pic-wrap">
|
||
<a href="{{link_to_show}}" title="{{name}}">
|
||
<img class="i-member-pic img-thumbnail" src="{{image}}" title="{{name}}">
|
||
</a>
|
||
</div>
|
||
<tr class="profile_tr" data-list="profile_data" data-level="3">
|
||
<td data-title="{{title}}" class="{{value_class}}">{{value}}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
{{pagination_goes_here}}
|
||
<script>
|
||
$(document).ready(function () {
|
||
$('.index-member-list').each(function () {
|
||
var $statusBlock = $(this);
|
||
|
||
// 1️⃣ 找到照片標題並插入到該區塊的表頭
|
||
var $photoTitle = $statusBlock.find('.i-member-title-img').first();
|
||
var $theadRow = $statusBlock.find('.i-member-tr-head').first();
|
||
|
||
if ($photoTitle.length && $theadRow.length) {
|
||
// 只插入一次
|
||
if ($theadRow.find('.i-member-title-photo').length === 0) {
|
||
$theadRow.prepend(
|
||
'<th class="i-member-title i-member-title-photo">' + $photoTitle.text() + '</th>'
|
||
);
|
||
}
|
||
$photoTitle.remove();
|
||
}
|
||
|
||
// 2️⃣ 把每個 .i-member-pic-wrap 插入對應的 profile_tr 最前面
|
||
var $pics = $statusBlock.find('.i-member-pic-wrap');
|
||
var $rows = $statusBlock.find('.profile_tr');
|
||
|
||
$pics.each(function (index) {
|
||
var $pic = $(this);
|
||
var $targetRow = $rows.eq(index);
|
||
if ($targetRow.length) {
|
||
// 插入到該列最前面
|
||
$targetRow.prepend(
|
||
$('<td class="i-member__img-cell">').append($pic)
|
||
);
|
||
}
|
||
});
|
||
});
|
||
});
|
||
|
||
|
||
</script> |