cambium 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cambium.gemspec +25 -23
- data/lib/cambium/version.rb +1 -1
- data/lib/generators/cambium/helpers/_autoloader.rb +12 -0
- data/lib/generators/cambium/helpers/dependencies_helper.rb +58 -0
- data/lib/generators/cambium/helpers/generators_helper.rb +227 -0
- data/lib/generators/cambium/install/admin_generator.rb +68 -74
- data/lib/generators/cambium/install/app_generator.rb +86 -95
- data/lib/generators/cambium/install/config_generator.rb +98 -108
- data/lib/generators/cambium/install/utilities_generator.rb +2 -50
- data/lib/generators/cambium/model/image_generator.rb +67 -0
- data/lib/generators/cambium/model/page_generator.rb +131 -0
- data/lib/generators/cambium/model/post_generator.rb +71 -0
- data/lib/generators/cambium/model/tag_generator.rb +40 -0
- data/lib/generators/cambium/model/user_generator.rb +78 -0
- data/lib/generators/cambium/templates/Gemfile +43 -0
- data/lib/generators/cambium/templates/_partials/pages/admin_icon.rb +6 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js.coffee +3 -1
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/image.js.coffee +14 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/tag.js.coffee +14 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/parser_rules/custom.js +552 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/routers/router.js.coffee +21 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/tag.jst.ejs +7 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/image.jst.ejs +3 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/post_tag.jst.ejs +1 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/image_upload.js.coffee +28 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/tags.js.coffee +158 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/wysiwyg.js.coffee +77 -0
- data/lib/generators/cambium/templates/app/controllers/admin/images_controller.rb +45 -0
- data/lib/generators/cambium/templates/app/controllers/admin/pages_controller.rb +42 -0
- data/lib/generators/cambium/templates/app/controllers/admin/posts_controller.rb +39 -0
- data/lib/generators/cambium/templates/app/controllers/admin/taggings_controller.rb +69 -0
- data/lib/generators/cambium/templates/app/controllers/admin/tags_controller.rb +11 -0
- data/lib/generators/cambium/templates/app/controllers/admin_controller.rb +11 -2
- data/lib/generators/cambium/templates/app/controllers/application_controller.rb +2 -2
- data/lib/generators/cambium/templates/app/controllers/images_controller.rb +45 -0
- data/lib/generators/cambium/templates/app/controllers/pages_controller.rb +12 -0
- data/lib/generators/cambium/templates/app/controllers/posts_controller.rb +11 -0
- data/lib/generators/cambium/templates/app/helpers/admin/pages_controller.rb +47 -0
- data/lib/generators/cambium/templates/app/helpers/admin_helper.rb +1 -1
- data/lib/generators/cambium/templates/app/models/concerns/image_cropper.rb +24 -0
- data/lib/generators/cambium/templates/app/models/concerns/publishable.rb +32 -4
- data/lib/generators/cambium/templates/app/models/concerns/slug.rb +4 -0
- data/lib/generators/cambium/templates/app/models/concerns/tags.rb +6 -1
- data/lib/generators/cambium/templates/app/models/image.rb +43 -0
- data/lib/generators/cambium/templates/app/models/page.rb +81 -0
- data/lib/generators/cambium/templates/app/models/post.rb +45 -0
- data/lib/generators/cambium/templates/app/models/tag.rb +33 -0
- data/lib/generators/cambium/templates/app/models/tagging.rb +20 -0
- data/lib/generators/cambium/templates/app/uploaders/image_uploader.rb +91 -0
- data/lib/generators/cambium/templates/app/views/admin/images/_image.html.erb +1 -0
- data/lib/generators/cambium/templates/app/views/admin/images/create.js.erb +7 -0
- data/lib/generators/cambium/templates/app/views/admin/images/index.json.jbuilder +4 -0
- data/lib/generators/cambium/templates/app/views/admin/pages/_form.html.erb +26 -0
- data/lib/generators/cambium/templates/app/views/admin/posts/_form.html.erb +40 -0
- data/lib/generators/cambium/templates/app/views/admin/shared/_insert_image.html.erb +12 -0
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_editor.html.erb +3 -3
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_page.html.erb +5 -1
- data/lib/generators/cambium/templates/app/views/home/index.html.erb +7 -0
- data/lib/generators/cambium/templates/app/views/page_templates/default.html.erb +2 -0
- data/lib/generators/cambium/templates/app/views/posts/_post.html.erb +4 -0
- data/lib/generators/cambium/templates/app/views/posts/index.html.erb +1 -0
- data/lib/generators/cambium/templates/app/views/posts/show.html.erb +10 -0
- data/lib/generators/cambium/templates/config/app_routes.rb +77 -0
- data/lib/generators/cambium/templates/config/routes.rb.erb +11 -2
- data/lib/generators/cambium/templates/db/migrate/create_pages.rb.erb +24 -0
- data/lib/generators/cambium/templates/db/migrate/create_posts.rb +19 -0
- data/lib/generators/cambium/templates/gitignore +1 -0
- metadata +52 -256
- data/lib/generators/cambium/install/users_generator.rb +0 -104
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_icons.scss +0 -5194
@@ -0,0 +1,552 @@
|
|
1
|
+
/**
|
2
|
+
* Full HTML5 compatibility rule set
|
3
|
+
* These rules define which tags and CSS classes are supported and which tags should be specially treated.
|
4
|
+
*
|
5
|
+
* Examples based on this rule set:
|
6
|
+
*
|
7
|
+
* <a href="http://foobar.com">foo</a>
|
8
|
+
* ... becomes ...
|
9
|
+
* <a href="http://foobar.com" target="_blank" rel="nofollow">foo</a>
|
10
|
+
*
|
11
|
+
* <img align="left" src="http://foobar.com/image.png">
|
12
|
+
* ... becomes ...
|
13
|
+
* <img class="wysiwyg-float-left" src="http://foobar.com/image.png" alt="">
|
14
|
+
*
|
15
|
+
* <div>foo<script>alert(document.cookie)</script></div>
|
16
|
+
* ... becomes ...
|
17
|
+
* <div>foo</div>
|
18
|
+
*
|
19
|
+
* <marquee>foo</marquee>
|
20
|
+
* ... becomes ...
|
21
|
+
* <span>foo</span>
|
22
|
+
*
|
23
|
+
* foo <br clear="both"> bar
|
24
|
+
* ... becomes ...
|
25
|
+
* foo <br class="wysiwyg-clear-both"> bar
|
26
|
+
*
|
27
|
+
* <div>hello <iframe src="http://google.com"></iframe></div>
|
28
|
+
* ... becomes ...
|
29
|
+
* <div>hello </div>
|
30
|
+
*
|
31
|
+
* <center>hello</center>
|
32
|
+
* ... becomes ...
|
33
|
+
* <div class="wysiwyg-text-align-center">hello</div>
|
34
|
+
*/
|
35
|
+
var wysihtml5ParserRules = {
|
36
|
+
/**
|
37
|
+
* CSS Class white-list
|
38
|
+
* Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
|
39
|
+
*/
|
40
|
+
"classes": {
|
41
|
+
"wysiwyg-clear-both": 1,
|
42
|
+
"wysiwyg-clear-left": 1,
|
43
|
+
"wysiwyg-clear-right": 1,
|
44
|
+
"wysiwyg-color-aqua": 1,
|
45
|
+
"wysiwyg-color-black": 1,
|
46
|
+
"wysiwyg-color-blue": 1,
|
47
|
+
"wysiwyg-color-fuchsia": 1,
|
48
|
+
"wysiwyg-color-gray": 1,
|
49
|
+
"wysiwyg-color-green": 1,
|
50
|
+
"wysiwyg-color-lime": 1,
|
51
|
+
"wysiwyg-color-maroon": 1,
|
52
|
+
"wysiwyg-color-navy": 1,
|
53
|
+
"wysiwyg-color-olive": 1,
|
54
|
+
"wysiwyg-color-purple": 1,
|
55
|
+
"wysiwyg-color-red": 1,
|
56
|
+
"wysiwyg-color-silver": 1,
|
57
|
+
"wysiwyg-color-teal": 1,
|
58
|
+
"wysiwyg-color-white": 1,
|
59
|
+
"wysiwyg-color-yellow": 1,
|
60
|
+
"wysiwyg-float-left": 1,
|
61
|
+
"wysiwyg-float-right": 1,
|
62
|
+
"wysiwyg-font-size-large": 1,
|
63
|
+
"wysiwyg-font-size-larger": 1,
|
64
|
+
"wysiwyg-font-size-medium": 1,
|
65
|
+
"wysiwyg-font-size-small": 1,
|
66
|
+
"wysiwyg-font-size-smaller": 1,
|
67
|
+
"wysiwyg-font-size-x-large": 1,
|
68
|
+
"wysiwyg-font-size-x-small": 1,
|
69
|
+
"wysiwyg-font-size-xx-large": 1,
|
70
|
+
"wysiwyg-font-size-xx-small": 1,
|
71
|
+
"wysiwyg-text-align-center": 1,
|
72
|
+
"wysiwyg-text-align-justify": 1,
|
73
|
+
"wysiwyg-text-align-left": 1,
|
74
|
+
"wysiwyg-text-align-right": 1
|
75
|
+
},
|
76
|
+
/**
|
77
|
+
* Tag list
|
78
|
+
*
|
79
|
+
* The following options are available:
|
80
|
+
*
|
81
|
+
* - add_class: converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
|
82
|
+
* The following methods are implemented in wysihtml5.dom.parse:
|
83
|
+
* - align_text: converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
|
84
|
+
* <p align="center">foo</p> ... becomes ... <p> class="wysiwyg-text-align-center">foo</p>
|
85
|
+
* - clear_br: converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
|
86
|
+
* <br clear="all"> ... becomes ... <br class="wysiwyg-clear-both">
|
87
|
+
* - align_img: converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
|
88
|
+
*
|
89
|
+
* - remove: removes the element and its content
|
90
|
+
*
|
91
|
+
* - rename_tag: renames the element to the given tag
|
92
|
+
*
|
93
|
+
* - set_class: adds the given class to the element (note: make sure that the class is in the "classes" white list above)
|
94
|
+
*
|
95
|
+
* - set_attributes: sets/overrides the given attributes
|
96
|
+
*
|
97
|
+
* - check_attributes: checks the given HTML attribute via the given method
|
98
|
+
* - url: allows only valid urls (starting with http:// or https://)
|
99
|
+
* - src: allows something like "/foobar.jpg", "http://google.com", ...
|
100
|
+
* - href: allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
|
101
|
+
* - alt: strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
|
102
|
+
* - numbers: ensures that the attribute only contains numeric characters
|
103
|
+
*/
|
104
|
+
"tags": {
|
105
|
+
"tr": {
|
106
|
+
"add_class": {
|
107
|
+
"align": "align_text"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"strike": {
|
111
|
+
"remove": 1
|
112
|
+
},
|
113
|
+
"form": {
|
114
|
+
"rename_tag": "div"
|
115
|
+
},
|
116
|
+
"rt": {
|
117
|
+
"rename_tag": "span"
|
118
|
+
},
|
119
|
+
"code": {},
|
120
|
+
"acronym": {
|
121
|
+
"rename_tag": "span"
|
122
|
+
},
|
123
|
+
"br": {
|
124
|
+
"add_class": {
|
125
|
+
"clear": "clear_br"
|
126
|
+
}
|
127
|
+
},
|
128
|
+
"details": {
|
129
|
+
"rename_tag": "div"
|
130
|
+
},
|
131
|
+
"h4": {
|
132
|
+
"add_class": {
|
133
|
+
"align": "align_text"
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"em": {},
|
137
|
+
"title": {
|
138
|
+
"remove": 1
|
139
|
+
},
|
140
|
+
"multicol": {
|
141
|
+
"rename_tag": "div"
|
142
|
+
},
|
143
|
+
"figure": {
|
144
|
+
"rename_tag": "div"
|
145
|
+
},
|
146
|
+
"xmp": {
|
147
|
+
"rename_tag": "span"
|
148
|
+
},
|
149
|
+
"small": {
|
150
|
+
"rename_tag": "span",
|
151
|
+
"set_class": "wysiwyg-font-size-smaller"
|
152
|
+
},
|
153
|
+
"area": {
|
154
|
+
"remove": 1
|
155
|
+
},
|
156
|
+
"time": {
|
157
|
+
"rename_tag": "span"
|
158
|
+
},
|
159
|
+
"dir": {
|
160
|
+
"rename_tag": "ul"
|
161
|
+
},
|
162
|
+
"bdi": {
|
163
|
+
"rename_tag": "span"
|
164
|
+
},
|
165
|
+
"command": {
|
166
|
+
"remove": 1
|
167
|
+
},
|
168
|
+
"ul": {},
|
169
|
+
"progress": {
|
170
|
+
"rename_tag": "span"
|
171
|
+
},
|
172
|
+
"dfn": {
|
173
|
+
"rename_tag": "span"
|
174
|
+
},
|
175
|
+
"iframe": {
|
176
|
+
"remove": 1
|
177
|
+
},
|
178
|
+
"figcaption": {
|
179
|
+
"rename_tag": "div"
|
180
|
+
},
|
181
|
+
"a": {
|
182
|
+
"check_attributes": {
|
183
|
+
"href": "url" // if you compiled master manually then change this from 'url' to 'href'
|
184
|
+
},
|
185
|
+
"set_attributes": {
|
186
|
+
"rel": "nofollow"
|
187
|
+
}
|
188
|
+
},
|
189
|
+
"img": {
|
190
|
+
"check_attributes": {
|
191
|
+
"width": "numbers",
|
192
|
+
"alt": "alt",
|
193
|
+
"src": "url", // if you compiled master manually then change this from 'url' to 'src'
|
194
|
+
"height": "numbers"
|
195
|
+
},
|
196
|
+
"add_class": {
|
197
|
+
"align": "align_img"
|
198
|
+
}
|
199
|
+
},
|
200
|
+
"rb": {
|
201
|
+
"rename_tag": "span"
|
202
|
+
},
|
203
|
+
"footer": {
|
204
|
+
"rename_tag": "div"
|
205
|
+
},
|
206
|
+
"noframes": {
|
207
|
+
"remove": 1
|
208
|
+
},
|
209
|
+
"abbr": {
|
210
|
+
"rename_tag": "span"
|
211
|
+
},
|
212
|
+
"u": {},
|
213
|
+
"bgsound": {
|
214
|
+
"remove": 1
|
215
|
+
},
|
216
|
+
"sup": {
|
217
|
+
"rename_tag": "span"
|
218
|
+
},
|
219
|
+
"address": {
|
220
|
+
"rename_tag": "div"
|
221
|
+
},
|
222
|
+
"basefont": {
|
223
|
+
"remove": 1
|
224
|
+
},
|
225
|
+
"nav": {
|
226
|
+
"rename_tag": "div"
|
227
|
+
},
|
228
|
+
"h1": {
|
229
|
+
"add_class": {
|
230
|
+
"align": "align_text"
|
231
|
+
}
|
232
|
+
},
|
233
|
+
"head": {
|
234
|
+
"remove": 1
|
235
|
+
},
|
236
|
+
"tbody": {
|
237
|
+
"add_class": {
|
238
|
+
"align": "align_text"
|
239
|
+
}
|
240
|
+
},
|
241
|
+
"dd": {
|
242
|
+
"rename_tag": "div"
|
243
|
+
},
|
244
|
+
"s": {
|
245
|
+
"rename_tag": "span"
|
246
|
+
},
|
247
|
+
"li": {},
|
248
|
+
"td": {
|
249
|
+
"check_attributes": {
|
250
|
+
"rowspan": "numbers",
|
251
|
+
"colspan": "numbers"
|
252
|
+
},
|
253
|
+
"add_class": {
|
254
|
+
"align": "align_text"
|
255
|
+
}
|
256
|
+
},
|
257
|
+
"object": {
|
258
|
+
"remove": 1
|
259
|
+
},
|
260
|
+
"div": {
|
261
|
+
"add_class": {
|
262
|
+
"align": "align_text"
|
263
|
+
}
|
264
|
+
},
|
265
|
+
"option": {
|
266
|
+
"rename_tag": "span"
|
267
|
+
},
|
268
|
+
"select": {
|
269
|
+
"rename_tag": "span"
|
270
|
+
},
|
271
|
+
"i": {},
|
272
|
+
"track": {
|
273
|
+
"remove": 1
|
274
|
+
},
|
275
|
+
"wbr": {
|
276
|
+
"remove": 1
|
277
|
+
},
|
278
|
+
"fieldset": {
|
279
|
+
"rename_tag": "div"
|
280
|
+
},
|
281
|
+
"big": {
|
282
|
+
"rename_tag": "span",
|
283
|
+
"set_class": "wysiwyg-font-size-larger"
|
284
|
+
},
|
285
|
+
"button": {
|
286
|
+
"rename_tag": "span"
|
287
|
+
},
|
288
|
+
"noscript": {
|
289
|
+
"remove": 1
|
290
|
+
},
|
291
|
+
"svg": {
|
292
|
+
"remove": 1
|
293
|
+
},
|
294
|
+
"input": {
|
295
|
+
"remove": 1
|
296
|
+
},
|
297
|
+
"table": {},
|
298
|
+
"keygen": {
|
299
|
+
"remove": 1
|
300
|
+
},
|
301
|
+
"h5": {
|
302
|
+
"add_class": {
|
303
|
+
"align": "align_text"
|
304
|
+
}
|
305
|
+
},
|
306
|
+
"meta": {
|
307
|
+
"remove": 1
|
308
|
+
},
|
309
|
+
"map": {
|
310
|
+
"rename_tag": "div"
|
311
|
+
},
|
312
|
+
"isindex": {
|
313
|
+
"remove": 1
|
314
|
+
},
|
315
|
+
"mark": {
|
316
|
+
"rename_tag": "span"
|
317
|
+
},
|
318
|
+
"caption": {
|
319
|
+
"add_class": {
|
320
|
+
"align": "align_text"
|
321
|
+
}
|
322
|
+
},
|
323
|
+
"tfoot": {
|
324
|
+
"add_class": {
|
325
|
+
"align": "align_text"
|
326
|
+
}
|
327
|
+
},
|
328
|
+
"base": {
|
329
|
+
"remove": 1
|
330
|
+
},
|
331
|
+
"video": {
|
332
|
+
"remove": 1
|
333
|
+
},
|
334
|
+
"strong": {},
|
335
|
+
"canvas": {
|
336
|
+
"remove": 1
|
337
|
+
},
|
338
|
+
"output": {
|
339
|
+
"rename_tag": "span"
|
340
|
+
},
|
341
|
+
"marquee": {
|
342
|
+
"rename_tag": "span"
|
343
|
+
},
|
344
|
+
"b": {},
|
345
|
+
"q": {
|
346
|
+
"check_attributes": {
|
347
|
+
"cite": "url"
|
348
|
+
}
|
349
|
+
},
|
350
|
+
"applet": {
|
351
|
+
"remove": 1
|
352
|
+
},
|
353
|
+
"span": {},
|
354
|
+
"rp": {
|
355
|
+
"rename_tag": "span"
|
356
|
+
},
|
357
|
+
"spacer": {
|
358
|
+
"remove": 1
|
359
|
+
},
|
360
|
+
"source": {
|
361
|
+
"remove": 1
|
362
|
+
},
|
363
|
+
"aside": {
|
364
|
+
"rename_tag": "div"
|
365
|
+
},
|
366
|
+
"frame": {
|
367
|
+
"remove": 1
|
368
|
+
},
|
369
|
+
"section": {
|
370
|
+
"rename_tag": "div"
|
371
|
+
},
|
372
|
+
"body": {
|
373
|
+
"rename_tag": "div"
|
374
|
+
},
|
375
|
+
"ol": {},
|
376
|
+
"nobr": {
|
377
|
+
"rename_tag": "span"
|
378
|
+
},
|
379
|
+
"html": {
|
380
|
+
"rename_tag": "div"
|
381
|
+
},
|
382
|
+
"summary": {
|
383
|
+
"rename_tag": "span"
|
384
|
+
},
|
385
|
+
"var": {
|
386
|
+
"rename_tag": "span"
|
387
|
+
},
|
388
|
+
"del": {
|
389
|
+
"remove": 1
|
390
|
+
},
|
391
|
+
"blockquote": {
|
392
|
+
"check_attributes": {
|
393
|
+
"cite": "url"
|
394
|
+
}
|
395
|
+
},
|
396
|
+
"style": {
|
397
|
+
"remove": 1
|
398
|
+
},
|
399
|
+
"device": {
|
400
|
+
"remove": 1
|
401
|
+
},
|
402
|
+
"meter": {
|
403
|
+
"rename_tag": "span"
|
404
|
+
},
|
405
|
+
"h3": {
|
406
|
+
"add_class": {
|
407
|
+
"align": "align_text"
|
408
|
+
}
|
409
|
+
},
|
410
|
+
"textarea": {
|
411
|
+
"rename_tag": "span"
|
412
|
+
},
|
413
|
+
"embed": {
|
414
|
+
"remove": 1
|
415
|
+
},
|
416
|
+
"hgroup": {
|
417
|
+
"rename_tag": "div"
|
418
|
+
},
|
419
|
+
"font": {
|
420
|
+
"rename_tag": "span",
|
421
|
+
"add_class": {
|
422
|
+
"size": "size_font"
|
423
|
+
}
|
424
|
+
},
|
425
|
+
"tt": {
|
426
|
+
"rename_tag": "span"
|
427
|
+
},
|
428
|
+
"noembed": {
|
429
|
+
"remove": 1
|
430
|
+
},
|
431
|
+
"thead": {
|
432
|
+
"add_class": {
|
433
|
+
"align": "align_text"
|
434
|
+
}
|
435
|
+
},
|
436
|
+
"blink": {
|
437
|
+
"rename_tag": "span"
|
438
|
+
},
|
439
|
+
"plaintext": {
|
440
|
+
"rename_tag": "span"
|
441
|
+
},
|
442
|
+
"xml": {
|
443
|
+
"remove": 1
|
444
|
+
},
|
445
|
+
"h6": {
|
446
|
+
"add_class": {
|
447
|
+
"align": "align_text"
|
448
|
+
}
|
449
|
+
},
|
450
|
+
"param": {
|
451
|
+
"remove": 1
|
452
|
+
},
|
453
|
+
"th": {
|
454
|
+
"check_attributes": {
|
455
|
+
"rowspan": "numbers",
|
456
|
+
"colspan": "numbers"
|
457
|
+
},
|
458
|
+
"add_class": {
|
459
|
+
"align": "align_text"
|
460
|
+
}
|
461
|
+
},
|
462
|
+
"legend": {
|
463
|
+
"rename_tag": "span"
|
464
|
+
},
|
465
|
+
"hr": {},
|
466
|
+
"label": {
|
467
|
+
"rename_tag": "span"
|
468
|
+
},
|
469
|
+
"dl": {
|
470
|
+
"rename_tag": "div"
|
471
|
+
},
|
472
|
+
"kbd": {
|
473
|
+
"rename_tag": "span"
|
474
|
+
},
|
475
|
+
"listing": {
|
476
|
+
"rename_tag": "div"
|
477
|
+
},
|
478
|
+
"dt": {
|
479
|
+
"rename_tag": "span"
|
480
|
+
},
|
481
|
+
"nextid": {
|
482
|
+
"remove": 1
|
483
|
+
},
|
484
|
+
"pre": {},
|
485
|
+
"center": {
|
486
|
+
"rename_tag": "div",
|
487
|
+
"set_class": "wysiwyg-text-align-center"
|
488
|
+
},
|
489
|
+
"audio": {
|
490
|
+
"remove": 1
|
491
|
+
},
|
492
|
+
"datalist": {
|
493
|
+
"rename_tag": "span"
|
494
|
+
},
|
495
|
+
"samp": {
|
496
|
+
"rename_tag": "span"
|
497
|
+
},
|
498
|
+
"col": {
|
499
|
+
"remove": 1
|
500
|
+
},
|
501
|
+
"article": {
|
502
|
+
"rename_tag": "div"
|
503
|
+
},
|
504
|
+
"cite": {},
|
505
|
+
"link": {
|
506
|
+
"remove": 1
|
507
|
+
},
|
508
|
+
"script": {
|
509
|
+
"remove": 1
|
510
|
+
},
|
511
|
+
"bdo": {
|
512
|
+
"rename_tag": "span"
|
513
|
+
},
|
514
|
+
"menu": {
|
515
|
+
"rename_tag": "ul"
|
516
|
+
},
|
517
|
+
"colgroup": {
|
518
|
+
"remove": 1
|
519
|
+
},
|
520
|
+
"ruby": {
|
521
|
+
"rename_tag": "span"
|
522
|
+
},
|
523
|
+
"h2": {
|
524
|
+
"add_class": {
|
525
|
+
"align": "align_text"
|
526
|
+
}
|
527
|
+
},
|
528
|
+
"ins": {
|
529
|
+
"rename_tag": "span"
|
530
|
+
},
|
531
|
+
"p": {
|
532
|
+
"add_class": {
|
533
|
+
"align": "align_text"
|
534
|
+
}
|
535
|
+
},
|
536
|
+
"sub": {
|
537
|
+
"rename_tag": "span"
|
538
|
+
},
|
539
|
+
"comment": {
|
540
|
+
"remove": 1
|
541
|
+
},
|
542
|
+
"frameset": {
|
543
|
+
"remove": 1
|
544
|
+
},
|
545
|
+
"optgroup": {
|
546
|
+
"rename_tag": "span"
|
547
|
+
},
|
548
|
+
"header": {
|
549
|
+
"rename_tag": "div"
|
550
|
+
}
|
551
|
+
}
|
552
|
+
};
|
@@ -6,11 +6,32 @@ class Admin.Routers.Router extends Backbone.Router
|
|
6
6
|
autoLoad: =>
|
7
7
|
if $(".wysihtml5").length > 0
|
8
8
|
for wysiwyg in $(".wysihtml5")
|
9
|
+
console.log 'wysihtml5'
|
9
10
|
new Admin.Views.Wysiwyg
|
10
11
|
id: $(wysiwyg).children('textarea').attr('id')
|
11
12
|
toolbarID: $(wysiwyg).siblings('.wysihtml5-toolbar').attr('id')
|
13
|
+
image_upload: true
|
14
|
+
url: "/admin/json/images"
|
12
15
|
new Admin.Views.Publishable if $("[class*=_active_date]").length > 0
|
13
16
|
new Admin.Views.InitCounter if $('input').length > 0
|
14
17
|
new Admin.Views.Paginator if $('table').length > 0
|
15
18
|
new Admin.Views.DropdownToggle if $('.dropdown-toggle').length > 0
|
16
19
|
new Admin.Views.Accordion if $('.accordion').length > 0
|
20
|
+
|
21
|
+
routes:
|
22
|
+
'admin': 'initAdmin'
|
23
|
+
"admin/posts": "initPosts"
|
24
|
+
"admin/posts/new": "initNewPost"
|
25
|
+
"admin/posts/:id/edit": "initEditPost"
|
26
|
+
|
27
|
+
initAdmin: =>
|
28
|
+
console.log "Welcome to your CMS, powered by Ruby on Rails and Cambium!"
|
29
|
+
|
30
|
+
initEditPost: (id) =>
|
31
|
+
new Admin.Views.Tags
|
32
|
+
id: id
|
33
|
+
taggable: "Post"
|
34
|
+
url: "/admin/json/posts/#{id}/taggings"
|
35
|
+
|
36
|
+
initNewPost: =>
|
37
|
+
$('#tag-container').closest('.fields').hide()
|
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= name %><a href="" data-tag="<%= name %>" class="margin-left-medium">x</a></li>
|
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/image_upload.js.coffee
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class Admin.Views.ImageUpload extends Backbone.View
|
2
|
+
|
3
|
+
el: "body"
|
4
|
+
|
5
|
+
# events:
|
6
|
+
# "click form.edit_project input[type=submit]": "submitForm"
|
7
|
+
|
8
|
+
initialize: (options) =>
|
9
|
+
@model = options.model
|
10
|
+
$("form.edit_#{@model} input[type=submit]").click @submitForm
|
11
|
+
$("#image_filename").attr "name", "image[filename]"
|
12
|
+
$(".images-container").after ->
|
13
|
+
$("#new_image").clone()
|
14
|
+
$(".new_image").last().remove()
|
15
|
+
$("#new_image").fileupload
|
16
|
+
add: (e,data) ->
|
17
|
+
$(".images-container").append """
|
18
|
+
<div class="loading">Uploading #{data.files[0].name}...</div>
|
19
|
+
"""
|
20
|
+
data.submit()
|
21
|
+
complete: (e,data) ->
|
22
|
+
$(".images-container div.loading").first().remove()
|
23
|
+
$(".images-container div.loading").insertAfter( $(".images-container img").last() )
|
24
|
+
|
25
|
+
submitForm: (e) =>
|
26
|
+
e.preventDefault()
|
27
|
+
$("#new_image").remove()
|
28
|
+
$("form.edit_#{@model}").submit()
|