picviews/user/card.html
<div id="Profile" class="text-center">
<% if (typeof(user) !== 'undefined' || current_user) { %>
<div class="profile-basic">
<a href="/user/<%= current_user.loginname %>" title="<%= current_user.loginname %>" class="img x loaded" style="text-indent: 0px;">
<img width="54" height="54" src="<%= avatarPath(current_user.avatar_url, 54) %>" data-baiduimageplus-ignore="1">
</a>
<a href="/user/<%= current_user.loginname %>" class="userlink"><%= current_user.loginname %></a>
<a href="/setting" title="帐号设置" class="settings"></a>
</div>
<div class="profile-stats">
<% if (typeof(showPicCount) == 'undefined' || (typeof(showPicCount) !== 'undefined' && !!showPicCount)) { %>
<a href="/user/<%= current_user.loginname %>/get" style="width:76px;"><strong><%= current_user.image_count + current_user.get_image_count %></strong>图片</a>
<% } %>
<% if (typeof(showTopicCount) == 'undefined' || (typeof(showTopicCount) !== 'undefined' && !!showTopicCount)) { %>
<a href="/user/<%= current_user.loginname %>/topics" style="border-left: #F5F2F2 solid 1px;width:76px;"><strong><%= current_user.topic_count %></strong>主题</a>
<% } %>
<a href="/boards" style="border-left: #F5F2F2 solid 1px;width:76px;"><strong><%= current_user.board_count %></strong>画板</a>
<a href="/user/<%= current_user.loginname %>/score" style="border-left: #F5F2F2 solid 1px;width:76px;"><strong><%= current_user.score %></strong>积分</a>
</div>
<div class="profile-acts convo">
<div class="links">
<a href="/topic/create" class="btn">
<strong>发布话题</strong></a>
<a id='create_pic_btn' data-toggle="modal" data-target="#image_upload" class="btn wbtn">
<strong>发布图片</strong></a>
</div>
</div>
<% } else { %>
<div class="profile-basic">
<p style="line-height: 50px;"><%= config.description %></p>
</div>
<div class="profile-acts convo">
<div class="links">
<a href="#" class="btn" data-toggle="modal" data-target="#signin_modal"><strong>登录</strong></a>
<a href="/signup" class="btn wbtn"><strong>注册</strong></a>
</div>
</div>
<div class="with-line">OR</div>
<div class="attribution" style="padding: 20px 25px;">
<a href="/auth/github" class="btn wbtn">
<strong>GitHub</strong></a>
</div>
<% } %>
</div>
<!-- 模板文件 -->
<%- partial('../topic/_pic_create_modal', {insertImage: false}) %>
<% if (current_user) { %>
<script>
$(document).ready(function () {
$('.follow_btn').click(function () {
var $me = $(this);
var action = $me.attr('action');
var params = {
follow_id: '<%= user._id %>',
_csrf: '<%- csrf %>'
};
$.post('/user/' + action, params, function (data) {
if (data.status === 'success') {
var $btns = $('.follow_btn');
if (action === 'follow') {
$btns.html('取消关注');
$btns.attr('action', 'un_follow');
} else {
$btns.html('加入关注');
$btns.attr('action', 'follow');
}
$btns.toggleClass('btn-success');
}
}, 'json');
});
});
</script>
<% } %>