diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a8a302045..90974b376 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -659,14 +659,10 @@ class ProjectsController < ApplicationController # Delete @project def destroy @project_to_destroy = @project - if api_request? || params[:confirm] - @project_to_destroy.destroy - respond_to do |format| - format.html { redirect_to admin_projects_url } - format.api { render_api_ok } - end - else - render :layout => "base_projects" + @project_to_destroy.destroy + respond_to do |format| + format.html { redirect_to admin_projects_url } + format.api { render_api_ok } end # hide project in layout @project = nil diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7e44174fe..3de491421 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -121,49 +121,37 @@ class UsersController < ApplicationController messages = MessageAll.where("user_id =?", @user).order("created_at desc") messages.each do |message_all| # 在点击或者刷新消息列表后未读的消息存放在数组 - if message_all.message.viewed == 0 + if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0 @message_alls << message_all.message end end - # when 'system_messages' - # @message_alls = SystemMessage.order("created_at desc").all - when 'apply' - @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc") + + #课程相关消息 when 'homework' @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage') and user_id =?", @user).order("created_at desc") when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") - when 'forge_message' - @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") - # @message_alls_count = @message_alls.count when 'course_news' # 课程通知包含发布的通知和回复的通知 @message_alls = CourseMessage.where("course_message_type =? or course_message_type =?", "News", "Comment").where("user_id =?", @user).order("created_at desc") - #@user_course_messages_count = @user_course_messages.count - # when 'forge_news' - # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") - # @message_alls_count = @message_alls.count - # when 'course_news_reply' - # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - # when 'forge_news_reply' - # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - # @message_alls_count = @message_alls.count - # when 'poll' - # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") - # @message_alls_count = @message_alls.count - # when 'works_reviewers' - # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") - # @message_alls_count = @message_alls.count - # when 'works_reply' - # @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - # @message_alls_count = @message_alls.count + when 'poll' + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + + #项目相关消息 when 'issue' @message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc") - # when 'issue_update' # 缺陷状态更新、留言 - # @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") - # @message_alls_count = @message_alls.count + when 'forge_message' + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + when 'forge_news' + @message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc") + when 'apply' + @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc") + + #贴吧消息 when 'forum' @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") + + #用户留言 when 'user_feedback' @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") else @@ -534,6 +522,7 @@ class UsersController < ApplicationController @atta_count = @attachments.count @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @offset ||= @atta_pages.offset + @seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids] #@curse_attachments_all = @all_attachments[@offset, @limit] @attachments = paginateHelper @attachments,7 respond_to do |format| @@ -567,6 +556,7 @@ class UsersController < ApplicationController @atta_count = @attachments.count @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @offset ||= @atta_pages.offset + @seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids] #@curse_attachments_all = @all_attachments[@offset, @limit] @attachments = paginateHelper @attachments,7 respond_to do |format| @@ -598,6 +588,7 @@ class UsersController < ApplicationController @atta_count = @attachments.count @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 @offset ||= @atta_pages.offset + @seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids] #@curse_attachments_all = @all_attachments[@offset, @limit] @attachments = paginateHelper @attachments,7 respond_to do |format| @@ -608,8 +599,8 @@ class UsersController < ApplicationController #将资源批量引入 def import_resources_to_homework @attachments = [] - unless params[:checkbox1].nil? || params[:checkbox1].blank? - params[:checkbox1].each do |id| + unless session[:seleted_resource_ids].nil? || session[:seleted_resource_ids].blank? + session[:seleted_resource_ids].each do |id| atta = Attachment.find(id) att_copy = atta.copy att_copy.container_id = nil @@ -620,11 +611,23 @@ class UsersController < ApplicationController @attachments << att_copy end end + session[:seleted_resource_ids] = [] #保存后清空 respond_to do |format| format.js end end + # ajax 用session保存选择的资源id + def store_selected_resource + session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil? + if params[:save] == 'y' + session[:seleted_resource_ids] << params[:res_id] + else + session[:seleted_resource_ids].delete( params[:res_id]) + end + render :nothing => true + end + include CoursesHelper def user_courses diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index f6b083b4d..2935d018a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -68,8 +68,14 @@ module UsersHelper '课程讨论' when 'course_news' '课程通知' + when 'poll' + '课程问卷' when 'issue' '项目任务' + when 'forge_message' + '项目讨论' + when 'forge_news' + '项目新闻' when 'forum' '贴吧帖子' when 'user_feedback' diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index f5b7955bf..3f6ee36f0 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -65,7 +65,7 @@ <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %> - <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %> + <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del', :onClick=>"delcfm()" ) %> <% end %> @@ -74,3 +74,11 @@ <% html_title(l(:label_project_plural)) -%> + + \ No newline at end of file diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index e2e1dcfc2..44b72868d 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -94,7 +94,7 @@ $('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); }); - <% if activity %> + <% if activity && activity.course_act%> <% act = activity.course_act %> <% case activity.course_act_type.to_s %> <% when 'HomeworkCommon' %> diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index e31eea960..9e88cb2fd 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -55,6 +55,7 @@
","").gsub("
","").gsub("","").gsub("
","").gsub("","").gsub("
","").gsub("课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
-提交截止:<%= ma.course_message.end_time %>@nbsp; 24点
-匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点
+提交截止:<%= ma.course_message.end_time %> 24点
+匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> @ 24点
迟交扣分:<%= ma.course_message.late_penalty %>分
请同学们抓紧时间提交自己的作品,谢谢!
<% else %><%= User.current.lastname + User.current.firstname %>老师您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)
作业标题:<%= ma.course_message.name %>
-提交截止:<%= ma.course_message.end_time %>@nbsp;@nbsp;24点
-匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %>@nbsp;@nbsp;24点
-匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>@nbsp;@nbsp;24点
+提交截止:<%= ma.course_message.end_time %> 24点
+匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 24点
+匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 24点
迟交扣分:<%= ma.course_message.late_penalty %>分
缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
您可以修改作业内容、评分规则、匿评过程等,谢谢!
diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb index 672dfda64..23a0774c3 100644 --- a/app/views/users/_user_message_userfeedaback.html.erb +++ b/app/views/users/_user_message_userfeedaback.html.erb @@ -9,7 +9,7 @@ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>","").gsub("
","").gsub("