Replaced protoype with jquery. Some fixes in mailer class.

This commit is contained in:
benni 2011-05-11 15:14:39 +02:00
parent bdb177dfa6
commit 2a72263bd3
28 changed files with 21207 additions and 10398 deletions

View file

@ -1,19 +1,14 @@
class FeedbackController < ApplicationController
def new
render :update do |page|
page.replace_html :ajax_box, :partial => "new"
page.show :ajax_box
end
end
def create
unless params[:message].blank?
Mailer.feedback(current_user, params[:message]).deliver
end
render :update do |page|
page.replace_html :ajax_box, :partial => "success"
redirect_to new_feedback_url, :notice => 'The message was successfully delivered.'
else
render :action => 'new'
end
end

View file

@ -6,7 +6,7 @@ class Mailer < ActionMailer::Base
default :from => "FoodSoft <#{Foodsoft.config[:email_sender]}>"
# Sends an email copy of the given internal foodsoft message.
def message(message, recipient)
def foodsoft_message(message, recipient)
@body = message.body
@sender = message.sender.nick
@recipients = recipient.nick
@ -67,9 +67,9 @@ class Mailer < ActionMailer::Base
:subject => "[#{Foodsoft.config[:name]}] Gruppenkonto im Minus"
end
def feedback(user, message)
def feedback(user, feedback)
@user = user
@message = message
@feedback = feedback
mail :to => Foodsoft.config[:notification]["error_recipients"],
:from => "#{user.nick} <#{user.email}>",

View file

@ -65,7 +65,7 @@ class Message < ActiveRecord::Base
for recipient in message.recipients
if recipient.settings['messages.sendAsEmail'] == "1" && !recipient.email.blank?
begin
Mailer.message(message, recipient).deliver
Mailer.foodsoft_message(message, recipient).deliver
rescue
logger.warn "Deliver failed for #{recipient.nick}: #{recipient.email}"
end

View file

@ -1,8 +0,0 @@
%h2 Fehler gefunden? Vorschlag? Idee? Kritik?
- form_remote_tag :url => {:action => "create"}, :before => "Element.show('loader')", :success => "Element.hide('loader')" do
%p
= text_area_tag :message, nil, :size => "40x15"
= submit_tag "Absenden"
oder
= link_to_function "Abbrechen", "Element.hide('ajax_box')"

View file

@ -1,4 +0,0 @@
%h2 Nachricht wurde verschickt!
%p Vielen Dank, Deine Nachricht wurde soeben dem Foodcooft Team zugestellt.
%p= link_to_function "Schließen", "Element.hide('ajax_box')"

View file

@ -0,0 +1,6 @@
%h2 Fehler gefunden? Vorschlag? Idee? Kritik?
= form_tag feedback_path do
%p
= text_area_tag :message, nil, :size => "40x15"
= submit_tag "Absenden"

View file

@ -8,7 +8,7 @@
<!--[if lte IE 7]>
= stylesheet_link_tag 'ie_hacks'
<![endif]-->
= javascript_include_tag 'prototype', 'effects', 'controls', 'application', 'ordering', :cache => "all_cached"
= javascript_include_tag 'jquery.min', 'jquery-ui.min', 'jquery_ujs', 'application', 'ordering', :cache => "all_cached"
= yield(:head)
%body
#logininfo= render :partial => 'shared/loginInfo'
@ -22,17 +22,10 @@
#main
#content
- if flash[:notice]
%h3.notice#flashNotice= flash[:notice]
- if flash[:error]
%h3.error#flashError= flash[:error]
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash#{name.to_s.camelize}", :class => "flash #{name}"
#loader{:style => "display:none;"}= image_tag("loader.gif", :border => 0)
- if show_title?
%h1= yield(:title)
= yield
#ajax_box(style="display:none")
- if flash[:notice]
= javascript_tag("new Effect.Highlight('flashNotice', {delay:0.8, duration:1});")
- if flash[:error]
= javascript_tag("new Effect.Highlight('flashError', {delay:0.8, duration:1});")

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Foodsoft</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -1,3 +1,3 @@
<%= @user.nick %> schrieb am <%= I18n.l Time.now, :format => :short %>:
<%= @message %>
<%= @feedback %>

View file

@ -5,6 +5,5 @@
- if Foodsoft.config[:homepage]
%li= link_to Foodsoft.config[:name], Foodsoft.config[:homepage], { :title => _("Go to your FoodCoop-Hompage") }
%li= link_to "Hilfe", 'http://dev.foodcoops.net/wiki/FoodsoftDoku'
%li= link_to_remote "Feedback", :url => {:controller => "/feedback", :action => "new"}, |
:method => :get, :html => {:title => "Fehler gefunden? Vorschlag? Idee? Kritik?"} |
%li= link_to "Feedback", new_feedback_path, :title => "Fehler gefunden? Vorschlag? Idee? Kritik?"
%li= link_to "Abmelden", logout_path