Refactored messages modul, but refactoring is still neccessary.
This commit is contained in:
parent
6ac04d5e19
commit
d5552059ce
13 changed files with 81 additions and 146 deletions
|
|
@ -6,5 +6,5 @@
|
|||
%td= format_subject(message, subject_length)
|
||||
%td= h(message.sender_name)
|
||||
%td= format_time(message.created_at)
|
||||
%td= link_to('Antworten', reply_message_path(message))
|
||||
%td= link_to('Antworten', new_message_path(:message => {:reply_to => message.id}))
|
||||
|
||||
|
|
@ -5,4 +5,4 @@
|
|||
%div{:style => "text-align:right"}= will_paginate @messages
|
||||
|
||||
#messages
|
||||
= render :partial => 'messages', :locals => { :subject_length => 130 }
|
||||
= render :partial => 'messages', :locals => { :messages => @messages, :subject_length => 130 }
|
||||
|
|
@ -1,61 +1,40 @@
|
|||
%h1 Neue Nachricht
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('#message_recipient_tokens').tokenInput("#{users_path(:format => :json)}", {
|
||||
crossDomain: false,
|
||||
prePopulate: $('#message_recipient_tokens').data('pre')
|
||||
});
|
||||
|
||||
- form_for @message do |f|
|
||||
= f.error_messages
|
||||
$('#message_sent_to_all').click(function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#recipients').slideUp();
|
||||
} else {
|
||||
$('#recipients').slideDown();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
%p
|
||||
Empfängerinnen
|
||||
%fieldset
|
||||
- if Foodsoft.config[:mailing_list].blank?
|
||||
= f.check_box :sent_to_all, :onchange => "Element.toggle('recipients')"
|
||||
gesamte Foodcoop
|
||||
- else
|
||||
%b Nachrichten an alle
|
||||
verschickst Du bitte über den Verteiler:
|
||||
= mail_to Foodsoft.config[:mailing_list]
|
||||
%br/
|
||||
%small{:style => "color:grey"}
|
||||
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
||||
%br/
|
||||
z.b. mit einer Mail an
|
||||
= mail_to Foodsoft.config[:mailing_list_subscribe]
|
||||
%table#recipients
|
||||
%tr
|
||||
%td
|
||||
%b BenutzerInnen:
|
||||
%br/
|
||||
%small{:style => "color:grey"} (Mehrere Benutzerinnen mit Komma trennen)
|
||||
%br/
|
||||
= text_field_with_auto_complete(:message, :recipients_nicks, {:value => @message.recipients_nicks}, {:tokens => ","})
|
||||
:javascript
|
||||
var userListLoaded = false;
|
||||
function checkUserList() {
|
||||
if (userListLoaded) {
|
||||
$('user-list').toggle();
|
||||
}
|
||||
return !userListLoaded;
|
||||
}
|
||||
= link_to_remote('Liste', :update => 'user-list', :url => {:action => 'user_list'}, :complete => 'userListLoaded = true', :condition => 'checkUserList()')
|
||||
#user-list.auto_complete
|
||||
%tr
|
||||
%td
|
||||
%b Gruppe:
|
||||
%br/
|
||||
= f.select :group_id, groups_for_select, :prompt => " -- Gruppe auswählen --"
|
||||
- title "Neue Nachricht"
|
||||
|
||||
%p
|
||||
Privat
|
||||
= f.check_box :private
|
||||
%small{:style => "color:grey"} (Nachricht taucht nicht im Foodsoft-Nachrichteneingang auf)
|
||||
|
||||
%p
|
||||
Betreff
|
||||
= simple_form_for @message do |f|
|
||||
- if Foodsoft.config[:mailing_list].blank?
|
||||
= f.input :sent_to_all, :as => :boolean
|
||||
- else
|
||||
%b Nachrichten an alle
|
||||
verschickst Du bitte über den Verteiler:
|
||||
= mail_to Foodsoft.config[:mailing_list]
|
||||
%br/
|
||||
= f.text_field :subject
|
||||
%small{:style => "color:grey"}
|
||||
Eventuell musst Du Dich dem Verteiler erst bekannt machen.
|
||||
%br/
|
||||
z.b. mit einer Mail an
|
||||
= mail_to Foodsoft.config[:mailing_list_subscribe]
|
||||
|
||||
%p
|
||||
Nachricht
|
||||
%br/
|
||||
~ f.text_area :body, :cols => '80', :rows => '20'
|
||||
|
||||
= submit_tag "Senden"
|
||||
#recipients
|
||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json }
|
||||
= f.input :group_id, :as => :select, :collection => Group.order(:type.desc, :name.desc).all.reject { |g| g.memberships.empty? }
|
||||
= f.input :private
|
||||
= f.input :subject
|
||||
= f.input :body
|
||||
= f.submit
|
||||
|
|
@ -16,6 +16,6 @@
|
|||
%p= simple_format(h(@message.body))
|
||||
%hr/
|
||||
%p
|
||||
= link_to('Antworten', reply_message_path(@message))
|
||||
= link_to('Antworten', new_message_path(:message => {:reply_to => @message.id}))
|
||||
|
|
||||
= link_to 'Nachricht im Überblick', messages_path
|
||||
Loading…
Add table
Add a link
Reference in a new issue