refinerycms-blog 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -1
  3. data/.travis.yml +3 -9
  4. data/Gemfile +10 -11
  5. data/app/assets/images/refinery/blog/icons/add.png +0 -0
  6. data/app/assets/stylesheets/refinery/blog/backend.css.scss +25 -25
  7. data/app/assets/stylesheets/refinery/blog/frontend.css.scss +87 -76
  8. data/app/controllers/refinery/blog/admin/comments_controller.rb +19 -19
  9. data/app/controllers/refinery/blog/admin/posts_controller.rb +9 -4
  10. data/app/controllers/refinery/blog/categories_controller.rb +1 -1
  11. data/app/controllers/refinery/blog/posts_controller.rb +12 -11
  12. data/app/helpers/refinery/blog/controller_helper.rb +7 -7
  13. data/app/helpers/refinery/blog/posts_helper.rb +5 -0
  14. data/app/models/refinery/blog/categorization.rb +12 -0
  15. data/app/models/refinery/blog/category.rb +14 -4
  16. data/app/models/refinery/blog/comment.rb +0 -9
  17. data/app/models/refinery/blog/post.rb +55 -13
  18. data/app/views/refinery/blog/admin/_submenu.html.erb +1 -4
  19. data/app/views/refinery/blog/admin/categories/_category.html.erb +11 -3
  20. data/app/views/refinery/blog/admin/categories/_form.html.erb +10 -11
  21. data/app/views/refinery/blog/admin/categories/_sortable_list.html.erb +2 -4
  22. data/app/views/refinery/blog/admin/categories/edit.html.erb +1 -1
  23. data/app/views/refinery/blog/admin/categories/index.html.erb +9 -15
  24. data/app/views/refinery/blog/admin/categories/new.html.erb +1 -1
  25. data/app/views/refinery/blog/admin/comments/_comment.html.erb +4 -2
  26. data/app/views/refinery/blog/admin/comments/_sortable_list.html.erb +2 -4
  27. data/app/views/refinery/blog/admin/comments/index.html.erb +14 -23
  28. data/app/views/refinery/blog/admin/comments/show.html.erb +6 -4
  29. data/app/views/refinery/blog/admin/posts/_form.html.erb +18 -26
  30. data/app/views/refinery/blog/admin/posts/_post.html.erb +14 -1
  31. data/app/views/refinery/blog/admin/posts/_sortable_list.html.erb +2 -4
  32. data/app/views/refinery/blog/admin/posts/edit.html.erb +1 -1
  33. data/app/views/refinery/blog/admin/posts/index.html.erb +9 -15
  34. data/app/views/refinery/blog/admin/posts/new.html.erb +1 -1
  35. data/app/views/refinery/blog/admin/posts/uncategorized.html.erb +2 -2
  36. data/app/views/refinery/blog/admin/settings/notification_recipients.html.erb +5 -7
  37. data/app/views/refinery/blog/categories/show.html.erb +2 -2
  38. data/app/views/refinery/blog/comment_mailer/notification.html.erb +5 -0
  39. data/app/views/refinery/blog/posts/_comment.html.erb +1 -1
  40. data/app/views/refinery/blog/posts/_comments.html.erb +28 -31
  41. data/app/views/refinery/blog/posts/_post.html.erb +3 -3
  42. data/app/views/refinery/blog/posts/archive.html.erb +6 -5
  43. data/app/views/refinery/blog/posts/index.html.erb +3 -3
  44. data/app/views/refinery/blog/posts/show.html.erb +4 -6
  45. data/app/views/refinery/blog/posts/tagged.html.erb +4 -4
  46. data/app/views/refinery/blog/shared/_body_content_right.html.erb +6 -6
  47. data/app/views/refinery/blog/shared/_post.html.erb +11 -13
  48. data/app/views/refinery/blog/shared/_rss_feed.html.erb +2 -0
  49. data/config/initializers/url_validator.rb +15 -11
  50. data/config/locales/bg.yml +2 -4
  51. data/config/locales/cs.yml +6 -8
  52. data/config/locales/de.yml +27 -8
  53. data/config/locales/en.yml +9 -6
  54. data/config/locales/es.yml +2 -4
  55. data/config/locales/fr.yml +23 -7
  56. data/config/locales/it.yml +2 -4
  57. data/config/locales/ja.yml +16 -5
  58. data/config/locales/nb.yml +0 -2
  59. data/config/locales/nl.yml +21 -7
  60. data/config/locales/pl.yml +3 -5
  61. data/config/locales/pt-BR.yml +38 -7
  62. data/config/locales/ru.yml +35 -2
  63. data/config/locales/sk.yml +4 -6
  64. data/config/locales/sv.yml +2 -4
  65. data/config/locales/zh-CN.yml +2 -4
  66. data/config/routes.rb +3 -3
  67. data/db/migrate/20110803223522_create_blog_structure.rb +15 -14
  68. data/db/migrate/20110803223523_add_user_id_to_blog_posts.rb +2 -2
  69. data/db/migrate/20110803223526_add_cached_slugs.rb +2 -2
  70. data/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb +1 -1
  71. data/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb +1 -1
  72. data/db/migrate/20110803223529_add_primary_key_to_categorizations.rb +4 -4
  73. data/db/migrate/20120530102901_create_blog_translations.rb +17 -0
  74. data/db/migrate/20120531113632_delete_cached_slugs.rb +6 -0
  75. data/db/migrate/20120601151114_create_category_translations.rb +14 -0
  76. data/db/seeds.rb +2 -2
  77. data/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb +3 -0
  78. data/lib/refinery/blog.rb +1 -0
  79. data/lib/refinery/blog/configuration.rb +23 -0
  80. data/readme.md +3 -3
  81. data/refinerycms-blog.gemspec +8 -14
  82. data/spec/controllers/refinery/blog/admin/comments_controller_spec.rb +84 -0
  83. data/spec/controllers/refinery/blog/posts_controller_spec.rb +0 -2
  84. data/spec/factories/blog_posts.rb +2 -2
  85. data/spec/features/refinery/blog/admin/categories_spec.rb +119 -0
  86. data/spec/{requests → features}/refinery/blog/admin/comments_spec.rb +9 -9
  87. data/spec/{requests → features}/refinery/blog/admin/menu_spec.rb +2 -2
  88. data/spec/features/refinery/blog/admin/posts_spec.rb +338 -0
  89. data/spec/features/refinery/blog/categories_spec.rb +28 -0
  90. data/spec/{requests → features}/refinery/blog/posts_spec.rb +62 -42
  91. data/spec/helpers/refinery/blog/controller_helper_spec.rb +27 -0
  92. data/spec/helpers/refinery/blog/posts_helper_spec.rb +12 -0
  93. data/spec/models/refinery/blog/category_spec.rb +10 -2
  94. data/spec/models/refinery/blog/post_spec.rb +21 -17
  95. data/spec/spec_helper.rb +20 -46
  96. metadata +41 -38
  97. data/Guardfile +0 -20
  98. data/app/assets/images/refinerycms-blog/.gitkeep +0 -0
  99. data/app/assets/javascripts/refinerycms-blog/.gitkeep +0 -0
  100. data/app/assets/stylesheets/refinerycms-blog/.gitkeep +0 -0
  101. data/app/models/refinery/categorization.rb +0 -10
  102. data/app/views/refinery/blog/admin/comments/approve.html.erb +0 -0
  103. data/lib/refinery/blog/version.rb +0 -17
  104. data/spec/requests/refinery/blog/admin/categories_spec.rb +0 -20
  105. data/spec/requests/refinery/blog/admin/posts_spec.rb +0 -175
  106. data/spec/requests/refinery/blog/categories_spec.rb +0 -24
@@ -1,11 +1,11 @@
1
1
  module Refinery
2
2
  module Blog
3
3
  module ControllerHelper
4
-
4
+
5
5
  protected
6
-
6
+
7
7
  def find_blog_post
8
- unless (@post = Refinery::Blog::Post.find(params[:id])).try(:live?)
8
+ unless (@post = Refinery::Blog::Post.with_globalize.find(params[:id])).try(:live?)
9
9
  if refinery_user? and current_refinery_user.authorized_plugins.include?("refinerycms_blog")
10
10
  @post = Refinery::Blog::Post.find(params[:id])
11
11
  else
@@ -13,16 +13,16 @@ module Refinery
13
13
  end
14
14
  end
15
15
  end
16
-
16
+
17
17
  def find_all_blog_posts
18
- @posts = Refinery::Blog::Post.live.includes(:comments, :categories).page(params[:page])
18
+ @posts = Refinery::Blog::Post.live.includes(:comments, :categories).with_globalize.page(params[:page])
19
19
  end
20
20
 
21
21
  def find_tags
22
- @tags = Refinery::Blog::Post.tag_counts_on(:tags)
22
+ @tags = Refinery::Blog::Post.live.tag_counts_on(:tags)
23
23
  end
24
24
  def find_all_blog_categories
25
- @categories = Refinery::Blog::Category.all
25
+ @categories = Refinery::Blog::Category.translated
26
26
  end
27
27
  end
28
28
  end
@@ -28,6 +28,11 @@ module Refinery
28
28
  Refinery::Blog::Post.published_dates_older_than(cutoff)
29
29
  end
30
30
 
31
+ def avatar_url(email, options = {:size => 60})
32
+ require 'digest/md5'
33
+ "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s.strip.downcase)}?s=#{options[:size]}.jpg"
34
+ end
35
+
31
36
  class ArchiveWidget
32
37
  delegate :t, :link_to, :refinery, :render, :to => :view_context
33
38
  attr_reader :view_context
@@ -0,0 +1,12 @@
1
+ module Refinery
2
+ module Blog
3
+ class Categorization < ActiveRecord::Base
4
+
5
+ self.table_name = 'refinery_blog_categories_blog_posts'
6
+ belongs_to :blog_post, :class_name => 'Refinery::Blog::Post', :foreign_key => :blog_post_id
7
+ belongs_to :blog_category, :class_name => 'Refinery::Blog::Category', :foreign_key => :blog_category_id
8
+
9
+ attr_accessible :blog_category_id, :blog_post_id
10
+ end
11
+ end
12
+ end
@@ -1,20 +1,30 @@
1
1
  module Refinery
2
2
  module Blog
3
3
  class Category < ActiveRecord::Base
4
+
5
+ translates :title, :slug
6
+
4
7
  extend FriendlyId
5
- friendly_id :title, :use => [:slugged]
8
+ friendly_id :title, :use => [:slugged, :globalize]
6
9
 
7
10
  has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_category_id
8
11
  has_many :posts, :through => :categorizations, :source => :blog_post
9
12
 
10
- acts_as_indexed :fields => [:title]
11
-
12
13
  validates :title, :presence => true, :uniqueness => true
13
14
 
14
15
  attr_accessible :title
16
+ attr_accessor :locale
17
+
18
+ class Translation
19
+ attr_accessible :locale
20
+ end
21
+
22
+ def self.translated
23
+ with_translations(::Globalize.locale)
24
+ end
15
25
 
16
26
  def post_count
17
- posts.select(&:live?).count
27
+ posts.live.with_globalize.count
18
28
  end
19
29
 
20
30
  # how many items to show per page
@@ -10,8 +10,6 @@ module Refinery
10
10
 
11
11
  belongs_to :post, :foreign_key => 'blog_post_id'
12
12
 
13
- acts_as_indexed :fields => [:name, :email, :message]
14
-
15
13
  alias_attribute :message, :body
16
14
 
17
15
  validates :name, :message, :presence => true
@@ -33,13 +31,6 @@ module Refinery
33
31
 
34
32
  self.per_page = Refinery::Blog.comments_per_page
35
33
 
36
- def avatar_url(options = {})
37
- options = {:size => 60}
38
- require 'digest/md5'
39
- size = ("?s=#{options[:size]}" if options[:size])
40
- "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg"
41
- end
42
-
43
34
  def approve!
44
35
  self.update_column(:state, 'approved')
45
36
  end
@@ -4,14 +4,17 @@ require 'seo_meta'
4
4
  module Refinery
5
5
  module Blog
6
6
  class Post < ActiveRecord::Base
7
+
8
+ translates :title, :body, :custom_url, :custom_teaser, :slug, :include => :seo_meta
9
+
7
10
  extend FriendlyId
8
- friendly_id :friendly_id_source, :use => [:slugged]
11
+ friendly_id :friendly_id_source, :use => [:slugged, :globalize]
9
12
 
10
13
  is_seo_meta if self.table_exists?
11
14
 
12
15
  default_scope :order => 'published_at DESC'
13
16
 
14
- belongs_to :author, :class_name => 'Refinery::User', :foreign_key => :user_id, :readonly => true
17
+ belongs_to :author, :class_name => Refinery::Blog.user_class.to_s, :foreign_key => :user_id, :readonly => true
15
18
 
16
19
  has_many :comments, :dependent => :destroy, :foreign_key => :blog_post_id
17
20
  acts_as_taggable
@@ -19,10 +22,9 @@ module Refinery
19
22
  has_many :categorizations, :dependent => :destroy, :foreign_key => :blog_post_id
20
23
  has_many :categories, :through => :categorizations, :source => :blog_category
21
24
 
22
- acts_as_indexed :fields => [:title, :body]
23
-
24
25
  validates :title, :presence => true, :uniqueness => true
25
26
  validates :body, :presence => true
27
+ validates :published_at, :author, :presence => true
26
28
 
27
29
  validates :source_url, :url => { :if => 'Refinery::Blog.validate_source_url',
28
30
  :update => true,
@@ -31,8 +33,21 @@ module Refinery
31
33
  :verify => [:resolve_redirects]}
32
34
 
33
35
  attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :author
34
- attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids
36
+ attr_accessible :browser_title, :meta_description, :user_id, :category_ids
35
37
  attr_accessible :source_url, :source_url_title
38
+ attr_accessor :locale
39
+
40
+
41
+ class Translation
42
+ is_seo_meta
43
+ attr_accessible :browser_title, :meta_description, :locale
44
+ end
45
+
46
+ # Delegate SEO Attributes to globalize3 translation
47
+ seo_fields = ::SeoMeta.attributes.keys.map{|a| [a, :"#{a}="]}.flatten
48
+ delegate(*(seo_fields << {:to => :translation}))
49
+
50
+ before_save { |m| m.translation.save }
36
51
 
37
52
  self.per_page = Refinery::Blog.posts_per_page
38
53
 
@@ -49,20 +64,47 @@ module Refinery
49
64
  end
50
65
 
51
66
  def friendly_id_source
52
- custom_url.present? ? custom_url : title
67
+ custom_url.presence || title
53
68
  end
54
69
 
55
70
  class << self
56
- def by_archive(date)
71
+
72
+ # Wrap up the logic of finding the pages based on the translations table.
73
+ def with_globalize(conditions = {})
74
+ conditions = {:locale => ::Globalize.locale}.merge(conditions)
75
+ globalized_conditions = {}
76
+ conditions.keys.each do |key|
77
+ if (translated_attribute_names.map(&:to_s) | %w(locale)).include?(key.to_s)
78
+ globalized_conditions["#{self.translation_class.table_name}.#{key}"] = conditions.delete(key)
79
+ end
80
+ end
81
+ # A join implies readonly which we don't really want.
82
+ joins(:translations).where(globalized_conditions).where(conditions).readonly(false)
83
+ end
84
+
85
+ def find_by_slug_or_id(slug_or_id)
86
+ if slug_or_id.friendly_id?
87
+ find_by_slug(slug_or_id)
88
+ else
89
+ find(slug_or_id)
90
+ end
91
+ end
92
+
93
+ def by_month(date)
57
94
  where(:published_at => date.beginning_of_month..date.end_of_month)
58
95
  end
59
96
 
97
+ def by_archive(date)
98
+ Refinery.deprecate("Refinery::Blog::Post.by_archive(date)", {:replacement => "Refinery::Blog::Post.by_month(date)", :when => 2.2 })
99
+ by_month(date)
100
+ end
101
+
60
102
  def by_year(date)
61
- where(:published_at => date.beginning_of_year..date.end_of_year)
103
+ where(:published_at => date.beginning_of_year..date.end_of_year).with_globalize
62
104
  end
63
105
 
64
106
  def published_dates_older_than(date)
65
- published_before(date).pluck(:published_at)
107
+ published_before(date).select(:published_at).map(&:published_at)
66
108
  end
67
109
 
68
110
  def recent(count)
@@ -70,7 +112,7 @@ module Refinery
70
112
  end
71
113
 
72
114
  def popular(count)
73
- unscoped.order("access_count DESC").limit(count)
115
+ unscoped.order("access_count DESC").limit(count).with_globalize
74
116
  end
75
117
 
76
118
  def previous(item)
@@ -78,15 +120,15 @@ module Refinery
78
120
  end
79
121
 
80
122
  def uncategorized
81
- live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil })
123
+ live.includes(:categories).where(Refinery::Blog::Categorization.table_name => { :blog_category_id => nil })
82
124
  end
83
125
 
84
126
  def next(current_record)
85
- where(["published_at > ? and draft = ?", current_record.published_at, false]).first
127
+ where(["published_at > ? and draft = ?", current_record.published_at, false]).reorder('published_at ASC').with_globalize.first
86
128
  end
87
129
 
88
130
  def published_before(date=Time.now)
89
- where("published_at < ? and draft = ?", date, false)
131
+ where("published_at < ? and draft = ?", date, false).with_globalize
90
132
  end
91
133
  alias_method :live, :published_before
92
134
 
@@ -1,10 +1,7 @@
1
1
  <nav id='actions' class='multilist'>
2
2
  <ul class='search_list'>
3
3
  <li class='not_a_link'>
4
- <%= render :partial => "/refinery/admin/search",
5
- :locals => {
6
- :url => refinery.blog_admin_posts_path
7
- } %>
4
+ <%= render "/refinery/admin/search", :url => request.path %>
8
5
  </li>
9
6
  </ul>
10
7
 
@@ -1,11 +1,19 @@
1
1
  <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(category) -%>">
2
2
  <span class='title'>
3
- <%= category.title %>
4
- <span class="preview">&nbsp;</span>
3
+ <%= category.title.presence || category.translations.detect {|t| t.title.present?}.title %>
4
+ <span class="preview">
5
+ <% category.translations.each do |translation| %>
6
+ <% if translation.title.present? %>
7
+ <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'),
8
+ refinery.edit_blog_admin_category_path(category, :switch_locale => translation.locale),
9
+ :class => 'locale' %>
10
+ <% end %>
11
+ <% end %>
12
+ </span>
5
13
  </span>
6
14
  <span class='actions'>
7
15
  <%= link_to refinery_icon_tag("application_edit.png"),
8
- refinery.edit_blog_admin_category_path(category, :dialog => true, :height => 325),
16
+ refinery.edit_blog_admin_category_path(category),
9
17
  :title => t('.edit') %>
10
18
  <%= link_to refinery_icon_tag("delete.png"), refinery.blog_admin_category_path(category),
11
19
  :class => "cancel confirm-delete",
@@ -1,19 +1,18 @@
1
1
  <%= form_for [refinery, :blog_admin, @category] do |f| -%>
2
- <%= render :partial => "/refinery/admin/error_messages",
3
- :locals => {
4
- :object => f.object,
5
- :include_object_name => true
6
- } %>
2
+ <%= render "/refinery/admin/error_messages",
3
+ :object => f.object,
4
+ :include_object_name => true %>
5
+
6
+ <%= render '/refinery/admin/locale_picker',
7
+ :current_locale => Globalize.locale %>
7
8
 
8
9
  <div class='field'>
9
10
  <%= f.label :title -%>
10
11
  <%= f.text_field :title, :class => 'larger widest' -%>
11
12
  </div>
12
13
 
13
- <%= render :partial => "/refinery/admin/form_actions",
14
- :locals => {
15
- :f => f,
16
- :continue_editing => false,
17
- :delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category')
18
- } %>
14
+ <%= render "/refinery/admin/form_actions",
15
+ :f => f,
16
+ :continue_editing => false,
17
+ :delete_title => t('delete', :scope => 'refinery.blog.admin.categories.category') %>
19
18
  <% end %>
@@ -1,7 +1,5 @@
1
1
  <ul id='sortable_list'>
2
2
  <%= render :partial => 'category', :collection => @categories %>
3
3
  </ul>
4
- <%= render :partial => "/refinery/admin/sortable_list",
5
- :locals => {
6
- :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
7
- } %>
4
+ <%= render "/refinery/admin/sortable_list",
5
+ :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) %>
@@ -1 +1 @@
1
- <%= render :partial => "form" %>
1
+ <%= render "form" %>
@@ -1,21 +1,15 @@
1
- <%= render :partial => '/refinery/blog/admin/submenu' %>
1
+ <%= render '/refinery/blog/admin/submenu' %>
2
+ <%= render 'refinery/admin/search_header', :url => request.path %>
2
3
  <div id='records'>
3
- <% if searching? %>
4
- <h2><%= t('results_for', :scope => 'refinery.admin.search',
5
- :query => params[:search]) %></h2>
6
- <% if @categories.any? %>
7
- <%= render :partial => "blog_categories",
8
- :collection => @categories %>
9
- <% else %>
10
- <p><%= t('no_results', :scope => 'refinery.admin.search') %></p>
11
- <% end %>
12
- <% else %>
13
- <% if @categories.any? %>
14
- <%= will_paginate @categories %>
4
+ <% if @categories.any? %>
5
+ <%= will_paginate @categories %>
15
6
 
16
- <%= render :partial => "sortable_list" %>
7
+ <%= render "sortable_list" %>
17
8
 
18
- <%= will_paginate @categories %>
9
+ <%= will_paginate @categories %>
10
+ <% else %>
11
+ <% if searching? %>
12
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
19
13
  <% else %>
20
14
  <p>
21
15
  <strong>
@@ -1 +1 @@
1
- <%= render :partial => "form" %>
1
+ <%= render "form" %>
@@ -11,10 +11,12 @@
11
11
  <%= link_to refinery_icon_tag('zoom.png'), refinery.blog_admin_comment_path(comment),
12
12
  :title => t('.read') %>
13
13
  <%= link_to refinery_icon_tag("cross.png"),
14
- refinery.rejected_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
14
+ refinery.reject_blog_admin_comment_path(comment),
15
+ :method => :post,
15
16
  :title => t('.reject') unless comment.rejected? %>
16
17
  <%= link_to refinery_icon_tag("tick.png"),
17
- refinery.approved_blog_admin_comment_path(comment, :return_to => request.path.split('/').last.gsub(/^comments$/, 'index')),
18
+ refinery.approve_blog_admin_comment_path(comment),
19
+ :method => :post,
18
20
  :title => t('.approve') unless comment.approved? %>
19
21
  </span>
20
22
  </li>
@@ -1,7 +1,5 @@
1
1
  <ul id='sortable_list'>
2
2
  <%= render :partial => 'comment', :collection => @comments %>
3
3
  </ul>
4
- <%= render :partial => "/refinery/admin/sortable_list",
5
- :locals => {
6
- :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)
7
- } %>
4
+ <%= render "/refinery/admin/sortable_list",
5
+ :continue_reordering => (defined?(continue_reordering) ? continue_reordering : true) %>
@@ -1,30 +1,21 @@
1
- <%= render :partial => '/refinery/blog/admin/submenu' %>
1
+ <%= render 'refinery/blog/admin/submenu' %>
2
+ <%= render 'refinery/admin/search_header', :url => request.path %>
2
3
  <div id='records'>
3
- <% if searching? %>
4
- <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
5
- <% if @comments.any? %>
6
- <%= will_paginate @comments %>
4
+ <% if @comments.any? %>
5
+ <%= will_paginate @comments %>
7
6
 
8
- <ul>
9
- <%= render :partial => "blog_comments",
10
- :collection => @comments %>
11
- </ul>
7
+ <%= render "sortable_list" %>
12
8
 
13
- <%= will_paginate @comments %>
14
- <% else %>
15
- <p><%= t('search_no_results', :scope => 'admin') %></p>
16
- <% end %>
9
+ <%= will_paginate @comments %>
17
10
  <% else %>
18
- <% if @comments.any? %>
19
- <%= will_paginate @comments %>
20
-
21
- <%= render :partial => "sortable_list" %>
22
-
23
- <%= will_paginate @comments %>
11
+ <% if searching? %>
12
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
24
13
  <% else %>
25
- <h3>
26
- <%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %>
27
- </h3>
28
- <% end %>
14
+ <p>
15
+ <strong>
16
+ <%= t('.no_items_yet', :type => action_name.gsub('index', 'new').downcase) %>
17
+ </strong>
18
+ </p>
29
19
  <% end %>
20
+ <% end %>
30
21
  </div>
@@ -9,12 +9,14 @@
9
9
  <%= link_to t('.back'), refinery.blog_admin_comments_path, :class => "back_icon" %>
10
10
  </li>
11
11
  <li>
12
- <%= link_to t('.reject'), refinery.rejected_blog_admin_comment_path(@comment, :return_to => 'rejected'),
13
- :class => 'comment_cross_icon' unless @comment.rejected? %>
12
+ <%= link_to t('.reject'), refinery.reject_blog_admin_comment_path(@comment),
13
+ :method => :post,
14
+ :class => 'comment_cross_icon' unless @comment.rejected? %>
14
15
  </li>
15
16
  <li>
16
- <%= link_to t('.approve'), refinery.approved_blog_admin_comment_path(@comment, :return_to => 'approved'),
17
- :class => 'comment_tick_icon' unless @comment.approved? %>
17
+ <%= link_to t('.approve'), refinery.approve_blog_admin_comment_path(@comment),
18
+ :method => :post,
19
+ :class => 'comment_tick_icon' unless @comment.approved? %>
18
20
  </li>
19
21
  </ul>
20
22
  </div>