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:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r173:d8e86bba9b6f - - 3 files changed: 18 inserted, 1 deleted
@@ -2,13 +2,14 | |||||
|
2 |
|
2 | ||
|
3 | before_filter :authenticate |
|
3 | before_filter :authenticate |
|
4 |
|
4 | ||
|
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', |
|
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]) |
|
12 | @messages = Message.find_all_sent_by_user(@user) |
|
13 | @messages = Message.find_all_sent_by_user(@user) |
|
13 | end |
|
14 | end |
|
14 |
|
15 | ||
@@ -45,12 +46,20 | |||||
|
45 | rep_msg.replied = true |
|
46 | rep_msg.replied = true |
|
46 | rep_msg.save |
|
47 | rep_msg.save |
|
47 | redirect_to :action => 'console' |
|
48 | redirect_to :action => 'console' |
|
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 = {} |
|
54 |
|
63 | ||
|
55 |
|
64 | ||
|
56 | # manually build replies hierarchy (to improve efficiency) |
|
65 | # manually build replies hierarchy (to improve efficiency) |
@@ -1,6 +1,7 | |||||
|
1 | %tr |
|
1 | %tr |
|
2 | %td=h short_message.sender.full_name |
|
2 | %td=h short_message.sender.full_name |
|
3 | %td= "#{short_message.created_at}" |
|
3 | %td= "#{short_message.created_at}" |
|
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 |
@@ -8,6 +8,13 | |||||
|
8 | %h3 Your reply: |
|
8 | %h3 Your reply: |
|
9 | - form_for 'r_message', nil, :url => { :action => 'reply'} do |f| |
|
9 | - form_for 'r_message', nil, :url => { :action => 'reply'} do |f| |
|
10 | = f.text_area :body, :rows => 5, :cols => 100 |
|
10 | = f.text_area :body, :rows => 5, :cols => 100 |
|
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