# HG changeset patch # User jittat # Date 2009-04-25 16:17:21 # Node ID d8e86bba9b6fa9b7408295cfbd731c602410406e # Parent 400ab663b3b922088bf5b5a0a34962ec0ae6bf98 added message hiding for admin in msg console git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@371 6386c4cd-e34a-4fa8-8920-d93eb39b512e diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -5,7 +5,8 @@ verify :method => :post, :only => ['create'], :redirect_to => { :action => 'list' } - before_filter :admin_authorization, :only => ['console','show','reply'] + before_filter :admin_authorization, :only => ['console','show', + 'reply','hide'] def list @user = User.find(session[:user_id]) @@ -48,6 +49,14 @@ end end + def hide + message = Message.find(params[:id]) + message.replied = true + message.save + flash[:notice] = 'Message hided (just marked replied)' + redirect_to :action => 'console' + end + protected def build_replying_message_hierarchy(user) @all_messages = {} diff --git a/app/views/messages/_short_message.html.haml b/app/views/messages/_short_message.html.haml --- a/app/views/messages/_short_message.html.haml +++ b/app/views/messages/_short_message.html.haml @@ -4,3 +4,4 @@ %td=h truncate(short_message.body) %td = link_to "[reply]", :action => 'show', :id => short_message.id + = link_to "[hide]", :action => 'hide', :id => short_message.id diff --git a/app/views/messages/show.html.haml b/app/views/messages/show.html.haml --- a/app/views/messages/show.html.haml +++ b/app/views/messages/show.html.haml @@ -11,3 +11,10 @@ = f.hidden_field :receiver_id, {:value => @message.sender_id } = f.hidden_field :replying_message_id, {:value => @message.id } = submit_tag "Post" + +%p + If you do not want to reply, but want to hide this message from + console, you can + = link_to "[hide]", :action => 'hide', :id => @message.id + this message. (This message will be marked as replied.) +