Merge branch 'szzh' into develop

This commit is contained in:
ouyangxuhua 2016-02-23 16:19:41 +08:00
commit da057bb519
19 changed files with 62 additions and 108 deletions

View File

@ -67,8 +67,9 @@ class CourseActivity < ActiveRecord::Base
# 导语 # 导语
def add_course_lead def add_course_lead
if self.course_act_type == "Course" if self.course_act_type == "Course"
name = Redmine::Configuration['course_message_lead_subject'] lead_message = Message.find(12440)
content = Redmine::Configuration['course_message_lead_content'] name = lead_message.subject
content = lead_message.content
# message的status状态为0为正常为1表示创建课程时发送的message # 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 ) 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 # fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
after_create :update_issue_time
# end # end
#after_destroy :down_user_score #after_destroy :down_user_score
#before_save :be_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) project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
end end
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 end

View File

@ -1,16 +1,3 @@
<style type="text/css">
/*回复框*/
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
.ReplyToMessageInputContainer .ke-outline{border:none;}
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
.ReplyToMessageInputContainer .ke-container{float:left;}
</style>
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>"> <div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
<div class="ReplyToMessageInputContainer mb10"> <div class="ReplyToMessageInputContainer mb10">

View File

@ -2,18 +2,6 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %> <% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url("/images/public_icon.png")}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<div id="user_homework_list"> <div id="user_homework_list">
<% homework_commons.each do |homework_common|%> <% homework_commons.each do |homework_common|%>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,18 +1,7 @@
<%= content_for(:header_tags) do %> <%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %> <%= import_ke(enable_at: true,init_activity: true) %>
<% end %> <% end %>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<script> <script>
$(function(){ $(function(){
$("#RSide").removeAttr("id"); $("#RSide").removeAttr("id");

View File

@ -46,7 +46,7 @@
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"> <li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;">
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), request.local? ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %> <%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), request.local? ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
<%= link_to User.current, (request.local? || request.subdomain.blank?) ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %> <%= link_to User.current, (request.local? || request.subdomain.blank?) ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
<%= link_to "退出",(request.local? || request.subdomain.nil?) ? logout_organization_path(@organization):"https://www.trustie.net/logout", :class =>"menuGrey", :method => 'post', :rel => "nofollow" %> <%= link_to "退出",(request.local? || request.subdomain.nil?) ? signout_path():"https://www.trustie.net/logout", :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
</li> </li>
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>--> <!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
<% else %> <% else %>

View File

@ -3,18 +3,6 @@
<%= javascript_include_tag "create_kindeditor" %> <%= javascript_include_tag "create_kindeditor" %>
<% end %> <% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if newss%> <% if newss%>
<% newss.each do |news| %> <% newss.each do |news| %>
<script> <script>

View File

@ -3,18 +3,6 @@
<%= javascript_include_tag "create_kindeditor" %> <%= javascript_include_tag "create_kindeditor" %>
<% end %> <% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if all_news %> <% if all_news %>
<% all_news.each do |news| %> <% all_news.each do |news| %>
<script> <script>

View File

@ -17,6 +17,7 @@
最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %> 最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %>
</div> </div>
<% end %> <% end %>
<div class="cl"></div>
<!-- <%# if defined?(home_id) %> <!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div> <div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>--> <%# end %>-->

View File

@ -35,18 +35,7 @@
}) })
}) })
</script> </script>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<% unless forge_acts.empty? %> <% unless forge_acts.empty? %>
<% forge_acts.each do |activity| -%> <% forge_acts.each do |activity| -%>
<script> <script>

View File

@ -36,12 +36,12 @@
<% if @changesets && !@changesets.empty? %> <% if @changesets && !@changesets.empty? %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %> <% 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") %> <%= 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="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> <div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span> </span>
<% else %> <% 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="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> <div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span> </span>

View File

@ -38,18 +38,7 @@
}) })
}) })
</script> </script>
<style type="text/css">
/*回复框*/
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}*/
/*span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}*/
/*span.ke-toolbar-icon-url{background-image:url( "/images/public_icon.png" )}*/
/*div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}*/
/*span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}*/
/*span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}*/
/*div.ke-toolbar .ke-outline{border:none;}*/
/*.ke-inline-block{display: none;}*/
/*div.ke-container{float:left;}*/
</style>
<% user_activities.each do |user_activity| <% user_activities.each do |user_activity|
if user_activities %> if user_activities %>
<script> <script>

View File

@ -2,18 +2,7 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%#= javascript_include_tag "init_KindEditor","user" %> <%#= javascript_include_tag "init_KindEditor","user" %>
<% end %> <% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<%if jours %> <%if jours %>
<% jours.each do |jour|%> <% jours.each do |jour|%>
<% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %>

View File

@ -12,7 +12,7 @@
<%= ma.content %> <%= ma.content %>
</li> </li>
<li class="homepageHomeworkContentWarn fl"> <li class="homepageHomeworkContentWarn fl">
<%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准", <%=link_to (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准",
agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ), agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ),
:id => "agree_apply_subdomain_#{ma.id}", :id => "agree_apply_subdomain_#{ma.id}",
:method => 'post', :method => 'post',

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. # 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| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -99,6 +99,8 @@ ActiveRecord::Schema.define(:version => 20160220100507) do
t.integer "quotes" t.integer "quotes"
t.integer "version" t.integer "version"
t.integer "attachment_id" t.integer "attachment_id"
t.integer "is_publish", :default => 1
t.date "publish_time"
end end
create_table "attachments", :force => true do |t| 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 "is_public", :default => 1
t.integer "copy_from" t.integer "copy_from"
t.integer "quotes" t.integer "quotes"
t.integer "is_publish", :default => 1
t.date "publish_time"
end end
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" 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 "changeset_num", :default => 0
t.integer "board_message_num", :default => 0 t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0 t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0 t.integer "attach_num", :default => 0
t.datetime "commit_time" t.datetime "commit_time"
end end

View File

@ -3,6 +3,15 @@
module Trustie module Trustie
module Gitlab module Gitlab
module Helper module Helper
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
# 项目公开和私有
PUBLIC = 20
PRIVATE = 0
def change_password(uid, en_pwd, salt) def change_password(uid, en_pwd, salt)
return unless uid return unless uid
options = {:encrypted_password=>en_pwd, :password_salt=>salt} options = {:encrypted_password=>en_pwd, :password_salt=>salt}
@ -44,6 +53,21 @@ module Trustie
self.g.delete_user(user.gid) self.g.delete_user(user.gid)
end 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 end
end end

View File

@ -61,7 +61,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end 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 rescue => e
puts e puts e
end end
@ -111,7 +111,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end 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 rescue => e
puts e puts e
end end
@ -125,7 +125,7 @@ module Trustie
unless gid unless gid
gid = sync_user(m.user).id gid = sync_user(m.user).id
end 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 rescue => e
puts e puts e
end end
@ -134,6 +134,8 @@ module Trustie
def remove_project def remove_project
end end
end 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{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;}
.proInfoBox2 ul li{ height:24px; position:relative;} .proInfoBox2 ul li{ height:24px; position:relative;}
.maxwidth150{max-width: 150px;}