imagine_cms 3.0.8 → 3.0.9
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.
@@ -137,62 +137,6 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
#
|
141
|
-
# AKN 2012-11-08: This was never really a good idea. Need to figure out a better way. Disabling for now.
|
142
|
-
#
|
143
|
-
|
144
|
-
# def edit_master
|
145
|
-
# @file_type = case params[:id]
|
146
|
-
# when 'template' then 'html'
|
147
|
-
# when 'web_stylesheet', 'print_stylesheet' then 'css'
|
148
|
-
# else nil
|
149
|
-
# end
|
150
|
-
#
|
151
|
-
# filename = case params[:id]
|
152
|
-
# when 'template' then File.join('app', 'views', 'layouts', 'application.rhtml')
|
153
|
-
# when 'web_stylesheet' then File.join('public', 'stylesheets', 'default.css')
|
154
|
-
# when 'print_stylesheet' then File.join('public', 'stylesheets', 'print.css')
|
155
|
-
# when 'ie_stylesheet' then File.join('public', 'stylesheets', 'ie.css')
|
156
|
-
# when 'ie6_stylesheet' then File.join('public', 'stylesheets', 'ie6.css')
|
157
|
-
# end
|
158
|
-
# filename = File.join(Rails.root, filename)
|
159
|
-
#
|
160
|
-
# case request.method
|
161
|
-
# when :get
|
162
|
-
# @file_content = File.open(filename, 'r').read
|
163
|
-
# when :post
|
164
|
-
# begin
|
165
|
-
# @pg = CmsPage.new
|
166
|
-
# @page_objects = HashObject.new
|
167
|
-
# render_to_string :inline => params[:file_content]
|
168
|
-
# rescue Exception => e
|
169
|
-
# message = e.message
|
170
|
-
# flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
|
171
|
-
# logger.debug e
|
172
|
-
# return
|
173
|
-
# end
|
174
|
-
#
|
175
|
-
# begin
|
176
|
-
# if params[:file_content].blank?
|
177
|
-
# flash[:error] = 'An error occurred, please contact support.'
|
178
|
-
# else
|
179
|
-
# File.open(filename, 'w') { |f| f.write(params[:file_content]) }
|
180
|
-
# flash[:notice] = 'File saved.'
|
181
|
-
# end
|
182
|
-
#
|
183
|
-
# CmsPage.find(:all).each do |page|
|
184
|
-
# expire_page :controller => 'cms/content', :action => 'show', :content_path => page.path.split('/')
|
185
|
-
# end
|
186
|
-
#
|
187
|
-
# redirect_to :action => 'edit_master', :id => params[:id]
|
188
|
-
# rescue Exception => e
|
189
|
-
# message = e.message
|
190
|
-
# flash.now[:error] = "<pre>#{ERB::Util.html_escape(message)}</pre>"
|
191
|
-
# log_error(e)
|
192
|
-
# end
|
193
|
-
# end
|
194
|
-
# end
|
195
|
-
|
196
140
|
def pages
|
197
141
|
@page_levels = [ '' ].concat((params[:path] || session[:cms_pages_path] || '').split('/').reject { |l| l.blank? })
|
198
142
|
@page_levels << ''
|
@@ -308,7 +252,7 @@ class Management::CmsController < Management::ApplicationController # :nodoc:
|
|
308
252
|
render :update do |page|
|
309
253
|
case params[:return_to]
|
310
254
|
when 'preview'
|
311
|
-
page.redirect_to "
|
255
|
+
page.redirect_to "#{@pg.path.blank? ? '' : '/' + @pg.path}/version/#{@pg.published_version > 0 ? @pg.published_version : @pg.version}"
|
312
256
|
else
|
313
257
|
flash[:notice] = 'Page saved.'
|
314
258
|
session[:cms_pages_path] = @pg.path
|
data/app/models/cms_page.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
class CmsPage < ActiveRecord::Base
|
2
2
|
include ActsAsTree
|
3
3
|
|
4
|
-
attr_accessible :cms_template_id, :cms_template_version, :parent_id,
|
4
|
+
attr_accessible :cms_template_id, :cms_template_version, :parent_id,
|
5
|
+
:name, :title, :path, :summary, :position,
|
6
|
+
:article_date, :article_end_date, :published_date, :expiration_date, :expires,
|
7
|
+
:thumbnail_path, :feature_image_path, :comment_count, :version, :published_version,
|
8
|
+
:search_index, :updated_by, :updated_by_username
|
5
9
|
|
6
10
|
acts_as_versioned
|
7
11
|
acts_as_tree :order => 'path'
|
@@ -10,6 +10,10 @@ class CmsContentSweeper < ActionController::Caching::Sweeper
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def delete_all_cached_pages
|
13
|
+
# expire home page
|
14
|
+
expire_page :controller => 'cms/content', :action => 'show', :content_path => nil
|
15
|
+
|
16
|
+
# expire all other pages
|
13
17
|
CmsPage.find_each do |page|
|
14
18
|
expire_page :controller => 'cms/content', :action => 'show', :content_path => page.path.split('/')
|
15
19
|
end
|
data/lib/imagine_cms/version.rb
CHANGED