rethoth 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +26 -0
  3. data/bin/thoth +233 -0
  4. data/lib/proto/config.ru +45 -0
  5. data/lib/proto/thoth.conf.sample +206 -0
  6. data/lib/thoth/cache.rb +53 -0
  7. data/lib/thoth/config.rb +158 -0
  8. data/lib/thoth/controller/admin.rb +75 -0
  9. data/lib/thoth/controller/api/comment.rb +73 -0
  10. data/lib/thoth/controller/api/page.rb +134 -0
  11. data/lib/thoth/controller/api/post.rb +122 -0
  12. data/lib/thoth/controller/api/tag.rb +59 -0
  13. data/lib/thoth/controller/archive.rb +50 -0
  14. data/lib/thoth/controller/comment.rb +173 -0
  15. data/lib/thoth/controller/main.rb +193 -0
  16. data/lib/thoth/controller/media.rb +172 -0
  17. data/lib/thoth/controller/page.rb +167 -0
  18. data/lib/thoth/controller/post.rb +310 -0
  19. data/lib/thoth/controller/search.rb +86 -0
  20. data/lib/thoth/controller/tag.rb +107 -0
  21. data/lib/thoth/controller.rb +48 -0
  22. data/lib/thoth/errors.rb +35 -0
  23. data/lib/thoth/helper/admin.rb +86 -0
  24. data/lib/thoth/helper/cookie.rb +45 -0
  25. data/lib/thoth/helper/error.rb +122 -0
  26. data/lib/thoth/helper/pagination.rb +131 -0
  27. data/lib/thoth/helper/wiki.rb +77 -0
  28. data/lib/thoth/helper/ysearch.rb +89 -0
  29. data/lib/thoth/importer/pants.rb +81 -0
  30. data/lib/thoth/importer/poseidon.rb +54 -0
  31. data/lib/thoth/importer/thoth.rb +103 -0
  32. data/lib/thoth/importer.rb +131 -0
  33. data/lib/thoth/layout/default.rhtml +47 -0
  34. data/lib/thoth/middleware/minify.rb +82 -0
  35. data/lib/thoth/migrate/001_create_schema.rb +108 -0
  36. data/lib/thoth/migrate/002_add_media_size.rb +37 -0
  37. data/lib/thoth/migrate/003_add_post_draft.rb +38 -0
  38. data/lib/thoth/migrate/004_add_comment_email.rb +37 -0
  39. data/lib/thoth/migrate/005_add_page_position.rb +37 -0
  40. data/lib/thoth/migrate/006_add_comment_close_delete.rb +43 -0
  41. data/lib/thoth/migrate/007_add_comment_summary.rb +37 -0
  42. data/lib/thoth/model/comment.rb +216 -0
  43. data/lib/thoth/model/media.rb +87 -0
  44. data/lib/thoth/model/page.rb +204 -0
  45. data/lib/thoth/model/post.rb +262 -0
  46. data/lib/thoth/model/tag.rb +80 -0
  47. data/lib/thoth/model/tags_posts_map.rb +34 -0
  48. data/lib/thoth/monkeypatch/sequel/model/errors.rb +37 -0
  49. data/lib/thoth/plugin/thoth_delicious.rb +105 -0
  50. data/lib/thoth/plugin/thoth_flickr.rb +86 -0
  51. data/lib/thoth/plugin/thoth_pinboard.rb +98 -0
  52. data/lib/thoth/plugin/thoth_tags.rb +68 -0
  53. data/lib/thoth/plugin/thoth_twitter.rb +175 -0
  54. data/lib/thoth/plugin.rb +59 -0
  55. data/lib/thoth/public/css/admin.css +223 -0
  56. data/lib/thoth/public/css/thoth.css +592 -0
  57. data/lib/thoth/public/images/admin-sprite.png +0 -0
  58. data/lib/thoth/public/images/thoth-sprite.png +0 -0
  59. data/lib/thoth/public/js/admin/comments.js +116 -0
  60. data/lib/thoth/public/js/admin/name.js +244 -0
  61. data/lib/thoth/public/js/admin/tagcomplete.js +332 -0
  62. data/lib/thoth/public/js/lazyload-min.js +4 -0
  63. data/lib/thoth/public/js/thoth.js +203 -0
  64. data/lib/thoth/public/robots.txt +5 -0
  65. data/lib/thoth/version.rb +37 -0
  66. data/lib/thoth/view/admin/index.rhtml +1 -0
  67. data/lib/thoth/view/admin/login.rhtml +23 -0
  68. data/lib/thoth/view/admin/toolbar.rhtml +117 -0
  69. data/lib/thoth/view/admin/welcome.rhtml +58 -0
  70. data/lib/thoth/view/archive/index.rhtml +24 -0
  71. data/lib/thoth/view/comment/comment.rhtml +47 -0
  72. data/lib/thoth/view/comment/delete.rhtml +15 -0
  73. data/lib/thoth/view/comment/form.rhtml +81 -0
  74. data/lib/thoth/view/comment/index.rhtml +68 -0
  75. data/lib/thoth/view/comment/list.rhtml +48 -0
  76. data/lib/thoth/view/media/delete.rhtml +15 -0
  77. data/lib/thoth/view/media/edit.rhtml +12 -0
  78. data/lib/thoth/view/media/form.rhtml +7 -0
  79. data/lib/thoth/view/media/list.rhtml +35 -0
  80. data/lib/thoth/view/media/media.rhtml +44 -0
  81. data/lib/thoth/view/media/new.rhtml +7 -0
  82. data/lib/thoth/view/page/delete.rhtml +15 -0
  83. data/lib/thoth/view/page/edit.rhtml +15 -0
  84. data/lib/thoth/view/page/form.rhtml +57 -0
  85. data/lib/thoth/view/page/index.rhtml +9 -0
  86. data/lib/thoth/view/page/list.rhtml +49 -0
  87. data/lib/thoth/view/page/new.rhtml +15 -0
  88. data/lib/thoth/view/post/comments.rhtml +12 -0
  89. data/lib/thoth/view/post/compact.rhtml +48 -0
  90. data/lib/thoth/view/post/delete.rhtml +15 -0
  91. data/lib/thoth/view/post/edit.rhtml +15 -0
  92. data/lib/thoth/view/post/form.rhtml +83 -0
  93. data/lib/thoth/view/post/index.rhtml +48 -0
  94. data/lib/thoth/view/post/list.rhtml +61 -0
  95. data/lib/thoth/view/post/new.rhtml +15 -0
  96. data/lib/thoth/view/post/tiny.rhtml +4 -0
  97. data/lib/thoth/view/search/index.rhtml +45 -0
  98. data/lib/thoth/view/tag/index.rhtml +34 -0
  99. data/lib/thoth/view/thoth/css.rhtml +9 -0
  100. data/lib/thoth/view/thoth/footer.rhtml +15 -0
  101. data/lib/thoth/view/thoth/header.rhtml +23 -0
  102. data/lib/thoth/view/thoth/index.rhtml +11 -0
  103. data/lib/thoth/view/thoth/js.rhtml +6 -0
  104. data/lib/thoth/view/thoth/sidebar.rhtml +38 -0
  105. data/lib/thoth/view/thoth/util/pager.rhtml +23 -0
  106. data/lib/thoth/view/thoth/util/simple_pager.rhtml +15 -0
  107. data/lib/thoth/view/thoth/util/table_sortheader.rhtml +20 -0
  108. data/lib/thoth.rb +394 -0
  109. metadata +409 -0
@@ -0,0 +1,592 @@
1
+ /* -- YUI Reset, Base, and Fonts -------------------------------------------- */
2
+
3
+ /*
4
+ Copyright (c) 2008, Yahoo! Inc. All rights reserved.
5
+ Code licensed under the BSD License:
6
+ http://developer.yahoo.net/yui/license.txt
7
+ version: 3.0.0pr2
8
+ */
9
+
10
+ /* reset */
11
+ html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
12
+
13
+ /* base (slightly modified) */
14
+ h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong{font-weight:bold;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}blockquote,ul,ol,dl{margin:1em;}dl{margin-left:0;}ol,ul{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}p,fieldset,table,pre{margin-bottom:1em;}
15
+
16
+ /* -- Defaults -------------------------------------------------------------- */
17
+ body, button, input, select { font: 13px/1.231 Helvetica, 'Bitstream Vera Sans', sans-serif; }
18
+
19
+ a {
20
+ color: #0066cc;
21
+ text-decoration: none;
22
+ }
23
+
24
+ a:hover { text-decoration: underline; }
25
+ a img { border: 0; }
26
+
27
+ blockquote {
28
+ border: 1px solid #efefef;
29
+ border-left: 5px solid #efefef;
30
+ font-size: 12px;
31
+ line-height: 1.3em;
32
+ margin-left: 1em;
33
+ padding: 5px;
34
+ }
35
+
36
+ blockquote blockquote {
37
+ border: none;
38
+ margin-right: 0;
39
+ padding: 0;
40
+ }
41
+
42
+ blockquote p:first-child { margin-top: 0; }
43
+ blockquote p:last-child { margin-bottom: 0; }
44
+
45
+ body {
46
+ background: #ededed;
47
+ color: #000;
48
+ margin: 0;
49
+ padding: 0;
50
+ }
51
+
52
+ fieldset {
53
+ border: 1px solid #ccc;
54
+ margin-top: 1.5em;
55
+ padding: 1.5em 1em;
56
+ }
57
+
58
+ fieldset legend { font-weight: bold; }
59
+
60
+ h1, h2 {
61
+ border-bottom: 1px solid #cfcfcf;
62
+ font-size: 16px;
63
+ font-weight: bold;
64
+ }
65
+
66
+ h3 {
67
+ font-size: 16px;
68
+ font-weight: bold;
69
+ }
70
+
71
+ html { background: none; }
72
+ input { font-size: 13px; }
73
+ p { margin-top: 1em; }
74
+
75
+ code, pre, textarea { font: 11px Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Consolas, fixed; }
76
+ textarea { font-size: 12px; }
77
+
78
+ pre {
79
+ background: #fcfcfc;
80
+ border: 1px solid #dfdfdf;
81
+ border-left: 5px solid #dfdfdf;
82
+ overflow-x: auto;
83
+ padding: 2px 5px;
84
+ width: 96%;
85
+ }
86
+
87
+ table {
88
+ border-collapse: separate;
89
+ border-spacing: 2px;
90
+ }
91
+
92
+ td, th {
93
+ border: 0;
94
+ padding: 0;
95
+ }
96
+
97
+ /* -- Layout ---------------------------------------------------------------- */
98
+ #doc {
99
+ margin: 0 auto;
100
+ padding: 0;
101
+ min-width: 550px;
102
+ }
103
+
104
+ /* -- Header ---------------------------------------------------------------- */
105
+ #hd { color: #fff; }
106
+
107
+ #hd a {
108
+ color: #fff;
109
+ text-decoration: none;
110
+ }
111
+
112
+ #hd h1 {
113
+ background: #4d4c4c;
114
+ border: 0;
115
+ font-size: 32px;
116
+ margin: 0;
117
+ padding: 0.3em 0.2em 0.1em 0.2em;
118
+ }
119
+
120
+ #toolbar {
121
+ background: #323232;
122
+ border-bottom: 1px solid #000;
123
+ border-top: 1px solid #5e5d5d;
124
+ color: #fff;
125
+ font-size: 12px;
126
+ height: 1.75em;
127
+ margin: 0;
128
+ padding: 0 0.7em;
129
+ position: relative;
130
+ text-align: right;
131
+ }
132
+
133
+ #toolbar .subtitle {
134
+ float: left;
135
+ font-weight: bold;
136
+ margin-top: 0.35em;
137
+ }
138
+
139
+ #toolbar ul {
140
+ float: right;
141
+ margin: 0;
142
+ }
143
+
144
+ #toolbar ul li {
145
+ display: inline;
146
+ list-style: none;
147
+ }
148
+
149
+ #toolbar ul li a {
150
+ color: #fff;
151
+ display: block;
152
+ float: left;
153
+ height: 1.44em;
154
+ margin: 0 0.2em;
155
+ padding: 0.35em 0.5em 0 0.5em;
156
+ }
157
+
158
+ #toolbar ul li a:hover { background: #474343; }
159
+
160
+ @media print {
161
+ #hd { display: none; }
162
+ }
163
+
164
+ /* -- Body ------------------------------------------------------------------ */
165
+ #bd {
166
+ background: #fff;
167
+ border: 1px solid #d3d3d3;
168
+ border-top: 0;
169
+ padding-top: 0.8em;
170
+ margin: 0 auto;
171
+ max-width: 800px;
172
+ }
173
+
174
+ #bd:after {
175
+ clear: both;
176
+ content: '.';
177
+ display: block;
178
+ height: 0;
179
+ visibility: hidden;
180
+ }
181
+
182
+ /* -- Footer ---------------------------------------------------------------- */
183
+ #ft {
184
+ clear: both;
185
+ color: #666;
186
+ font-size: 11px;
187
+ margin: 0 auto;
188
+ max-width: 800px;
189
+ padding: 1em 0;
190
+ }
191
+
192
+ #ft a { color: #666; }
193
+
194
+ /* -- Content --------------------------------------------------------------- */
195
+ #main {
196
+ margin: 0 205px 20px 1.5em;
197
+ padding: 0;
198
+ }
199
+
200
+ @media print {
201
+ #main {
202
+ margin: auto;
203
+ width: auto;
204
+ }
205
+ }
206
+
207
+ /* -- Sidebar --------------------------------------------------------------- */
208
+ #sidebar {
209
+ border-left: 1px solid #dfdfdf;
210
+ float: right;
211
+ margin: 0 0 0.5em 0;
212
+ padding: 0 0 1em 0.7em;
213
+ width: 175px;
214
+ }
215
+
216
+ #sidebar a {
217
+ color: #000;
218
+ text-decoration: none;
219
+ }
220
+
221
+ #sidebar a:hover { font-weight: bold; }
222
+ #sidebar dl { margin: 0; }
223
+
224
+ #sidebar dl dt {
225
+ clear: both;
226
+ font-size: 14px;
227
+ font-weight: bold;
228
+ margin: 1em 0 0.2em 0;
229
+ padding: 0 0.2em 0 0;
230
+ }
231
+
232
+ #sidebar dl dt a:hover { text-decoration: underline; }
233
+
234
+ #sidebar dl dd {
235
+ font-size: 12px;
236
+ margin: 0 5px 0 1px;
237
+ }
238
+
239
+ #sidebar dl dd p { margin: 0; }
240
+ #sidebar #search-query { width: 150px; }
241
+
242
+ @media print {
243
+ #sidebar { display: none; }
244
+ }
245
+
246
+ /* -- Posts ----------------------------------------------------------------- */
247
+ .post abbr.published { border: 0; }
248
+ .post address.author { display: none; }
249
+
250
+ .post {
251
+ margin: 0 0 1.5em 0;
252
+ padding-bottom: 1px;
253
+ }
254
+
255
+ .post .hd h1, .post .hd h2 {
256
+ border-bottom: 1px dotted #cfcfcf;
257
+ display: block;
258
+ margin-bottom: 0;
259
+ width: 100%;
260
+ }
261
+
262
+ .post .hd h1 a, .post .hd h2 a { color: #000; }
263
+
264
+ .post .hd .date {
265
+ color: #888;
266
+ font-size: 85%;
267
+ }
268
+
269
+ .post .ft { text-align: right; }
270
+
271
+ .post .tags {
272
+ float: left;
273
+ font-size: 11px;
274
+ min-height: 15px;
275
+ text-align: left;
276
+ width: 60%;
277
+ }
278
+
279
+ .post .ft:after {
280
+ clear: left;
281
+ content: '.';
282
+ display: block;
283
+ height: 0;
284
+ visibility: hidden;
285
+ }
286
+
287
+ .post .tags a { color: #73ade7; }
288
+
289
+ .post .tags ul {
290
+ margin: 0;
291
+ padding: 0 0 0 21px;
292
+ }
293
+
294
+ .post .tags ul li {
295
+ display: inline;
296
+ list-style: none;
297
+ margin-right: 0.3em;
298
+ white-space: nowrap;
299
+ }
300
+
301
+ .post .tags .icon.tag {
302
+ float: left;
303
+ vertical-align: middle;
304
+ }
305
+
306
+ @media print {
307
+ .post .ft .meta { display: none; }
308
+ }
309
+
310
+ /* -- Comments -------------------------------------------------------------- */
311
+ div.comment {
312
+ border: 1px solid #fff;
313
+ border-bottom: 1px dotted #cfcfcf;
314
+ color: #222;
315
+ margin: 0.5em 0;
316
+ padding: 5px;
317
+ }
318
+
319
+ div.comment:hover {
320
+ background: #f7fcff;
321
+ border: 1px solid #a7d7ff;
322
+ color: #000;
323
+ }
324
+
325
+ .comment h4 {
326
+ font-size: 14px;
327
+ margin: 0;
328
+ }
329
+
330
+ .comment h4 a { color: #333; }
331
+ .comment:hover h4 a { color: #000; }
332
+
333
+ .comment .bd {
334
+ line-height: 1.2em;
335
+ margin-bottom: 0.8em;
336
+ }
337
+
338
+ .comment .ft:after {
339
+ clear: left;
340
+ content: '.';
341
+ display: block;
342
+ height: 0;
343
+ visibility: hidden;
344
+ }
345
+
346
+ .comment .gravatar {
347
+ border: 1px solid #cfcfcf;
348
+ float: left;
349
+ margin: -2px 6px 6px 0;
350
+ padding: 1px;
351
+ }
352
+
353
+ .comment .gravatar:hover { border-color: #a0a0a0; }
354
+
355
+ .comment .gravatar, .comment .gravatar img {
356
+ height: 32px;
357
+ width: 32px;
358
+ }
359
+
360
+ .comment .author { margin-top: 5px; }
361
+ .comment .date { font-size: 11px; }
362
+ .comment .date a { color: inherit; }
363
+
364
+ /* -- Post Comment Form ----------------------------------------------------- */
365
+ #post-comment { margin-top: 30px; }
366
+
367
+ #post-comment label {
368
+ float: left;
369
+ margin-top: 4px;
370
+ width: 4em;
371
+ }
372
+
373
+ #post-comment input[type='text'] { width: 200px; }
374
+ #post-comment input#title { width: 80%; }
375
+ #post-comment p { margin: 0.7em 0; }
376
+ #post-comment p.tip { font-size: 12px; }
377
+
378
+ #post-comment span.tip {
379
+ color: #666;
380
+ font-size: 12px;
381
+ margin-left: 0.5em;
382
+ }
383
+
384
+ #post-comment textarea { width: 100%; }
385
+ #post-comment .error { font-size: 11px; }
386
+
387
+ @media print {
388
+ #post-comment { display: none; }
389
+ }
390
+
391
+ /* -- Pagination ------------------------------------------------------------ */
392
+ .pg {
393
+ font-size: 12px;
394
+ margin: 1em 0;
395
+ text-align: center;
396
+ zoom: 1;
397
+ }
398
+
399
+ .pg:after {
400
+ clear: left;
401
+ content: '.';
402
+ display: block;
403
+ height: 0;
404
+ visibility: hidden;
405
+ }
406
+
407
+ .pg a, .pg strong {
408
+ border: 1px solid #c7dbff;
409
+ float: left;
410
+ margin: 1px;
411
+ padding: 2px 6px 1px 6px;
412
+ }
413
+
414
+ .pg a.prev, .pg a.next { font-weight: bold; }
415
+
416
+ .pg a:hover {
417
+ border: 1px solid #0066cc;
418
+ text-decoration: none;
419
+ }
420
+
421
+ .pg strong {
422
+ background: #2663cf;
423
+ border-color: #2663cf;
424
+ color: #fff;
425
+ font-weight: bold;
426
+ }
427
+
428
+ @media print {
429
+ .pg { display: none; }
430
+ }
431
+
432
+ /* -- Recent Comments ------------------------------------------------------- */
433
+ ul.comments {
434
+ padding: 0;
435
+ margin: 0;
436
+ }
437
+
438
+ ul.comments li {
439
+ background: #f9f9f9;
440
+ border: 1px solid #ddd;
441
+ list-style: none;
442
+ margin-bottom: 0.5em;
443
+ padding: 3px;
444
+ }
445
+
446
+ ul.comments li:hover {
447
+ background: #fff5ef;
448
+ border: 1px solid #ffaf7f;
449
+ }
450
+
451
+ ul.comments .meta { font-size: 11px; }
452
+
453
+ /* -- Search Results -------------------------------------------------------- */
454
+ .search h4 {
455
+ font-size: 14px;
456
+ margin-bottom: 0;
457
+ }
458
+
459
+ .search ul {
460
+ margin-left: 0;
461
+ padding-left: 0;
462
+ }
463
+
464
+ .search ul li {
465
+ list-style: none;
466
+ margin-bottom: 0.7em;
467
+ }
468
+
469
+ .search .date, .search .url {
470
+ color: #888;
471
+ font-size: 12px;
472
+ }
473
+
474
+ /* -- Admin Toolbar --------------------------------------------------------- */
475
+ #adminToolbar {
476
+ background: #f5f5f5;
477
+ border: 1px solid #d3d3d3;
478
+ border-top: none;
479
+ color: #000;
480
+ font-size: 12px;
481
+ height: 24px;
482
+ margin: 0 auto;
483
+ max-width: 820px;
484
+ padding: 3px 4px 4px 4px;
485
+ }
486
+
487
+ #adminToolbar form input { padding: 2px; }
488
+ #adminToolbar form label { margin-left: 1em; }
489
+ #adminToolbar form label:first-child { margin-left: 7px; }
490
+
491
+ /* -- Login Page ------------------------------------------------------------ */
492
+ #login_page label { font-weight: bold; }
493
+
494
+ /* -- Flash Messages -------------------------------------------------------- */
495
+ .flash {
496
+ background: #f5f5f5;
497
+ border: 1px solid #cfcfcf;
498
+ color: #000;
499
+ padding: 3px 4px 2px;
500
+ }
501
+
502
+ .flash.error {
503
+ background: #ffb7b7;
504
+ border-color: #ff4747;
505
+ }
506
+
507
+ form .flash.error { margin: 0.2em 0 0; }
508
+
509
+ .flash.success {
510
+ background: #d4ffc7;
511
+ border-color: #7bd75e;
512
+ }
513
+
514
+ /* -- Icons ----------------------------------------------------------------- */
515
+ .icon {
516
+ background: url(../images/thoth-sprite.png) no-repeat;
517
+ display: -moz-inline-box;
518
+ display: inline-block;
519
+ vertical-align: middle;
520
+ }
521
+
522
+ .icon.comment {
523
+ background-position: -33px -1px;
524
+ height: 11px;
525
+ margin: 0 1px 1px 0;
526
+ width: 13px;
527
+ *margin-right: 3px;
528
+ }
529
+
530
+ .icon.comment-post {
531
+ background-position: -17px -1px;
532
+ height: 14px;
533
+ width: 14px;
534
+ *margin-right: 3px;
535
+ }
536
+
537
+ .icon.comments {
538
+ background-position: -33px -1px;
539
+ height: 11px;
540
+ margin: 0 0 1px 0;
541
+ width: 13px;
542
+ *margin: 1px 4px 0 0;
543
+ }
544
+
545
+ .icon.feed {
546
+ background-position: -97px -1px;
547
+ height: 14px;
548
+ margin-bottom: 3px;
549
+ width: 14px;
550
+ *margin: 1px 3px 2px 0;
551
+ }
552
+
553
+ .icon.tag {
554
+ background-position: -79px -1px;
555
+ height: 15px;
556
+ width: 15px;
557
+ }
558
+
559
+ /* -- Misc ------------------------------------------------------------------ */
560
+ img.icon {
561
+ background: none;
562
+ vertical-align: middle;
563
+ }
564
+
565
+ img.left {
566
+ border: 1px solid #000;
567
+ float: left;
568
+ margin: 5px 8px 8px 0;
569
+ }
570
+
571
+ img.right {
572
+ border: 1px solid #000;
573
+ float: right;
574
+ margin: 5px 0 8px 8px;
575
+ }
576
+
577
+ p.footnote {
578
+ font-size: 11px;
579
+ margin: 0;
580
+ }
581
+
582
+ p.footnote:last-child { margin-bottom: 1em; }
583
+
584
+ sup.footnote { line-height: 0.9em; }
585
+
586
+ .alignLeft { text-align: left; }
587
+ .alignCenter { text-align: center; }
588
+ .alignRight { text-align: right; }
589
+
590
+ .noseeum, .hidden { display: none; }
591
+ .spaced li { margin-bottom: 1em; }
592
+ .spaced li p { margin-top: 0; }
@@ -0,0 +1,116 @@
1
+ Thoth.Admin = Thoth.Admin || {};
2
+
3
+ Thoth.Admin.Comments = function () {
4
+ // Shorthand.
5
+ var Y = YAHOO,
6
+ yut = Y.util,
7
+ yuc = yut.Connect,
8
+ yud = yut.Dom,
9
+ yue = yut.Event;
10
+
11
+ // -- Private Methods --------------------------------------------------------
12
+
13
+ /**
14
+ * Deletes the comment with the specified <i>id</i>.
15
+ *
16
+ * @method deleteComment
17
+ * @param {Number} id comment id
18
+ * @param {Boolean} silent if <i>true</i>, no confirmation dialog will be
19
+ * displayed
20
+ * @private
21
+ */
22
+ function deleteComment(id, silent) {
23
+ var postData = 'id=' + encodeURIComponent(id) + '&token=' +
24
+ encodeURIComponent(Thoth.getToken());
25
+
26
+ if (!silent && !confirm(
27
+ 'Are you sure you want to permanently delete this comment?')) {
28
+ return;
29
+ }
30
+
31
+ yuc.asyncRequest('POST', '/api/comment/delete', {
32
+ scope: this,
33
+ timeout: 8000,
34
+ failure: function (r) {
35
+ try {
36
+ alert(Y.lang.JSON.parse(r.responseText).error);
37
+ } catch (e) {
38
+ alert('Unable to delete comment.');
39
+ }
40
+ },
41
+ success: function () { hideComment(id); }
42
+ }, postData);
43
+ }
44
+
45
+ /**
46
+ * Hides the comment with the specified <i>id</i> if it's currently visible,
47
+ * using a fade-out animation. Will lazy-load the YUI Animation library if
48
+ * it hasn't already been loaded.
49
+ *
50
+ * @method hideComment
51
+ * @param {Number} id comment id
52
+ * @private
53
+ */
54
+ function hideComment(id) {
55
+ var el = yud.get('comment-' + id);
56
+
57
+ if (!el) {
58
+ return;
59
+ }
60
+
61
+ function animate() {
62
+ var anim = new yut.Anim(el, {opacity: {to: 0.0}, height: {to: 0}}, 0.2,
63
+ yut.Easing.easeBoth);
64
+
65
+ anim.onComplete.subscribe(function () {
66
+ yud.addClass(el, 'hidden');
67
+ });
68
+
69
+ anim.animate();
70
+ }
71
+
72
+ if (yut.Anim) {
73
+ animate();
74
+ } else {
75
+ LazyLoad.js(Thoth.js.yui.anim, animate);
76
+ }
77
+ }
78
+
79
+ // -- Private Event Handlers -------------------------------------------------
80
+
81
+ /**
82
+ * Handles clicks within the comments div. Uses delegation to determine what
83
+ * action to take, if any.
84
+ *
85
+ * @method handleCommentClick
86
+ * @param {Event} e event object
87
+ * @private
88
+ */
89
+ function handleCommentClick(e) {
90
+ var el = yue.getTarget(e),
91
+ commentEl;
92
+
93
+ if (yud.hasClass(el, 'comment-delete') &&
94
+ (commentEl = yud.getAncestorByClassName(el, 'comment'))) {
95
+
96
+ yue.preventDefault(e);
97
+ deleteComment(commentEl.id.split('-')[1], e.shiftKey || e.metaKey);
98
+ }
99
+ }
100
+
101
+ return {
102
+ // -- Public Methods -------------------------------------------------------
103
+
104
+ /**
105
+ * Initializes the Comments module.
106
+ *
107
+ * @method init
108
+ */
109
+ init: function () {
110
+ yue.on('comments', 'click', handleCommentClick, this, true);
111
+ }
112
+ };
113
+ }();
114
+
115
+ YAHOO.util.Event.onContentReady('comments', Thoth.Admin.Comments.init,
116
+ Thoth.Admin.Comments, true);