Skip to content

Commit

Permalink
Merge pull request #689 from shalott/Jun2012_emergency_deploy_tweaks2
Browse files Browse the repository at this point in the history
Jun2012 emergency deploy tweaks2
  • Loading branch information
elzj committed Jun 8, 2012
2 parents 9a42919 + 69f6b5b commit 2fc7f01
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 1 addition & 5 deletions app/controllers/comments_controller.rb
Expand Up @@ -163,11 +163,7 @@ def create
redirect_back_or_default(root_path)
end
else
setflash; flash[:comment_error] = ts("There was a problem saving your comment:")
msg = @comment.errors.full_messages.map {|msg| "#{msg}"}.join
unless msg.blank?
flash[:comment_error] += "#{msg}"
end
setflash
render :action => "new"
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/comment.rb
Expand Up @@ -24,7 +24,7 @@ def check_for_spam
errors.add(:base, ts("This comment looks like spam to our system, sorry! Please try again, or create an account to comment.")) unless check_for_spam?
end

validates :content, :uniqueness => {:scope => [:commentable_id, :commentable_type, :name, :email, :pseud_id], :message => ts("has already been left on this work. (It may not appear right away for performance reasons.)")}
validates :content, :uniqueness => {:scope => [:commentable_id, :commentable_type, :name, :email, :pseud_id], :message => ts("^This comment has already been left on this work. (It may not appear right away for performance reasons.)")}

scope :recent, lambda { |*args| {:conditions => ["created_at > ?", (args.first || 1.week.ago.to_date)]} }
scope :limited, lambda {|limit| {:limit => limit.kind_of?(Fixnum) ? limit : 5} }
Expand Down
7 changes: 6 additions & 1 deletion app/models/subscription.rb
Expand Up @@ -34,12 +34,17 @@ def subject_text(creation)

def creation_name(creation)
if creation.is_a?(Chapter)
"#{creation.chapter_title} of #{creation.work.title}"
"#{chapter_name(creation)} of #{creation.work.title}"
elsif subscribable_type == 'User'
creation.title
elsif subscribable_type == 'Series'
"#{creation.title} in #{self.name} series"
end
end

def chapter_name(creation)
title = creation.chapter_title
title.match(/^Chapter /) ? title : "Chapter #{title}"
end

end
10 changes: 6 additions & 4 deletions app/views/user_mailer/batch_subscription_notification.html.erb
Expand Up @@ -4,14 +4,16 @@
<% this_work = creation.respond_to?(:work) ? creation.work : creation %>
<% if creation.is_a?(Chapter) %>

<p>
<%= creation.work.pseuds.map{|p| p.byline}.to_sentence %> posted a new chapter of
<%= creation.work.pseuds.map{|p| p.byline}.to_sentence %> posted
<%= link_to @subscription.chapter_name(creation), work_chapter_url(this_work, creation) %> of
<%= link_to this_work.title, work_url(this_work) %> at
<%= link_to work_chapter_url(this_work, creation), work_chapter_url(this_work, creation) %>:
<%= link_to work_chapter_url(this_work, creation), work_chapter_url(this_work, creation) %>.
</p>

<% if creation.summary %>
<p>Summary: <%= sanitize_field(creation, :summary) %></p>
<% unless creation.summary.blank? %>
<p>Chapter Summary:</p> <%= raw sanitize_field(creation, :summary) %>
<% end %>
<% elsif creation.is_a?(Work) %>
Expand Down

0 comments on commit 2fc7f01

Please sign in to comment.