sibu 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/sibu/pages_controller.rb +1 -1
- data/app/models/sibu/page.rb +8 -0
- data/app/models/sibu/site.rb +1 -1
- data/lib/sibu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f546bd4008bbe0847d6328ae30fd34f0feb06f8
|
4
|
+
data.tar.gz: 9734a6b7db39f25dd1a9de72feeafe551d49d302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3b58626ea0c86f6384d4cd7207733333077bf3bde3fc46c1729718658745c34ac0cf4497e5396f681e33df754195c7141048ff1248db26309e7da9b37e31563
|
7
|
+
data.tar.gz: 84cac6c6ffe0dd30976f762d3d14c05fc3862eea70c51da8edce32e744bedfd989667fb676aa8f5905419616be61c215d3bc668b9be30e238ac73209922fc7b4
|
@@ -38,7 +38,7 @@ module Sibu
|
|
38
38
|
|
39
39
|
def create
|
40
40
|
@page = Sibu::Page.new(page_params)
|
41
|
-
if @page.
|
41
|
+
if @page.save_and_init
|
42
42
|
redirect_to site_pages_url(@page.site_id), notice: "La page a bien été créée."
|
43
43
|
else
|
44
44
|
flash.now[:alert] = "Une erreur s'est produite lors de la création de la page."
|
data/app/models/sibu/page.rb
CHANGED
@@ -7,5 +7,13 @@ module Sibu
|
|
7
7
|
store :metadata, accessors: [:title, :description], coder: JSON
|
8
8
|
|
9
9
|
validates_presence_of :name, :site, :language, :template
|
10
|
+
|
11
|
+
def save_and_init
|
12
|
+
if valid?
|
13
|
+
template_defaults = site.site_template.pages.select {|p| p[:template] == template}.first
|
14
|
+
self.sections = template_defaults[:sections] if template_defaults
|
15
|
+
end
|
16
|
+
save
|
17
|
+
end
|
10
18
|
end
|
11
19
|
end
|
data/app/models/sibu/site.rb
CHANGED
data/lib/sibu/version.rb
CHANGED