Merge branch 'develop' into rep_quality

This commit is contained in:
huang 2016-08-31 11:16:23 +08:00
commit 97fa6562fa
16 changed files with 74 additions and 35 deletions

View File

@ -521,10 +521,10 @@ class IssuesController < ApplicationController
def delete_journal
@issue = Issue.find(params[:id])
begin
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first
forge_acts.destroy unless forge_acts.nil?
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first
at_message.destroy unless at_message.nil?
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
forge_acts.destroy_all unless forge_acts.empty?
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
at_message.destroy_all unless at_message.empty?
Journal.delete(params[:journal_id])
rescue Exception => e
puts e

View File

@ -37,6 +37,13 @@ module ApplicationHelper
# super
# end
# 隐藏项目以外的信息
# return: true 显示false 不显示
def hidden_unproject_infos
hidden_info = Setting.find_by_name("hidden_non_project")
(hidden_info && hidden_info.value == "1") ? true : false
end
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
def get_user_by_mail mail
user = User.find_by_mail(mail)

View File

@ -34,7 +34,7 @@ class Tracker < ActiveRecord::Base
end
has_and_belongs_to_many :projects
has_and_belongs_to_many :courses
# has_and_belongs_to_many :courses
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list

View File

@ -4,7 +4,9 @@
<li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<% if hidden_unproject_infos %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
</ul>

View File

@ -10,12 +10,14 @@
<li class="navHomepageMenu fl">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %>
</li>
<% if hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
</li>
<% end %>
</ul>
</div>
<script>

View File

@ -251,9 +251,10 @@
});
</script>
</div>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="fade" class="black_overlay">123</div>
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>

View File

@ -298,6 +298,7 @@
<div class="cl"></div>
</div><!--Container end-->
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-modal" style="display:none;"></div>

View File

@ -59,7 +59,9 @@
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= render :partial => 'layouts/new_feedback' %>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>

View File

@ -159,9 +159,7 @@
</div>
<div class="user_leftnav ">
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<% if hidden_unproject_infos %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
@ -224,7 +222,9 @@
<%= yield %>
</div>
</div>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>

View File

@ -3,6 +3,7 @@
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<% if hidden_unproject_infos %>
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14"><strong>课程消息</strong></li>
@ -12,7 +13,7 @@
<li><%= link_to "班级问卷", user_message_path(User.current, :type => 'poll'), :class => "homepagePostTypeQuiz postTypeGrey" %></a></li>
</ul>
</li>
<% end %>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14"><strong>项目消息</strong></li>

View File

@ -4,10 +4,12 @@
<li>
<a href="<%= resource_search_user_path(:id => @user.id, :type => @type, :status => 1, :search => @switch_search) %>" id="resource_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部 </a>
</li>
<% if hidden_unproject_infos %>
<li>
<a href="<%= resource_search_user_path(:id => @user.id, :type => @type, :status => 2, :search => @switch_search) %>" id="resource_type_course" class="homepagePostTypeAssignment postTypeGrey'" data-method="get" data-remote="true">班级资源 </a>
<%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
</li>
<% end %>
<li>
<a href="<%= resource_search_user_path(:id => @user.id, :type => @type, :status => 3, :search => @switch_search) %>" id="resource_type_project" class="homepagePostTypeQuiz postTypeGrey" data-method="get" data-remote="true">项目资源 </a>
<%#= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), id="resource_type_project", :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>

View File

@ -7,9 +7,7 @@
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<% if hidden_unproject_infos %>
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>

View File

@ -21,7 +21,9 @@
<%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %>
<%# 课程消息 %>
<% if hidden_unproject_infos %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
<% end %>
<!--项目消息-->
<%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %>

View File

@ -6,6 +6,7 @@ class MergeTwoHomeworks < ActiveRecord::Migration
work.update_column('homework_common_id', 3463)
end
end
begin
homework = HomeworkCommon.find 3387
homework.destroy if homework
stu_works = StudentWork.where("homework_common_id = 3387")
@ -13,6 +14,9 @@ class MergeTwoHomeworks < ActiveRecord::Migration
stu_work_tests = StudentWorkTest.where("student_work_id in #{stu_work_ids}")
stu_work_tests.destroy_all if stu_work_tests
stu_works.destroy_all if stu_works
rescue Exception => e
puts e
end
end
def down

View File

@ -0,0 +1,17 @@
class DeleteNullAtMessages < ActiveRecord::Migration
def up
count = AtMessage.all.count / 30 + 2
transaction do
for i in 1 ... count do i
AtMessage.page(i).per(30).each do |am|
if am.at_message.nil?
am.destroy
end
end
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.
ActiveRecord::Schema.define(:version => 20160824073554) do
ActiveRecord::Schema.define(:version => 20160830090214) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false