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. # Renders the "inbox" action.
def index def index
@messages = Message.all :order => 'created_at DESC', :limit => 100 @messages = Message.public.all :order => 'created_at DESC', :limit => 100
end end
# Creates a new message object. # Creates a new message object.

View file

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

View file

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