Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2016-01-22 20:55:31 +08:00
commit 4530e7896a
20 changed files with 88 additions and 24 deletions

View File

@ -127,6 +127,7 @@ class BlogCommentsController < ApplicationController
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
@article.children << @blogComment @article.children << @blogComment
@article.save @article.save
# @article.update_attribute(:updated_on, @blogComment.updated_on)
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
if user_activity if user_activity

View File

@ -81,7 +81,7 @@ class IssuesController < ApplicationController
@priority_id = params[:priority_id] @priority_id = params[:priority_id]
@status_id = params[:status_id] @status_id = params[:status_id]
@subject = params[:subject] @subject = params[:subject]
@done_ratio = parmas[:done_ratio] @done_ratio = params[:done_ratio]
@issue_count = @query.issue_count @issue_count = @query.issue_count
@issue_pages = Paginator.new @issue_count, @limit, params['page'] @issue_pages = Paginator.new @issue_count, @limit, params['page']
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1 params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
@ -222,7 +222,7 @@ class IssuesController < ApplicationController
def update def update
if params[:issue_detail] if params[:issue_detail]
issue = Issue.find(params[:issue_id]) issue = Issue.find(params[:id])
issue = update_user_issue_detail(issue, params) issue = update_user_issue_detail(issue, params)
@saved = update_user_issue_detail(issue, params) @saved = update_user_issue_detail(issue, params)
return return

View File

@ -55,7 +55,7 @@ class OrganizationsController < ApplicationController
@organization.name = params[:organization][:name] @organization.name = params[:organization][:name]
@organization.description = params[:organization][:description] @organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public] @organization.is_public = params[:organization][:is_public]
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 @organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
@organization.creator_id = User.current.id @organization.creator_id = User.current.id
member = OrgMember.new(:user_id => User.current.id) member = OrgMember.new(:user_id => User.current.id)

View File

@ -360,6 +360,9 @@ update
end end
# end # end
@changesets_latest_coimmit = @changesets[0] @changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@properties = @repository.properties(@path, @rev) @properties = @repository.properties(@path, @rev)
@repositories = @project.repositories @repositories = @project.repositories
@course_tag = params[:course] @course_tag = params[:course]
@ -589,6 +592,11 @@ update
project.project_score.update_attribute(:changeset_num, count) project.project_score.update_attribute(:changeset_num, count)
end end
# 更新项目提交次数时间
def update_commits_date project, date
project.project_score.update_attribute(:commit_time, date.created_at)
end
def find_repository def find_repository
@repository = Repository.find(params[:id]) @repository = Repository.find(params[:id])
@project = @repository.project @project = @repository.project

View File

@ -49,6 +49,11 @@ module ApplicationHelper
end end
end end
def link_to_user_version(version, options = {})
return '' unless version && version.is_a?(Version)
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue "
end
# 判断课程是否为精品课程 # 判断课程是否为精品课程
def is_excellent_course course def is_excellent_course course
(course.is_excellent? or course.excellent_option?) ? true : false (course.is_excellent? or course.excellent_option?) ? true : false

View File

@ -85,11 +85,6 @@ module UsersHelper
end end
end end
def link_to_user_version(version, options = {})
return '' unless version && version.is_a?(Version)
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue "
end
# 统计未读消息数 # 统计未读消息数
def unviewed_message(user) def unviewed_message(user)
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count

View File

@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base
after_save :add_user_activity after_save :add_user_activity
after_update :update_activity after_update :update_activity
after_create :update_parent_time
before_destroy :destroy_user_activity before_destroy :destroy_user_activity
scope :like, lambda {|arg| scope :like, lambda {|arg|
@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base
(user && user.logged? && (self.author == user) ) || user.admin? (user && user.logged? && (self.author == user) ) || user.admin?
end end
def update_parent_time
if !self.parent.nil?
self.root.update_attribute(:updated_on, self.updated_on)
end
end
def project def project
end end
end end

View File

@ -380,7 +380,15 @@ class Mailer < ActionMailer::Base
end end
# issue截止时间提醒 # issue截止时间提醒
def issue_due_date(issue, recipients) def issue_due_date(issue)
recipients ||= []
if issue.author.id != issue.assigned_to_id
recipients << issue.author.mail
end
# 被指派人邮箱地址加入数组
recipients << issue.assigned_to.mail
# cc = wiki_content.page.wiki.watcher_recipients - recipients
@author = issue.author @author = issue.author
@issue_name = issue.subject @issue_name = issue.subject
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id) @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)

View File

@ -7,7 +7,7 @@
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p> <p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
<p class="f12"> <p class="f12">
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span> <span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(e_course), :class => "linkBlue2" %>)</span></p> <span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span></p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</li> </li>

View File

@ -126,4 +126,4 @@
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div> </div>
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <%# html_title(l(:label_attachment_plural)) -%>

View File

@ -95,4 +95,4 @@
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
</div> </div>
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <%# html_title(l(:label_attachment_plural)) -%>

View File

@ -74,7 +74,7 @@
</div><!---re_con end--> </div><!---re_con end-->
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <%# html_title(l(:label_attachment_plural)) -%>
<script> <script>
function org_upload_files(org_subfield_id){ function org_upload_files(org_subfield_id){
$.ajax({ $.ajax({

View File

@ -20,7 +20,7 @@
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); sd_create_editor_from_data(<%= @issue.id %>, null, "100%");
<%else%> <%else%>
$("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>"); $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity'); init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%"); // sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %> <%end %>

View File

View File

@ -52,9 +52,13 @@
</div> </div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<%# 局部刷新修改xissue属性 %> <%# 局部刷新修改xissue属性 %>
<% if is_project_manager?(User.current, activity.project) %>
<% unless params[:action] == "index" %>
<div id="div_user_issue_detail_<%=activity.id %>"> <div id="div_user_issue_detail_<%=activity.id %>">
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
</div> </div>
<% end %>
<% end %>
<div class="cl"></div> <div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div> <div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div> <div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>

View File

@ -42,7 +42,7 @@
{:include_blank => false, :selected => @status_id ? @status_id : 0 }, {:include_blank => false, :selected => @status_id ? @status_id : 0 },
{:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %>
<%# end %> <%# end %>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p>
<p class="proInfoP"><span><%= activity.status.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a></p> <p class="proInfoP"><span><%= activity.status.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a></p>
@ -54,7 +54,7 @@
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"> <span class="pro_info_p">
@ -68,7 +68,7 @@
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<ul class="fl"> <ul class="fl">
<%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:70px;"><span><%= activity.priority.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span> <span class="proInfoP" style="width:70px;"><span><%= activity.priority.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>
@ -78,7 +78,7 @@
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;完成度&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;完成度&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:70px;"><span><%= activity.done_ratio %>%</span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span> <span class="proInfoP" style="width:70px;"><span><%= activity.done_ratio %>%</span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>

View File

@ -0,0 +1,17 @@
class ExcellentCourse < ActiveRecord::Migration
def up
arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:is_excellent, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
end
end

View File

@ -0,0 +1,19 @@
class ExcellentOptionCourse < ActiveRecord::Migration
def up
arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50,
419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175,
124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:excellent_option, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
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 => 20160122083507) do ActiveRecord::Schema.define(:version => 20160122094829) 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
@ -1372,6 +1372,7 @@ ActiveRecord::Schema.define(:version => 20160122083507) do
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 "attach_num", :default => 0 t.integer "attach_num", :default => 0
t.datetime "commit_time"
end end
create_table "project_statuses", :force => true do |t| create_table "project_statuses", :force => true do |t|

View File

@ -14,10 +14,10 @@ namespace :issue_due_date do
recipients << assigner recipients << assigner
recipients.each do |r| recipients.each do |r|
issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1) issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1)
end
end
# issue截止时间邮件提醒 # issue截止时间邮件提醒
Mailer.issue_due_date(issue, recipients).deliver Mailer.issue_due_date(issue).deliver
end
end
end end
end end
end end