refinerycms-pages 0.9.9.9 → 0.9.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,18 +20,24 @@ module Admin
20
20
 
21
21
  protected
22
22
 
23
+ # We can safely assume Refinery::I18n is defined because this method only gets
24
+ # Invoked when the before_filter from the plugin is run.
23
25
  def globalize!
24
- super
26
+ unless action_name.to_s == 'index'
27
+ super
25
28
 
26
- # Check whether we need to override e.g. on the pages form.
27
- unless params[:switch_locale] or @page.try(:slug).nil? or !@page.persisted?
28
- Thread.current[:globalize_locale] = @page.slug.locale
29
+ # Check whether we need to override e.g. on the pages form.
30
+ unless params[:switch_locale] or @page.nil? or @page.slugs.where(:locale => Refinery::I18n.current_locale).nil? or !@page.persisted?
31
+ Thread.current[:globalize_locale] = @page.slug.locale
32
+ end
33
+ else
34
+ Thread.current[:globalize_locale] = nil
29
35
  end
30
36
  end
31
37
 
32
38
  def show_errors_for_reserved_slug(exception)
33
39
  flash[:error] = t('reserved_system_word', :scope => 'admin.pages')
34
- if params[:action] == 'update'
40
+ if action_name == 'update'
35
41
  find_page
36
42
  render :edit
37
43
  else
data/app/models/page.rb CHANGED
@@ -40,7 +40,7 @@ class Page < ActiveRecord::Base
40
40
  # This works using a query against the translated content first and then
41
41
  # using all of the page_ids we further filter against this model's table.
42
42
  scope :in_menu, lambda {
43
- where(:show_in_menu => true).joins(:translations).includes(:translations).where(
43
+ where(:show_in_menu => true).includes(:translations).where(
44
44
  :id => Page::Translation.where(:locale => Globalize.locale).map(&:page_id)
45
45
  )
46
46
  }
@@ -3,7 +3,7 @@
3
3
  :collection => @pages.select{|p| p.parent_id.nil?},
4
4
  :locals => {
5
5
  :collection => @pages
6
- }, %>
6
+ } %>
7
7
  </ul>
8
8
  <%= render :partial => "/shared/admin/sortable_list",
9
9
  :locals => {:continue_reordering => !!local_assigns[:continue_reordering]} %>
@@ -1,6 +1,6 @@
1
1
  <section id='records' class='tree'>
2
2
  <% caching = RefinerySetting.find_or_set(:cache_pages_backend, false) && File.writable?(Rails.cache.cache_path) %>
3
- <% cache_if(caching, [Refinery.base_cache_key, "pages_backend", Globalize.locale].join('_')) do %>
3
+ <% cache_if(caching && !logged_in?, [Refinery.base_cache_key, "pages_backend", Globalize.locale].join('_')) do %>
4
4
  <%= render :partial => 'records' %>
5
5
  <% end %>
6
6
  </section>
@@ -9,16 +9,9 @@ class TranslateCustomTitleOnPages < ActiveRecord::Migration
9
9
  end
10
10
 
11
11
  end
12
-
13
- if ::Page.column_names.map(&:to_sym).include?(:custom_title)
14
- remove_column ::Page.table_name, :custom_title
15
- end
16
12
  end
17
13
 
18
14
  def self.down
19
- # Restore
20
- add_column ::Page.table_name, :custom_title, :string
21
-
22
15
  # Re-save custom_title
23
16
  ::Page.all.each do |page|
24
17
  ::Page.update_all({
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-pages}
5
- s.version = %q{0.9.9.9}
5
+ s.version = %q{0.9.9.10}
6
6
  s.summary = %q{Pages engine for Refinery CMS}
7
7
  s.description = %q{The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.}
8
- s.date = %q{2011-03-15}
8
+ s.date = %q{2011-03-17}
9
9
  s.email = %q{info@refinerycms.com}
10
10
  s.homepage = %q{http://refinerycms.com}
11
11
  s.rubyforge_project = %q{refinerycms}
@@ -111,5 +111,5 @@ Gem::Specification.new do |s|
111
111
  'spec/models/page_spec.rb'
112
112
  ]
113
113
 
114
- s.add_dependency 'refinerycms-core', '~> 0.9.9.9'
114
+ s.add_dependency 'refinerycms-core', '~> 0.9.9.10'
115
115
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-pages
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.9
5
+ version: 0.9.9.10
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-03-15 00:00:00 +13:00
16
+ date: 2011-03-17 00:00:00 +13:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 0.9.9.9
27
+ version: 0.9.9.10
28
28
  type: :runtime
29
29
  version_requirements: *id001
30
30
  description: The default content engine of Refinery CMS. This engine handles the administration and display of user-editable pages.