Fix orbit_mailer file read and _right_menu login issue

This commit is contained in:
spen 2014-07-17 11:07:45 +08:00
parent ccaede2f1d
commit a1ab533b43
4 changed files with 15 additions and 6 deletions

View File

@ -45,6 +45,9 @@ gem 'ckeditor'
gem 'unicorn'
gem 'zhconv'
#form helpers
gem 'dynamic_form'
#built in modules
eval(File.read(File.dirname(__FILE__) + '/built_in_extensions.rb'))
#modules installed from the store

View File

@ -30,8 +30,8 @@ class OrbitMailer < ActionMailer::Base
unless email.email_files.blank?
email.email_files.each_with_index do |email_file, i|
file_type = File.extname(email_file.file.to_s)
file_content = File.read(email_file.file.url)
attachments["#{email_file.title}#{file_type}"] = file_content.read
# file_content = File.read(email_file.file.url)
attachments["#{email_file.title}#{file_type}"] = email_file.file.read
end
end
@ -62,6 +62,8 @@ class OrbitMailer < ActionMailer::Base
mail_log.save
email.destroy
end
end

View File

@ -20,6 +20,7 @@ class Email
field :update_user_id
has_many :email_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :email_files, :allow_destroy => true
scope :can_deliver, ->{ where(:mail_sentdate.lte => Time.now, :is_sent=>false) }

View File

@ -56,22 +56,25 @@
<h3 id="ModalLabel"><%= t(:login_orbit) %></h3>
</div>
<div class="modal-body">
<%= form_for :user, url: sessions_path, html: {class: 'container'} do |f| %>
<%= form_tag sessions_path, :class => 'container' do %>
<%#= form_for :user, url: sessions_path, html: {class: 'container'} do |f| %>
<div class="input-prepend">
<span class="add-on">
<i class="icon-user"></i>
</span>
<%= f.text_field :user_name, class: "input-xlarge" , placeholder: t("users.user_id") %>
<%#= f.text_field :user_name, class: "input-xlarge" , placeholder: t("users.user_id") %>
<%= text_field_tag :user_name, params[:user_name], :placeholder => t("users.user_id"), :id=>"user_email" %>
</div>
<div class="input-prepend">
<span class="add-on">
<i class="icon-lock"></i>
</span>
<%= f.password_field :password, class: "input-xlarge", placeholder: t(:password) %>
<%#= f.password_field :password, class: "input-xlarge", placeholder: t(:password) %>
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
</div>
<div class="pull-left" style="width: 150px;">
<label class="checkbox">
<input type="checkbox" name="user[remember_me]" value="1" checked="checked" />
<input type="checkbox" name="remember_me" value="1" checked="checked" />
<small>Remember me</small>
</label>
<%= content_tag :button, t(:login), :type => :submit, :class => 'btn btn-primary' %>