用户ID装换成用户名
This commit is contained in:
parent
70c7b0d12c
commit
1b8bf05be5
|
@ -56,6 +56,14 @@ module ApplicationHelper
|
|||
user.nil? ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 重置user_path,目的是将id转换成用户名
|
||||
def user_path(resource, parameters = {})
|
||||
if Fixnum === resource
|
||||
resource = User.find(resource)
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
# 历史数据(老版本库数据)处理完则可以修改该放放
|
||||
def get_rep_identifier_by_project project
|
||||
identifier = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||
|
|
|
@ -320,6 +320,12 @@ class User < Principal
|
|||
self.user_extensions.try(:occupation).to_s
|
||||
end
|
||||
|
||||
# id 转换成 登录名
|
||||
def to_param
|
||||
self.login.to_i > 0 ? id : login
|
||||
end
|
||||
|
||||
|
||||
def my_blogs_count
|
||||
self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count
|
||||
end
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
|
||||
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">最新动态</div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="homepagePostType">
|
||||
<li>
|
||||
<ul class="homepagePostTypeHomework fl">
|
||||
<% if hidden_unproject_infos %>
|
||||
<li class="f14">班级动态</li>
|
||||
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
|
||||
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
|
||||
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
|
||||
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
|
||||
<li><%= link_to "班级留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">项目动态</li>
|
||||
<li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
|
||||
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
|
||||
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
|
||||
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">更多</li>
|
||||
<li class="mt-4"><%= link_to "个人留言", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
|
||||
<li class="mt-4"><%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%>
|
||||
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => "all"}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!--显示个人主页-->
|
||||
<%# if @user.blog.homepage_id and BlogComment.where("id=?", @user.blog.homepage_id).count > 0 %>
|
||||
<%# homepage = BlogComment.find(@user.blog.homepage_id) %>
|
||||
<%#= render :partial => 'blogs/homepage', :locals => {:activity => homepage, :user_activity_id => homepage.id} %>
|
||||
<%# end %>
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
|
37
db/schema.rb
37
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20161015102324) do
|
||||
ActiveRecord::Schema.define(:version => 20161019020422) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -117,6 +117,18 @@ ActiveRecord::Schema.define(:version => 20161015102324) do
|
|||
t.integer "apply_user_id"
|
||||
end
|
||||
|
||||
create_table "article_homepages", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "content"
|
||||
t.integer "user_id"
|
||||
t.integer "homepage_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "article_homepages", ["homepage_id"], :name => "index_article_homepages_on_homepage_id"
|
||||
add_index "article_homepages", ["user_id"], :name => "index_article_homepages_on_user_id"
|
||||
|
||||
create_table "at_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "at_message_id"
|
||||
|
@ -313,14 +325,16 @@ ActiveRecord::Schema.define(:version => 20161015102324) do
|
|||
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
||||
|
||||
create_table "changesets", :force => true do |t|
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.string "committer"
|
||||
t.datetime "committed_on", :null => false
|
||||
t.datetime "committed_on", :null => false
|
||||
t.text "comments"
|
||||
t.date "commit_date"
|
||||
t.string "scmid"
|
||||
t.integer "user_id"
|
||||
t.integer "project_id"
|
||||
t.integer "type", :default => 0
|
||||
end
|
||||
|
||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||
|
@ -870,6 +884,16 @@ ActiveRecord::Schema.define(:version => 20161015102324) do
|
|||
|
||||
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
|
||||
|
||||
create_table "homepages", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "article_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "homepages", ["user_id"], :name => "index_homepages_on_user_id"
|
||||
|
||||
create_table "homework_attaches", :force => true do |t|
|
||||
t.integer "bid_id"
|
||||
t.integer "user_id"
|
||||
|
@ -971,6 +995,10 @@ ActiveRecord::Schema.define(:version => 20161015102324) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "innodb_monitor", :id => false, :force => true do |t|
|
||||
t.integer "a"
|
||||
end
|
||||
|
||||
create_table "invite_lists", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1517,6 +1545,7 @@ ActiveRecord::Schema.define(:version => 20161015102324) do
|
|||
t.integer "board_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
t.integer "pull_request_num", :default => 0
|
||||
end
|
||||
|
||||
create_table "project_statuses", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue