finish messages i18n + controller + model
This commit is contained in:
parent
5941bbbf4f
commit
36b18bcfbd
7 changed files with 60 additions and 28 deletions
|
@ -15,7 +15,7 @@ class MessagesController < ApplicationController
|
|||
@message = @current_user.send_messages.new(params[:message])
|
||||
if @message.save
|
||||
Resque.enqueue(UserNotifier, FoodsoftConfig.scope, 'message_deliver', @message.id)
|
||||
redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet."
|
||||
redirect_to messages_url, :notice => I18n.t('messages.create.notice')
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
|
|
|
@ -48,9 +48,9 @@ class Message < ActiveRecord::Base
|
|||
def reply_to=(message_id)
|
||||
message = Message.find(message_id)
|
||||
add_recipients([message.sender])
|
||||
self.subject = "Re: #{message.subject}"
|
||||
self.body = "#{message.sender.nick} schrieb am #{I18n.l(message.created_at, :format => :short)}:\n"
|
||||
message.body.each_line{ |l| self.body += "> #{l}" }
|
||||
self.subject = I18n.t('messages.model.reply_subject', :subject => message.subject)
|
||||
self.body = I18n.t('messages.model.reply_header', :user => message.sender.nick, :when => I18n.l(message.created_at, :format => :short)) + "\n"
|
||||
message.body.each_line{ |l| self.body += I18n.t('messages.model.reply_indent', :line => l) }
|
||||
end
|
||||
|
||||
def mail_to=(user_id)
|
||||
|
@ -64,7 +64,7 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def sender_name
|
||||
system_message? ? 'Foodsoft' : sender.nick rescue "??"
|
||||
system_message? ? I18n.t('layouts.foodsoft') : sender.nick rescue "??"
|
||||
end
|
||||
|
||||
def recipients
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
%td= format_subject(message, 130)
|
||||
%td= h(message.sender_name)
|
||||
%td= format_time(message.created_at)
|
||||
%td= link_to 'Antworten', new_message_path(:message => {:reply_to => message.id}), class: 'btn'
|
||||
%td= link_to t('.reply'), new_message_path(:message => {:reply_to => message.id}), class: 'btn'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- title "Nachrichten"
|
||||
- title t('.title')
|
||||
|
||||
- content_for :actionbar do
|
||||
= link_to 'Neue Nachricht', new_message_path, class: 'btn btn-primary'
|
||||
= link_to t('.new'), new_message_path, class: 'btn btn-primary'
|
||||
#messages
|
||||
= render 'messages', messages: @messages, pagination: true
|
||||
= render 'messages', messages: @messages, pagination: true
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
$('#message_recipient_tokens').tokenInput("#{users_path(:format => :json)}", {
|
||||
crossDomain: false,
|
||||
prePopulate: $('#message_recipient_tokens').data('pre'),
|
||||
hintText: 'Nach Nutzerin suchen',
|
||||
noResultText: 'Keine Nutzerin gefunden',
|
||||
searchingText: 'Suche ...',
|
||||
hintText: '#{t '.search_user'}',
|
||||
noResultText: '#{t '.no_user_found'}',
|
||||
searchingText: '#{t '.search'}',
|
||||
theme: 'facebook'
|
||||
});
|
||||
|
||||
|
@ -19,25 +19,21 @@
|
|||
});
|
||||
});
|
||||
|
||||
- title "Neue Nachricht"
|
||||
- title t('.title')
|
||||
|
||||
= simple_form_for @message do |f|
|
||||
- if FoodsoftConfig[:mailing_list].blank?
|
||||
= f.input :sent_to_all, :as => :boolean
|
||||
- else
|
||||
%b Nachrichten an alle
|
||||
verschickst Du bitte über den Verteiler:
|
||||
= mail_to FoodsoftConfig[:mailing_list]
|
||||
%b= t '.list.desc', list: mail_to(FoodsoftConfig[:mailing_list])
|
||||
%br/
|
||||
%small{:style => "color:grey"}
|
||||
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
||||
= t '.list.subscribe_msg'
|
||||
%br/
|
||||
- if FoodsoftConfig[:mailing_list_subscribe].blank?
|
||||
Erklärungen zum Verteiler findest Du im
|
||||
= link_to 'Wiki (Abschnitt Mailing-Liste)', wiki_page_path('MailingListe')
|
||||
= t '.list.subscribe', link: link_to(t('.list.wiki'), wiki_page_path('MailingListe'))
|
||||
- else
|
||||
z.b. mit einer Mail an
|
||||
= mail_to FoodsoftConfig[:mailing_list_subscribe]
|
||||
= t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])
|
||||
|
||||
#recipients
|
||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
||||
|
@ -47,4 +43,4 @@
|
|||
= f.input :body, input_html: {class: 'input-xxlarge'}
|
||||
.form-actions
|
||||
= f.submit class: 'btn btn-primary'
|
||||
= link_to 'oder abbrechen', :back
|
||||
= link_to t('.cancel'), :back
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
- title "Nachricht anzeigen"
|
||||
- title t('.title')
|
||||
|
||||
%div{:style => "width:40em"}
|
||||
%table{:style => "width:25em"}
|
||||
%tr
|
||||
%td Von:
|
||||
%td= t '.from'
|
||||
%td=h @message.sender_name
|
||||
%tr
|
||||
%td Betreff:
|
||||
%td= t '.subject'
|
||||
%td
|
||||
%b=h @message.subject
|
||||
%tr
|
||||
%td Gesendet:
|
||||
%td= t '.sent_on'
|
||||
%td= format_time(@message.created_at)
|
||||
%hr/
|
||||
%p= simple_format(h(@message.body))
|
||||
%hr/
|
||||
%p
|
||||
= link_to 'Antworten', new_message_path(:message => {:reply_to => @message.id}), class: 'btn'
|
||||
= link_to t('.reply'), new_message_path(:message => {:reply_to => @message.id}), class: 'btn'
|
||||
|
|
||||
= link_to 'Nachricht im Überblick', messages_path
|
||||
= link_to t('.all_messages'), messages_path
|
||||
|
|
36
config/locales/de/de.messages.yml
Normal file
36
config/locales/de/de.messages.yml
Normal file
|
@ -0,0 +1,36 @@
|
|||
de:
|
||||
messages:
|
||||
index:
|
||||
title: 'Nachrichten'
|
||||
new: 'Neue Nachricht'
|
||||
messages:
|
||||
reply: 'Antworten'
|
||||
new:
|
||||
title: 'Neue Nachricht'
|
||||
search_user: 'Nach Nutzerin suchen'
|
||||
no_user_found: 'Keine Nutzerin gefunden'
|
||||
search: 'Suche ...'
|
||||
list:
|
||||
desc: 'Nachrichten an alle verschickst Du bitte über den Verteiler: %{list}'
|
||||
subscribe_msg: 'Eventuell musst Du Dich dem Verteiler erst bekannt machen.'
|
||||
subscribe: 'Erklärungen zum Verteiler findest Du im %{link}.'
|
||||
wiki: 'Wiki (Abschnitt Mailing-Liste)'
|
||||
mail: 'z.b. mit einer Mail an %{email}.'
|
||||
cancel: 'oder abbrechen'
|
||||
show:
|
||||
title: 'Nachricht anzeigen'
|
||||
from: 'Von:'
|
||||
subject: 'Betreff:'
|
||||
sent_on: 'Gesendet:'
|
||||
reply: 'Antworten'
|
||||
all_messages: 'Nachricht im Überblick'
|
||||
|
||||
# used by controller
|
||||
create:
|
||||
notice: 'Nachricht ist gespeichert und wird versendet.'
|
||||
|
||||
# used by model
|
||||
model:
|
||||
reply_subject: 'Re: %{subject}'
|
||||
reply_header: '%{user} schrieb am %{when}:'
|
||||
reply_indent: '> %{line}'
|
Loading…
Reference in a new issue