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 default :from => Locomotive.config.mailer_sender
def new_content_entry(account, entry) def new_content_entry(entry, account)
@account, @entry, @type = account, entry.to_presenter, entry.content_type @account, @entry, @type = account, entry, entry.content_type
subject = t('locomotive.notifications.new_content_entry.subject', :type => @type.name, :locale => account.locale) 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? return if !self.content_type.public_submission_enabled? || self.content_type.public_submission_accounts.blank?
self.site.accounts.each do |account| 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 Locomotive::Notifications.new_content_entry(account, self).deliver
end end

View File

@ -10,13 +10,20 @@
%hr %hr
%ul %ul
- @type.entries_custom_fields.each do |field| - @type.ordered_entries_custom_fields.each do |field|
- value = @entry.value_for(field) - value = @entry.send(field.name)
%li %li
%strong= field.label %strong= field.label
 -   - 
%i %i
- if field.type == 'file' - case field.type.to_s
= link_to File.basename(value), value - when 'string', 'text', 'boolean', 'date'
- else
= value = 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')) @account_2 = FactoryGirl.build('frenchy user', :id => fake_bson_id('2'))
@content_type.public_submission_enabled = true @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 = FactoryGirl.build(:site)
site.stubs(:accounts).returns([@account_1, @account_2]) site.stubs(:accounts).returns([@account_1, @account_2])