Added ability to send private messages.

This commit is contained in:
Benjamin Meichsner 2009-03-17 18:28:09 +01:00
parent e4c394d881
commit 843e4a7233
3 changed files with 11 additions and 4 deletions

View file

@ -2,7 +2,7 @@ class MessagesController < ApplicationController
# Renders the "inbox" action.
def index
@messages = Message.all :order => 'created_at DESC', :limit => 100
@messages = Message.public.all :order => 'created_at DESC', :limit => 100
end
# Creates a new message object.

View file

@ -21,6 +21,7 @@ class Message < ActiveRecord::Base
named_scope :pending, :conditions => { :email_state => 0 }
named_scope :sent, :conditions => { :email_state => 1 }
named_scope :public, :conditions => {:private => false}
# Values for the email_state attribute: :none, :pending, :sent, :failed
EMAIL_STATE = {

View file

@ -4,6 +4,7 @@
= f.error_messages
%p
Empfängerinnen
%fieldset
- if APP_CONFIG[:mailing_list].blank?
= f.check_box :sent_to_all, :onchange => "Element.toggle('recipients')"
@ -41,14 +42,19 @@
%b Gruppe:
%br/
= f.select :group_id, groups_for_select, :prompt => " -- Gruppe auswählen --"
%p
= f.label :subject, "Betreff"
Privat
= f.check_box :private
%small{:style => "color:grey"} (Nachricht taucht nicht im Foodsoft-Nachrichteneingang auf)
%p
Betreff
%br/
= f.text_field :subject
%p
= f.label :body, "Nachricht"
Nachricht
%br/
~ f.text_area :body, :cols => '80', :rows => '20'