Description:
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
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r173:d8e86bba9b6f - - 3 files changed: 18 inserted, 1 deleted

@@ -5,7 +5,8
5 verify :method => :post, :only => ['create'],
5 verify :method => :post, :only => ['create'],
6 :redirect_to => { :action => 'list' }
6 :redirect_to => { :action => 'list' }
7
7
8 - before_filter :admin_authorization, :only => ['console','show','reply']
8 + before_filter :admin_authorization, :only => ['console','show',
9 + 'reply','hide']
9
10
10 def list
11 def list
11 @user = User.find(session[:user_id])
12 @user = User.find(session[:user_id])
@@ -48,6 +49,14
48 end
49 end
49 end
50 end
50
51
52 + def hide
53 + message = Message.find(params[:id])
54 + message.replied = true
55 + message.save
56 + flash[:notice] = 'Message hided (just marked replied)'
57 + redirect_to :action => 'console'
58 + end
59 +
51 protected
60 protected
52 def build_replying_message_hierarchy(user)
61 def build_replying_message_hierarchy(user)
53 @all_messages = {}
62 @all_messages = {}
@@ -4,3 +4,4
4 %td=h truncate(short_message.body)
4 %td=h truncate(short_message.body)
5 %td
5 %td
6 = link_to "[reply]", :action => 'show', :id => short_message.id
6 = link_to "[reply]", :action => 'show', :id => short_message.id
7 + = link_to "[hide]", :action => 'hide', :id => short_message.id
@@ -11,3 +11,10
11 = f.hidden_field :receiver_id, {:value => @message.sender_id }
11 = f.hidden_field :receiver_id, {:value => @message.sender_id }
12 = f.hidden_field :replying_message_id, {:value => @message.id }
12 = f.hidden_field :replying_message_id, {:value => @message.id }
13 = submit_tag "Post"
13 = submit_tag "Post"
14 +
15 + %p
16 + If you do not want to reply, but want to hide this message from
17 + console, you can
18 + = link_to "[hide]", :action => 'hide', :id => @message.id
19 + this message. (This message will be marked as replied.)
20 +
You need to be logged in to leave comments. Login now