brightcontent-pages 2.0.17 → 2.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +6 -6
- data/app/models/brightcontent/page.rb +1 -33
- data/app/models/brightcontent/page_core.rb +43 -0
- metadata +9 -8
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brightcontent-pages (2.0.
|
4
|
+
brightcontent-pages (2.0.18)
|
5
5
|
awesome_nested_set
|
6
|
-
brightcontent-attachments (= 2.0.
|
7
|
-
brightcontent-core (= 2.0.
|
6
|
+
brightcontent-attachments (= 2.0.18)
|
7
|
+
brightcontent-core (= 2.0.18)
|
8
8
|
|
9
9
|
PATH
|
10
10
|
remote: ../attachments
|
11
11
|
specs:
|
12
|
-
brightcontent-attachments (2.0.
|
13
|
-
brightcontent-core (= 2.0.
|
12
|
+
brightcontent-attachments (2.0.18)
|
13
|
+
brightcontent-core (= 2.0.18)
|
14
14
|
jquery-fileupload-rails
|
15
15
|
paperclip
|
16
16
|
|
17
17
|
PATH
|
18
18
|
remote: ../core
|
19
19
|
specs:
|
20
|
-
brightcontent-core (2.0.
|
20
|
+
brightcontent-core (2.0.18)
|
21
21
|
bcrypt-ruby
|
22
22
|
bootstrap-wysihtml5-rails
|
23
23
|
has_scope
|
@@ -1,37 +1,5 @@
|
|
1
1
|
module Brightcontent
|
2
2
|
class Page < ActiveRecord::Base
|
3
|
-
|
4
|
-
acts_as_nested_set
|
5
|
-
include Brightcontent::Attachable
|
6
|
-
|
7
|
-
validates_presence_of :name
|
8
|
-
after_save :update_slug
|
9
|
-
|
10
|
-
def self.default_scope
|
11
|
-
order(:lft)
|
12
|
-
end
|
13
|
-
|
14
|
-
def homepage?
|
15
|
-
lft == 1
|
16
|
-
end
|
17
|
-
|
18
|
-
def attachment_styles
|
19
|
-
Brightcontent.page_attachment_styles
|
20
|
-
end
|
21
|
-
|
22
|
-
def root_parent_children
|
23
|
-
root? ? children : ancestors.first.children
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def update_slug
|
29
|
-
self.update_column(:slug, slug_name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def slug_name
|
33
|
-
homepage? ? "" : self_and_ancestors.map { |p| p.name.parameterize }.join("/")
|
34
|
-
end
|
35
|
-
|
3
|
+
include Brightcontent::PageCore
|
36
4
|
end
|
37
5
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Brightcontent
|
2
|
+
module PageCore
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attr_accessible :body, :name, :parent_id, :hidden
|
7
|
+
acts_as_nested_set
|
8
|
+
include Brightcontent::Attachable
|
9
|
+
|
10
|
+
validates_presence_of :name
|
11
|
+
after_save :update_slug
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def default_scope
|
16
|
+
order(:lft)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def homepage?
|
21
|
+
lft == 1
|
22
|
+
end
|
23
|
+
|
24
|
+
def attachment_styles
|
25
|
+
Brightcontent.page_attachment_styles
|
26
|
+
end
|
27
|
+
|
28
|
+
def root_parent_children
|
29
|
+
root? ? children : ancestors.first.children
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def update_slug
|
35
|
+
self.update_column(:slug, slug_name)
|
36
|
+
end
|
37
|
+
|
38
|
+
def slug_name
|
39
|
+
homepage? ? "" : self_and_ancestors.map { |p| p.name.parameterize }.join("/")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightcontent-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.18
|
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: 2013-01-
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: brightcontent-core
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.18
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.18
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: brightcontent-attachments
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - '='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.0.
|
37
|
+
version: 2.0.18
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - '='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.0.
|
45
|
+
version: 2.0.18
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: awesome_nested_set
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- app/controllers/brightcontent/pages_controller.rb
|
154
154
|
- app/helpers/brightcontent/pages_helper.rb
|
155
155
|
- app/models/brightcontent/page.rb
|
156
|
+
- app/models/brightcontent/page_core.rb
|
156
157
|
- app/views/brightcontent/pages/_form_field_body.html.erb
|
157
158
|
- app/views/brightcontent/pages/_form_field_parent_id.html.erb
|
158
159
|
- app/views/brightcontent/pages/_list_field_name.html.erb
|
@@ -228,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
229
|
version: '0'
|
229
230
|
segments:
|
230
231
|
- 0
|
231
|
-
hash:
|
232
|
+
hash: -1183033676360603863
|
232
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
234
|
none: false
|
234
235
|
requirements:
|
@@ -237,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
238
|
version: '0'
|
238
239
|
segments:
|
239
240
|
- 0
|
240
|
-
hash:
|
241
|
+
hash: -1183033676360603863
|
241
242
|
requirements: []
|
242
243
|
rubyforge_project:
|
243
244
|
rubygems_version: 1.8.24
|