This commit is contained in:
Didier Lafforgue 2012-04-13 14:38:00 +02:00
parent 106cc6fc50
commit 7a595208aa
4 changed files with 16 additions and 9 deletions

View File

@ -3,8 +3,8 @@ module Locomotive
default :from => Locomotive.config.mailer_sender
def new_content_entry(account, entry)
@account, @entry, @type = account, entry.to_presenter, entry.content_type
def new_content_entry(entry, account)
@account, @entry, @type = account, entry, entry.content_type
subject = t('locomotive.notifications.new_content_entry.subject', :type => @type.name, :locale => account.locale)

View File

@ -146,7 +146,7 @@ module Locomotive
return if !self.content_type.public_submission_enabled? || self.content_type.public_submission_accounts.blank?
self.site.accounts.each do |account|
next unless self.content_type.public_submission_accounts.include?(account._id)
next unless self.content_type.public_submission_accounts.map(&:to_s).include?(account._id.to_s)
Locomotive::Notifications.new_content_entry(account, self).deliver
end

View File

@ -10,13 +10,20 @@
%hr
%ul
- @type.entries_custom_fields.each do |field|
- value = @entry.value_for(field)
- @type.ordered_entries_custom_fields.each do |field|
- value = @entry.send(field.name)
%li
%strong= field.label
 - 
%i
- if field.type == 'file'
= link_to File.basename(value), value
- else
- case field.type.to_s
- when 'string', 'text', 'boolean', 'date'
= value
- when 'file'
= link_to File.basename(value.to_s), value.to_s
- when 'select'
= value
- when 'belongs_to'
= value.try(:_label)
- when 'has_many', 'many_to_many'
= value.map(&:_label).join(', ')

View File

@ -202,7 +202,7 @@ describe Locomotive::ContentEntry do
@account_2 = FactoryGirl.build('frenchy user', :id => fake_bson_id('2'))
@content_type.public_submission_enabled = true
@content_type.public_submission_accounts = ['', @account_1._id, @account_2._id]
@content_type.public_submission_accounts = ['', @account_1._id, @account_2._id.to_s]
site = FactoryGirl.build(:site)
site.stubs(:accounts).returns([@account_1, @account_2])