tb_cms 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.markdown +1 -1
- data/app/assets/javascripts/{spud/admin → admin}/cms/application.js +2 -2
- data/app/controllers/{spud/admin → admin}/menu_items_controller.rb +13 -14
- data/app/controllers/{spud/admin → admin}/menus_controller.rb +11 -12
- data/app/controllers/{spud/admin → admin}/pages_controller.rb +11 -12
- data/app/controllers/{spud/admin → admin}/snippets_controller.rb +11 -13
- data/app/controllers/{spud/cms → cms}/sitemaps_controller.rb +1 -1
- data/app/helpers/{spud/cms → cms}/application_helper.rb +1 -1
- data/app/observers/page_sweeper.rb +2 -2
- data/app/views/{spud/admin → admin}/menu_items/_menu_item_row.html.erb +2 -2
- data/app/views/admin/menu_items/edit.html.erb +10 -0
- data/app/views/{spud/admin → admin}/menu_items/index.html.erb +1 -1
- data/app/views/admin/menu_items/new.html.erb +12 -0
- data/app/views/{spud/admin → admin}/menus/edit.html.erb +2 -2
- data/app/views/admin/menus/index.html.erb +24 -0
- data/app/views/{spud/admin → admin}/menus/new.html.erb +2 -2
- data/app/views/{spud/admin → admin}/pages/_form.html.erb +1 -1
- data/app/views/admin/pages/_page_row.html.erb +18 -0
- data/app/views/{spud/admin → admin}/pages/edit.html.erb +2 -2
- data/app/views/{spud/admin → admin}/pages/index.html.erb +1 -1
- data/app/views/{spud/admin → admin}/pages/new.html.erb +2 -2
- data/app/views/admin/snippets/edit.html.erb +7 -0
- data/app/views/admin/snippets/index.html.erb +24 -0
- data/app/views/{spud/admin → admin}/snippets/new.html.erb +2 -2
- data/app/views/admin/templates/edit.html.erb +9 -0
- data/app/views/admin/templates/index.html.erb +17 -0
- data/app/views/{spud/admin → admin}/templates/new.html.erb +2 -2
- data/config/routes.rb +21 -22
- data/lib/spud_cms/engine.rb +8 -8
- data/lib/spud_cms/template_parser.rb +1 -1
- data/lib/spud_cms/version.rb +1 -1
- data/spec/controllers/{spud/admin → admin}/menu_items_controller_spec.rb +4 -4
- data/spec/controllers/{spud/admin → admin}/menus_controller_spec.rb +4 -4
- data/spec/controllers/{spud/admin → admin}/pages_controller_spec.rb +11 -3
- data/spec/controllers/admin/snippets_controller_spec.rb +5 -0
- data/spec/controllers/{spud/cms → cms}/sitemaps_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +1 -1
- data/spec/dummy/db/migrate/20120307003559_create_spud_permalinks.spud_permalinks.rb +1 -1
- data/spec/dummy/db/migrate/20120610123556_add_scope_to_spud_admin_permissions.spud_core.rb +1 -1
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/dummy/log/test.log +7557 -0
- data/spec/helpers/{spud/cms → cms}/application_helper_spec.rb +1 -1
- metadata +51 -57
- data/app/assets/javascripts/spud/admin/snippets.js +0 -2
- data/app/assets/stylesheets/spud/admin/cms.css +0 -4
- data/app/assets/stylesheets/spud/admin/snippets.css +0 -4
- data/app/controllers/spud/admin/cms_controller.rb +0 -3
- data/app/views/spud/admin/menu_items/edit.html.erb +0 -10
- data/app/views/spud/admin/menu_items/new.html.erb +0 -12
- data/app/views/spud/admin/menus/index.html.erb +0 -24
- data/app/views/spud/admin/pages/_page_row.html.erb +0 -18
- data/app/views/spud/admin/snippets/edit.html.erb +0 -7
- data/app/views/spud/admin/snippets/index.html.erb +0 -24
- data/app/views/spud/admin/templates/edit.html.erb +0 -9
- data/app/views/spud/admin/templates/index.html.erb +0 -17
- data/spec/controllers/spud/admin/cms_controller_spec.rb +0 -11
- data/spec/controllers/spud/admin/snippets_controller_spec.rb +0 -5
- /data/app/assets/javascripts/{spud/admin → admin}/cms/menu_items.js +0 -0
- /data/app/assets/javascripts/{spud/admin → admin}/cms/pages.js +0 -0
- /data/app/assets/stylesheets/{spud/admin → admin}/cms/application.css +0 -0
- /data/app/views/{spud/admin → admin}/menu_items/_form.html.erb +0 -0
- /data/app/views/{spud/admin → admin}/menus/_form.html.erb +0 -0
- /data/app/views/{spud/admin → admin}/pages/_page_partials_form.html.erb +0 -0
- /data/app/views/{spud/admin → admin}/pages/show.html.erb +0 -0
- /data/app/views/{spud/admin → admin}/snippets/_form.html.erb +0 -0
- /data/app/views/{spud/admin → admin}/templates/_form.html.erb +0 -0
- /data/app/views/{spud/cms → cms}/sitemaps/show.xml.builder +0 -0
data/config/routes.rb
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
namespace :spud do
|
3
|
-
namespace :admin do
|
4
|
-
resources :pages do
|
5
|
-
get :page_parts, :on => :collection
|
6
|
-
get :clear, :on => :collection
|
7
|
-
member do
|
8
|
-
post 'preview'
|
9
|
-
end
|
10
|
-
end
|
11
2
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
namespace :cms do
|
20
|
-
resource :sitemap,:only => "show"
|
21
|
-
end
|
3
|
+
namespace :admin do
|
4
|
+
resources :pages do
|
5
|
+
get :page_parts, :on => :collection
|
6
|
+
get :clear, :on => :collection
|
7
|
+
member do
|
8
|
+
post 'preview'
|
9
|
+
end
|
22
10
|
end
|
23
|
-
|
11
|
+
resources :snippets
|
12
|
+
resources :menus do
|
13
|
+
resources :menu_items
|
14
|
+
end
|
15
|
+
resources :contacts
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :cms do
|
19
|
+
resource :sitemap,:only => "show"
|
20
|
+
end
|
21
|
+
|
22
|
+
root :to => 'pages#show'
|
24
23
|
|
25
|
-
|
26
|
-
|
24
|
+
# This is located in lib/spud_cms/page_route.rb to make sure it is loaded last
|
25
|
+
# match "*id", :controller => "pages",:action => "show", :as => "page"
|
27
26
|
|
28
27
|
end
|
29
28
|
|
data/lib/spud_cms/engine.rb
CHANGED
@@ -14,17 +14,17 @@ module Spud
|
|
14
14
|
|
15
15
|
initializer :admin do
|
16
16
|
Spud::Core.configure do |config|
|
17
|
-
config.admin_applications += [{:name => "Pages",:thumbnail => "spud/admin/pages_thumb.png",:url => "/
|
17
|
+
config.admin_applications += [{:name => "Pages",:thumbnail => "spud/admin/pages_thumb.png",:url => "/admin/pages",:order => 0}]
|
18
18
|
if Spud::Cms.menus_enabled
|
19
|
-
config.admin_applications += [{:name => "Menus",:thumbnail => "spud/admin/menus_thumb.png",:url => "/
|
19
|
+
config.admin_applications += [{:name => "Menus",:thumbnail => "spud/admin/menus_thumb.png",:url => "/admin/menus",:order => 2}]
|
20
20
|
end
|
21
21
|
|
22
22
|
if Spud::Cms.snippets_enabled
|
23
|
-
config.admin_applications += [{:name => "Snippets",:thumbnail => "spud/admin/snippets_thumb.png",:url => "/
|
23
|
+
config.admin_applications += [{:name => "Snippets",:thumbnail => "spud/admin/snippets_thumb.png",:url => "/admin/snippets",:order => 3}]
|
24
24
|
end
|
25
25
|
|
26
26
|
if Spud::Cms.enable_sitemap == true
|
27
|
-
config.sitemap_urls += [:
|
27
|
+
config.sitemap_urls += [:cms_sitemap_url]
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -36,7 +36,7 @@ module Spud
|
|
36
36
|
end
|
37
37
|
initializer :cms_sweepers do |config|
|
38
38
|
if ActiveRecord::Base.connection.tables.include?('spud_pages')
|
39
|
-
|
39
|
+
Admin::ApplicationController.instance_eval do
|
40
40
|
cache_sweeper :page_sweeper, :except => [:show,:index]
|
41
41
|
end
|
42
42
|
end
|
@@ -47,9 +47,9 @@ module Spud
|
|
47
47
|
end
|
48
48
|
|
49
49
|
initializer :assets do |config|
|
50
|
-
Rails.application.config.assets.precompile += ["
|
51
|
-
Spud::Core.append_admin_javascripts('
|
52
|
-
Spud::Core.append_admin_stylesheets('
|
50
|
+
Rails.application.config.assets.precompile += ["admin/cms*"]
|
51
|
+
Spud::Core.append_admin_javascripts('admin/cms/application')
|
52
|
+
Spud::Core.append_admin_stylesheets('admin/cms/application')
|
53
53
|
end
|
54
54
|
|
55
55
|
initializer :liquid do |config|
|
@@ -73,7 +73,7 @@ module Spud
|
|
73
73
|
|
74
74
|
def check_for_defaults(layouts)
|
75
75
|
default_layout_path = layout_path(Rails.application.root.join('app','views','layouts',Spud::Cms.default_page_layout))
|
76
|
-
puts(layouts)
|
76
|
+
#puts(layouts)
|
77
77
|
if layouts[default_layout_path].blank?
|
78
78
|
layouts[default_layout_path] = {:template_name => "Default", :partials => ["Body"], :sites => [Spud::Core.short_name.downcase], :default => true}
|
79
79
|
else
|
data/lib/spud_cms/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Admin::MenuItemsController do
|
4
4
|
before(:each) do
|
5
5
|
ActiveRecord::Base.observers.disable(:page_sweeper)
|
6
6
|
|
@@ -28,7 +28,7 @@ describe Spud::Admin::MenuItemsController do
|
|
28
28
|
end
|
29
29
|
it "should redirect if the menu is not found" do
|
30
30
|
get :index,:menu_id => @menu.id + 1
|
31
|
-
response.should redirect_to
|
31
|
+
response.should redirect_to admin_menus_url
|
32
32
|
flash[:error].should_not be_blank
|
33
33
|
end
|
34
34
|
end
|
@@ -87,7 +87,7 @@ describe Spud::Admin::MenuItemsController do
|
|
87
87
|
|
88
88
|
it "should redirect_to index if menu item not found" do
|
89
89
|
get :edit,:menu_id => @menu.id,:id => "345"
|
90
|
-
response.should redirect_to
|
90
|
+
response.should redirect_to admin_menu_menu_items_url(:menu_id => @menu.id)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -139,7 +139,7 @@ describe Spud::Admin::MenuItemsController do
|
|
139
139
|
it "should not allow editing of a menu_item in a menu that is different from the current admin site" do
|
140
140
|
menu_item = FactoryGirl.create(:spud_menu_item)
|
141
141
|
get :edit,:id => menu_item.id,:menu_id => @menu.id
|
142
|
-
response.should redirect_to
|
142
|
+
response.should redirect_to admin_menus_url
|
143
143
|
flash[:warning].should_not be_blank
|
144
144
|
end
|
145
145
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Admin::MenusController do
|
4
4
|
before(:each) do
|
5
5
|
activate_authlogic
|
6
6
|
u = SpudUser.new(:login => "testuser",:email => "test@testuser.com",:password => "test",:password_confirmation => "test")
|
@@ -63,7 +63,7 @@ describe Spud::Admin::MenusController do
|
|
63
63
|
menu2 = FactoryGirl.create(:spud_menu,:site_id => 1)
|
64
64
|
get :edit,:id => menu2.id
|
65
65
|
|
66
|
-
response.should redirect_to
|
66
|
+
response.should redirect_to admin_menus_url
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -76,7 +76,7 @@ describe Spud::Admin::MenusController do
|
|
76
76
|
end
|
77
77
|
it "should redirect to index if menu not found" do
|
78
78
|
get :edit,:id => 3
|
79
|
-
response.should redirect_to
|
79
|
+
response.should redirect_to admin_menus_url
|
80
80
|
end
|
81
81
|
|
82
82
|
end
|
@@ -96,7 +96,7 @@ describe Spud::Admin::MenusController do
|
|
96
96
|
menu = FactoryGirl.create(:spud_menu)
|
97
97
|
put :update,:id => menu.id,:spud_menu => menu.attributes.merge!(:name => "MyMenu").reject{|k,v| k == 'site_id' || k == 'id'}
|
98
98
|
|
99
|
-
response.should redirect_to(
|
99
|
+
response.should redirect_to(admin_menu_menu_items_url(:menu_id => menu.id))
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe Admin::PagesController do
|
4
4
|
before(:each) do
|
5
5
|
activate_authlogic
|
6
6
|
u = SpudUser.new(:login => "testuser",:email => "test@testuser.com",:password => "test",:password_confirmation => "test")
|
@@ -9,6 +9,14 @@ describe Spud::Admin::PagesController do
|
|
9
9
|
@user = SpudUserSession.create(u)
|
10
10
|
end
|
11
11
|
|
12
|
+
it "should return site_config by short_name" do
|
13
|
+
Spud::Cms.configure do |config|
|
14
|
+
config.multisite_config = [{:short_name => "siteb",:site_name => "Test Site B",:site_id => 2}]
|
15
|
+
end
|
16
|
+
|
17
|
+
Spud::Cms.site_config_for_short_name(:siteb)[:site_id].should == 2
|
18
|
+
end
|
19
|
+
|
12
20
|
describe :index do
|
13
21
|
it "should return an array of parent pages" do
|
14
22
|
2.times {|x| s = FactoryGirl.create(:spud_page)}
|
@@ -39,7 +47,7 @@ describe Spud::Admin::PagesController do
|
|
39
47
|
# it "should redirect if no id specified" do
|
40
48
|
# get :show,:id => nil
|
41
49
|
|
42
|
-
# response.should redirect_to
|
50
|
+
# response.should redirect_to admin_pages_url
|
43
51
|
# end
|
44
52
|
|
45
53
|
end
|
@@ -86,7 +94,7 @@ describe Spud::Admin::PagesController do
|
|
86
94
|
new_name = "Adam"
|
87
95
|
put :update, :id => page.id, :spud_page => page.attributes.merge!(:name => new_name).reject{ |key,value| key == 'id' || key == 'created_at' || key == 'updated_at' || key == 'site_id'}
|
88
96
|
|
89
|
-
response.should redirect_to(
|
97
|
+
response.should redirect_to(admin_pages_url)
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
@@ -43,7 +43,7 @@ describe PagesController do
|
|
43
43
|
page = FactoryGirl.create(:spud_page,:name => "about",:visibility => 1)
|
44
44
|
|
45
45
|
get :show, :id => "about"
|
46
|
-
response.should redirect_to
|
46
|
+
response.should redirect_to login_path
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "page caching" do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This migration comes from spud_permalinks (originally 20120306195503)
|
2
2
|
class CreateSpudPermalinks < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
create_table :
|
4
|
+
create_table :spud_admin_permalinks do |t|
|
5
5
|
t.string :url_name
|
6
6
|
t.string :attachment_type
|
7
7
|
t.integer :attachment_id
|
data/spec/dummy/db/schema.rb
CHANGED