Implement notification for upcoming tasks via a daily fired rake-task.
This commit is contained in:
parent
053593f718
commit
67743cd014
7 changed files with 54 additions and 9 deletions
|
|
@ -37,5 +37,14 @@ class Mailer < ActionMailer::Base
|
|||
:link => url_for(:host => request.host, :controller => "login", :action => "invite", :id => invite.token),
|
||||
:foodsoftUrl => url_for(:host => request.host, :controller => "index")
|
||||
end
|
||||
|
||||
# Notify user of upcoming task.
|
||||
def notify_upcoming_tasks(user, task)
|
||||
subject "[#{APP_CONFIG[:name]}] Aufgaben werden fällig!"
|
||||
recipients user.email
|
||||
from "FoodSoft <#{APP_CONFIG[:email_sender]}>"
|
||||
body :user => user, :task => task
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class Task < ActiveRecord::Base
|
|||
|
||||
named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }
|
||||
named_scope :done, :conditions => {:done => true}, :order => "due_date ASC"
|
||||
named_scope :upcoming, lambda { |*args| {:conditions => ["done = 0 AND due_date = ?", (args.first || 7.days.from_now)]} }
|
||||
|
||||
# form will send user in string. responsibilities will added later
|
||||
attr_protected :users
|
||||
|
|
|
|||
|
|
@ -53,12 +53,13 @@ class User < ActiveRecord::Base
|
|||
# returns the User-settings and the translated description
|
||||
def self.setting_keys
|
||||
{
|
||||
"notify.orderFinished" => 'Get message with order result',
|
||||
"notify.negativeBalance" => 'Get message if negative account balance',
|
||||
"messages.sendAsEmail" => 'Get messages as emails',
|
||||
"profile.phoneIsPublic" => 'Phone is visible for foodcoop members',
|
||||
"profile.emailIsPublic" => 'Email is visible for foodcoop members',
|
||||
"profile.nameIsPublic" => 'Name is visible for foodcoop members'
|
||||
"notify.orderFinished" => 'Informier mich über meine Bestellergebnisse (nach Ende der Bestellung).',
|
||||
"notify.negativeBalance" => 'Informiere mich, falls meine Bestellgruppe ins Minus rutscht.',
|
||||
"notify.upcoming_tasks" => 'Erinnere mich an anstehende Aufgaben.',
|
||||
"messages.sendAsEmail" => 'Bekomme Nachrichten als Emails.',
|
||||
"profile.phoneIsPublic" => 'Telefon ist für Mitglieder sichtbar',
|
||||
"profile.emailIsPublic" => 'E-Mail ist für Mitglieder sichtbar',
|
||||
"profile.nameIsPublic" => 'Name ist für Mitglieder sichtbar'
|
||||
}
|
||||
end
|
||||
# retuns the default setting for a NEW user
|
||||
|
|
@ -67,7 +68,8 @@ class User < ActiveRecord::Base
|
|||
def settings_default(setting)
|
||||
# define a default for the settings
|
||||
defaults = {
|
||||
"messages.sendAsEmail" => true
|
||||
"messages.sendAsEmail" => true,
|
||||
"notify.upcoming_tasks" => true
|
||||
}
|
||||
return true if self.new_record? && defaults[setting]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue