Merge branch 'develop' into szzh
This commit is contained in:
commit
c9ebd5b9e9
|
@ -488,6 +488,23 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
if !attachments.empty? && attachments[:files]
|
||||
attachments[:files].each do |attachment|
|
||||
if params[:publish_time]
|
||||
if params[:publish_time] == ""
|
||||
attachment.publish_time = Date.today
|
||||
else
|
||||
attachment.publish_time = params[:publish_time]
|
||||
end
|
||||
else
|
||||
attachment.publish_time = Date.today
|
||||
end
|
||||
if attachment.publish_time > Date.today
|
||||
attachment.is_publish = 0
|
||||
end
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
|
||||
params[:course_attachment_type].each do |type|
|
||||
tag_name = get_tag_name_by_type_number type
|
||||
|
|
|
@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
|
|
|
@ -2144,22 +2144,22 @@ class UsersController < ApplicationController
|
|||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " +
|
||||
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "2" #课程资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+
|
||||
"or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "3" #项目资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
|
|
|
@ -746,7 +746,7 @@ module CoursesHelper
|
|||
return[] unless course
|
||||
result = []
|
||||
course.attachments.each do |attachment|
|
||||
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
|
||||
if attachment.is_public? ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
|
|
|
@ -123,7 +123,8 @@ module FilesHelper
|
|||
attachments.each do |attachment|
|
||||
if attachment.is_public? ||
|
||||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
|
||||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
|
||||
attachment.author_id == User.current.id ||
|
||||
attachment.container_type == "OrgSubfield"
|
||||
result << attachment
|
||||
|
|
|
@ -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 )
|
||||
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -139,6 +139,6 @@
|
|||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time").click(select);
|
||||
$("#term").click(select);
|
||||
//$("#time").click(select);
|
||||
//$("#term").click(select);
|
||||
</script>
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
<span class="img_private ml5">私有</span>
|
||||
<%end %>
|
||||
</span>
|
||||
<% if file.is_publish == 0 %>
|
||||
<span class="grey_homework_btn_cir ml5"><%=file.publish_time %> 0点发布</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
|
||||
|
|
|
@ -21,10 +21,20 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly">
|
||||
<%#= calendar_for('attachment_publish_time')%>
|
||||
</div>
|
||||
<span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" class=" fr courseSendCancel mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="c_white courseSendSubmit fr" onclick="submit_course_resource();"><%= l(:button_confirm)%></a>
|
||||
<%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
@ -35,8 +45,39 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
function submit_resource()
|
||||
function regex_publish_time()
|
||||
{
|
||||
$('#submit_resource').parent().submit();
|
||||
var myDate = new Date();
|
||||
if($.trim($("#attachment_publish_time").val()) == "")
|
||||
{
|
||||
return true;
|
||||
} else{
|
||||
var publish_time = Date.parse($("#attachment_publish_time").val());
|
||||
if(Date.parse(formate_date(myDate)) > publish_time)
|
||||
{
|
||||
$("#publish_time_notice").text("发布日期不能小于当前日期");
|
||||
return false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#publish_time_notice").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function submit_course_resource()
|
||||
{
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
if(regex_publish_time()) {
|
||||
$('#submit_resource').parent().submit();
|
||||
}
|
||||
<% else %>
|
||||
$('#submit_resource').parent().submit();
|
||||
<% end %>
|
||||
}
|
||||
$(function(){
|
||||
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
|
||||
$('#attachment_publish_time').datepicker(datepickerOptions);
|
||||
});
|
||||
</script>
|
|
@ -44,8 +44,8 @@
|
|||
</li>
|
||||
<% if User.current.logged? %>
|
||||
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;">
|
||||
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), user_path(User.current),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
|
||||
<%= link_to User.current, user_path(User.current),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
|
||||
<%= 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 "退出",logout_organization_path(@organization), :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
|
||||
</li>
|
||||
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<% if has_commit%>
|
||||
<li><%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fr mr10"%></li>
|
||||
<%else%>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" title="请先提交问卷再查看统计结果">统计结果</li>
|
||||
<%end%>
|
||||
<% end %>
|
||||
<% end%>
|
|
@ -60,31 +60,6 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %>
|
||||
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
|
||||
<ul>
|
||||
<li >
|
||||
<label class="label02"><%=l(:label_scm)%>:</label>
|
||||
<%= label_tag('repository_scm',
|
||||
options_for_select(["Git"],@repository.class.name.demodulize),
|
||||
:data => {:remote => true, :method => 'get'})%>
|
||||
<% if @repository && ! @repository.class.scm_available %>
|
||||
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% unless judge_main_repository(@project) %>
|
||||
<li>
|
||||
<label class="label02"><%=l(:field_repository_is_default)%>:</label>
|
||||
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li >
|
||||
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%>:</label>
|
||||
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
|
||||
<% unless @repository.identifier_frozen? %>
|
||||
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
|
||||
=======
|
||||
<% if @project.repositories.any? %>
|
||||
<%= render :partial => 'projects/settings/rep_gitlab', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %>
|
||||
<%#= render :partial => 'projects/settings/rep_forge', :locals => {:project => @project, :ip => "ip", :project_path_cut => "project_path_cut" } %>
|
||||
|
@ -109,7 +84,6 @@
|
|||
<td class="w360" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
>>>>>>> develop
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class UpdateCourseTerm < ActiveRecord::Migration
|
||||
def up
|
||||
count = Course.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Course.page(i).per(30).each do |course|
|
||||
if course.end_time.nil? && course.end_term.nil?
|
||||
course.end_time = course.time
|
||||
course.end_term = course.term
|
||||
course.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,21 @@
|
|||
class AddPublishToAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :attachments, :is_publish, :integer, :default => 1
|
||||
add_column :attachments, :publish_time, :date
|
||||
=begin
|
||||
count = Attachment.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Attachment.page(i).per(30).each do |atta|
|
||||
begin
|
||||
atta.publish_time = atta.created_on.strftime('%d-%b-%Y')
|
||||
atta.save
|
||||
ensure
|
||||
logger.error("===================>>container_id is null")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
=end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160202034530) do
|
||||
ActiveRecord::Schema.define(:version => 20160220100507) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1219,7 +1219,6 @@ ActiveRecord::Schema.define(:version => 20160202034530) do
|
|||
create_table "org_members", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "organization_id"
|
||||
t.string "role"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
@ -1374,7 +1373,7 @@ ActiveRecord::Schema.define(:version => 20160202034530) 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 "act_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#coding=utf-8
|
||||
|
||||
namespace :resource_publish do
|
||||
desc "start publish resource"
|
||||
task :publish => :environment do
|
||||
attachments = Attachment.where("publish_time = '#{Date.today}'")
|
||||
attachments.each do |attachment|
|
||||
attachment.update_column('is_publish', 1)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -113,4 +113,6 @@ div.flash {margin-top :0px !important}
|
|||
.blueBtn:hover {background-color:#298fbd;}
|
||||
/*文本描述展开高度*/
|
||||
.maxh360 {max-height: 810px;}
|
||||
.lh18 { line-height: 18px;}
|
||||
.lh18 { line-height: 18px;}
|
||||
|
||||
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}
|
|
@ -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;}
|
||||
|
|
|
@ -255,6 +255,7 @@ a.bBlue {background-color:#3498db;}
|
|||
a.bBlue:hover {background-color:#297fb8;}
|
||||
a.submit_btn {border:1px solid #3498db; padding:3px 10px; border-radius:3px; color:#3498db;}
|
||||
a.submit_btn:hover {background-color:#3498db; color:#ffffff;}
|
||||
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}
|
||||
|
||||
/* commonBtn */
|
||||
.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;}
|
||||
|
|
Loading…
Reference in New Issue