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

@@ -2,13 +2,14
2 2
3 3 before_filter :authenticate
4 4
5 5 verify :method => :post, :only => ['create'],
6 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 11 def list
11 12 @user = User.find(session[:user_id])
12 13 @messages = Message.find_all_sent_by_user(@user)
13 14 end
14 15
@@ -45,12 +46,20
45 46 rep_msg.replied = true
46 47 rep_msg.save
47 48 redirect_to :action => 'console'
48 49 end
49 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 60 protected
52 61 def build_replying_message_hierarchy(user)
53 62 @all_messages = {}
54 63
55 64
56 65 # manually build replies hierarchy (to improve efficiency)
@@ -1,6 +1,7
1 1 %tr
2 2 %td=h short_message.sender.full_name
3 3 %td= "#{short_message.created_at}"
4 4 %td=h truncate(short_message.body)
5 5 %td
6 6 = link_to "[reply]", :action => 'show', :id => short_message.id
7 + = link_to "[hide]", :action => 'hide', :id => short_message.id
@@ -8,6 +8,13
8 8 %h3 Your reply:
9 9 - form_for 'r_message', nil, :url => { :action => 'reply'} do |f|
10 10 = f.text_area :body, :rows => 5, :cols => 100
11 11 = f.hidden_field :receiver_id, {:value => @message.sender_id }
12 12 = f.hidden_field :replying_message_id, {:value => @message.id }
13 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