diff --git a/app/mailers/mailing.rb b/app/mailers/mailing.rb index 8f7c302..2e43ff9 100644 --- a/app/mailers/mailing.rb +++ b/app/mailers/mailing.rb @@ -1,4 +1,4 @@ -require 'mailing_job' +require_dependency 'mailing_job' class Mailing < ActiveRecord::Base @@ -40,10 +40,8 @@ class Mailing < ActiveRecord::Base begin Mailing::Sender.notification(self, recipient.email).deliver self.mailing_sents.create(:person => recipient) - rescue Exception - # FIXME should not discard errors silently. An idea is to collect all - # errors and generate a task (notification) for the +source+ - # (environment/organization) listing these errors. + rescue Exception => ex + Rails.logger.error("#{ex.class.to_s} - #{ex.to_s} at #{__FILE__}:#{__LINE__}") end end end diff --git a/app/models/textile_article.rb b/app/models/textile_article.rb index 3dd9be8..394d1aa 100644 --- a/app/models/textile_article.rb +++ b/app/models/textile_article.rb @@ -12,7 +12,7 @@ class TextileArticle < TextArticle convert_to_html(body) end - def lead + def lead(length = nil) if abstract.blank? super else diff --git a/app/views/mailing/sender/notification.html.erb b/app/views/mailing/sender/notification.html.erb index dc92944..52deb71 100644 --- a/app/views/mailing/sender/notification.html.erb +++ b/app/views/mailing/sender/notification.html.erb @@ -3,7 +3,7 @@ - + <%= word_wrap(@message) %>

--
diff --git a/config/schedule.rb b/config/schedule.rb index de1e06d..7be5812 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -28,3 +28,15 @@ end every 30.days do runner "ProfileSuggestion.generate_all_profile_suggestions" end + +# Loads "schedule.rb" files from plugins +# +# Allows Noosfero's plugins schedule jobs using `whenever` Ruby gem the same +# way we do here, just create the file "config/schedule.rb" into the plugin +# root directory and write jobs using the same syntax used here (see example in +# the `newsletter` plugin) + +Dir.glob("config/plugins/*/config/schedule.rb").each do |filename| + filecontent = IO.read(filename) + instance_eval(Whenever::NumericSeconds.process_string(filecontent), filename) +end diff --git a/lib/acts_as_having_image.rb b/lib/acts_as_having_image.rb index 7c695c7..7faa4d7 100644 --- a/lib/acts_as_having_image.rb +++ b/lib/acts_as_having_image.rb @@ -5,6 +5,7 @@ module ActsAsHavingImage belongs_to :image, dependent: :destroy scope :with_image, :conditions => [ "#{table_name}.image_id IS NOT NULL" ] scope :without_image, :conditions => [ "#{table_name}.image_id IS NULL" ] + attr_accessible :image_builder self.send(:include, ActsAsHavingImage) end end @@ -19,4 +20,4 @@ module ActsAsHavingImage end -ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods) \ No newline at end of file +ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods) diff --git a/script/sample-articles b/script/sample-articles index bc242b2..6dfd74f 100755 --- a/script/sample-articles +++ b/script/sample-articles @@ -65,3 +65,22 @@ for subject in EVENT_SUBJECTS end end done + +print "Creating some posts: " +for subject in SUBJECTS + rand(20).times do |i| + profile = profiles.sample + name = "%s #{subject}" % profile.name + article = TinyMceArticle.new( + :name => name, + :body => name, + :tag_list => [TAGS.sample, TAGS.sample], + :profile => profile, + :parent_id => profile.blog.id + ) + save article do + article.add_category categories.sample + end + end +end +done -- libgit2 0.21.2