This commit is contained in:
ouyangxuhua 2016-02-23 16:18:01 +08:00
commit d818e1774b
8 changed files with 55 additions and 9 deletions

View File

@ -67,8 +67,9 @@ class CourseActivity < ActiveRecord::Base
# 导语
def add_course_lead
if self.course_act_type == "Course"
name = Redmine::Configuration['course_message_lead_subject']
content = Redmine::Configuration['course_message_lead_content']
lead_message = Message.find(12440)
name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直

View File

@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base
# fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
after_create :update_issue_time
# end
#after_destroy :down_user_score
#before_save :be_user_score
@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
end
end
# 回复issue的时候更新issue的时候
def update_issue_time
if self.journalized_type == "Issue"
forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first
forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil?
end
end
end

View File

@ -36,12 +36,12 @@
<% if @changesets && !@changesets.empty? %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% else %>
<span class="fl"><div class="fb fontGrey3 rep_mail_name mr5 fl"><%=@changesets_latest_coimmit.author_email %></div>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150"><%=@changesets_latest_coimmit.author_email %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>

View File

@ -0,0 +1,6 @@
class AddPublishToAttachmentHistories < ActiveRecord::Migration
def change
add_column :attachment_histories, :is_publish, :integer, :default => 1
add_column :attachment_histories, :publish_time, :date
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160220100507) do
ActiveRecord::Schema.define(:version => 20160223073859) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -99,6 +99,8 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "quotes"
t.integer "version"
t.integer "attachment_id"
t.integer "is_publish", :default => 1
t.date "publish_time"
end
create_table "attachments", :force => true do |t|
@ -118,6 +120,8 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "is_public", :default => 1
t.integer "copy_from"
t.integer "quotes"
t.integer "is_publish", :default => 1
t.date "publish_time"
end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
@ -1373,7 +1377,6 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0
t.datetime "commit_time"
end

View File

@ -3,6 +3,15 @@
module Trustie
module Gitlab
module Helper
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
# 项目公开和私有
PUBLIC = 20
PRIVATE = 0
def change_password(uid, en_pwd, salt)
return unless uid
options = {:encrypted_password=>en_pwd, :password_salt=>salt}
@ -44,6 +53,21 @@ module Trustie
self.g.delete_user(user.gid)
end
def get_gitlab_role m
case m.roles.first.position
when 1,2
GUEST
when 5
REPORTER
when 4
DEVELOPER
when 3
MASTER
else
GUEST
end
end
end
end
end

View File

@ -61,7 +61,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER)
self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -111,7 +111,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER)
self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -125,7 +125,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER)
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -134,6 +134,8 @@ module Trustie
def remove_project
end
end
end

View File

@ -1168,3 +1168,4 @@ div.disable_link {background-color: #c1c1c1 !important;}
/*问题跟踪局部修改属性*/
.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;}
.proInfoBox2 ul li{ height:24px; position:relative;}
.maxwidth150{max-width: 150px;}