sibu 0.1.28 → 0.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/sibu/Sibu.eot +0 -0
- data/app/assets/fonts/sibu/Sibu.svg +14 -0
- data/app/assets/fonts/sibu/Sibu.ttf +0 -0
- data/app/assets/fonts/sibu/Sibu.woff +0 -0
- data/app/assets/javascripts/sibu/sibu.js.erb +43 -1
- data/app/assets/stylesheets/sibu/icons.scss +41 -0
- data/app/assets/stylesheets/sibu/sibu.css +49 -0
- data/app/helpers/sibu/pages_helper.rb +0 -1
- data/app/models/concerns/sibu/sections_concern.rb +3 -7
- data/app/models/sibu/dynamic_style.rb +70 -0
- data/app/models/sibu/site.rb +1 -1
- data/app/views/layouts/sibu/edit_content.html.erb +2 -2
- data/lib/sibu/engine.rb +1 -0
- data/lib/sibu/version.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8802ba0633e1ea408940f8a1501e0c626d3cd97
|
4
|
+
data.tar.gz: c3c3a46644d59de28ffd144f000fc0ba23c5c6e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97695f4f2b0f2f4dcf0fca09276ddfd225010468c257596b48d525ff2f6652d359f291a1b7e483eec3d0297088b2f9b50ed746ba670d5de414bfe4b5637c9c85
|
7
|
+
data.tar.gz: 9cda5333a49d2fd2cd2741808c33786e1ebb1e41a47b27b8a9d11ffd829f81fe315e9dbc15a17e1fe23ebe18042b2aa080b1b65f3f031387cfe9ec6b6476538c
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<metadata>Generated by IcoMoon</metadata>
|
5
|
+
<defs>
|
6
|
+
<font id="Sibu" horiz-adv-x="1024">
|
7
|
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8
|
+
<missing-glyph horiz-adv-x="1024" />
|
9
|
+
<glyph unicode=" " horiz-adv-x="512" d="" />
|
10
|
+
<glyph unicode="" glyph-name="facebook" d="M771.755 960h-132.779c-149.163 0-245.76-98.987-245.76-251.904v-116.053h-133.461c-0.001 0-0.002 0-0.003 0-11.499 0-20.821-9.322-20.821-20.821 0-0.12 0.001-0.24 0.003-0.359v0.018-168.277c0-11.499 9.322-20.821 20.821-20.821h133.461v-424.96c0-11.499 9.322-20.821 20.821-20.821h174.080c11.499 0 20.821 9.322 20.821 20.821v0 424.96h156.331c11.499 0 20.821 9.322 20.821 20.821v0 168.277c0 11.499-9.322 20.821-20.821 20.821v0h-155.989v98.645c0 47.445 11.264 71.339 73.045 71.339h89.429c0.102-0.002 0.221-0.003 0.341-0.003 11.499 0 20.821 9.322 20.821 20.821 0 0.001 0 0.002 0 0.003v0 156.331c0.002 0.102 0.003 0.223 0.003 0.344 0 11.499-9.322 20.821-20.821 20.821-0.121 0-0.242-0.001-0.362-0.003h0.018z" />
|
11
|
+
<glyph unicode="" glyph-name="pinterest" d="M802.816 854.869c-69.838 64.965-163.785 104.836-267.044 104.836-2.118 0-4.231-0.017-6.341-0.050l0.318 0.004c-4.907 0.2-10.667 0.314-16.454 0.314-117.598 0-224.216-47.012-302.085-123.267l0.075 0.073c-65.636-64.324-106.924-153.279-108.88-251.88l-0.006-0.365c0-114.005 47.787-201.387 127.659-234.155 4.726-2.078 10.227-3.326 16.010-3.413h0.033c0.131-0.002 0.285-0.003 0.439-0.003 16.924 0 30.971 12.317 33.667 28.475l0.027 0.199c2.731 10.24 8.875 34.133 11.605 46.080 1.664 4.4 2.627 9.488 2.627 14.8 0 12.669-5.478 24.059-14.194 31.929l-0.038 0.034c-21.351 25.578-34.315 58.804-34.315 95.058 0 2.582 0.066 5.15 0.196 7.7l-0.015-0.358c-0.004 0.509-0.006 1.11-0.006 1.712 0 140.787 113.648 255.030 254.207 255.994h11.697c136.533 0 221.867-77.824 221.867-202.752 0.070-2.87 0.11-6.25 0.11-9.64 0-71.34-17.722-138.542-49.003-197.442l1.106 2.282c-21.355-45.576-65.026-77.523-116.556-81.884l-0.521-0.036c-0.508-0.012-1.107-0.019-1.708-0.019-24.13 0-45.694 10.982-59.969 28.22l-0.104 0.13c-9.346 11.908-14.989 27.111-14.989 43.631 0 6.453 0.861 12.706 2.474 18.648l-0.115-0.497c6.144 25.941 14.336 52.907 22.528 78.848 14.36 37.026 24.631 79.974 28.864 124.68l0.15 1.955c0.322 2.907 0.505 6.277 0.505 9.691 0 48.156-36.528 87.78-83.388 92.675l-0.402 0.034h-10.24c-71.339 0-126.976-72.363-126.976-164.523-0.042-1.69-0.066-3.679-0.066-5.675 0-31.077 5.784-60.803 16.335-88.161l-0.568 1.676-70.997-305.493c-5.803-24.917-40.96-221.525 17.067-237.227 65.536-17.749 124.245 173.739 130.048 195.584s21.845 83.968 32.085 124.928c34.35-31.666 80.16-51.36 130.558-52.222l0.173-0.002c0.91-0.010 1.984-0.016 3.060-0.016 96.167 0 181.57 46.082 235.333 117.369l0.54 0.748c55.806 76.896 89.272 173.161 89.272 277.243 0 4.653-0.067 9.29-0.2 13.911l0.015-0.679c-1.113 94.744-41.363 179.873-105.305 240.142l-0.167 0.156z" />
|
12
|
+
<glyph unicode="" glyph-name="twitter" d="M1024 759.296c-35.043-16.331-75.7-28.326-118.374-33.907l-2.117-0.226c43.313 26.322 75.883 66.637 91.733 114.563l0.427 1.49c-38.425-23.098-83.134-40.74-130.741-50.398l-2.72-0.461c-38.389 40.374-92.502 65.487-152.48 65.487-116.124 0-210.261-94.137-210.261-210.261 0-16.193 1.831-31.959 5.296-47.102l-0.272 1.412c-175.064 8.961-329.067 92.127-432.307 218.411l-0.845 1.066c-17.885-30.274-28.451-66.711-28.451-105.617 0-72.662 36.858-136.715 92.897-174.484l0.749-0.475c-35.125 1.149-67.771 10.753-96.282 26.827l1.050-0.544v-2.731c0.642-100.85 72.185-184.805 167.255-204.563l1.363-0.237c-16.564-4.704-35.596-7.44-55.257-7.509h-0.039c-0.251-0.001-0.549-0.002-0.846-0.002-13.709 0-27.099 1.367-40.040 3.973l1.291-0.217c27.574-84.217 104.673-144.304 196.058-146.087l0.208-0.003c-70.883-55.966-161.519-89.771-260.051-89.771-0.256 0-0.511 0-0.767 0.001h0.039c-1.248-0.013-2.723-0.020-4.2-0.020-16.315 0-32.425 0.875-48.286 2.581l1.968-0.172c90.847-59.286 202.061-94.549 321.512-94.549 0.129 0 0.257 0 0.386 0h-0.021c386.389 0 597.675 320.171 597.675 597.675v27.307c41.225 29.917 75.903 65.899 103.494 107.033l0.954 1.511z" />
|
13
|
+
<glyph unicode="" glyph-name="instagram" d="M741.376 960h-458.752c-156.011-0.194-282.43-126.613-282.624-282.606v-458.77c0.194-156.011 126.613-282.43 282.606-282.624h458.77c156.011 0.194 282.43 126.613 282.624 282.606v458.77c-0.194 156.011-126.613 282.43-282.606 282.624h-0.018zM933.205 218.624c0-105.944-85.885-191.829-191.829-191.829v0h-458.752c-105.944 0-191.829 85.885-191.829 191.829v458.752c0 105.944 85.885 191.829 191.829 191.829v0h458.752c105.944 0 191.829-85.885 191.829-191.829v0-458.752zM512 711.851c-145.721 0-263.851-118.13-263.851-263.851s118.13-263.851 263.851-263.851c145.721 0 263.851 118.13 263.851 263.851v0c-0.194 145.643-118.208 263.657-263.832 263.851h-0.019zM512 274.944c-95.576 0-173.056 77.48-173.056 173.056s77.48 173.056 173.056 173.056c95.576 0 173.056-77.48 173.056-173.056v0c0-95.576-77.48-173.056-173.056-173.056v0zM786.773 789.333c-0.186 0.002-0.406 0.003-0.626 0.003-37.703 0-68.267-30.564-68.267-68.267s30.564-68.267 68.267-68.267c37.703 0 68.267 30.564 68.267 68.267 0 19.119-7.86 36.403-20.525 48.796l-0.012 0.012c-12.152 11.891-28.748 19.282-47.071 19.456h-0.033z" />
|
14
|
+
</font></defs></svg>
|
Binary file
|
Binary file
|
@@ -3,20 +3,62 @@
|
|
3
3
|
//= require ../quill/quill
|
4
4
|
//= require_self
|
5
5
|
|
6
|
+
var Inline = Quill.import('blots/inline');
|
6
7
|
|
8
|
+
class IconBlot extends Inline {
|
9
|
+
static create(args) {
|
10
|
+
let node = super.create();
|
11
|
+
node.setAttribute('href', args[0]);
|
12
|
+
node.setAttribute('target', '_blank');
|
13
|
+
node.setAttribute('class', args[1]);
|
14
|
+
return node;
|
15
|
+
}
|
16
|
+
|
17
|
+
static formats(node) {
|
18
|
+
return node.getAttribute('href');
|
19
|
+
}
|
20
|
+
}
|
21
|
+
IconBlot.blotName = 'icon';
|
22
|
+
IconBlot.tagName = 'a';
|
23
|
+
|
24
|
+
Quill.register(IconBlot);
|
7
25
|
Quill.register(Quill.import('attributors/style/align'), true);
|
8
26
|
|
9
27
|
function initQuillEditor(container) {
|
10
|
-
|
28
|
+
var quill = new Quill(container, {
|
11
29
|
modules: {
|
12
30
|
toolbar: [
|
13
31
|
['bold', 'italic', 'underline'], ['link'],
|
14
32
|
[{ 'color': [] }, { 'background': [] }],
|
15
33
|
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
16
34
|
[{ 'align': [] }],
|
35
|
+
['facebook', 'twitter', 'instagram', 'pinterest'],
|
17
36
|
['clean']
|
18
37
|
]
|
19
38
|
},
|
20
39
|
theme: 'snow'
|
21
40
|
});
|
41
|
+
|
42
|
+
var fbButton = document.querySelector('.ql-facebook');
|
43
|
+
fbButton.addEventListener('click', function() {
|
44
|
+
var value = prompt('Adresse de la page Facebook :');
|
45
|
+
quill.format('icon', [value, 'sb-facebook']);
|
46
|
+
});
|
47
|
+
var twButton = document.querySelector('.ql-twitter');
|
48
|
+
twButton.addEventListener('click', function() {
|
49
|
+
var value = prompt('Adresse du compte Twitter :');
|
50
|
+
quill.format('icon', [value, 'sb-twitter']);
|
51
|
+
});
|
52
|
+
var igButton = document.querySelector('.ql-instagram');
|
53
|
+
igButton.addEventListener('click', function() {
|
54
|
+
var value = prompt('Adresse du compte Instagram :');
|
55
|
+
quill.format('icon', [value, 'sb-instagram']);
|
56
|
+
});
|
57
|
+
var piButton = document.querySelector('.ql-pinterest');
|
58
|
+
piButton.addEventListener('click', function() {
|
59
|
+
var value = prompt('Adresse du compte Pinterest :');
|
60
|
+
quill.format('icon', [value, 'sb-pinterest']);
|
61
|
+
});
|
62
|
+
|
63
|
+
return quill;
|
22
64
|
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
@font-face {
|
2
|
+
font-family: 'Sibu';
|
3
|
+
src: font-url('sibu/Sibu.eot');
|
4
|
+
src: font-url('sibu/Sibu.eot') format('embedded-opentype'), font-url('sibu/Sibu.ttf') format('truetype'),
|
5
|
+
font-url('sibu/Sibu.woff') format('woff'), font-url('sibu/Sibu.svg') format('svg');
|
6
|
+
font-weight: normal;
|
7
|
+
font-style: normal;
|
8
|
+
}
|
9
|
+
|
10
|
+
a[class^="sb-"]:before, a[class*=" sb-"]:before {
|
11
|
+
/* use !important to prevent issues with browser extensions that change fonts */
|
12
|
+
font-family: 'Sibu' !important;
|
13
|
+
speak: none;
|
14
|
+
font-style: normal;
|
15
|
+
font-weight: normal;
|
16
|
+
font-variant: normal;
|
17
|
+
text-transform: none;
|
18
|
+
line-height: 1;
|
19
|
+
display: inline-block;
|
20
|
+
margin-right: 3px;
|
21
|
+
|
22
|
+
/* Better Font Rendering =========== */
|
23
|
+
-webkit-font-smoothing: antialiased;
|
24
|
+
-moz-osx-font-smoothing: grayscale;
|
25
|
+
}
|
26
|
+
|
27
|
+
.sb-facebook:before {
|
28
|
+
content: "\e900";
|
29
|
+
}
|
30
|
+
|
31
|
+
.sb-pinterest:before {
|
32
|
+
content: "\e901";
|
33
|
+
}
|
34
|
+
|
35
|
+
.sb-twitter:before {
|
36
|
+
content: "\e902";
|
37
|
+
}
|
38
|
+
|
39
|
+
.sb-instagram:before {
|
40
|
+
content: "\e903";
|
41
|
+
}
|
@@ -82,3 +82,52 @@
|
|
82
82
|
align-items: center;
|
83
83
|
cursor: pointer;
|
84
84
|
}
|
85
|
+
|
86
|
+
|
87
|
+
.ql-snow .ql-tooltip[data-mode="link"]::before {
|
88
|
+
content: "Adresse du lien :";
|
89
|
+
}
|
90
|
+
|
91
|
+
.ql-snow div.ql-tooltip.ql-editing a.ql-action::after {
|
92
|
+
content: "Enregistrer";
|
93
|
+
}
|
94
|
+
|
95
|
+
.ql-snow div.ql-tooltip::before {
|
96
|
+
content: "Accéder au site :";
|
97
|
+
}
|
98
|
+
|
99
|
+
.ql-snow div.ql-tooltip a.ql-action::after {
|
100
|
+
content: 'Modifier';
|
101
|
+
}
|
102
|
+
|
103
|
+
.ql-snow div.ql-tooltip a.ql-remove::before {
|
104
|
+
content: 'Supprimer';
|
105
|
+
}
|
106
|
+
|
107
|
+
.ql-snow.ql-toolbar button.ql-facebook {
|
108
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-3251.088 6300.088 16.219 30'%3E%3Cpath fill='%23444' d='M37.686.006,33.8,0c-4.371,0-7.2,2.9-7.2,7.383v3.4H22.689a.612.612,0,0,0-.612.612v4.932a.612.612,0,0,0,.612.612H26.6V29.388a.612.612,0,0,0,.612.612h5.1a.612.612,0,0,0,.612-.612V16.943H37.5a.612.612,0,0,0,.612-.612l0-4.932a.612.612,0,0,0-.612-.612H32.927V7.9c0-1.387.331-2.091,2.137-2.091h2.621A.612.612,0,0,0,38.3,5.2V.618A.612.612,0,0,0,37.686.006Z' transform='translate%28-3273.165 6300.088%29'/%3E%3C/svg%3E");
|
109
|
+
background-repeat: no-repeat;
|
110
|
+
background-size: 18px 18px;
|
111
|
+
background-position: center;
|
112
|
+
}
|
113
|
+
|
114
|
+
.ql-snow.ql-toolbar button.ql-twitter {
|
115
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-3139.088 6300.088 36.933 30'%3E%3Cpath fill='%23444' d='M36.934,60.99a15.13,15.13,0,0,1-4.35,1.193,7.608,7.608,0,0,0,3.33-4.189A15.274,15.274,0,0,1,31.1,59.834a7.582,7.582,0,0,0-12.91,6.907A21.51,21.51,0,0,1,2.574,58.826,7.585,7.585,0,0,0,4.919,68.939a7.577,7.577,0,0,1-3.432-.951v.095a7.584,7.584,0,0,0,6.077,7.429,7.674,7.674,0,0,1-2,.265,7.271,7.271,0,0,1-1.426-.141A7.58,7.58,0,0,0,11.217,80.9a15.2,15.2,0,0,1-9.409,3.238A16.1,16.1,0,0,1,0,84.032a21.416,21.416,0,0,0,11.613,3.409c13.937,0,21.555-11.544,21.555-21.555l-.025-.981A15.13,15.13,0,0,0,36.934,60.99Z' transform='translate%28-3139.089 6242.647%29'/%3E%3C/svg%3E");
|
116
|
+
background-repeat: no-repeat;
|
117
|
+
background-size: 18px 18px;
|
118
|
+
background-position: center;
|
119
|
+
}
|
120
|
+
|
121
|
+
.ql-snow.ql-toolbar button.ql-instagram {
|
122
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-3202.088 6300.088 30 30'%3E%3Cg transform='translate%28-4031.088 -1288.912%29'%3E%3Cpath fill='%23444' d='M21.721,0H8.279A8.288,8.288,0,0,0,0,8.279V21.721A8.288,8.288,0,0,0,8.279,30H21.721A8.288,8.288,0,0,0,30,21.721V8.279A8.288,8.288,0,0,0,21.721,0Zm5.618,21.721a5.624,5.624,0,0,1-5.617,5.617H8.279a5.623,5.623,0,0,1-5.617-5.617V8.279A5.624,5.624,0,0,1,8.279,2.662H21.721a5.624,5.624,0,0,1,5.617,5.617V21.721Z' transform='translate%28829 7589%29'/%3E%3Cpath fill='%23444' d='M48.7,40.97a7.73,7.73,0,1,0,7.73,7.73A7.739,7.739,0,0,0,48.7,40.97Zm0,12.8A5.068,5.068,0,1,1,53.767,48.7,5.074,5.074,0,0,1,48.7,53.768Z' transform='translate%28795.302 7555.3%29'/%3E%3Cpath fill='%23444' d='M120.873,28.251a1.951,1.951,0,1,0,1.381.571A1.96,1.96,0,0,0,120.873,28.251Z' transform='translate%28731.181 7565.762%29'/%3E%3C/g%3E%3C/svg%3E");
|
123
|
+
background-repeat: no-repeat;
|
124
|
+
background-size: 18px 18px;
|
125
|
+
background-position: center;
|
126
|
+
}
|
127
|
+
|
128
|
+
.ql-snow.ql-toolbar button.ql-pinterest {
|
129
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-3005.088 6300.088 23.579 30'%3E%3Cpath fill='%23444' d='M53.7,3.074A11.5,11.5,0,0,0,45.655,0a12.649,12.649,0,0,0-9.329,3.6,10.629,10.629,0,0,0-3.145,7.367c0,3.339,1.4,5.9,3.736,6.856a1.237,1.237,0,0,0,.47.1,1.045,1.045,0,0,0,1.02-.841c.079-.3.262-1.03.341-1.348a1.265,1.265,0,0,0-.339-1.368,4.36,4.36,0,0,1-.992-2.979,7.5,7.5,0,0,1,7.775-7.548c4.007,0,6.5,2.277,6.5,5.943a12.35,12.35,0,0,1-1.4,6.033,4.15,4.15,0,0,1-3.433,2.4,2.276,2.276,0,0,1-1.81-.827,2.082,2.082,0,0,1-.365-1.808c.179-.756.422-1.545.658-2.307a14.278,14.278,0,0,0,.836-3.757,2.728,2.728,0,0,0-2.746-3c-2.087,0-3.722,2.12-3.722,4.825a7.176,7.176,0,0,0,.512,2.7c-.263,1.114-1.825,7.736-2.122,8.985-.171.729-1.2,6.487.5,6.946,1.92.516,3.636-5.092,3.81-5.725.142-.515.637-2.464.94-3.662a5.8,5.8,0,0,0,3.871,1.5,8.633,8.633,0,0,0,6.932-3.468,13.922,13.922,0,0,0,2.606-8.513A9.816,9.816,0,0,0,53.7,3.074Z' transform='translate%28-3038.269 6300.088%29'/%3E%3C/svg%3E");
|
130
|
+
background-repeat: no-repeat;
|
131
|
+
background-size: 18px 18px;
|
132
|
+
background-position: center;
|
133
|
+
}
|
@@ -100,7 +100,6 @@ module Sibu
|
|
100
100
|
content_tag(tag, capture(self, &block), opts)
|
101
101
|
end
|
102
102
|
|
103
|
-
# Todo : voir comment générer une section par défaut en mode liste des sections et insertion d'un bloc avec sections
|
104
103
|
def sections(id, tag, html_opts = {}, &block)
|
105
104
|
(@sb_entity.find_or_init(id)["elements"].map.with_index do |elt, i|
|
106
105
|
@sb_section = [id, elt["id"]]
|
@@ -60,13 +60,9 @@ module Sibu
|
|
60
60
|
def delete_element(*ids, element_id)
|
61
61
|
src_elt = find_or_init(*ids, element_id)
|
62
62
|
siblings = find_or_init(*ids)["elements"]
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
save
|
67
|
-
else
|
68
|
-
nil
|
69
|
-
end
|
63
|
+
ref_index = siblings.index {|s| s["id"] == element_id}
|
64
|
+
siblings.delete_at(ref_index)
|
65
|
+
save
|
70
66
|
end
|
71
67
|
|
72
68
|
def child_element(*ids, element_id)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Sibu
|
2
|
+
class DynamicStyle
|
3
|
+
|
4
|
+
attr_reader :site, :body, :env, :filename, :scss_file
|
5
|
+
|
6
|
+
def initialize(site_id)
|
7
|
+
@site = Sibu::Site.find(site_id)
|
8
|
+
@filename = "_variables"
|
9
|
+
@scss_file = File.new(scss_file_path, 'w')
|
10
|
+
vars_binding = OpenStruct.new(site: @site).instance_eval { binding }
|
11
|
+
@body = ERB.new(File.read(template_file_path)).result(vars_binding)
|
12
|
+
@env = Rails.application.assets
|
13
|
+
end
|
14
|
+
|
15
|
+
# Todo : la compilation semble marcher
|
16
|
+
# Modifier le fichier cible scss pour que les variables soient directement renseignées (detente.scss.erb)
|
17
|
+
# Tester la compilation SASS puis mettre en place upload du fichier compilé dans Sibu::Site si ça marche
|
18
|
+
def compile
|
19
|
+
find_or_create_scss
|
20
|
+
|
21
|
+
begin
|
22
|
+
scss_file.write generate_css
|
23
|
+
scss_file.flush
|
24
|
+
# site.update(style_url: File.join(site.site_template.path, "#{filename}.css"))
|
25
|
+
ensure
|
26
|
+
scss_file.close
|
27
|
+
# File.delete(scss_file)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def template_file_path
|
34
|
+
@template_file_path ||= File.join(Rails.root, 'app', 'assets', 'stylesheets', site.site_template.path, '_template.scss.erb')
|
35
|
+
end
|
36
|
+
|
37
|
+
def scss_tmpfile_path
|
38
|
+
@scss_file_path ||= File.join(Rails.root, 'app', 'assets', 'stylesheets', site.site_template.path)
|
39
|
+
FileUtils.mkdir_p(@scss_file_path) unless File.exists?(@scss_file_path)
|
40
|
+
@scss_file_path
|
41
|
+
end
|
42
|
+
|
43
|
+
def scss_file_path
|
44
|
+
@scss_file_path ||= File.join(scss_tmpfile_path, "#{filename}.scss")
|
45
|
+
end
|
46
|
+
|
47
|
+
def find_or_create_scss
|
48
|
+
File.open(scss_file_path, 'w') {|f| f.write(body)}
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_css
|
52
|
+
Sass::Engine.new(asset_source, {
|
53
|
+
syntax: :scss,
|
54
|
+
cache: false,
|
55
|
+
read_cache: false,
|
56
|
+
style: :compressed
|
57
|
+
}).render
|
58
|
+
end
|
59
|
+
|
60
|
+
def asset_source
|
61
|
+
if env.find_asset(filename)
|
62
|
+
env.find_asset(filename).source
|
63
|
+
else
|
64
|
+
uri = Sprockets::URIUtils.build_asset_uri(scss_file.path, type: "text/css")
|
65
|
+
asset = Sprockets::UnloadedAsset.new(uri, env)
|
66
|
+
env.load(asset.uri).source
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/app/models/sibu/site.rb
CHANGED
@@ -3,7 +3,7 @@ module Sibu
|
|
3
3
|
include Sibu::SectionsConcern
|
4
4
|
|
5
5
|
store :custom_data, accessors: [:primary_font, :secondary_font, :primary_color, :secondary_color], coder: JSON
|
6
|
-
store :metadata, accessors: [:analytics_id]
|
6
|
+
store :metadata, accessors: [:analytics_id, :style_url], coder: JSON
|
7
7
|
|
8
8
|
belongs_to :site_template, :class_name => 'Sibu::SiteTemplate'
|
9
9
|
has_many :pages, :class_name => 'Sibu::Page', dependent: :destroy
|
@@ -34,8 +34,8 @@
|
|
34
34
|
<div class="overlay_bottom"></div>
|
35
35
|
<div class="edit_mode_actions">
|
36
36
|
<p id="edit_section_msg">Modifier la section</p>
|
37
|
-
<button id="new_section_before" onclick="newSection(false)">Insérer avant</button>
|
38
|
-
<button id="new_section_after" onclick="newSection(true)">Insérer après</button>
|
37
|
+
<button id="new_section_before" onclick="newSection(false)">Insérer un bloc avant</button>
|
38
|
+
<button id="new_section_after" onclick="newSection(true)">Insérer un bloc après</button>
|
39
39
|
<button id="delete_section" onclick="deleteSection()">Supprimer</button>
|
40
40
|
<button onclick="cancelEditMode()">Fermer</button>
|
41
41
|
</div>
|
data/lib/sibu/engine.rb
CHANGED
data/lib/sibu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sibu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Baptiste Vilain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '4.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sass-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.0'
|
97
111
|
description: Sibu is an engine for Ruby on Rails that enables creation of static websites
|
98
112
|
in a simple & wysiwyg way.
|
99
113
|
email:
|
@@ -106,9 +120,14 @@ files:
|
|
106
120
|
- README.md
|
107
121
|
- Rakefile
|
108
122
|
- app/assets/config/sibu_manifest.js
|
123
|
+
- app/assets/fonts/sibu/Sibu.eot
|
124
|
+
- app/assets/fonts/sibu/Sibu.svg
|
125
|
+
- app/assets/fonts/sibu/Sibu.ttf
|
126
|
+
- app/assets/fonts/sibu/Sibu.woff
|
109
127
|
- app/assets/javascripts/quill/quill.js
|
110
128
|
- app/assets/javascripts/sibu/sibu.js.erb
|
111
129
|
- app/assets/stylesheets/quill/quill.snow.css
|
130
|
+
- app/assets/stylesheets/sibu/icons.scss
|
112
131
|
- app/assets/stylesheets/sibu/sibu.css
|
113
132
|
- app/controllers/sibu/application_controller.rb
|
114
133
|
- app/controllers/sibu/images_controller.rb
|
@@ -123,6 +142,7 @@ files:
|
|
123
142
|
- app/models/concerns/sibu/image_uploader.rb
|
124
143
|
- app/models/concerns/sibu/sections_concern.rb
|
125
144
|
- app/models/sibu/application_record.rb
|
145
|
+
- app/models/sibu/dynamic_style.rb
|
126
146
|
- app/models/sibu/image.rb
|
127
147
|
- app/models/sibu/page.rb
|
128
148
|
- app/models/sibu/site.rb
|