diff --git a/app/controllers/activity_notifys_controller.rb b/app/controllers/activity_notifys_controller.rb new file mode 100644 index 000000000..c696836b2 --- /dev/null +++ b/app/controllers/activity_notifys_controller.rb @@ -0,0 +1,54 @@ +class ActivityNotifysController < ApplicationController +# layout 'base_projects'#by young +# default_search_scope :messages + before_filter :find_project_by_project_id#, :find_board_if_available +# before_filter :authorize, :except => [:new, :show, :create, :index] +# accept_rss_auth :index, :show + + helper :activities + def index + query = nil + if @course + query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',@course.id,'Course',User.current.id); + else + @events_by_day = [] + end + + if( query != nil ) + logger.info('xxoo') + limit = 10; + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all(); + events=[]; + for item in list + event = item.activity; + event.set_notify_id(item.id) + event.set_notify_is_read(item.is_read) + events << event + end + @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} + @controller_name = 'ActivityNotifys' + logger.info('aavv') + end + respond_to do |format| + format.html {render :template => 'courses/show', :layout => 'base_courses'} + end + end + + def chang_read_flag + if @course + if(params[:an_id] != nil ) + query = ActivityNotify.where('id=? and notify_to=?',params[:an_id],User.current.id) + else + query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=? and is_read=0',@course.id,'Course',User.current.id) + end + @result = query.update_all('is_read=1'); + else + @result = false; + end + respond_to do |format| + format.html{render :layout => nil} + end + end +end \ No newline at end of file diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 8ad48c9b2..ec0480c19 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -211,9 +211,19 @@ class AttachmentsController < ApplicationController if !@attachment.container.nil? && (@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) && @attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && - @attachment.container.board && @attachment.container.board.course ) ) + @attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) || + @attachment.container.is_a?(StudentWork)) if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } + elsif @attachment.container.is_a?(StudentWorksScore) + @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + format.js + elsif @attachment.container.is_a?(HomeworkCommon) + @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + format.js + elsif @attachment.container.is_a?(StudentWork) + @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + format.js elsif @attachment.container.is_a?(Message) format.html { redirect_to_referer_or new_board_message_path(@attachment.container) } elsif @course.nil? @@ -451,7 +461,7 @@ private @attachment.container.board.course) @course = @attachment.container.board.course else - unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWorks' + unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' @project = @attachment.project end end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index db5bded55..6ff4d2f97 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -88,14 +88,40 @@ class BoardsController < ApplicationController preload(:author, {:last_reply => :author}). all elsif @course - board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). - includes(:last_reply). - # limit(@topic_pages.per_page). - # offset(@topic_pages.offset). - - preload(:author, {:last_reply => :author}). - all : [] - @topics = paginateHelper board_topics,10 + # + # board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + # includes(:last_reply). + # # limit(@topic_pages.per_page). + # # offset(@topic_pages.offset). + # + # preload(:author, {:last_reply => :author}). + # all : [] + # @topics = paginateHelper board_topics,10 + if( @board ) + limit = 10; + pageno = params[:page]; + if(pageno == nil || pageno=='') + dw_topic = nil; + if( params[:parent_id]!=nil && params[:parent_id]!='' ) + dw_topic = @board.topics.where(id:params[:parent_id]).first(); + end + if( dw_topic != nil ) + dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count(); + dw_count = dw_count+1; + pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1) + end + end + if(pageno == nil || pageno=='') + pageno=1; + end + @topic_count = @board.topics.count(); + @topic_pages = Paginator.new @topic_count, limit, pageno + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + limit(limit).offset(@topic_pages.offset).includes(:last_reply). + preload(:author, {:last_reply => :author}).all(); + else + @topics = []; + end end @message = Message.new(:board => @board) @@ -103,6 +129,7 @@ class BoardsController < ApplicationController if @project render :action => 'show', :layout => 'base_projects' elsif @course + @params=params render :action => 'show', :layout => 'base_courses' end } diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index f6b044c63..5dd5363b9 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -334,9 +334,8 @@ class HomeworkAttachController < ApplicationController @homework.name = name @homework.description = description @homework.project_id = params[:project_id] || 0 - if params[:attachments] - @homework.save_attachments(params[:attachments]) - end + @homework.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(@homework) if @homework.save respond_to do |format| format.html { redirect_to course_for_bid_url @homework.bid } diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 58c959512..06bc1fd38 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -5,7 +5,7 @@ class HomeworkCommonController < ApplicationController before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] def index - homeworks = @course.homework_commons + homeworks = @course.homework_commons.order("created_at desc") @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @homeworks = paginateHelper homeworks,20 @@ -17,14 +17,14 @@ class HomeworkCommonController < ApplicationController def new @homework = HomeworkCommon.new @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 2 + @homework.late_penalty = 0 @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d') #匿评作业相关属性 @homework_detail_manual = HomeworkDetailManual.new @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 2 + @homework_detail_manual.absence_penalty = 0 @homework_detail_manual.evaluation_num = 3 @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @@ -101,6 +101,9 @@ class HomeworkCommonController < ApplicationController @homework_detail_manual.evaluation_num = params[:evaluation_num] @homework_detail_manual.absence_penalty = params[:absence_penalty] + @homework.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(@homework) + if @homework.save && @homework_detail_manual.save respond_to do |format| format.html { @@ -197,7 +200,7 @@ class HomeworkCommonController < ApplicationController end #是不是课程的老师 def teacher_of_course - render_403 unless User.current.allowed_to?(:as_teacher,@course) + render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index e33eb8d75..9e36d15f4 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -31,6 +31,8 @@ class MessagesController < ApplicationController include AttachmentsHelper helper :project_score + include CoursesHelper + REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE) # Show a topic and its replies @@ -91,6 +93,29 @@ class MessagesController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE end + # 与我相关动态的记录add start + if(@board.course_id>0) #项目的先不管 + teachers = searchTeacherAndAssistant(@board.course); + for teacher in teachers + if(teacher.user_id != User.current.id) + notify = ActivityNotify.new() + if(@board.course_id>0) + notify.activity_container_id = @board.course_id + notify.activity_container_type = 'Course' + else + notify.activity_container_id = @board.project_id + notify.activity_container_type = 'Project' + end + notify.activity_id = @message.id + notify.activity_type = 'Message' + notify.notify_to = teacher.user_id + notify.is_read = 0 + notify.save() + end + end + end + # 与我相关动态的记录add end + call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) render_attachment_warning_if_needed(@message) if params[:is_board] @@ -151,6 +176,35 @@ class MessagesController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE end + + # 与我相关动态的记录add start + if(@board.course_id>0) #项目的先不管 + notifyto_arr = {} + notifyto_arr[@topic.author_id] = @topic.author_id + if( params[:parent_topic] != nil && params[:parent_topic] != '') + parent_topic = Message.find(params[:parent_topic]) + notifyto_arr[parent_topic.author_id] = parent_topic.author_id + end + notifyto_arr.each do |k,user_id| + if(user_id != User.current.id) + notify = ActivityNotify.new() + if(@board.course_id>0) + notify.activity_container_id = @board.course_id + notify.activity_container_type = 'Course' + else + notify.activity_container_id = @board.project_id + notify.activity_container_type = 'Project' + end + notify.activity_id = @reply.id + notify.activity_type = 'Message' + notify.notify_to = user_id + notify.is_read = 0 + notify.save() + end + end + end + # 与我相关动态的记录add end + call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply}) attachments = Attachment.attach_files(@reply, params[:attachments]) render_attachment_warning_if_needed(@reply) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fbafd16e9..3c34aa549 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -363,7 +363,8 @@ class ProjectsController < ApplicationController #发送邮件邀请新用户 def invite_members_by_mail - if User.current.member_of?(@project) || User.current.admin? + if User.current.member_of?(@project) || User.current.admin? + @inviter_lists = InviteList.where(project_id:@project.id).all @is_zhuce = false respond_to do |format| format.html diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8c5561d74..30fd0ff50 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -253,13 +253,13 @@ class StudentWorkController < ApplicationController #是不是当前课程的成员 #当前课程成员才可以看到作品列表 def member_of_course - render_403 unless User.current.member_of_course? @course + render_403 unless User.current.member_of_course? @course || User.current.admin? end #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end #根据条件过滤作业结果 diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index 5399fd5bf..b9940f4be 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -3,7 +3,7 @@ module HomeworkCommonHelper #迟交扣分下拉框 def late_penalty_option type = [] - for i in (1..5) + for i in (0..5) option = [] option << i option << i @@ -29,7 +29,7 @@ module HomeworkCommonHelper #缺评扣分 def absence_penalty_option type = [] - i = 1 + i = 0 while i <= 5 option = [] option << i diff --git a/app/models/activity_notify.rb b/app/models/activity_notify.rb new file mode 100644 index 000000000..0fbe1f6f1 --- /dev/null +++ b/app/models/activity_notify.rb @@ -0,0 +1,3 @@ +class ActivityNotify < ActiveRecord::Base + belongs_to :activity, polymorphic: true +end \ No newline at end of file diff --git a/app/models/invite_list.rb b/app/models/invite_list.rb index f1ba8546f..4868fc3d7 100644 --- a/app/models/invite_list.rb +++ b/app/models/invite_list.rb @@ -1,5 +1,13 @@ class InviteList < ActiveRecord::Base attr_accessible :project_id, :user_id - # belongs_to :user - # belongs_to :project + belongs_to :user + belongs_to :project + + # 用户拒绝邀请后,删除记录 + def self.delete_inviter(userid, projectid) + @inviters = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid) + @inviters.each do |inviter| + inviter.destroy + end + end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index dbc5d3cff..087fb6d73 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -58,6 +58,7 @@ class Mailer < ActionMailer::Base us = UsersService.new # 自动激活用户 user = us.register_auto(login, @email, @password) + InviteList.create(:user_id => user.id, :project_id => project.id) User.current = user unless User.current.nil? @user = user @@ -73,6 +74,10 @@ class Mailer < ActionMailer::Base @project_name = "#{project.name}" @user = user @project = project + inviter_lists = InviteList.where(project_id:@project.id, user_id:@user.id).all + if inviter_lists.blank? + InviteList.create(:user_id => user.id, :project_id => project.id) + end @token = Token.get_token_from_user(user, 'autologin') @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) mail :to => email, :subject => @subject @@ -83,13 +88,10 @@ class Mailer < ActionMailer::Base # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 def send_for_user_activities(user, date_to, days) date_from = date_to - days.days - subject = "[ #{user.show_name}#{l(:label_day_mail)}]" @subject = " #{user.show_name}#{l(:label_day_mail)}" - date_from = "#{date_from} 17:59:59" date_to = "#{date_to} 17:59:59" - # 生成token用于直接点击登录 @user = user @token = Token.get_token_from_user(user, 'autologin') @@ -100,34 +102,32 @@ class Mailer < ActionMailer::Base project_ids = projects.map{|project| project.id}.join(",") course_ids = courses.map {|course| course.id}.join(",") - # 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷 - sql = "select DISTINCT i.* from issues i, watchers w - where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id} - or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id})) - and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" + # 查询user的缺陷,项目中成员都能收到 + sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' + and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @attachments ||= [] - @bids ||= [] # 老师发布的作业 - unless courses.first.nil? count = courses.count count = count - 1 for i in 0..count do bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc") attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') - @bids += bids if bids.count > 0 - @attachments += attachments if attachments.count > 0 + @bids += bids if bids.count > 0 + @attachments += attachments if attachments.count > 0 end end # user 提交的作业 @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # 查询user在课程。项目中发布的讨论帖子 - messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + messages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @course_messages ||= [] @project_messages ||= [] unless messages.first.nil? @@ -139,6 +139,7 @@ class Mailer < ActionMailer::Base end end end + # 查询user在课程中发布的通知,项目中发的新闻 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) @@ -151,18 +152,13 @@ class Mailer < ActionMailer::Base jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') - - # 查询user新建贴吧或发布帖子 @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news, - @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| - !o.empty? - } + @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 mail :to => user.mail,:subject => subject if has_content @@ -277,11 +273,11 @@ class Mailer < ActionMailer::Base @token = Token.get_token_from_user(user, 'autologin') @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value) - # edit - @issue_author_url = url_for(user_activities_url(@author,:token => @token.value)) - @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) + # edit + @issue_author_url = url_for(user_activities_url(@author,:token => @token.value)) + @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) - @user_url = url_for(my_account_url(user,:token => @token.value)) + @user_url = url_for(my_account_url(user,:token => @token.value)) subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" @@ -289,13 +285,13 @@ class Mailer < ActionMailer::Base :subject => subject, :filter => true end - # issue.attachments.each do |attach| - # attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}") - # end - # cc = issue.watcher_recipients - recipients - #mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll") + # issue.attachments.each do |attach| + # attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}") + # end + # cc = issue.watcher_recipients - recipients + #mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll") + - # Builds a Mail::Message object used to email recipients of the edited issue. @@ -324,13 +320,13 @@ class Mailer < ActionMailer::Base @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) @user_url = url_for(my_account_url(user,:token => @token.value)) - @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value) + @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value) s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] " s << "(#{issue.status.name}) " if journal.new_value_for('status_id') s << issue.subject @issue = issue @journal = journal - # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") + # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") mail :to => recipients, :subject => s, :filter => true @@ -360,10 +356,10 @@ class Mailer < ActionMailer::Base @issues = issues @days = days @issues_url = url_for(:controller => 'issues', :action => 'index', - :set_filter => 1, :assigned_to_id => user.id, - :sort => 'due_date:asc') + :set_filter => 1, :assigned_to_id => user.id, + :sort => 'due_date:asc') mail :to => user.mail, - :subject => l(:mail_subject_reminder, :count => issues.size, :days => days) + :subject => l(:mail_subject_reminder, :count => issues.size, :days => days) end #缺陷到期邮件通知 @@ -494,8 +490,8 @@ class Mailer < ActionMailer::Base @news = news @news_url = url_for(:controller => 'news', :action => 'show', :id => news) mail :to => news.recipients, - :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}", - :filter => true + :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}", + :filter => true elsif news.course redmine_headers 'Course' => news.course.id @author = news.author @@ -526,9 +522,9 @@ class Mailer < ActionMailer::Base @comment = comment @news_url = url_for(:controller => 'news', :action => 'show', :id => news) mail :to => news.recipients, - :cc => news.watcher_recipients, - :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}", - :filter => true + :cc => news.watcher_recipients, + :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}", + :filter => true elsif news.course redmine_headers 'Course' => news.course.id @author = comment.author @@ -563,9 +559,9 @@ class Mailer < ActionMailer::Base @message = message @message_url = url_for(message.event_url) mail :to => recipients, - :cc => cc, - :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", - :filter => true + :cc => cc, + :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", + :filter => true elsif message.course redmine_headers 'Course' => message.course.id, 'Topic-Id' => (message.parent_id || message.id) @@ -598,12 +594,12 @@ class Mailer < ActionMailer::Base cc = wiki_content.page.wiki.watcher_recipients - recipients @wiki_content = wiki_content @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', - :project_id => wiki_content.project, - :id => wiki_content.page.title) + :project_id => wiki_content.project, + :id => wiki_content.page.title) mail :to => recipients, - :cc => cc, - :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}", - :filter => true + :cc => cc, + :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}", + :filter => true end # Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated. @@ -620,15 +616,15 @@ class Mailer < ActionMailer::Base cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients @wiki_content = wiki_content @wiki_content_url = url_for(:controller => 'wiki', :action => 'show', - :project_id => wiki_content.project, - :id => wiki_content.page.title) + :project_id => wiki_content.project, + :id => wiki_content.page.title) @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff', - :project_id => wiki_content.project, :id => wiki_content.page.title, - :version => wiki_content.version) + :project_id => wiki_content.project, :id => wiki_content.page.title, + :version => wiki_content.version) mail :to => recipients, - :cc => cc, - :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}", - :filter => true + :cc => cc, + :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}", + :filter => true end # Builds a Mail::Message object used to email the specified user their account information. @@ -642,7 +638,7 @@ class Mailer < ActionMailer::Base @password = password @login_url = url_for(:controller => 'account', :action => 'login') mail :to => user.mail, - :subject => l(:mail_subject_register, Setting.app_title) + :subject => l(:mail_subject_register, Setting.app_title) end # Builds a Mail::Message object used to email all active administrators of an account activation request. @@ -655,10 +651,10 @@ class Mailer < ActionMailer::Base recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact @user = user @url = url_for(:controller => 'users', :action => 'index', - :status => User::STATUS_REGISTERED, - :sort_key => 'created_on', :sort_order => 'desc') + :status => User::STATUS_REGISTERED, + :sort_key => 'created_on', :sort_order => 'desc') mail :to => recipients, - :subject => l(:mail_subject_account_activation_request, Setting.app_title) + :subject => l(:mail_subject_account_activation_request, Setting.app_title) end # Builds a Mail::Message object used to email the specified user that their account was activated by an administrator. @@ -671,7 +667,7 @@ class Mailer < ActionMailer::Base @user = user @login_url = url_for(:controller => 'account', :action => 'login') mail :to => user.mail, - :subject => l(:mail_subject_register, Setting.app_title) + :subject => l(:mail_subject_register, Setting.app_title) end def lost_password(token) @@ -679,7 +675,7 @@ class Mailer < ActionMailer::Base @token = token @url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value) mail :to => token.user.mail, - :subject => l(:mail_subject_lost_password, Setting.app_title) + :subject => l(:mail_subject_lost_password, Setting.app_title) end def register(token) @@ -687,14 +683,14 @@ class Mailer < ActionMailer::Base @token = token @url = url_for(:controller => 'account', :action => 'activate', :token => token.value) mail :to => token.user.mail, - :subject => l(:mail_subject_register, Setting.app_title) + :subject => l(:mail_subject_register, Setting.app_title) end def test_email(user) set_language_if_valid(user.language) @url = url_for(:controller => 'welcome') mail :to => user.mail, - :subject => 'forge test' + :subject => 'forge test' end # Overrides default deliver! method to prevent from sending an email @@ -702,8 +698,8 @@ class Mailer < ActionMailer::Base def deliver!(mail = @mail) set_language_if_valid @initial_language return false if (recipients.nil? || recipients.empty?) && - (cc.nil? || cc.empty?) && - (bcc.nil? || bcc.empty?) + (cc.nil? || cc.empty?) && + (bcc.nil? || bcc.empty?) # Log errors when raise_delivery_errors is set to false, Rails does not @@ -735,8 +731,8 @@ class Mailer < ActionMailer::Base user_ids = options[:users] scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" + - " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" + - " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date + " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" + + " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date ) scope = scope.where(:assigned_to_id => user_ids) if user_ids.present? scope = scope.where(:project_id => project.id) if project @@ -800,12 +796,12 @@ class Mailer < ActionMailer::Base def mail(headers={}) headers.merge! 'X-Mailer' => 'Redmine', - 'X-Redmine-Host' => Setting.host_name, - 'X-Redmine-Site' => Setting.app_title, - 'X-Auto-Response-Suppress' => 'OOF', - 'Auto-Submitted' => 'auto-generated', - 'From' => Setting.mail_from, - 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" + 'X-Redmine-Host' => Setting.host_name, + 'X-Redmine-Site' => Setting.app_title, + 'X-Auto-Response-Suppress' => 'OOF', + 'Auto-Submitted' => 'auto-generated', + 'From' => Setting.mail_from, + 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" # Removes the author from the recipients and cc # if he doesn't want to receive notifications about what he does @@ -851,7 +847,7 @@ class Mailer < ActionMailer::Base set_language_if_valid Setting.default_language super end - + def self.deliver_mail(mail) return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank? Thread.new do @@ -898,7 +894,7 @@ class Mailer < ActionMailer::Base end def mylogger - if Setting.delayjob_enabled? + if Setting.delayjob_enabled? Delayed::Worker.logger else Rails.logger diff --git a/app/models/message.rb b/app/models/message.rb index bbf62b5dc..15d358789 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -34,6 +34,8 @@ class Message < ActiveRecord::Base has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end + has_many :ActivityNotifies,:as => :activity, :dependent => :destroy + acts_as_searchable :columns => ['subject', 'content'], :include => {:board => :project}, :project_key => "#{Board.table_name}.project_id", @@ -148,6 +150,19 @@ class Message < ActiveRecord::Base usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project))) end + def set_notify_id(notify_id) + @notify_id= notify_id + end + def get_notify_id() + return @notify_id + end + def set_notify_is_read(notify_is_read) + @notify_is_read = notify_is_read + end + def get_notify_is_read() + return @notify_is_read + end + private def add_author_as_watcher @@ -218,4 +233,5 @@ class Message < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE end + end diff --git a/app/models/project.rb b/app/models/project.rb index 4a546a430..49ed2d0ee 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -67,7 +67,7 @@ class Project < ActiveRecord::Base has_many :student, :through => :students_for_courses, :source => :user has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects - # has_many :invite_lists + has_many :invite_lists # end #ADDED BY NIE diff --git a/app/views/activity_notifys/chang_read_flag.html.erb b/app/views/activity_notifys/chang_read_flag.html.erb new file mode 100644 index 000000000..ca89a7e3f --- /dev/null +++ b/app/views/activity_notifys/chang_read_flag.html.erb @@ -0,0 +1 @@ +<%= @result == false ? 'false' : 'true' %> \ No newline at end of file diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index 0b6cee0df..d23422e24 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,26 +1,30 @@ -var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); -//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start -var containerid=$('.remove-upload',attachment_html_obj).data('containerid'); -if(containerid==undefined){ - $('#attachments_<%= j params[:attachment_id] %>').remove(); - var count=$('#attachments_fields>span').length; - if(count<=0){ - $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>'); - $(".remove_all").remove(); +<% if @is_destroy%> + $("#attachment_<%= @attachment.id%>").remove(); +<%else%> + var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); + //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start + var containerid=$('.remove-upload',attachment_html_obj).data('containerid'); + if(containerid==undefined){ + $('#attachments_<%= j params[:attachment_id] %>').remove(); + var count=$('#attachments_fields>span').length; + if(count<=0){ + $("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>'); + $(".remove_all").remove(); + }else{ + $("#upload_file_count").html(""+count+""+"个文件"+"已上传"); + } }else{ - $("#upload_file_count").html(""+count+""+"个文件"+"已上传"); + $('#attachments_<%= j params[:attachment_id] %>').remove(); + var count=$('#attachments_fields'+containerid+'>span').length; + if(count<=0){ + $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>'); + var remove_all_html_obj = $(".remove_all").filter(function(index){ + return $(this).data('containerid')==containerid; + }); + remove_all_html_obj.remove(); + }else{ + $('#upload_file_count'+containerid).html(""+count+""+"个文件"+"已上传"); + } } -}else{ - $('#attachments_<%= j params[:attachment_id] %>').remove(); - var count=$('#attachments_fields'+containerid+'>span').length; - if(count<=0){ - $('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>'); - var remove_all_html_obj = $(".remove_all").filter(function(index){ - return $(this).data('containerid')==containerid; - }); - remove_all_html_obj.remove(); - }else{ - $('#upload_file_count'+containerid).html(""+count+""+"个文件"+"已上传"); - } -} -//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end \ No newline at end of file + //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end +<% end%> \ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 0d9d6a780..48e5a870d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -109,6 +109,7 @@ :html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %> <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> +
<%= l(:button_cancel)%> @@ -127,7 +128,7 @@
-
+

文件大小:<%= number_to_human_size(file.filesize) %>

<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_common_form.html.erb index cbe054335..e3ef0d237 100644 --- a/app/views/homework_common/_homework_common_form.html.erb +++ b/app/views/homework_common/_homework_common_form.html.erb @@ -33,7 +33,7 @@ <%= calendar_for('homework_end_time')%>
-
  • +
  • +<% end %> + + +<% unless @user_journal_messages.first.nil? %>
    -

    <%= l(:lable_bar_active) %>

    - <% unless @forums.first.nil? %> +

    <%= l(:label_activities) %>

    + + + +
    +<% end %> +<% if @forums.first || @memos.first %> +
    +

    <%= l(:lable_bar_active) %>

    + <% unless @forums.first.nil? %> + <% end %> <% unless @memos.first.nil? %>
    <% end %> -
    - <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> - <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> - - <% else %> - <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> - <% end %> - <% end %> -
    +
    + <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> + <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> + + <% else %> + <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> + <% end %> + <% end %> +
    diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 7f952cb3c..ce7ea2aa1 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -45,39 +45,55 @@ } -// if (filter.test(email)&& !(email.value == null)) return true; -// else -// { -// document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确"; -// document.getElementById('valid_email').style.color = "#FF0000"; -// return false; -// } -// -// } + // if (filter.test(email)&& !(email.value == null)) return true; + // else + // { + // document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确"; + // document.getElementById('valid_email').style.color = "#FF0000"; + // return false; + // } + // + // }

    <%= l(:label_invite_join)%>

    -

    - <%= l(:label_invite_email_tips)%> -

    -
    - <%= render :partial => 'regested', locals: { :isregisted => false} %> -
    - <%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %> - - -
    - - <%= l(:label_send_email)%> - +

    + <%= l(:label_invite_email_tips)%> +

    +
    + <%= render :partial => 'regested', locals: { :isregisted => false} %> +
    + <%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %> + + +
    + + <%= l(:label_send_email)%> + + <% end %> + <%# 邀请用户的状态 %> + <% unless @inviter_lists.blank? %> +
    + 已邀请的用户
    + <% @inviter_lists.each do |inviter_list| %> + <%= inviter_list.user.name %>
    + <% end %> +
    + 等待加入项目的用户
    + <% @inviter_lists.each do |inviter_list| %> + <% unless inviter_list.user.member_of?(@project) %> + <%= inviter_list.user.name %>
    + <% end %> + <% end %> +
    + <% end %> +
    + - <% end %> - - \ No newline at end of file diff --git a/app/views/student_work/_add_score.html.erb b/app/views/student_work/_add_score.html.erb index e091e507d..bdfcff6e1 100644 --- a/app/views/student_work/_add_score.html.erb +++ b/app/views/student_work/_add_score.html.erb @@ -16,7 +16,7 @@ <%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %> <%end%> - 提交 + 提交
    <% end%> \ No newline at end of file diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 80030c0e7..5a339dc03 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -1,22 +1,22 @@ -
    +
    <%@work.student_works_scores.order("created_at desc").each do |score|%>
    <%= render :partial => 'student_work_score',:locals => {:score => score}%> diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index 3d288c302..e8fb2ce3a 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -1,21 +1,23 @@
      " id="student_work_<%= student_work.id%>"> -
    • - <%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%> +
    • + + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
    • -
    • - <%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%> +
    • + <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name%>
    • - <%= link_to student_work.name, student_work_path(student_work),:remote => true%> + <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
    • -
    • +
    • <%= student_work.teacher_score.nil? ? "--" : format("%.2f",student_work.teacher_score)%>
    • -
    • +
    • <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.2f",student_work.teaching_asistant_score)%>
    • -
    • +
    • <%= student_work.student_score.nil? ? "--" : format("%.2f",student_work.student_score)%> <% unless student_work.student_score.nil?%> @@ -29,7 +31,7 @@
    <% end%> -
  • +
  • <%= student_work.final_score.nil? ? "--" : format("%.2f",student_work.final_score)%>
  • diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb index 7cf5e5d01..8162ea971 100644 --- a/app/views/student_work/_student_work_title.html.erb +++ b/app/views/student_work/_student_work_title.html.erb @@ -1,32 +1,32 @@ -
  • - 学号 +
  • + 学号
  • -
  • - 学生姓名 +
  • + 学生姓名
  • 作品名称
  • -
  • - <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> +
  • + <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%> <% if @show_all && @order == "teacher_score"%> <% end%>
  • -
  • - <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> +
  • + <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%> <% if @show_all && @order == "teaching_asistant_score"%> <% end%>
  • -
  • - <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> +
  • + <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "student_score"%> <% end%>
  • -
  • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> +
  • + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "final_score"%> <% end%> diff --git a/app/views/student_work/_work_attachments.html.erb b/app/views/student_work/_work_attachments.html.erb index 638644fdf..f303897bc 100644 --- a/app/views/student_work/_work_attachments.html.erb +++ b/app/views/student_work/_work_attachments.html.erb @@ -1,5 +1,8 @@ -<% for attachment in attachments %> - <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%> - (<%= number_to_human_size attachment.filesize %>) -
    +<% attachments.each_with_index do |attachment,i| %> +
    + <%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%> + <%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %> + (<%= number_to_human_size attachment.filesize %>) +
    +
    <% end -%> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 9fa678bc4..1cd665569 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,6 +36,7 @@ <% if @show_all%> + 搜索 <% end%> <% if @is_teacher%>
    diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 256a976c4..143c32dbe 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -140,9 +140,7 @@ <%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%> <% end%> - <% cache all_new_hot_course.max().created_at do %> - <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %> - <% end %> + <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
    <% else %> @@ -175,9 +173,7 @@ <%break if Time.new.strftime("%Y").to_i - year_now >= 2%> <% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%> <% end%> - <% cache all_new_hot_course.max().created_at do %> - <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %> - <% end %> + <%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %> <% end %>
  • diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 3acee0acf..c03b0de76 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -68,7 +68,6 @@
    -<% cache :expire_in => 2.hours do%>

    <%= l(:lable_hot_projects)%>

    <% if User.current.logged? %> @@ -113,7 +112,6 @@
    -<% end %>