push_type_wysiwyg 0.2.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +20 -0
- data/README.md +3 -0
- data/app/assets/javascripts/push_type/froala_overrides/file_upload.js +133 -0
- data/app/assets/javascripts/push_type/froala_overrides/froala_editor.js +34 -0
- data/app/assets/javascripts/push_type/froala_overrides/image_editor.js +215 -0
- data/app/assets/javascripts/push_type/froala_overrides/media_manager.js +184 -0
- data/app/assets/javascripts/push_type/media_styles.js.coffee.erb +5 -0
- data/app/assets/javascripts/push_type/wysiwyg.js.coffee +50 -0
- data/app/assets/stylesheets/push_type/froala_overrides.scss +77 -0
- data/app/assets/stylesheets/push_type/pt_theme.scss +373 -0
- data/app/assets/stylesheets/push_type/wysiwyg.scss +36 -0
- data/app/controllers/push_type/wysiwyg_media_controller.rb +43 -0
- data/app/fields/push_type/wysiwyg_field.rb +10 -0
- data/app/helpers/push_type/wysiwyg_media_helper.rb +34 -0
- data/config/routes.rb +3 -0
- data/lib/push_type/wysiwyg/engine.rb +16 -0
- data/lib/push_type/wysiwyg.rb +14 -0
- data/lib/push_type_wysiwyg.rb +2 -0
- data/lib/tasks/push_type_tasks.rake +4 -0
- data/test/controllers/push_type/wysiwyg_media_controller_test.rb +58 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/page.rb +10 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/nodes/page.html.erb +3 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +14 -0
- data/test/dummy/config/boot.rb +4 -0
- data/test/dummy/config/database.yml +85 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/push_type.rb +15 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +59 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20150208150336_create_push_type_users.push_type.rb +13 -0
- data/test/dummy/db/migrate/20150208150337_create_push_type_nodes.push_type.rb +25 -0
- data/test/dummy/db/migrate/20150208150338_create_push_type_node_hierarchies.push_type.rb +17 -0
- data/test/dummy/db/migrate/20150208150339_create_push_type_assets.push_type.rb +19 -0
- data/test/dummy/db/schema.rb +67 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/log/test.log +1309 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/0a170bcd46595a69e9181ea5eb52ec6f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/853c1095ab6e7f4eba1f3406f0f3bba6 +0 -0
- data/test/helpers/push_type/wysiwyg_media_helper_test.rb +41 -0
- data/test/models/push_type/wysiwyg_field_test.rb +9 -0
- data/test/test_helper.rb +21 -0
- data/vendor/assets/javascripts/jquery.simplePagination.js +334 -0
- metadata +252 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
.froala-editor .froala-popup div.f-popup-line[class*="f-image-"] label {
|
2
|
+
width: 35px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.froala-editor .froala-popup div.f-popup-line select {
|
6
|
+
font-family: inherit;
|
7
|
+
font-size: 12px;
|
8
|
+
width: 160px;
|
9
|
+
border: solid 1px $input-border-color;
|
10
|
+
margin: 0 5px !important;
|
11
|
+
height: 25px;
|
12
|
+
line-height: 21px;
|
13
|
+
display: block;
|
14
|
+
padding: 2px;
|
15
|
+
float: left;
|
16
|
+
-webkit-box-sizing: border-box;
|
17
|
+
-moz-box-sizing: border-box;
|
18
|
+
box-sizing: border-box;
|
19
|
+
border-radius: 0;
|
20
|
+
-moz-border-radius: 0;
|
21
|
+
-webkit-border-radius: 0;
|
22
|
+
-moz-background-clip: padding;
|
23
|
+
-webkit-background-clip: padding-box;
|
24
|
+
background-clip: padding-box;
|
25
|
+
box-shadow: none;
|
26
|
+
-moz-box-shadow: none;
|
27
|
+
-webkit-box-shadow: none;
|
28
|
+
outline: 0;
|
29
|
+
}
|
30
|
+
|
31
|
+
.froala-editor .froala-popup div.f-popup-line select:focus {
|
32
|
+
border: solid 1px #54acd2;
|
33
|
+
}
|
34
|
+
|
35
|
+
.froala-modal .f-modal-wrapper h4 {
|
36
|
+
background: $silver;
|
37
|
+
margin: 0;
|
38
|
+
padding: 1rem;
|
39
|
+
}
|
40
|
+
|
41
|
+
.froala-modal .f-modal-wrapper div.f-image-list {
|
42
|
+
position: relative;
|
43
|
+
list-style-type: none;
|
44
|
+
margin: 0;
|
45
|
+
padding: 1.25rem 0.5rem 1rem;
|
46
|
+
column-count: 1;
|
47
|
+
-moz-column-count: 1;
|
48
|
+
-webkit-column-count: 1;
|
49
|
+
column-gap: 0;
|
50
|
+
-moz-column-gap: 0;
|
51
|
+
-webkit-column-gap: 0;
|
52
|
+
width: 640px;
|
53
|
+
}
|
54
|
+
.froala-modal .f-modal-wrapper div.f-image-list div {
|
55
|
+
box-sizing: border-box;
|
56
|
+
-webkit-box-sizing: border-box;
|
57
|
+
-moz-box-sizing: border-box;
|
58
|
+
width: 25%;
|
59
|
+
display: inline;
|
60
|
+
float: left;
|
61
|
+
margin-bottom: 1rem;
|
62
|
+
padding-left: 0.5rem;
|
63
|
+
padding-right: 0.5rem;
|
64
|
+
}
|
65
|
+
.froala-modal .f-modal-wrapper div.f-image-list img {
|
66
|
+
border: 1px solid $silver;
|
67
|
+
}
|
68
|
+
.froala-modal .f-modal-wrapper div.f-image-list span.f-media-title {
|
69
|
+
display: block;
|
70
|
+
text-align: center;
|
71
|
+
height: 40px;
|
72
|
+
margin-bottom: 0;
|
73
|
+
padding: 3px 0;
|
74
|
+
overflow: hidden;
|
75
|
+
font-size: 14px;
|
76
|
+
line-height: 20px;
|
77
|
+
}
|
@@ -0,0 +1,373 @@
|
|
1
|
+
.pt-theme.froala-box {
|
2
|
+
margin-bottom: 1.25rem;
|
3
|
+
}
|
4
|
+
.pt-theme.froala-box.focus {
|
5
|
+
box-shadow: $input-box-shadow;
|
6
|
+
background: $input-focus-bg-color;
|
7
|
+
border-color: $input-focus-border-color;
|
8
|
+
}
|
9
|
+
.pt-theme.froala-box .froala-element {
|
10
|
+
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
11
|
+
}
|
12
|
+
.pt-theme.froala-box .html-switch {
|
13
|
+
border-color: #aaaaaa;
|
14
|
+
}
|
15
|
+
.pt-theme.froala-box .froala-element hr {
|
16
|
+
border-top-color: $input-border-color;
|
17
|
+
}
|
18
|
+
.pt-theme.froala-box .froala-element.f-placeholder:before {
|
19
|
+
color: $input-border-color;
|
20
|
+
}
|
21
|
+
.pt-theme.froala-box .froala-element pre {
|
22
|
+
border: solid 1px $input-border-color;
|
23
|
+
background: #fcfcfc;
|
24
|
+
border-radius: 4px;
|
25
|
+
-moz-border-radius: 4px;
|
26
|
+
-webkit-border-radius: 4px;
|
27
|
+
-moz-background-clip: padding;
|
28
|
+
-webkit-background-clip: padding-box;
|
29
|
+
background-clip: padding-box;
|
30
|
+
}
|
31
|
+
.pt-theme.froala-box .froala-element blockquote {
|
32
|
+
border-left: solid 5px $input-border-color;
|
33
|
+
}
|
34
|
+
.pt-theme.froala-box .froala-element img {
|
35
|
+
min-width: 32px !important;
|
36
|
+
min-height: 32px !important;
|
37
|
+
}
|
38
|
+
.pt-theme.froala-box .froala-element img.fr-fil {
|
39
|
+
padding: 10px 10px 10px 3px;
|
40
|
+
}
|
41
|
+
.pt-theme.froala-box .froala-element img.fr-fir {
|
42
|
+
padding: 10px 3px 10px 10px;
|
43
|
+
}
|
44
|
+
.pt-theme.froala-box .froala-element img.fr-fin {
|
45
|
+
padding: 10px 0;
|
46
|
+
}
|
47
|
+
.pt-theme.froala-box .froala-element img::selection {
|
48
|
+
color: #ffffff;
|
49
|
+
}
|
50
|
+
.pt-theme.froala-box .froala-element img::-moz-selection {
|
51
|
+
color: #ffffff;
|
52
|
+
}
|
53
|
+
.pt-theme.froala-box .froala-element span.f-img-editor:before {
|
54
|
+
border: solid 2px #ffffff !important;
|
55
|
+
outline: solid 1px $input-border-color !important;
|
56
|
+
}
|
57
|
+
.pt-theme.froala-box .froala-element span.f-img-editor.fr-fil {
|
58
|
+
margin: 10px 10px 10px 3px;
|
59
|
+
}
|
60
|
+
.pt-theme.froala-box .froala-element span.f-img-editor.fr-fir {
|
61
|
+
margin: 10px 3px 10px 10px;
|
62
|
+
}
|
63
|
+
.pt-theme.froala-box .froala-element span.f-img-editor.fr-fin {
|
64
|
+
margin: 10px 0;
|
65
|
+
}
|
66
|
+
.pt-theme.froala-box .froala-element span.f-img-handle {
|
67
|
+
height: 13px;
|
68
|
+
width: 13px;
|
69
|
+
border: solid 1px $input-border-color !important;
|
70
|
+
background: #ffffff;
|
71
|
+
}
|
72
|
+
.pt-theme.froala-box .froala-element span.f-video-editor.active:after {
|
73
|
+
border: solid 1px $input-border-color;
|
74
|
+
}
|
75
|
+
.pt-theme.froala-box .froala-wrapper {
|
76
|
+
border: solid 1px $input-border-color;
|
77
|
+
}
|
78
|
+
.pt-theme.froala-box .froala-element.f-basic {
|
79
|
+
//border: solid 1px $input-border-color;
|
80
|
+
background: transparent;
|
81
|
+
color: '#444';
|
82
|
+
}
|
83
|
+
.pt-theme.froala-box .froala-element.f-basic a {
|
84
|
+
color: inherit;
|
85
|
+
}
|
86
|
+
.pt-theme.froala-box .froala-element table td {
|
87
|
+
border: solid 1px $input-border-color;
|
88
|
+
}
|
89
|
+
.pt-theme.froala-box.f-html .froala-element {
|
90
|
+
background: #202020;
|
91
|
+
color: #ffffff;
|
92
|
+
font-family: 'Courier New', Monospace;
|
93
|
+
font-size: 13px;
|
94
|
+
}
|
95
|
+
.pt-theme.froala-editor {
|
96
|
+
background: #ffffff;
|
97
|
+
border: solid 1px $input-border-color;
|
98
|
+
border-top: solid 1px $input-border-color;
|
99
|
+
}
|
100
|
+
.pt-theme.froala-editor hr {
|
101
|
+
border-top-color: $input-border-color;
|
102
|
+
}
|
103
|
+
.pt-theme.froala-editor span.f-sep {
|
104
|
+
border-right: solid 1px $input-border-color;
|
105
|
+
height: 35px;
|
106
|
+
}
|
107
|
+
.pt-theme.froala-editor button.fr-bttn,
|
108
|
+
.pt-theme.froala-editor button.fr-trigger {
|
109
|
+
background: transparent;
|
110
|
+
color: $primary-color;
|
111
|
+
font-size: 16px;
|
112
|
+
line-height: 35px;
|
113
|
+
width: 40px;
|
114
|
+
}
|
115
|
+
.pt-theme.froala-editor button.fr-bttn img,
|
116
|
+
.pt-theme.froala-editor button.fr-trigger img {
|
117
|
+
max-width: 40px;
|
118
|
+
max-height: 35px;
|
119
|
+
}
|
120
|
+
.pt-theme.froala-editor button.fr-bttn:disabled,
|
121
|
+
.pt-theme.froala-editor button.fr-trigger:disabled {
|
122
|
+
color: #aaaaaa !important;
|
123
|
+
}
|
124
|
+
.pt-theme.froala-editor button.fr-bttn:disabled:after,
|
125
|
+
.pt-theme.froala-editor button.fr-trigger:disabled:after {
|
126
|
+
border-top-color: #aaaaaa !important;
|
127
|
+
}
|
128
|
+
.pt-theme.froala-editor.ie8 button.fr-bttn:hover,
|
129
|
+
.pt-theme.froala-editor.ie8 button.fr-trigger:hover {
|
130
|
+
background: $primary-color;
|
131
|
+
color: #ffffff;
|
132
|
+
}
|
133
|
+
.pt-theme.froala-editor.ie8 button.fr-bttn:hover:after,
|
134
|
+
.pt-theme.froala-editor.ie8 button.fr-trigger:hover:after {
|
135
|
+
border-top-color: #ffffff;
|
136
|
+
}
|
137
|
+
.pt-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-bttn:hover,
|
138
|
+
.pt-theme.froala-editor .froala-popup button.fr-bttn:hover,
|
139
|
+
.pt-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-trigger:hover,
|
140
|
+
.pt-theme.froala-editor .froala-popup button.fr-trigger:hover {
|
141
|
+
background: $primary-color;
|
142
|
+
color: #ffffff;
|
143
|
+
}
|
144
|
+
.pt-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-bttn:hover:after,
|
145
|
+
.pt-theme.froala-editor .froala-popup button.fr-bttn:hover:after,
|
146
|
+
.pt-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-trigger:hover:after,
|
147
|
+
.pt-theme.froala-editor .froala-popup button.fr-trigger:hover:after {
|
148
|
+
border-top-color: #ffffff;
|
149
|
+
}
|
150
|
+
.pt-theme.froala-editor .fr-bttn.active {
|
151
|
+
color: $primary-color;
|
152
|
+
background: transparent;
|
153
|
+
}
|
154
|
+
.pt-theme.froala-editor .fr-trigger:after {
|
155
|
+
border-top-color: $primary-color;
|
156
|
+
}
|
157
|
+
.pt-theme.froala-editor .fr-trigger.active {
|
158
|
+
color: #ffffff;
|
159
|
+
background: $primary-color;
|
160
|
+
}
|
161
|
+
.pt-theme.froala-editor .fr-trigger.active:after {
|
162
|
+
border-top-color: #ffffff !important;
|
163
|
+
}
|
164
|
+
.pt-theme.froala-editor .fr-dropdown .fr-trigger {
|
165
|
+
width: calc(38px);
|
166
|
+
}
|
167
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu {
|
168
|
+
background: #ffffff;
|
169
|
+
border: solid 1px $input-border-color;
|
170
|
+
}
|
171
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu li.active a {
|
172
|
+
background: $primary-color !important;
|
173
|
+
color: #ffffff !important;
|
174
|
+
}
|
175
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu li a {
|
176
|
+
color: $primary-color;
|
177
|
+
}
|
178
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu li a:hover {
|
179
|
+
background: $primary-color !important;
|
180
|
+
color: #ffffff !important;
|
181
|
+
}
|
182
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li:hover > a,
|
183
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li.hover > a {
|
184
|
+
background: $primary-color;
|
185
|
+
color: #ffffff;
|
186
|
+
}
|
187
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > ul {
|
188
|
+
background: #ffffff;
|
189
|
+
color: $primary-color;
|
190
|
+
border: solid 1px $input-border-color;
|
191
|
+
}
|
192
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div {
|
193
|
+
background: #ffffff;
|
194
|
+
color: $primary-color;
|
195
|
+
border: solid 1px $input-border-color;
|
196
|
+
}
|
197
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span > span {
|
198
|
+
border: solid 1px $input-border-color;
|
199
|
+
}
|
200
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span:hover > span,
|
201
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span.hover > span {
|
202
|
+
background: rgba(61, 142, 185, 0.3);
|
203
|
+
border: solid 1px #3d8eb9;
|
204
|
+
}
|
205
|
+
.pt-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > hr {
|
206
|
+
border-top: solid 1px $input-border-color;
|
207
|
+
}
|
208
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p {
|
209
|
+
color: #444444;
|
210
|
+
}
|
211
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p a.fr-bttn {
|
212
|
+
color: #444444;
|
213
|
+
}
|
214
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p a.fr-bttn:hover {
|
215
|
+
color: $primary-color;
|
216
|
+
}
|
217
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn.active {
|
218
|
+
outline: solid 1px $input-border-color;
|
219
|
+
}
|
220
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn.active:after {
|
221
|
+
color: #ffffff;
|
222
|
+
}
|
223
|
+
.pt-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn:hover:not(:focus):not(:active) {
|
224
|
+
outline: solid 1px $input-border-color;
|
225
|
+
}
|
226
|
+
.pt-theme.froala-editor .froala-popup {
|
227
|
+
background: #ffffff;
|
228
|
+
}
|
229
|
+
.pt-theme.froala-editor .froala-popup h4 {
|
230
|
+
color: #444444;
|
231
|
+
}
|
232
|
+
.pt-theme.froala-editor .froala-popup h4 i {
|
233
|
+
color: $input-border-color;
|
234
|
+
}
|
235
|
+
.pt-theme.froala-editor .froala-popup h4 i.fa-external-link {
|
236
|
+
color: #444444;
|
237
|
+
}
|
238
|
+
.pt-theme.froala-editor .froala-popup h4 i.fa-external-link:hover {
|
239
|
+
color: $primary-color;
|
240
|
+
}
|
241
|
+
.pt-theme.froala-editor .froala-popup h4 i:hover {
|
242
|
+
color: #444444;
|
243
|
+
}
|
244
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger) {
|
245
|
+
color: #ffffff;
|
246
|
+
}
|
247
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger).f-ok {
|
248
|
+
background: #2c82c9;
|
249
|
+
color: #ffffff;
|
250
|
+
}
|
251
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger).f-unlink {
|
252
|
+
background: #b8312f;
|
253
|
+
color: #ffffff;
|
254
|
+
}
|
255
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger).f-unlink:hover {
|
256
|
+
background: #353535;
|
257
|
+
color: #ffffff;
|
258
|
+
}
|
259
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger):hover,
|
260
|
+
.pt-theme.froala-editor .froala-popup button:not(.fr-bttn):not(.fr-trigger):focus {
|
261
|
+
background: #353535;
|
262
|
+
color: #ffffff;
|
263
|
+
}
|
264
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line.f-popup-toolbar {
|
265
|
+
background: #ffffff;
|
266
|
+
}
|
267
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line label {
|
268
|
+
color: #444444;
|
269
|
+
}
|
270
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line input[type="text"] {
|
271
|
+
border: solid 1px $input-border-color;
|
272
|
+
}
|
273
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line input[type="text"]:focus {
|
274
|
+
border: solid 1px #54acd2;
|
275
|
+
}
|
276
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line input[type="text"]:disabled {
|
277
|
+
background: #ffffff;
|
278
|
+
color: #aaaaaa;
|
279
|
+
}
|
280
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line textarea {
|
281
|
+
border: solid 1px $input-border-color;
|
282
|
+
}
|
283
|
+
.pt-theme.froala-editor .froala-popup div.f-popup-line textarea:focus {
|
284
|
+
border: solid 1px #54acd2;
|
285
|
+
}
|
286
|
+
.pt-theme.froala-editor .froala-popup.froala-image-editor-popup div.f-popup-line + div.f-popup-line {
|
287
|
+
border-top: solid 1px $input-border-color;
|
288
|
+
}
|
289
|
+
.pt-theme.froala-editor .froala-popup.froala-video-popup p.or {
|
290
|
+
color: #444444;
|
291
|
+
}
|
292
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload {
|
293
|
+
color: #444444;
|
294
|
+
border: dashed 2px $input-border-color;
|
295
|
+
}
|
296
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload:hover {
|
297
|
+
border: dashed 2px #353535;
|
298
|
+
}
|
299
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload.f-hover {
|
300
|
+
border: dashed 2px #61bd6d;
|
301
|
+
}
|
302
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line button.f-browse {
|
303
|
+
background: #475577;
|
304
|
+
color: #ffffff;
|
305
|
+
}
|
306
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line button.f-browse:hover {
|
307
|
+
background: #353535;
|
308
|
+
color: #ffffff;
|
309
|
+
}
|
310
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line + div.f-popup-line {
|
311
|
+
border-top: solid 1px $input-border-color;
|
312
|
+
}
|
313
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup p.f-progress {
|
314
|
+
background-color: #61bd6d;
|
315
|
+
}
|
316
|
+
.pt-theme.froala-editor .froala-popup.froala-image-popup p.f-progress span {
|
317
|
+
background-color: #61bd6d;
|
318
|
+
color: #ffffff;
|
319
|
+
}
|
320
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line .f-browse-links {
|
321
|
+
background: #475577;
|
322
|
+
color: #ffffff;
|
323
|
+
}
|
324
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line .f-browse-links:hover {
|
325
|
+
background: #353535;
|
326
|
+
color: #ffffff;
|
327
|
+
}
|
328
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul {
|
329
|
+
background: #ffffff;
|
330
|
+
border: solid 1px $input-border-color;
|
331
|
+
}
|
332
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li {
|
333
|
+
color: $primary-color;
|
334
|
+
}
|
335
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li + li {
|
336
|
+
border-top: solid 1px $input-border-color;
|
337
|
+
}
|
338
|
+
.pt-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li:hover {
|
339
|
+
background: $primary-color;
|
340
|
+
color: #ffffff;
|
341
|
+
}
|
342
|
+
.pt-theme.froala-modal .f-modal-wrapper {
|
343
|
+
background: #ffffff;
|
344
|
+
border: solid 1px $input-border-color;
|
345
|
+
border-top: solid 1px $input-border-color;
|
346
|
+
}
|
347
|
+
.pt-theme.froala-modal .f-modal-wrapper h4 {
|
348
|
+
color: #444444;
|
349
|
+
}
|
350
|
+
.pt-theme.froala-modal .f-modal-wrapper h4 i {
|
351
|
+
color: $input-border-color;
|
352
|
+
}
|
353
|
+
.pt-theme.froala-modal .f-modal-wrapper h4 i:hover {
|
354
|
+
color: #444444;
|
355
|
+
}
|
356
|
+
.pt-theme.froala-modal .f-modal-wrapper div.f-image-list div.f-empty {
|
357
|
+
background: $input-border-color;
|
358
|
+
}
|
359
|
+
.pt-theme.froala-modal .f-modal-wrapper div.f-image-list div .f-delete-img {
|
360
|
+
background: #b8312f;
|
361
|
+
color: #ffffff;
|
362
|
+
}
|
363
|
+
.pt-theme.froala-modal .f-modal-wrapper div.f-image-list div .f-delete-img:hover {
|
364
|
+
background: #353535;
|
365
|
+
color: #ffffff;
|
366
|
+
}
|
367
|
+
.pt-theme.froala-modal .f-modal-wrapper div.f-image-list:not(.f-touch) div:hover .f-delete-img:hover {
|
368
|
+
background: #353535;
|
369
|
+
color: #ffffff;
|
370
|
+
}
|
371
|
+
.froala-overlay {
|
372
|
+
background: #000000;
|
373
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require froala_editor.min
|
14
|
+
*= require froala_style.min
|
15
|
+
*= require font-awesome
|
16
|
+
*= require_self
|
17
|
+
*/
|
18
|
+
|
19
|
+
$white: #fff;
|
20
|
+
$silver: #EFEFEF;
|
21
|
+
$primary-color: #008CBA;
|
22
|
+
$input-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
|
23
|
+
$input-focus-bg-color: $white;
|
24
|
+
$input-border-color: scale-color($white, $lightness: -20%);
|
25
|
+
$input-focus-border-color: scale-color($white, $lightness: -40%);
|
26
|
+
|
27
|
+
@import 'pt_theme';
|
28
|
+
@import 'froala_overrides';
|
29
|
+
|
30
|
+
.simple-pagination {
|
31
|
+
background: $silver;
|
32
|
+
padding: 1rem;
|
33
|
+
.pagination {
|
34
|
+
margin: 0;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_dependency "push_type/admin_controller"
|
2
|
+
|
3
|
+
module PushType
|
4
|
+
class WysiwygMediaController < AdminController
|
5
|
+
|
6
|
+
before_filter :load_assets, only: :index
|
7
|
+
before_filter :build_asset, only: :create
|
8
|
+
|
9
|
+
def index
|
10
|
+
respond_to do |format|
|
11
|
+
format.json { render json: view_context.wysiwyg_assets_hash(@assets) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
respond_to do |format|
|
17
|
+
format.json do
|
18
|
+
if @asset.save
|
19
|
+
render json: { link: main_app.media_url(@asset.file_uid) }
|
20
|
+
else
|
21
|
+
render json: { error: @asset.errors.full_messages.first }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def load_assets
|
30
|
+
query = PushType::Asset.not_trash.page(params[:page]).per(12)
|
31
|
+
@assets = params[:filter] == 'image' ? query.image : query.not_image
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_asset
|
35
|
+
@asset = PushType::Asset.new asset_params.merge(uploader: push_type_user)
|
36
|
+
end
|
37
|
+
|
38
|
+
def asset_params
|
39
|
+
params.fetch(:asset, {}).permit(:file)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module PushType
|
2
|
+
module WysiwygMediaHelper
|
3
|
+
|
4
|
+
include PushType::AssetsHelper
|
5
|
+
|
6
|
+
def wysiwyg_assets_hash(assets)
|
7
|
+
{
|
8
|
+
assets: assets.map { |a| wysiwyg_asset_hash(a) },
|
9
|
+
meta: wysiwyg_assets_meta(assets)
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def wysiwyg_assets_meta(assets)
|
14
|
+
{
|
15
|
+
current_page: assets.current_page,
|
16
|
+
total_pages: assets.total_pages
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def wysiwyg_asset_hash(asset)
|
21
|
+
{
|
22
|
+
src: asset_preview_thumb_url(asset),
|
23
|
+
info: {
|
24
|
+
id: asset.id,
|
25
|
+
kind: asset.kind,
|
26
|
+
src: main_app.media_url(asset.file_uid),
|
27
|
+
title: asset.description_or_file_name
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module PushType
|
2
|
+
module Wysiwyg
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
isolate_namespace PushType
|
5
|
+
engine_name 'push_type_rich_text'
|
6
|
+
|
7
|
+
config.admin_assets.register 'push_type/wysiwyg' if defined?(PushType::Admin::Assets)
|
8
|
+
|
9
|
+
config.generators do |g|
|
10
|
+
g.assets false
|
11
|
+
g.helper false
|
12
|
+
g.test_framework :minitest, spec: true, fixture: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module PushType
|
4
|
+
describe WysiwygMediaController do
|
5
|
+
|
6
|
+
let(:json_response) { JSON.parse(response.body) }
|
7
|
+
let(:asset_attrs) { FactoryGirl.attributes_for(:asset) }
|
8
|
+
|
9
|
+
describe 'GET #index' do
|
10
|
+
before :all do
|
11
|
+
5.times { FactoryGirl.create :image_asset }
|
12
|
+
13.times { FactoryGirl.create :document_asset }
|
13
|
+
end
|
14
|
+
describe 'filtering for images' do
|
15
|
+
before { get :index, format: :json, filter: 'image' }
|
16
|
+
it { response.must_respond_with :success }
|
17
|
+
it { json_response['assets'].size.must_equal 5 }
|
18
|
+
it { json_response['meta']['current_page'].must_equal 1 }
|
19
|
+
it { json_response['meta']['total_pages'].must_equal 1 }
|
20
|
+
end
|
21
|
+
describe 'filtering for files' do
|
22
|
+
before { get :index, format: :json, filter: 'file' }
|
23
|
+
it { response.must_respond_with :success }
|
24
|
+
it { json_response['assets'].size.must_equal 12 }
|
25
|
+
it { json_response['meta']['current_page'].must_equal 1 }
|
26
|
+
it { json_response['meta']['total_pages'].must_equal 2 }
|
27
|
+
end
|
28
|
+
describe 'with pagination' do
|
29
|
+
before { get :index, format: :json, filter: 'file', page: 2 }
|
30
|
+
it { response.must_respond_with :success }
|
31
|
+
it { json_response['assets'].size.must_equal 1 }
|
32
|
+
it { json_response['meta']['current_page'].must_equal 2 }
|
33
|
+
it { json_response['meta']['total_pages'].must_equal 2 }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'POST #create' do
|
38
|
+
let(:action!) { post :create, format: :json, asset: asset_attrs }
|
39
|
+
describe 'with valid asset' do
|
40
|
+
before { action! }
|
41
|
+
it { response.must_respond_with :success }
|
42
|
+
it { json_response['link'].must_be :present? }
|
43
|
+
it { json_response['error'].wont_be :present? }
|
44
|
+
end
|
45
|
+
describe 'asset count' do
|
46
|
+
it { proc { action! }.must_change 'Asset.count', 1 }
|
47
|
+
end
|
48
|
+
describe 'with in-valid asset' do
|
49
|
+
let(:asset_attrs) { {} }
|
50
|
+
before { action! }
|
51
|
+
it { response.must_respond_with :success }
|
52
|
+
it { json_response['link'].wont_be :present? }
|
53
|
+
it { json_response['error'].must_be :present? }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|