spud_cms 0.4.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
|
|
1
1
|
class PagesController < ApplicationController
|
2
|
-
|
2
|
+
caches_action :show,:layout => false, :if => Proc.new { |c| Spud::Cms.enable_full_page_caching }
|
3
3
|
def show
|
4
4
|
url_name = !params[:id].blank? ? params[:id] : Spud::Cms.root_page_name
|
5
5
|
@page = SpudPage.published_pages.where(:url_name => url_name).includes([:spud_template,:spud_page_partials]).first
|
@@ -20,6 +20,7 @@ class Spud::Admin::MenuItemsController < Spud::Admin::ApplicationController
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create
|
23
|
+
clear_action_cache
|
23
24
|
add_breadcrumb "New", :new_spud_admin_page_path
|
24
25
|
@page_name = "New Menu Item"
|
25
26
|
@menu_item = SpudMenuItem.new(params[:spud_menu_item])
|
@@ -41,6 +42,8 @@ class Spud::Admin::MenuItemsController < Spud::Admin::ApplicationController
|
|
41
42
|
end
|
42
43
|
flash[:notice] = "Menu Created successfully!" if @menu_item.save
|
43
44
|
|
45
|
+
|
46
|
+
|
44
47
|
respond_with @menu_item,:location => spud_admin_menu_menu_items_url
|
45
48
|
end
|
46
49
|
|
@@ -54,6 +57,7 @@ class Spud::Admin::MenuItemsController < Spud::Admin::ApplicationController
|
|
54
57
|
end
|
55
58
|
|
56
59
|
def update
|
60
|
+
clear_action_cache
|
57
61
|
add_breadcrumb "Edit #{@menu_item.name}", :edit_spud_admin_menu_menu_item_path
|
58
62
|
@page_name = "Edit #{@menu_item.name}"
|
59
63
|
if params[:spud_menu_item][:parent_id].blank?
|
@@ -70,7 +74,7 @@ class Spud::Admin::MenuItemsController < Spud::Admin::ApplicationController
|
|
70
74
|
end
|
71
75
|
|
72
76
|
def destroy
|
73
|
-
|
77
|
+
clear_action_cache
|
74
78
|
flash[:notice] = "Menu Item removed!" if @menu_item.destroy
|
75
79
|
|
76
80
|
respond_with @menu_item,:location => spud_admin_menu_menu_items_url
|
@@ -94,4 +98,18 @@ private
|
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
101
|
+
def clear_action_cache
|
102
|
+
if(Spud::Cms.enable_full_page_caching == false)
|
103
|
+
return
|
104
|
+
end
|
105
|
+
@pages = SpudPage.published_pages.all
|
106
|
+
if !@pages.blank?
|
107
|
+
@pages.each do |page|
|
108
|
+
expire_action page_url(:id => page.url_name)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
|
97
115
|
end
|
@@ -72,7 +72,7 @@ class Spud::Admin::PagesController < Spud::Admin::ApplicationController
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def update
|
75
|
-
|
75
|
+
expire_action page_url(:id => @page.url_name)
|
76
76
|
if @page.update_attributes(params[:spud_page])
|
77
77
|
flash[:notice] = "Page updated successfully!"
|
78
78
|
redirect_to spud_admin_pages_url() and return
|
@@ -85,8 +85,7 @@ class Spud::Admin::PagesController < Spud::Admin::ApplicationController
|
|
85
85
|
|
86
86
|
def destroy
|
87
87
|
status = 500
|
88
|
-
|
89
|
-
|
88
|
+
expire_action page_url(:id => @page.url_name)
|
90
89
|
if @page.destroy
|
91
90
|
flash[:notice] = "Page removed successfully!"
|
92
91
|
status = 200
|
@@ -33,6 +33,7 @@ class Spud::Admin::TemplatesController < Spud::Admin::ApplicationController
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def update
|
36
|
+
clear_action_cache
|
36
37
|
add_breadcrumb "Edit #{@template.name}", :edit_spud_admin_template_path
|
37
38
|
flash[:notice] = "Template updated successfully" if @template.update_attributes(params[:spud_template])
|
38
39
|
|
@@ -41,6 +42,7 @@ class Spud::Admin::TemplatesController < Spud::Admin::ApplicationController
|
|
41
42
|
|
42
43
|
|
43
44
|
def destroy
|
45
|
+
clear_action_cache
|
44
46
|
flash[:notice] = "Template removed" if @template.destroy
|
45
47
|
|
46
48
|
respond_with @template, :location => spud_admin_templates_url
|
@@ -54,4 +56,16 @@ private
|
|
54
56
|
redirect_to spud_admin_templates_url and return false
|
55
57
|
end
|
56
58
|
end
|
59
|
+
|
60
|
+
def clear_action_cache
|
61
|
+
if(Spud::Cms.enable_full_page_caching == false)
|
62
|
+
return
|
63
|
+
end
|
64
|
+
if !@template.spud_pages.blank?
|
65
|
+
@template.spud_pages.each do |page|
|
66
|
+
expire_action page_path(:id => page.url_name)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
57
71
|
end
|
@@ -2,7 +2,7 @@ module Spud
|
|
2
2
|
module Cms
|
3
3
|
include ActiveSupport::Configurable
|
4
4
|
|
5
|
-
config_accessor :menus_enabled,:templates_enabled,:root_page_name,:default_page_parts,:yield_body_as_content_block,:default_page_layout,:enable_sitemap,:enable_full_page_caching
|
5
|
+
config_accessor :menus_enabled,:templates_enabled,:root_page_name,:default_page_parts,:yield_body_as_content_block,:default_page_layout,:enable_sitemap,:enable_full_page_caching
|
6
6
|
|
7
7
|
self.root_page_name = "home"
|
8
8
|
self.menus_enabled = true
|
@@ -11,7 +11,6 @@ module Spud
|
|
11
11
|
self.default_page_parts = ["Body"]
|
12
12
|
self.yield_body_as_content_block = false
|
13
13
|
self.enable_full_page_caching = false
|
14
|
-
self.page_cache_expires_in = 10.minutes
|
15
14
|
self.enable_sitemap = true
|
16
15
|
end
|
17
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spud_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spud_core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70142195494420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.6.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70142195494420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: codemirror-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70142195510320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70142195510320
|
36
36
|
description:
|
37
37
|
email: destes@redwindsw.com
|
38
38
|
executables: []
|