aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/refinery/blog/posts_controller.rb2
-rw-r--r--app/models/refinery/blog/category.rb4
-rw-r--r--app/models/refinery/blog/comment.rb2
-rw-r--r--app/models/refinery/blog/post.rb6
-rw-r--r--app/views/refinery/blog/admin/categories/_category.html.erb10
-rw-r--r--app/views/refinery/blog/admin/posts/_form.html.erb2
-rw-r--r--app/views/refinery/blog/admin/posts/_post.html.erb14
7 files changed, 28 insertions, 12 deletions
diff --git a/app/controllers/refinery/blog/posts_controller.rb b/app/controllers/refinery/blog/posts_controller.rb
index 1cc9698..2e504f7 100644
--- a/app/controllers/refinery/blog/posts_controller.rb
+++ b/app/controllers/refinery/blog/posts_controller.rb
@@ -41,7 +41,7 @@ module Refinery
if @comment.valid?
if Comment::Moderation.enabled? or @comment.ham?
begin
- CommentMailer.notification(@comment, request).deliver
+ CommentMailer.notification(@comment, request).deliver_now
rescue
logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
end
diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb
index 5cf4ea5..ca3824e 100644
--- a/app/models/refinery/blog/category.rb
+++ b/app/models/refinery/blog/category.rb
@@ -12,6 +12,10 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
+ def self.by_title(title)
+ joins(:translations).find_by(title: title)
+ end
+
def self.translated
with_translations(::Globalize.locale)
end
diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb
index be94238..2050616 100644
--- a/app/models/refinery/blog/comment.rb
+++ b/app/models/refinery/blog/comment.rb
@@ -1,3 +1,5 @@
+require 'filters_spam'
+
module Refinery
module Blog
class Comment < ActiveRecord::Base
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index f80a939..c64c8f2 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -78,7 +78,7 @@ module Refinery
def find_by_slug_or_id(slug_or_id)
if slug_or_id.friendly_id?
- find_by_slug(slug_or_id)
+ friendly.find(slug_or_id)
else
find(slug_or_id)
end
@@ -92,6 +92,10 @@ module Refinery
newest_first.where(:published_at => date.beginning_of_year..date.end_of_year).with_globalize
end
+ def by_title(title)
+ joins(:translations).find_by(:title => title)
+ end
+
def newest_first
order("published_at DESC")
end
diff --git a/app/views/refinery/blog/admin/categories/_category.html.erb b/app/views/refinery/blog/admin/categories/_category.html.erb
index c1cfa15..3f813f5 100644
--- a/app/views/refinery/blog/admin/categories/_category.html.erb
+++ b/app/views/refinery/blog/admin/categories/_category.html.erb
@@ -4,10 +4,14 @@
<span class="preview">
<% category.translations.each do |translation| %>
<% if translation.title.present? %>
- <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'),
- refinery.edit_blog_admin_category_path(category, :switch_locale => translation.locale),
- :class => 'locale' %>
+ <%= link_to refinery.edit_blog_admin_category_path(category, :switch_locale => translation.locale),
+ :class => 'locale' do %>
+ <div class="locale_icon <%= translation.locale %>">
+ <%= refinery_icon_tag('locale-blue.svg', :size => '24x24') %>
+ <span class="code"><%= translation.locale.upcase %></span>
+ </div>
<% end %>
+ <% end %>
<% end %>
</span>
</span>
diff --git a/app/views/refinery/blog/admin/posts/_form.html.erb b/app/views/refinery/blog/admin/posts/_form.html.erb
index b2a31e1..1d52c56 100644
--- a/app/views/refinery/blog/admin/posts/_form.html.erb
+++ b/app/views/refinery/blog/admin/posts/_form.html.erb
@@ -44,7 +44,7 @@
<div class='field'>
<%= f.label :tag_list, t('refinery.blog.shared.tags.title') -%>
- <%= f.text_field :tag_list, :class => 'larger' -%>
+ <%= f.text_field :tag_list, value: @post.tag_list.to_s, :class => 'larger' -%>
</div>
<div id='more_options' style="display:none;">
diff --git a/app/views/refinery/blog/admin/posts/_post.html.erb b/app/views/refinery/blog/admin/posts/_post.html.erb
index eb9cc9d..6457c7b 100644
--- a/app/views/refinery/blog/admin/posts/_post.html.erb
+++ b/app/views/refinery/blog/admin/posts/_post.html.erb
@@ -2,12 +2,14 @@
<span class='title'>
<%= post.title.presence || post.translations.detect {|t| t.title.present?}.title %>
<span class="preview">
- <% post.translations.each do |translation| %>
- <% if translation.title.present? %>
- <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'),
- refinery.edit_blog_admin_post_path(post, :switch_locale => translation.locale),
- :class => 'locale' %>
- <% end %>
+ <% post.translations.reject {|t| t.title.blank? }.each do |translation| %>
+ <%= link_to refinery.edit_blog_admin_post_path(post, :switch_locale => translation.locale),
+ :class => 'locale' do %>
+ <div class="locale_icon <%= translation.locale %>">
+ <%= refinery_icon_tag('locale-blue.svg', :size => '24x24') %>
+ <span class="code"><%= translation.locale.upcase %></span>
+ </div>
+ <% end %>
<% end %>
<%= post.published_at.try(:strftime, '%b %d, %Y') || 'draft' %>