spud_cms 0.8.15 → 0.8.17
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.
- data/app/assets/javascripts/spud/admin/cms/application.js +4 -3
- data/app/assets/javascripts/spud/admin/cms/menu_items.js +44 -0
- data/app/assets/stylesheets/spud/admin/cms/application.css +25 -1
- data/app/controllers/spud/admin/menu_items_controller.rb +21 -7
- data/app/controllers/spud/admin/menus_controller.rb +6 -3
- data/app/controllers/spud/admin/pages_controller.rb +16 -24
- data/app/controllers/spud/admin/templates_controller.rb +10 -7
- data/app/models/page_sweeper.rb +11 -4
- data/app/models/spud_page.rb +17 -17
- data/app/views/spud/admin/menu_items/_menu_item_row.html.erb +13 -9
- data/app/views/spud/admin/menu_items/index.html.erb +9 -4
- data/lib/spud_cms/version.rb +1 -1
- data/spec/controllers/spud/admin/cms_controller_spec.rb +6 -0
- data/spec/controllers/spud/admin/pages_controller_spec.rb +119 -0
- data/spec/dummy/app/views/layouts/content_left.html.erb +0 -0
- data/spec/dummy/log/test.log +17234 -0
- data/spec/models/spud_page_spec.rb +107 -1
- metadata +11 -6
- data/spec/dummy/db/schema.rb +0 -156
@@ -37,6 +37,7 @@ describe SpudPage do
|
|
37
37
|
}.should change(SpudPagePartial, :count).from(1).to(0)
|
38
38
|
end
|
39
39
|
|
40
|
+
|
40
41
|
end
|
41
42
|
|
42
43
|
describe "scopes" do
|
@@ -53,6 +54,111 @@ describe SpudPage do
|
|
53
54
|
SpudPage.public.to_sql.should == SpudPage.where(:visibility => 0).to_sql
|
54
55
|
end
|
55
56
|
|
57
|
+
it "should group pages by parent" do
|
58
|
+
parent_page = Factory.build(:spud_page,:name => "parent")
|
59
|
+
parent_page.save
|
60
|
+
|
61
|
+
page = Factory.build(:spud_page,:name => "Page 1")
|
62
|
+
page.spud_page = parent_page
|
63
|
+
page.save
|
64
|
+
page2 = Factory.build(:spud_page,:name => "Page 2")
|
65
|
+
page2.spud_page = parent_page
|
66
|
+
page2.save
|
67
|
+
|
68
|
+
SpudPage.grouped()[parent_page.id].count.should == 2
|
69
|
+
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return private if visibility is == 1" do
|
74
|
+
parent_page = Factory.build(:spud_page,:name => "parent",:visibility => 1)
|
75
|
+
|
76
|
+
parent_page.is_private?.should == true
|
77
|
+
|
78
|
+
parent_page.visibility = 0
|
79
|
+
parent_page.is_private?.should == false
|
80
|
+
end
|
81
|
+
|
82
|
+
|
56
83
|
end
|
57
84
|
|
58
|
-
|
85
|
+
describe "generate_url_name" do
|
86
|
+
it "should add the parent url name if a page has a parent" do
|
87
|
+
# Factory(:spud_page, :name => "test")
|
88
|
+
parent_page = Factory.build(:spud_page,:name => "about")
|
89
|
+
parent_page.save
|
90
|
+
t = Factory.build(:spud_page, :name => "test")
|
91
|
+
t.spud_page = parent_page
|
92
|
+
t.valid?
|
93
|
+
|
94
|
+
t.url_name.should == 'about/test'
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should add a counter to url_name if the url_name is already in use" do
|
99
|
+
page = Factory.build(:spud_page,:name => "testimonials")
|
100
|
+
page.save
|
101
|
+
|
102
|
+
page2 = Factory.build(:spud_page,:name => "testimonials")
|
103
|
+
page2.valid?
|
104
|
+
|
105
|
+
page2.url_name.should == 'testimonials-1'
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should add a counter to url_name if the url_name was once in use by another page that was renamed" do
|
109
|
+
page = Factory.build(:spud_page,:name => "another")
|
110
|
+
page.save
|
111
|
+
page.name = "again"
|
112
|
+
page.save
|
113
|
+
|
114
|
+
page2 = Factory.build(:spud_page,:name => "another")
|
115
|
+
page2.valid?
|
116
|
+
|
117
|
+
page2.url_name.should == 'another-1'
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should destroy historical permalink if a page is renamed back to its previous name" do
|
121
|
+
page = Factory.build(:spud_page,:name => "permapage")
|
122
|
+
page.save
|
123
|
+
|
124
|
+
page.name = 'permapage new'
|
125
|
+
page.save
|
126
|
+
|
127
|
+
page.name = 'permapage'
|
128
|
+
|
129
|
+
basecount = SpudPermalink.count
|
130
|
+
|
131
|
+
lambda {
|
132
|
+
page.valid?
|
133
|
+
}.should change(page.spud_permalinks.where(:url_name => 'permapage'), :count).from(1).to(0)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should not allow a custom url to be reused by another page" do
|
137
|
+
page = Factory.build(:spud_page,:name => "original")
|
138
|
+
page.save
|
139
|
+
|
140
|
+
page = Factory.build(:spud_page,:name => "new",:use_custom_url_name => true,:url_name => "original")
|
141
|
+
|
142
|
+
page.valid?.should == false
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should not allow a custom url to be reused by another page even if it is a historical permalink" do
|
146
|
+
page = Factory.build(:spud_page,:name => "original")
|
147
|
+
page.save
|
148
|
+
page.name = "original2"
|
149
|
+
page.save
|
150
|
+
|
151
|
+
page = Factory.build(:spud_page,:name => "new")
|
152
|
+
page.save
|
153
|
+
page.use_custom_url_name = true
|
154
|
+
page.url_name = 'original'
|
155
|
+
page.valid?.should == false
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
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.8.
|
4
|
+
version: 0.8.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- app/assets/images/spud/admin/pages_thumb.png
|
227
227
|
- app/assets/images/spud/admin/templates_thumb.png
|
228
228
|
- app/assets/javascripts/spud/admin/cms/application.js
|
229
|
+
- app/assets/javascripts/spud/admin/cms/menu_items.js
|
229
230
|
- app/assets/stylesheets/spud/admin/cms/application.css
|
230
231
|
- app/assets/stylesheets/spud/admin/cms.css
|
231
232
|
- app/controllers/pages_controller.rb
|
@@ -294,12 +295,14 @@ files:
|
|
294
295
|
- Rakefile
|
295
296
|
- README.markdown
|
296
297
|
- spec/controllers/spud/admin/cms_controller_spec.rb
|
298
|
+
- spec/controllers/spud/admin/pages_controller_spec.rb
|
297
299
|
- spec/controllers/spud/cms/sitemaps_controller_spec.rb
|
298
300
|
- spec/dummy/app/assets/javascripts/application.js
|
299
301
|
- spec/dummy/app/assets/stylesheets/application.css
|
300
302
|
- spec/dummy/app/controllers/application_controller.rb
|
301
303
|
- spec/dummy/app/helpers/application_helper.rb
|
302
304
|
- spec/dummy/app/views/layouts/application.html.erb
|
305
|
+
- spec/dummy/app/views/layouts/content_left.html.erb
|
303
306
|
- spec/dummy/config/application.rb
|
304
307
|
- spec/dummy/config/boot.rb
|
305
308
|
- spec/dummy/config/database.yml
|
@@ -323,7 +326,7 @@ files:
|
|
323
326
|
- spec/dummy/db/migrate/20120610123556_add_scope_to_spud_admin_permissions.spud_core.rb
|
324
327
|
- spec/dummy/db/migrate/20120610123557_create_spud_user_settings.spud_core.rb
|
325
328
|
- spec/dummy/db/migrate/20120610123615_add_site_id_to_spud_permalinks.spud_permalinks.rb
|
326
|
-
- spec/dummy/
|
329
|
+
- spec/dummy/log/test.log
|
327
330
|
- spec/dummy/public/404.html
|
328
331
|
- spec/dummy/public/422.html
|
329
332
|
- spec/dummy/public/500.html
|
@@ -350,7 +353,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
350
353
|
version: '0'
|
351
354
|
segments:
|
352
355
|
- 0
|
353
|
-
hash:
|
356
|
+
hash: 736450693392698425
|
354
357
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
355
358
|
none: false
|
356
359
|
requirements:
|
@@ -359,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
362
|
version: '0'
|
360
363
|
segments:
|
361
364
|
- 0
|
362
|
-
hash:
|
365
|
+
hash: 736450693392698425
|
363
366
|
requirements: []
|
364
367
|
rubyforge_project:
|
365
368
|
rubygems_version: 1.8.24
|
@@ -368,12 +371,14 @@ specification_version: 3
|
|
368
371
|
summary: Modular CMS Engine
|
369
372
|
test_files:
|
370
373
|
- spec/controllers/spud/admin/cms_controller_spec.rb
|
374
|
+
- spec/controllers/spud/admin/pages_controller_spec.rb
|
371
375
|
- spec/controllers/spud/cms/sitemaps_controller_spec.rb
|
372
376
|
- spec/dummy/app/assets/javascripts/application.js
|
373
377
|
- spec/dummy/app/assets/stylesheets/application.css
|
374
378
|
- spec/dummy/app/controllers/application_controller.rb
|
375
379
|
- spec/dummy/app/helpers/application_helper.rb
|
376
380
|
- spec/dummy/app/views/layouts/application.html.erb
|
381
|
+
- spec/dummy/app/views/layouts/content_left.html.erb
|
377
382
|
- spec/dummy/config/application.rb
|
378
383
|
- spec/dummy/config/boot.rb
|
379
384
|
- spec/dummy/config/database.yml
|
@@ -397,7 +402,7 @@ test_files:
|
|
397
402
|
- spec/dummy/db/migrate/20120610123556_add_scope_to_spud_admin_permissions.spud_core.rb
|
398
403
|
- spec/dummy/db/migrate/20120610123557_create_spud_user_settings.spud_core.rb
|
399
404
|
- spec/dummy/db/migrate/20120610123615_add_site_id_to_spud_permalinks.spud_permalinks.rb
|
400
|
-
- spec/dummy/
|
405
|
+
- spec/dummy/log/test.log
|
401
406
|
- spec/dummy/public/404.html
|
402
407
|
- spec/dummy/public/422.html
|
403
408
|
- spec/dummy/public/500.html
|
data/spec/dummy/db/schema.rb
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended to check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(:version => 20120610123615) do
|
15
|
-
|
16
|
-
create_table "spud_admin_permissions", :force => true do |t|
|
17
|
-
t.integer "user_id"
|
18
|
-
t.string "name"
|
19
|
-
t.boolean "access"
|
20
|
-
t.datetime "created_at", :null => false
|
21
|
-
t.datetime "updated_at", :null => false
|
22
|
-
t.string "scope"
|
23
|
-
end
|
24
|
-
|
25
|
-
create_table "spud_menu_items", :force => true do |t|
|
26
|
-
t.string "parent_type"
|
27
|
-
t.integer "parent_id"
|
28
|
-
t.integer "item_type"
|
29
|
-
t.integer "spud_page_id"
|
30
|
-
t.integer "menu_order", :default => 0
|
31
|
-
t.string "url"
|
32
|
-
t.datetime "created_at", :null => false
|
33
|
-
t.datetime "updated_at", :null => false
|
34
|
-
t.string "name"
|
35
|
-
t.integer "spud_menu_id"
|
36
|
-
t.string "classes"
|
37
|
-
end
|
38
|
-
|
39
|
-
add_index "spud_menu_items", ["menu_order"], :name => "index_spud_menu_items_on_menu_order"
|
40
|
-
add_index "spud_menu_items", ["parent_type", "parent_id"], :name => "index_spud_menu_items_on_parent_type_and_parent_id"
|
41
|
-
add_index "spud_menu_items", ["spud_menu_id"], :name => "index_spud_menu_items_on_spud_menu_id"
|
42
|
-
|
43
|
-
create_table "spud_menus", :force => true do |t|
|
44
|
-
t.string "name"
|
45
|
-
t.text "description"
|
46
|
-
t.datetime "created_at", :null => false
|
47
|
-
t.datetime "updated_at", :null => false
|
48
|
-
t.integer "site_id"
|
49
|
-
end
|
50
|
-
|
51
|
-
add_index "spud_menus", ["site_id"], :name => "index_spud_menus_on_site_id"
|
52
|
-
|
53
|
-
create_table "spud_page_partial_revisions", :force => true do |t|
|
54
|
-
t.string "name"
|
55
|
-
t.text "content"
|
56
|
-
t.string "format"
|
57
|
-
t.integer "spud_page_id"
|
58
|
-
t.datetime "created_at", :null => false
|
59
|
-
t.datetime "updated_at", :null => false
|
60
|
-
end
|
61
|
-
|
62
|
-
add_index "spud_page_partial_revisions", ["spud_page_id", "name"], :name => "revision_idx"
|
63
|
-
|
64
|
-
create_table "spud_page_partials", :force => true do |t|
|
65
|
-
t.integer "spud_page_id"
|
66
|
-
t.string "name"
|
67
|
-
t.text "content"
|
68
|
-
t.string "format"
|
69
|
-
t.datetime "created_at", :null => false
|
70
|
-
t.datetime "updated_at", :null => false
|
71
|
-
end
|
72
|
-
|
73
|
-
add_index "spud_page_partials", ["spud_page_id"], :name => "index_spud_page_partials_on_spud_page_id"
|
74
|
-
|
75
|
-
create_table "spud_pages", :force => true do |t|
|
76
|
-
t.string "name"
|
77
|
-
t.string "url_name"
|
78
|
-
t.datetime "publish_at"
|
79
|
-
t.integer "created_by"
|
80
|
-
t.integer "updated_by"
|
81
|
-
t.string "format", :default => "html"
|
82
|
-
t.integer "spud_page_id"
|
83
|
-
t.text "meta_description"
|
84
|
-
t.string "meta_keywords"
|
85
|
-
t.integer "page_order"
|
86
|
-
t.integer "template_id"
|
87
|
-
t.datetime "created_at", :null => false
|
88
|
-
t.datetime "updated_at", :null => false
|
89
|
-
t.integer "visibility", :default => 0
|
90
|
-
t.boolean "published", :default => true
|
91
|
-
t.boolean "use_custom_url_name", :default => false
|
92
|
-
t.text "notes"
|
93
|
-
t.integer "site_id"
|
94
|
-
end
|
95
|
-
|
96
|
-
add_index "spud_pages", ["site_id"], :name => "index_spud_pages_on_site_id"
|
97
|
-
|
98
|
-
create_table "spud_permalinks", :force => true do |t|
|
99
|
-
t.string "url_name"
|
100
|
-
t.string "attachment_type"
|
101
|
-
t.integer "attachment_id"
|
102
|
-
t.datetime "created_at", :null => false
|
103
|
-
t.datetime "updated_at", :null => false
|
104
|
-
t.integer "site_id"
|
105
|
-
end
|
106
|
-
|
107
|
-
add_index "spud_permalinks", ["attachment_type", "attachment_id"], :name => "index_spud_permalinks_on_attachment_type_and_attachment_id"
|
108
|
-
add_index "spud_permalinks", ["site_id"], :name => "index_spud_permalinks_on_site_id"
|
109
|
-
|
110
|
-
create_table "spud_templates", :force => true do |t|
|
111
|
-
t.string "name"
|
112
|
-
t.string "base_layout"
|
113
|
-
t.text "content"
|
114
|
-
t.text "page_parts"
|
115
|
-
t.datetime "created_at", :null => false
|
116
|
-
t.datetime "updated_at", :null => false
|
117
|
-
t.integer "site_id"
|
118
|
-
end
|
119
|
-
|
120
|
-
add_index "spud_templates", ["site_id"], :name => "index_spud_templates_on_site_id"
|
121
|
-
|
122
|
-
create_table "spud_user_settings", :force => true do |t|
|
123
|
-
t.integer "spud_user_id"
|
124
|
-
t.string "key"
|
125
|
-
t.string "value"
|
126
|
-
t.datetime "created_at", :null => false
|
127
|
-
t.datetime "updated_at", :null => false
|
128
|
-
end
|
129
|
-
|
130
|
-
create_table "spud_users", :force => true do |t|
|
131
|
-
t.string "first_name"
|
132
|
-
t.string "last_name"
|
133
|
-
t.boolean "super_admin"
|
134
|
-
t.string "login", :null => false
|
135
|
-
t.string "email", :null => false
|
136
|
-
t.string "crypted_password", :null => false
|
137
|
-
t.string "password_salt", :null => false
|
138
|
-
t.string "persistence_token", :null => false
|
139
|
-
t.string "single_access_token", :null => false
|
140
|
-
t.string "perishable_token", :null => false
|
141
|
-
t.integer "login_count", :default => 0, :null => false
|
142
|
-
t.integer "failed_login_count", :default => 0, :null => false
|
143
|
-
t.datetime "last_request_at"
|
144
|
-
t.datetime "current_login_at"
|
145
|
-
t.datetime "last_login_at"
|
146
|
-
t.string "current_login_ip"
|
147
|
-
t.string "last_login_ip"
|
148
|
-
t.datetime "created_at", :null => false
|
149
|
-
t.datetime "updated_at", :null => false
|
150
|
-
t.string "time_zone"
|
151
|
-
end
|
152
|
-
|
153
|
-
add_index "spud_users", ["email"], :name => "index_spud_users_on_email"
|
154
|
-
add_index "spud_users", ["login"], :name => "index_spud_users_on_login"
|
155
|
-
|
156
|
-
end
|