Commit 839a4ce1 authored by Martin Markech's avatar Martin Markech
Browse files

Prepare refinerycms-news for Rails 6 and Refinery > 4

parent 52684d22
......@@ -5,10 +5,15 @@ gem "refinerycms-authentication-devise", '~> 2.0.1', git: 'https://github.com/r
gemspec
gem 'refinerycms', '~> 4.0.3'
gem 'refinerycms-acts-as-indexed', '~> 5.0.0', git: 'git@gitlab.matho.sk:open-source/refinerycms-acts-as-indexed.git', branch: 'master'
gem 'refinerycms', '~> 4.1.0', git: 'https://github.com/refinery/refinerycms.git', branch: 'master'
gem 'actionmailer', '~> 6.0.0'
gem 'mobility', '~> 0.8.9'
group :development, :test do
gem 'refinerycms-testing', '~> 4.0.3'
# gem 'refinerycms-testing', '~> 4.0.3'
end
# Add the default visual editor, for now.
......
......@@ -26,15 +26,15 @@ module Refinery
protected
def find_latest_news_items
@items = Refinery::News::Item.latest.with_translations
@items = Refinery::News::Item.latest
end
def find_published_news_items
@items = Refinery::News::Item.published.with_translations.page(params[:page])
@items = Refinery::News::Item.published.page(params[:page])
end
def find_news_item
@item = Refinery::News::Item.published.with_translations.find(params[:id])
@item = Refinery::News::Item.published.find(params[:id])
end
def find_page
......
module Refinery
module News
class Item < Refinery::Core::BaseModel
extend Mobility
extend FriendlyId
translates :slug, :title, :body, :teaser
translates :title, :body, :teaser
friendly_id :title, :use => :mobility
attr_accessor :locale # to hold temporarily
......@@ -19,9 +21,6 @@ module Refinery
validates :title, :publish_date, :presence => true
friendly_id :title, :use => [:slugged, :finders]
acts_as_indexed :fields => [:title, :body, :teaser]
default_scope -> { order('publish_date DESC') }
......@@ -88,7 +87,7 @@ module Refinery
# rejects any page that has not been translated to the current locale.
def translated
includes(:translations).where(
translation_class.arel_table[:locale].eq(::Globalize.locale)
translation_class.arel_table[:locale].eq(::Mobility.locale)
).where(
arel_table[:id].eq(translation_class.arel_table[:refinery_news_item_id])
)
......
......@@ -3,7 +3,7 @@
:object => @item,
:include_object_name => true %>
<%= render '/refinery/admin/locale_picker', :current_locale => Globalize.locale %>
<%= render '/refinery/admin/locale_picker', :current_locale => Mobility.locale %>
<div class='field'>
<%= f.label :title %>
......
......@@ -3,7 +3,7 @@ require 'date'
Gem::Specification.new do |s|
s.name = %q{refinerycms-news}
s.version = %q{4.0.0}
s.version = %q{5.0.0}
s.description = %q{A really straightforward open source Ruby on Rails news engine designed for integration with Refinery CMS.}
s.date = Date.today.strftime("%Y-%m-%d")
s.summary = %q{Ruby on Rails news engine for Refinery CMS.}
......@@ -15,10 +15,10 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
s.add_dependency 'refinerycms-core', '~> 4.0.3'
s.add_dependency 'refinerycms-core', '~> 4.1.0'
s.add_dependency 'refinerycms-settings', '~> 4.0.1'
s.add_dependency 'friendly_id', '~> 5.2.1'
# Development dependencies
s.add_development_dependency 'refinerycms-testing', '~> 4.0.3'
# s.add_development_dependency 'refinerycms-testing', '~> 4.1.0'
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment