Merge branch 'rep_quality' into develop

This commit is contained in:
huang 2016-07-29 21:39:57 +08:00
commit bef6828166
28 changed files with 2921 additions and 2372 deletions

View File

@ -1,8 +1,10 @@
class AppliedProjectController < ApplicationController
helper :watchers
#申请加入项目
def applied_join_project
@project = Project.find_by_id(params[:object_id])
if params[:object_id]
@project = Project.find_by_id(params[:object_id])
end
# @user_id = params[:user_id]
# if params[:project_join]
# if @project
@ -43,11 +45,15 @@ class AppliedProjectController < ApplicationController
end
# @flage:提示语标志1邀请码错误2已经是项目成员 3角色没有选择; 4申请成功
# role:成员角色 => 01管理人员2开发人员3:报告人员)
# role:成员角色 => 04管理人员5开发人员6:报告人员)
# 申请成功则发送消息
def applied_project_info
@project = Project.find(params[:project_id])
if params[:invite_code].to_s != @project.invite_code
if params[:project_id].nil?
@project = Project.where(:invite_code => params[:invite_code]).first
else
@project = Project.find(params[:project_id])
end
if !@project || params[:invite_code].to_s != @project.invite_code
@flag = 1
elsif User.current.member_of?(@project)
@flag = 2
@ -55,8 +61,8 @@ class AppliedProjectController < ApplicationController
@flag = 3
else
@flag = 4
role = params[:member] == "member_manager" ? 1 : (params[:member] = "member_developer" ? 2 : 3)
applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => params[:project_id], :role => role)
role = params[:member] == "member_manager" ? 3 : (params[:member] = "member_developer" ? 4 :5)
applied_project = AppliedProject.create(:user_id => User.current.id, :project_id => @project.id, :role => role)
# 申请成功则给项目管理员发送邮件及发送消息
Mailer.run.applied_project(applied_project)
end

View File

@ -17,10 +17,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MembersController < ApplicationController
helper :users
model_object Member
before_filter :find_model_object, :except => [:index, :create, :autocomplete]
before_filter :find_model_object, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
#before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete]
before_filter :find_project_from_association, :except => [:index, :create, :autocomplete]
before_filter :find_project_from_association, :except => [:index, :create, :autocomplete, :allow_to_join_project, :refused_allow_to_join_project]
before_filter :find_project_by_project_id, :only => [:index, :create, :autocomplete]
before_filter :authorize
accept_api_auth :index, :show, :create, :update, :destroy
@ -49,6 +50,62 @@ class MembersController < ApplicationController
end
end
# 同意消息中申请加入项目
# 之所以role不在参数中传送是考虑到安全问题
# status(1申请的消息2已操作过该消息包括同意或者拒绝消息状态更新3决绝消息4:被拒人收到消息5拒绝者收到消息6同意后申请人收到消息7同意后批准人收到消息)
def allow_to_join_project
@applied_message = AppliedMessage.find(params[:applied_message_id])
applied_project = @applied_message.applied
user = User.find(@applied_message.applied_user_id)
project = Project.find(applied_project.project_id)
if user.member_of?(project)
@flash_message = "您已经是项目成员了"
@applied_message.update_attribute(:status, 2)
else
ap_role = applied_project.try(:role)
if ap_role
begin
members = []
user_grades = []
project_info = []
members << Member.new(:role_ids => ["#{ap_role}"], :user_id => @applied_message.applied_user_id)
user_grades << UserGrade.new(:user_id => @applied_message.applied_user_id, :project_id => project.id)
role = Role.find(ap_role)
project_info << ProjectInfo.new(:project_id => project.id, :user_id => @applied_message.applied_user_id) if role.allowed_to?(:is_manager)
project.members << members
project.project_infos << project_info
project.user_grades << user_grades unless user_grades.first.user_id.nil?
@applied_message.update_attribute(:status, 2)
# 添加成功后,申请人收到消息
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
:status => 6, :viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
# 添加成功后,批准人收到消息
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
:status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
rescue Exception => e
puts e
end
end
end
end
# 同意消息中拒绝加入项目
# params[:user_id]为申请者ID
# params[:send_id]为拒绝人ID
# status(1申请的消息2已操作过该消息包括同意或者拒绝消息状态更新3拒绝消息4:被拒人收到消息5拒绝者收到消息6同意后申请人收到消息7同意后批准人收到消息)
def refused_allow_to_join_project
@applied_message = AppliedMessage.find(params[:applied_message_id])
@applied_message.update_attribute(:status, 3)
applied_project = @applied_message.applied
# 发送消息给被拒者,user_id对应的收到信息的用户
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
:viewed => true, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
# 发送消息给拒绝者
AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
:viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
applied_project.delete
end
def create
if params[:refusal_button]
members = []
@ -318,6 +375,11 @@ class MembersController < ApplicationController
grade.destroy
end
end
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first
unless applied_projects.nil?
applied_projects.delete
end
#移出项目发送消息
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
end

View File

@ -37,7 +37,7 @@ class QualityAnalysisController < ApplicationController
quality_an.delete unless quality_an.blank?
end
# Checks if the given job exists in Jenkins.
unless @client.job.exists?(job_name)
# unless @client.job.exists?(job_name)
@g = Gitlab.client
branch = params[:branch]
language = swith_language_type(params[:language])
@ -111,7 +111,7 @@ class QualityAnalysisController < ApplicationController
end
end
end
end
# end
rescue => e
@message = e.message
end

View File

@ -57,15 +57,41 @@ module UsersHelper
# 获取消息角色
def applied_project_message_type role
case role
when 1
"管理员"
when 2
"开发人员"
when 3
"管理员"
when 4
"开发人员"
when 5
"报告人员"
end
end
# 判断当前用户能否对消息进行操作
def allow_to_show applied_message
(User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false
end
# 项目申请消息通过状态判断用户
# status(1申请的消息2已操作过该消息包括同意或者拒绝消息状态更新3拒绝消息4:被拒人收到消息5拒绝者收到消息6同意后申请人收到消息7同意后批准人收到消息)
def applied_project_users applied_message
# case applied_message.status
# when 3,2,1,5,4,7,6
user = User.find(applied_message.applied_user_id)
# end
end
# 项目申请消息通过状态判断tip描述
def applied_project_tip applied_message
case applied_message.status
when 4
"拒绝申请加入项目:"
when 5,3,2,1,7
"申请加入项目:"
when 6
"同意申请加入项目"
end
end
def get_resource_origin attach
type = attach.container_type
content = attach.container

View File

@ -1,6 +1,6 @@
class AppliedMessage < ActiveRecord::Base
# status: 0表示未批准 status1表示已批准 status 2表示已拒绝
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :name
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id
belongs_to :applied ,:polymorphic => true
belongs_to :apply_add_schools
belongs_to :user

View File

@ -10,7 +10,7 @@ class AppliedProject < ActiveRecord::Base
# 仅仅给项目管理人员发送消息
def send_appliled_message
self.project.managers.each do |member|
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false)
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id)
end
# end
end

View File

@ -920,8 +920,8 @@ class Project < ActiveRecord::Base
CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
def generate_invite_code
code = read_attribute(:invite_code)
if !code || code.size <5
code = CODES.sample(5).join
if !code || code.size <6
code = CODES.sample(6).join
return generate_invite_code if Project.where(invite_code: code).present?
update_attribute(:invite_code, code)
end

View File

@ -369,7 +369,8 @@ class User < Principal
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count
end
# 查询指派给我的缺陷记录

View File

@ -4,7 +4,7 @@
<div class="cl"></div>
</div>
<div class="sy_popup_con" style="width:370px;">
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => @project.id), :remote => true, :id => 'project_applied_form') do %>
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
<ul class="sy_popup_add ">
<li>
<label >项目邀请码:</label>

View File

@ -1,3 +1,3 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => @project.id}) %>";
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_join_project', locals: {:project_id => (@project.nil? ? nil : @project.id)}) %>";
pop_box_new(htmlvalue,460,40,50);

View File

@ -1,3 +1,5 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip', locals: {:project_id => @project.id}) %>";
<% if @project %>
$("#join_in_project_applied").html('<%= escape_javascript( render :partial => 'projects/applied_status') %>');
<% end %>
var htmlvalue = "<%= escape_javascript(render :partial => 'applied_project/applied_project_tip') %>";
pop_box_new(htmlvalue,380,40,50);
//$("#join_in_project").attr('href','<%#= join_in_project_link(@project, User.current) %>');

View File

@ -1,12 +1,8 @@
<div class="pr_info_join fl">
<!--关注:非项目成员-->
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
<span><%= watcher_link_for_project(@project, User.current) %></span>
<!--加入项目 -->
<span id="join_in_project">
<%= join_in_project_link(@project, User.current) %>
</span>
<% end %>
<div id="join_in_project_applied">
<%= render :partial => "projects/applied_status" %>
</div>
<!--配置项目-->
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %>

View File

@ -245,8 +245,21 @@
</div>
<div class="homepageLeftMenuBlock">
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %>
<% if is_current_user%>
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
<% if is_current_user %>
<div class="courseMenu" id="projectMenu">
<ul>
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
<ul class="topnav_course_menu" id="topnav_project_menu">
<li>
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :class => "menuGrey"%>
</li>
<li>
<%= link_to "加入项目", applied_join_project_path,:remote => true,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
</div>
<%# if @user.projects.visible.count > 0
@ -362,6 +375,12 @@
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$("#projectMenu").mouseenter(function(){
$("#topnav_project_menu").show();
});
$("#projectMenu").mouseleave(function(){
$("#topnav_project_menu").hide();
});
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");

View File

@ -0,0 +1,5 @@
<% if @flash_message %>
alert("<%= @flash_message %>");
<% else%>
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');
<% end%>

View File

@ -0,0 +1 @@
$("#applied_project_<%= @applied_message.id %>").html('<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => @applied_message} %>');

View File

@ -0,0 +1,9 @@
<% if !User.current.member_of?(@project) && User.current.login? && !User.current.admin %>
<span><%= watcher_link_for_project(@project, User.current) %></span>
<!--加入项目 -->
<% if AppliedProject.where(:user_id => User.current, :project_id => @project_id).first.nil? %>
<%= join_in_project_link(@project, User.current) %>
<% else %>
等待审批
<% end %>
<% end %>

View File

@ -55,12 +55,6 @@
<%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %>
<% end %>
</div>
<!--quality_analysis-->
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<div class="subNav">
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "f14 c_blue02" %>
</div>
<% end %>
<% end %>
<!-- more -->
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>

View File

@ -92,32 +92,6 @@
<% if roles.any? %>
<div class="members_right">
<!-- applied -->
<% if @project.applied_projects.any? %>
<div class="members_jion">
<p class="c_blue mb10 fb"><%= l(:label_apply_project) %></p>
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div id="principals_for_applied_member">
<%= render_principals_for_applied_members_new(@project) %>
</div>
<ul class="mb10">
<li><%= l(:label_role_plural) %>:</li>
<% roles.each do |role| %>
<li>
<%= check_box_tag 'membership[role_ids][]', role.id %>
<label ><%= h role %></label >
</li>
<% end %>
</ul>
<a remote="true" href="javascript:void(0)" class="blue_btn fl" onclick="$('#new_membership').submit();">
<%= l(:label_approve) %>
</a>
<a remote="true" href="javascript:void(0)" class="grey_btn fl ml10" onclick="refusal_applied_member();">
<%= l(:label_refusal) %>
</a>
<% end %>
<div class="cl"></div>
</div>
<% end %><!--members_jion end-->
<div class="cl"></div>
<!-- add members -->
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>

View File

@ -7,6 +7,10 @@
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch ), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
<% end %>
<!--quality_analysis-->
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %>
<% end %>
</div>
<div class="repository_con" style="line-height:1.9;">
<% if @entries.nil? %>

View File

@ -0,0 +1,12 @@
<% if allow_to_show(ma) %>
<%= link_to "同意", allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :post, :class => "link-blue"%> |
<%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id), :remote => true, :method => :get, :class => "link-blue" %>
<% elsif ma.status == 4 %>
<span class="fontGrey3">被拒绝</span>
<% elsif ma.status == 5 %>
<span class="fontGrey3">您已拒绝</span>
<% elsif ma.status == 6 %>
<span class="fontGrey3">已通过</span>
<% elsif ma.status == 7 %>
<span class="fontGrey3">您已同意</span>
<% end %>

View File

@ -0,0 +1,2 @@
<%=link_to applied_project_users(ma), user_path(applied_project_users(ma)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl"><%= applied_project_tip(ma) %></span>

View File

@ -33,18 +33,22 @@
<% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.applied.user), :width => "30", :height => "30"), user_path(ma.applied.user), :target => '_blank' %></a>
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(applied_project_users(ma)), :width => "30", :height => "30"), user_path(applied_project_users(ma)), :target => '_blank' %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.applied.user, user_path(ma.applied.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申请加入项目:</span>
<%= render :partial => "users/user_message_applide_users", :locals =>{:ma => ma} %>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
以“<%= applied_project_message_type(ma.applied.role) %>”身份加入
<%= link_to ma.applied.project, settings_project_path(:id => ma.applied.project.id, :tab => "members"), :class => "link-blue", :target => '_blank' %>
:同意 | 拒绝
<li class="homepageNewsContent fl" style="width:283px;"><a href="javascript:void(0);" class="newsGrey">
以“<%= applied_project_message_type(ma.role) %>”身份加入
<% project = Project.find(ma.project_id) %>
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
</a>
</li>
<li class="fl" style="width:71px; height:49px;">
<span id="applied_project_<%= ma.id %>">
<%= render :partial => "users/user_message_applide_action", :locals =>{:ma => ma} %>
</span>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -770,6 +770,8 @@ RedmineApp::Application.routes.draw do
collection do
get 'autocomplete'
get 'appliedproject'
post 'allow_to_join_project'
get 'refused_allow_to_join_project'
end
end

View File

@ -0,0 +1,5 @@
class AddAppliedUserIdToAppliedMessage < ActiveRecord::Migration
def change
add_column :applied_messages, :applied_user_id, :integer
end
end

View File

@ -0,0 +1,5 @@
class AddRoleToAppliedMessage < ActiveRecord::Migration
def change
add_column :applied_messages, :role, :integer
end
end

View File

@ -0,0 +1,5 @@
class AddProjectIdToAppliedMessage < ActiveRecord::Migration
def change
add_column :applied_messages, :project_id, :integer
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 => 20160725091759) do
ActiveRecord::Schema.define(:version => 20160729124833) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -52,9 +52,46 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
create_table "application_settings", :force => true do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "signin_enabled"
t.boolean "gravatar_enabled"
t.text "sign_in_text"
t.datetime "created_at"
t.datetime "updated_at"
t.string "home_page_url"
t.integer "default_branch_protection", :default => 2
t.boolean "twitter_sharing_enabled", :default => true
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", :default => true
t.integer "max_attachment_size", :default => 10, :null => false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.text "restricted_signup_domains"
t.boolean "user_oauth_applications", :default => true
t.string "after_sign_out_path"
t.integer "session_expire_delay", :default => 10080, :null => false
end
create_table "applied_messages", :force => true do |t|
t.integer "user_id"
t.integer "applied_id"
t.string "applied_type"
t.integer "viewed", :default => 0
t.integer "status", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "applied_user_id"
t.integer "role"
t.integer "project_id"
end
create_table "applied_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.integer "role", :default => 0
t.integer "applied_user_id"
end
create_table "apply_add_schools", :force => true do |t|
@ -169,6 +206,20 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.string "typeName", :limit => 50
end
create_table "audit_events", :force => true do |t|
t.integer "author_id", :null => false
t.string "type", :null => false
t.integer "entity_id", :null => false
t.string "entity_type", :null => false
t.text "details"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id"
add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type"
add_index "audit_events", ["type"], :name => "index_audit_events_on_type"
create_table "auth_sources", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 60, :default => "", :null => false
@ -266,6 +317,17 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
add_index "boards", ["project_id"], :name => "boards_project_id"
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "color"
t.string "font"
end
create_table "bug_to_osps", :force => true do |t|
t.integer "osp_id"
t.integer "relative_memo_id"
@ -295,14 +357,16 @@ ActiveRecord::Schema.define(:version => 20160725091759) 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"
@ -582,8 +646,11 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.string "qrcode"
end
add_index "courses", ["id"], :name => "id", :unique => true
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
add_index "courses", ["syllabus_id"], :name => "index_courses_on_syllabus_id"
add_index "courses", ["tea_id"], :name => "tea_id"
add_index "courses", ["visits"], :name => "visits"
create_table "custom_fields", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
@ -646,6 +713,15 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -695,6 +771,16 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "created_at"
end
create_table "emails", :force => true do |t|
t.integer "user_id", :null => false
t.string "email", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true
add_index "emails", ["user_id"], :name => "index_emails_on_user_id"
create_table "enabled_modules", :force => true do |t|
t.integer "project_id"
t.string "name", :null => false
@ -717,6 +803,25 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "events", :force => true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "exercise_answers", :force => true do |t|
t.integer "user_id"
t.integer "exercise_question_id"
@ -819,6 +924,15 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forked_project_links", :force => true do |t|
t.integer "forked_to_project_id", :null => false
t.integer "forked_from_project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -948,6 +1062,17 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "identities", :force => true do |t|
t.string "extern_uid"
t.string "provider"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id"
add_index "identities", ["user_id"], :name => "index_identities_on_user_id"
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1094,6 +1219,20 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "private", :default => 0
end
create_table "keys", :force => true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "type"
t.string "fingerprint"
t.boolean "public", :default => false, :null => false
end
add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
create_table "kindeditor_assets", :force => true do |t|
t.string "asset"
t.integer "file_size"
@ -1105,6 +1244,27 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "owner_type", :default => 0
end
create_table "label_links", :force => true do |t|
t.integer "label_id"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id"
add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type"
create_table "labels", :force => true do |t|
t.string "title"
t.string "color"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
create_table "member_roles", :force => true do |t|
t.integer "member_id", :null => false
t.integer "role_id", :null => false
@ -1155,6 +1315,47 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "viewed_count", :default => 0
end
create_table "merge_request_diffs", :force => true do |t|
t.string "state"
t.text "st_commits", :limit => 2147483647
t.text "st_diffs", :limit => 2147483647
t.integer "merge_request_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true
create_table "merge_requests", :force => true do |t|
t.string "target_branch", :null => false
t.string "source_branch", :null => false
t.integer "source_project_id", :null => false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "milestone_id"
t.string "state"
t.string "merge_status"
t.integer "target_project_id", :null => false
t.integer "iid"
t.text "description"
t.integer "position", :default => 0
t.datetime "locked_at"
end
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "message_alls", :force => true do |t|
t.integer "user_id"
t.integer "message_id"
@ -1189,6 +1390,39 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "milestones", :force => true do |t|
t.string "title", :null => false
t.integer "project_id", :null => false
t.text "description"
t.date "due_date"
t.datetime "created_at"
t.datetime "updated_at"
t.string "state"
t.integer "iid"
end
add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id"
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t|
t.string "name", :null => false
t.string "path", :null => false
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
t.string "description", :default => "", :null => false
t.string "avatar"
end
add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id"
add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@ -1214,6 +1448,31 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
t.boolean "system", :default => false, :null => false
t.text "st_diff", :limit => 2147483647
end
add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id"
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at"
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
@ -1223,6 +1482,49 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "oauth_access_grants", :force => true do |t|
t.integer "resource_owner_id", :null => false
t.integer "application_id", :null => false
t.string "token", :null => false
t.integer "expires_in", :null => false
t.text "redirect_uri", :null => false
t.datetime "created_at", :null => false
t.datetime "revoked_at"
t.string "scopes"
end
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
create_table "oauth_access_tokens", :force => true do |t|
t.integer "resource_owner_id"
t.integer "application_id"
t.string "token", :null => false
t.string "refresh_token"
t.integer "expires_in"
t.datetime "revoked_at"
t.datetime "created_at", :null => false
t.string "scopes"
end
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
create_table "oauth_applications", :force => true do |t|
t.string "name", :null => false
t.string "uid", :null => false
t.string "secret", :null => false
t.text "redirect_uri", :null => false
t.string "scopes", :default => "", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
t.string "owner_type"
end
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
create_table "onclick_times", :force => true do |t|
t.integer "user_id"
t.datetime "onclick_time"
@ -1380,6 +1682,23 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "allow_teacher", :default => 0
end
create_table "permissions", :force => true do |t|
t.string "controller", :limit => 30, :default => "", :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "description", :limit => 60, :default => "", :null => false
t.boolean "is_public", :default => false, :null => false
t.integer "sort", :default => 0, :null => false
t.boolean "mail_option", :default => false, :null => false
t.boolean "mail_enabled", :default => false, :null => false
end
create_table "permissions_roles", :id => false, :force => true do |t|
t.integer "permission_id", :default => 0, :null => false
t.integer "role_id", :default => 0, :null => false
end
add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -1462,6 +1781,11 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "project_import_data", :force => true do |t|
t.integer "project_id"
t.text "data"
end
create_table "project_infos", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1539,6 +1863,8 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0
t.integer "hot", :default => 0
t.string "invite_code"
t.string "qrcode"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1552,6 +1878,16 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
create_table "protected_branches", :force => true do |t|
t.integer "project_id", :null => false
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "developers_can_push", :default => false, :null => false
end
add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
create_table "quality_analyses", :force => true do |t|
t.integer "project_id"
t.string "author_login"
@ -1700,6 +2036,25 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "is_teacher_score", :default => 0
end
create_table "services", :force => true do |t|
t.string "type"
t.string "title"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", :default => false, :null => false
t.text "properties"
t.boolean "template", :default => false
t.boolean "push_events", :default => true
t.boolean "issues_events", :default => true
t.boolean "merge_requests_events", :default => true
t.boolean "tag_push_events", :default => true
t.boolean "note_events", :default => true, :null => false
end
add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id"
add_index "services", ["project_id"], :name => "index_services_on_project_id"
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -1738,6 +2093,26 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "snippets", :force => true do |t|
t.string "title"
t.text "content", :limit => 2147483647
t.integer "author_id", :null => false
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
t.string "type"
t.integer "visibility_level", :default => 0, :null => false
end
add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id"
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level"
create_table "softapplications", :force => true do |t|
t.string "name"
t.text "description"
@ -1818,9 +2193,9 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.integer "absence_penalty", :default => 0
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
t.float "work_score"
t.integer "simi_id"
t.integer "simi_value"
t.float "work_score"
t.integer "work_status", :default => 0
end
@ -1869,13 +2244,13 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
create_table "sub_domains", :force => true do |t|
t.integer "org_subfield_id"
t.integer "priority", :default => 0
t.integer "priority"
t.string "name"
t.string "field_type"
t.integer "hide", :default => 0
t.integer "status", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "hide"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "subfield_subdomain_dirs", :force => true do |t|
@ -1885,6 +2260,17 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "subscriptions", :force => true do |t|
t.integer "user_id"
t.integer "subscribable_id"
t.string "subscribable_type"
t.boolean "subscribed"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true
create_table "syllabuses", :force => true do |t|
t.string "title"
t.text "description"
@ -2145,6 +2531,17 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
add_index "users", ["type"], :name => "index_users_on_type"
create_table "users_star_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id"
add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true
add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id"
create_table "versions", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :default => "", :null => false
@ -2196,6 +2593,23 @@ ActiveRecord::Schema.define(:version => 20160725091759) do
t.datetime "updated_at", :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", :default => "ProjectHook"
t.integer "service_id"
t.boolean "push_events", :default => true, :null => false
t.boolean "issues_events", :default => false, :null => false
t.boolean "merge_requests_events", :default => false, :null => false
t.boolean "tag_push_events", :default => false
t.boolean "note_events", :default => false, :null => false
end
add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id"
add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"

View File

@ -1499,6 +1499,7 @@ function pop_box_new(value, Width, Top, Left){
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css({"top": Top+"%","left": Left+"%","transform":"translate(-50%,-50%)","padding":"0","border":"none"});
$('#ajax-modal').css({"padding":"0"});
}
// 公共提示弹框样式