代码改进

This commit is contained in:
daiao 2016-12-12 10:00:05 +08:00
parent 6cec329ce3
commit 0f328d36e1
5 changed files with 20 additions and 13 deletions

View File

@ -1817,12 +1817,6 @@ class UsersController < ApplicationController
def show
if is_current_user
# 自己的主页显示消息
# 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
# 全部设为已读
if params[:viewed] == "all"
update_message_viewed(@user)
end
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")

View File

@ -37,6 +37,11 @@ module ApplicationHelper
# super
# end
# 获取多种类型的user用户名
def user_message_username user
user.try(:show_name)
end
# 超出1w后用k+形式显示
def switch_integer_into_k number
number > 10000 ? (number.to_f / 1000).round.to_s + "k" : number

View File

@ -135,6 +135,10 @@ class Issue < ActiveRecord::Base
after_save :after_create_from_copy
after_destroy :update_parent_attributes
def user
self.author
end
#动态的更新
def update_activity
update_user_activity(self.class, self.id)

View File

@ -106,6 +106,10 @@ class Message < ActiveRecord::Base
end
}
def description
self.content
end
def topic?
parent_id.nil?
end

View File

@ -503,13 +503,13 @@ a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
.flex-container_homepage div{ width:68px; float:left; border-right:1px solid #62ACE2; text-align:center; font-size:14px; height: 70px; margin:10px 0px; color: #ffffff;}
.flex-container_homepage div:last-child { border:none; }
.flex-cell_homepage {flex:1; text-align: center}
.homepage_review_tab{ display:block; background:url(/images/user/homepage_tab.png) -16px -185px no-repeat; width:30px; height:30px; }
.homepage_issue_tab { display:block; background:url(/images/user/homepage_tab.png) -16px -13px no-repeat; width:30px; height:30px; }
.homepage_work_tab { display:block; background:url(/images/user/homepage_tab.png) -16px -56px no-repeat; width:30px; height:30px; }
.homepage_test_tab { display:block; background:url(/images/user/homepage_tab.png) -16px -99px no-repeat; width:30px; height:30px; }
.homepage_poll_tab { display:block; background:url(/images/user/homepage_tab.png) -16px -142px no-repeat; width:30px; height:30px; }
.homepage_anonymity_tab { display:block; background:url(/images/user/homepage_tab.png) -16px -228px no-repeat; width:30px; height:30px; }
.homepage_apply_tab { display:block; background:url(/images/user/apply_tab.png) -11px -13px no-repeat; width:30px; height:30px; }
.homepage_review_tab{ display:block; background:url(/images/user/homepage_tab.png) -15px -185px no-repeat; width:32px; height:32px; }
.homepage_issue_tab { display:block; background:url(/images/user/homepage_tab.png) -15px -12px no-repeat; width:32px; height:32px; }
.homepage_work_tab { display:block; background:url(/images/user/homepage_tab.png) -15px -56px no-repeat; width:32px; height:32px; }
.homepage_test_tab { display:block; background:url(/images/user/homepage_tab.png) -15px -99px no-repeat; width:32px; height:32px; }
.homepage_poll_tab { display:block; background:url(/images/user/homepage_tab.png) -15px -142px no-repeat; width:32px; height:32px; }
.homepage_anonymity_tab { display:block; background:url(/images/user/homepage_tab.png) -15px -228px no-repeat; width:32px; height:32px; }
.homepage_apply_tab { display:block; background:url(/images/user/apply_tab.png) -10px -12px no-repeat; width:32px; height:32px; }
/* 个人主页左侧导航 */