增加组织成员加入时间

This commit is contained in:
ouyangxuhua 2015-11-16 15:39:59 +08:00
parent de32745eef
commit 10dedcb7be
4 changed files with 23 additions and 2 deletions

View File

@ -16,7 +16,7 @@ class OrgMemberController < ApplicationController
member_ids = params[:membership][:user_ids]
role_id = params[:orgRole]
member_ids.each do |user_id|
member = OrgMember.create(:user_id=>user_id)
member = OrgMember.create(:user_id=>user_id, :created_at => Time.now)
@org.org_members << member
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
end

View File

@ -5,7 +5,7 @@
</div>
<div class="st_list" style="width: 720px;">
<div class="st_box">
<!--<span class="fr fb fontGrey3">加入时间</span>-->
<span class="fr fb fontGrey3">加入时间</span>
<div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %>
@ -16,6 +16,9 @@
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml5 c_blue02") %><br />
<span class="fl c_grey ml10">身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %></span>
<% if member.created_at %>
<span class="fr c_grey"><%= format_time(member.created_at) %></span>
<% end %>
</div>
<div class="cl"></div>
<% end%>

View File

@ -0,0 +1,5 @@
class AddCreatedAtToOrgMembers < ActiveRecord::Migration
def change
add_column :org_members, :created_at, :timestamp
end
end

View File

@ -0,0 +1,13 @@
class SetTimeForOrgMember < ActiveRecord::Migration
def up
OrgMember.all.each do |member|
if(member.created_at.nil?)
member.created_at = Time.now - 5.days
member.save
end
end
end
def down
end
end