nfu-ossr/modules/member/member_index1.html.erb

68 lines
2.4 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>