diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 0199e4d90..8ad0dce79 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -475,7 +475,6 @@ class AdminController < ApplicationController else @limit = 15#per_page_option end - @status = params[:status] || 1 scope = User.logged.status(@status) scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present? @@ -483,8 +482,7 @@ class AdminController < ApplicationController @user_pages = Paginator.new @user_count, @limit, params['page'] @user_base_tag = params[:id] ? 'base_users':'base' - @users = scope.offset(@user_pages.offset).limit(@user_pages.per_page) - + @users = scope.order(sort_clause).offset(@user_pages.offset).limit(@user_pages.per_page).all respond_to do |format| format.html { @groups = Group.all.sort diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 9994e5a3c..9d7b1fb59 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -47,6 +47,8 @@ class AtController < ApplicationController find_topic(id) when 'JournalsForMessage' find_journals_for_message(id) + when 'Journal' + find_journal(id) when 'Principal' find_principal(id) when 'BlogComment' @@ -159,6 +161,12 @@ class AtController < ApplicationController #Journal def find_journal(id) + journal = Journal.find id + if journal.journalized_type == 'Issue' + issue_id = journal.issue.id + find_at_users(journal.journalized_type, issue_id) + end + end #Document diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 0f5a55ab9..f15114d20 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -121,7 +121,7 @@ class ForumsController < ApplicationController order = "" @order_str = "" if(params[:reorder_complex]) - order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" + order = "last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" @order_str = "reorder_complex="+params[:reorder_complex] elsif(params[:reorder_popu]) order = "replies_count #{params[:reorder_popu]}" @@ -166,16 +166,16 @@ class ForumsController < ApplicationController order = "" @order_str = "" if(params[:reorder_complex]) - order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" + order = "#{Memo.table_name}.sticky desc, last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" @order_str = "reorder_complex="+params[:reorder_complex] elsif(params[:reorder_popu]) - order = "replies_count #{params[:reorder_popu]}" + order = "#{Memo.table_name}.sticky desc, replies_count #{params[:reorder_popu]}" @order_str = "reorder_popu="+params[:reorder_popu] elsif(params[:reorder_time]) - order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}" + order = "#{Memo.table_name}.sticky desc, #{Memo.table_name}.updated_at #{params[:reorder_time]}" @order_str = "reorder_time="+params[:reorder_time] else - order = "#{Memo.table_name}.updated_at desc" + order = "#{Memo.table_name}.sticky desc, #{Memo.table_name}.updated_at desc" @order_str = "reorder_time=desc" end @memo = Memo.new(:forum => @forum) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 8e84f2659..eb31cf13f 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -50,6 +50,8 @@ class MemosController < ApplicationController @memo = Memo.new(params[:memo]) @memo.forum_id = @forum.id @memo.author_id = User.current.id + # 问吧置顶sticky:1 置顶;0不置顶 + @memo.sticky = params[:memo][:sticky].to_i if params[:memo][:parent_id] @memo.root_id = (Memo.find params[:memo][:parent_id]).root_id.nil? ? params[:memo][:parent_id].to_i : (Memo.find params[:memo][:parent_id]).root_id @@ -189,6 +191,14 @@ class MemosController < ApplicationController end end + #置顶功能 + def change_sticky + @memo.sticky ? @memo.update_attribute(:sticky, false) : @memo.update_attribute(:sticky, true) + respond_to do |format| + format.html { redirect_to forum_memo_path(@memo.forum, @memo) } + end + end + private def find_memo diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4cdd82d72..97b90e7a1 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -64,6 +64,11 @@ class MessagesController < ApplicationController #offset(@reply_pages.offset). #all #@replies = paginateHelper messages_replies,10 + # 班级帖子消息设为已读 + @replies.each do |comment| + course_message = CourseMessage.where(:course_message_id => comment.id, :user_id => User.current.id, :viewed => 0) + course_message.update_all(:viewed => 1) + end @left_nav_type = 2 respond_to do |format| format.js @@ -187,13 +192,15 @@ class MessagesController < ApplicationController # @reply.reply_id = params[:id] parent.children << @reply else - @quote = params[:quote][:quote] + #@quote = params[:quote][:quote] @reply = Message.new @reply.author = User.current @reply.board = @board + @reply.subject = @topic.subject + @reply.content = params[:content] @reply.safe_attributes = params[:reply] - @reply.content = @quote + @reply.content - @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] + #@reply.content = @quote + @reply.content + #@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] @reply.root_id = @topic.id @topic.children << @reply # @reply.reply_id = params[:id] diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index cd433a450..f86768e94 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -160,7 +160,7 @@ class StudentWorkController < ApplicationController student_work.name = params[:title] student_work.description = params[:src] - if @homework.end_time < Time.now.to_s + if !is_test && @homework.end_time < Time.now.to_s student_work.late_penalty = @homework.late_penalty else student_work.late_penalty = 0 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 805cbcf6a..ddff55733 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2089,6 +2089,8 @@ class UsersController < ApplicationController def show if User.current == @user + # 点击小铃铛,更新点击时间 + update_onclick_time if params[:click_user_message] == 'true' # 全部设为已读 # 自己的主页显示消息 messages_all = MessageAll.where(:user_id => @user.id) diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index ad5f5b9d4..fcbdb2921 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -202,6 +202,7 @@ class VersionsController < ApplicationController @is_setting = params[:is_setting] @is_create = params[:is_create] @is_index = params[:is_index] + @version_id = params[:id] end def update @@ -276,10 +277,11 @@ class VersionsController < ApplicationController end # 判断里程碑是否重名 + # 项目内的里程碑不能重名,项目之间的里程碑能重名 def judge_version_title begin version = Version.where(:name => params[:version_name], :project_id => @project.id).first - if version.blank? + if version.blank? || version.id == params[:version_id].to_i result = {:result => true} else result = {:result => false} diff --git a/app/views/admin/_all_schools.html.erb b/app/views/admin/_all_schools.html.erb index d4cf916f5..fa8041c68 100644 --- a/app/views/admin/_all_schools.html.erb +++ b/app/views/admin/_all_schools.html.erb @@ -12,6 +12,9 @@ \ No newline at end of file diff --git a/app/views/admin/_update_school_form.html.erb b/app/views/admin/_update_school_form.html.erb index 8bcdbe97d..845669bf1 100644 --- a/app/views/admin/_update_school_form.html.erb +++ b/app/views/admin/_update_school_form.html.erb @@ -24,4 +24,4 @@ 取消 -
\ No newline at end of file +
diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 774d1c100..21764a055 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -122,18 +122,18 @@
- +

-
- <%=topic.subject%> +
+ <%= topic.subject %> + <% if topic.sticky && !params[:id].blank? %> + + <% end %>
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 2a9704d4e..6d9ad618f 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -94,10 +94,10 @@