Noosfero/noosfero

View on GitHub
app/views/profile/send_mail.html.erb

Summary

Maintainability
Test Coverage
<h1><%= h profile.short_name(50) %></h1>

<h2><%= _('Send e-mail to members') %></h2>

<%= error_messages_for :mailing %>

  <% to = @mailing.data[:members_filtered].present? ? @mailing.recipients.map{|r| r.name}.join(', ') : _('All members')%>
  <%= labelled_form_field(_('To:'), text_area(:data, 'members_filtered', :value => to, :rows => 4, :disabled => 'disabled', :class => 'send-mail-recipients'))  %>
<div class="template-selection">
  <% if @email_templates.present? %>
    <%= labelled_form_field(_('Select a template:'), select_tag(:template, options_from_collection_for_select(@email_templates, :id, :name), :include_blank => true, 'data-url' => url_for(:controller => 'email_templates', :action => 'show_parsed'))) %>
  <% end %>
</div>

<%= form_for :mailing, :url => {:action => 'send_mail'}, :html => {:id => 'mailing-form'} do |f| %>

  <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %>

  <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'body ' + current_editor)) %>

  <%= submit_button(:email, _('Send'), :cancel => { :action => @back_to }) %>
<% end %>