pagoda-jekyll 0.0.9 → 0.0.10
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.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/pagoda/app.rb +18 -3
- data/lib/pagoda/public/css/pagoda.css +118 -16
- data/lib/pagoda/public/css/pagoda.scss +133 -17
- data/lib/pagoda/public/js/editor.coffee +66 -11
- data/lib/pagoda/public/js/editor.js +87 -12
- data/lib/pagoda/templates/edit.mustache +21 -3
- data/lib/pagoda/templates/layout.mustache +1 -1
- data/lib/pagoda/views/edit.rb +1 -0
- data/pagoda.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmQ5MDVhNjhiMmY3ZTQ2MTA3ODExMGRlNDM3MzY3YmMxMzYxZGQ3YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2VmNmE5Y2JjMDFmODRkM2ZjY2FkMDBkMTQzZTJmOWFmNTUwMTlkNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODNiOTBiYzI1NmM4NTAwOTBmMjVlMmE0NGUyYjZkM2NhYWI5ZTNhMGM1YWY2
|
10
|
+
NDE1Y2YyZjljZGY5NTdjMjM5YmQ3NTM0NzFhNTY3YzZiNTAwNjNkZmZjNDFh
|
11
|
+
Nzc3OWM1ODkwYTM4YTFmMTNmNjM0MTM2ZWNkZmE2ZjlhZGFiMzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjY1YTk3MmE1ODUyYTViOTQxNzNlZmEwNmQxNWY3MTNjNjlkNGZiNjg4OWIz
|
14
|
+
NGZhNmE5MTRiMDYwMjQzZDNhNmU1MTg5ZTViYzA3M2FlMDYxNGFjMjA4YjFj
|
15
|
+
NDRhOTg2Yjg1NzdiZTg1M2Y0NDAyZjZmMWUzY2I1YjgxNWY1ZGM=
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Pagoda [
|
|
4
4
|
|
5
5
|

|
6
6
|
|
7
|
-
Zen like **blog editor** for your **Jekyll** blog, heavily inspired by Svbtle.
|
7
|
+
Zen like **blog editor** for your **Jekyll** blog, heavily inspired by [Svbtle](http://dcurt.is/codename-svbtle) and [Obtvse](https://github.com/natew/obtvse).
|
8
8
|
|
9
9
|
Screenshots
|
10
10
|
===========
|
data/lib/pagoda/app.rb
CHANGED
@@ -44,9 +44,17 @@ module Shwedagon
|
|
44
44
|
|
45
45
|
# Merge existing yaml with post params
|
46
46
|
def merge_config(yaml, params)
|
47
|
-
|
48
|
-
params[
|
49
|
-
|
47
|
+
if params['post'].has_key? 'yaml'
|
48
|
+
params['post']['yaml'].each do |key, value|
|
49
|
+
if value == 'true'
|
50
|
+
yaml[key] = true
|
51
|
+
elsif value == 'false'
|
52
|
+
yaml[key] = false
|
53
|
+
else
|
54
|
+
yaml[key] = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
50
58
|
|
51
59
|
yaml
|
52
60
|
end
|
@@ -102,6 +110,13 @@ module Shwedagon
|
|
102
110
|
@title = post.data['title']
|
103
111
|
@content = post.content
|
104
112
|
@name = post.name
|
113
|
+
|
114
|
+
@data_array = []
|
115
|
+
|
116
|
+
post.data.each do |key, value|
|
117
|
+
@data_array << {'key' => key, 'value' => value}
|
118
|
+
end
|
119
|
+
|
105
120
|
if post.data['published'] == false
|
106
121
|
@draft = true
|
107
122
|
end
|
@@ -156,11 +156,15 @@ code {
|
|
156
156
|
position: fixed;
|
157
157
|
bottom: 0;
|
158
158
|
left: 0;
|
159
|
-
background: #
|
159
|
+
background: #bbb;
|
160
160
|
color: #fff;
|
161
161
|
width: 100%;
|
162
162
|
text-align: center;
|
163
163
|
padding: 10px 0 3px;
|
164
|
+
border-top: 1px solid #999;
|
165
|
+
-webkit-box-shadow: rgba(68, 68, 68, 0.9) 0 0 5px;
|
166
|
+
-moz-box-shadow: rgba(68, 68, 68, 0.9) 0 0 5px;
|
167
|
+
box-shadow: rgba(68, 68, 68, 0.9) 0 0 5px;
|
164
168
|
}
|
165
169
|
@media only screen and (max-device-width: 480px) {
|
166
170
|
#publish-bar {
|
@@ -207,6 +211,101 @@ code {
|
|
207
211
|
#publish-bar .sub-menu li {
|
208
212
|
margin: 0 0 15px 0;
|
209
213
|
}
|
214
|
+
#publish-bar .yaml-block {
|
215
|
+
display: inline-block;
|
216
|
+
}
|
217
|
+
#publish-bar .yaml-block .button {
|
218
|
+
cursor: pointer;
|
219
|
+
}
|
220
|
+
#publish-bar .yaml-block .arrow-box {
|
221
|
+
position: relative;
|
222
|
+
background: #aaa;
|
223
|
+
border: 2px solid #444444;
|
224
|
+
}
|
225
|
+
#publish-bar .yaml-block .arrow-box:after, #publish-bar .yaml-block .arrow-box:before {
|
226
|
+
top: 100%;
|
227
|
+
border: solid transparent;
|
228
|
+
content: " ";
|
229
|
+
height: 0;
|
230
|
+
width: 0;
|
231
|
+
position: absolute;
|
232
|
+
pointer-events: none;
|
233
|
+
}
|
234
|
+
#publish-bar .yaml-block .arrow-box:after {
|
235
|
+
border-color: rgba(119, 119, 119, 0);
|
236
|
+
border-top-color: #aaa;
|
237
|
+
border-width: 10px;
|
238
|
+
left: 50%;
|
239
|
+
margin-left: -10px;
|
240
|
+
}
|
241
|
+
#publish-bar .yaml-block .arrow-box:before {
|
242
|
+
border-color: rgba(68, 68, 68, 0);
|
243
|
+
border-top-color: #444444;
|
244
|
+
border-width: 13px;
|
245
|
+
left: 50%;
|
246
|
+
margin-left: -13px;
|
247
|
+
}
|
248
|
+
#publish-bar .yaml-block .yaml-table {
|
249
|
+
position: absolute;
|
250
|
+
background-color: #fff;
|
251
|
+
bottom: 10px;
|
252
|
+
left: 20px;
|
253
|
+
float: left;
|
254
|
+
background-color: #aaa;
|
255
|
+
display: none;
|
256
|
+
-webkit-border-radius: 2px;
|
257
|
+
-moz-border-radius: 2px;
|
258
|
+
-ms-border-radius: 2px;
|
259
|
+
-o-border-radius: 2px;
|
260
|
+
border-radius: 2px;
|
261
|
+
padding: 0px;
|
262
|
+
}
|
263
|
+
#publish-bar .yaml-block .yaml-table .yaml-table-inner {
|
264
|
+
background-color: #fff;
|
265
|
+
margin: 1px;
|
266
|
+
border: 1px solid rgba(68, 68, 68, 0.4);
|
267
|
+
}
|
268
|
+
#publish-bar .yaml-block .yaml-table ul {
|
269
|
+
margin: 0;
|
270
|
+
padding: 0;
|
271
|
+
}
|
272
|
+
#publish-bar .yaml-block .yaml-table ul li .key input, #publish-bar .yaml-block .yaml-table ul li .value input {
|
273
|
+
width: 90px;
|
274
|
+
border: 0 none;
|
275
|
+
margin: 0;
|
276
|
+
padding: 0;
|
277
|
+
color: #333;
|
278
|
+
font-family: 'Titillium Web', sans-serif;
|
279
|
+
font-size: 14px;
|
280
|
+
padding-left: 10px;
|
281
|
+
}
|
282
|
+
#publish-bar .yaml-block .yaml-table ul li .key, #publish-bar .yaml-block .yaml-table ul li .value {
|
283
|
+
border-bottom: 1px solid #777;
|
284
|
+
margin: 0;
|
285
|
+
padding: 0;
|
286
|
+
padding-bottom: 2px;
|
287
|
+
display: inline-block;
|
288
|
+
}
|
289
|
+
#publish-bar .yaml-block .yaml-table ul li .key {
|
290
|
+
border-right: 1px solid #777;
|
291
|
+
}
|
292
|
+
#publish-bar .yaml-block .yaml-table ul li .value {
|
293
|
+
margin-left: -3px;
|
294
|
+
}
|
295
|
+
#publish-bar .yaml-block .yaml-table ul li:last-child .key, #publish-bar .yaml-block .yaml-table ul li:last-child .value {
|
296
|
+
border-bottom: 0 none;
|
297
|
+
}
|
298
|
+
#publish-bar .yaml-block .yaml-table ul li.add-yaml-entry {
|
299
|
+
color: #fff;
|
300
|
+
text-shadow: 0px 0px 5px #000;
|
301
|
+
background-color: #aaa;
|
302
|
+
font-size: 14px;
|
303
|
+
line-height: 20px;
|
304
|
+
cursor: pointer;
|
305
|
+
}
|
306
|
+
#publish-bar .yaml-block .yaml-table ul li.add-yaml-entry:hover {
|
307
|
+
text-shadow: 0px 0px 20px #000;
|
308
|
+
}
|
210
309
|
|
211
310
|
#publish-bar input[type=submit],
|
212
311
|
#publish-bar a,
|
@@ -288,11 +387,6 @@ label {
|
|
288
387
|
margin: 0 8px 0 0;
|
289
388
|
}
|
290
389
|
|
291
|
-
#post_draft {
|
292
|
-
position: relative;
|
293
|
-
margin: 0 20px 0 0;
|
294
|
-
}
|
295
|
-
|
296
390
|
.admin-links {
|
297
391
|
position: absolute;
|
298
392
|
text-align: right;
|
@@ -336,9 +430,9 @@ body.posts.new #admin {
|
|
336
430
|
}
|
337
431
|
#admin .draft-options {
|
338
432
|
display: inline-block;
|
339
|
-
border: 3px solid #
|
340
|
-
border-radius:
|
341
|
-
padding:
|
433
|
+
border: 3px solid #000;
|
434
|
+
border-radius: 5px;
|
435
|
+
padding: 1px;
|
342
436
|
}
|
343
437
|
@media only screen and (max-device-width: 480px) {
|
344
438
|
#admin .draft-options {
|
@@ -346,14 +440,22 @@ body.posts.new #admin {
|
|
346
440
|
}
|
347
441
|
}
|
348
442
|
#admin .draft-options a {
|
349
|
-
font-size:
|
350
|
-
padding:
|
443
|
+
font-size: 15px;
|
444
|
+
padding: 4px 10px;
|
445
|
+
background-color: transparent;
|
446
|
+
color: #000;
|
447
|
+
border-radius: 4px;
|
351
448
|
}
|
352
|
-
#admin .draft-options a.selected {
|
353
|
-
background-color: #
|
449
|
+
#admin .draft-options a.selected, #admin .draft-options a:hover {
|
450
|
+
background-color: #000;
|
451
|
+
color: #fff;
|
354
452
|
}
|
355
|
-
#admin .draft-options
|
356
|
-
|
453
|
+
#admin .draft-options a.override-select {
|
454
|
+
background-color: inherit;
|
455
|
+
color: #000;
|
456
|
+
}
|
457
|
+
#admin #save-button {
|
458
|
+
width: 90px;
|
357
459
|
}
|
358
460
|
#admin #save-button.saved {
|
359
461
|
color: #999;
|
@@ -671,7 +773,7 @@ body {
|
|
671
773
|
}
|
672
774
|
|
673
775
|
@media only screen and (max-device-width: 480px) {
|
674
|
-
#publish-bar .delete-bar, #publish-bar #draft_label
|
776
|
+
#publish-bar .delete-bar, #publish-bar #draft_label {
|
675
777
|
display: none;
|
676
778
|
}
|
677
779
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@import "compass/css3";
|
1
2
|
/* TODO: pull out coloring into variables */
|
2
3
|
$linkhover: red;
|
3
4
|
$iphone: "only screen and (max-device-width : 480px)";
|
@@ -151,11 +152,13 @@ code {
|
|
151
152
|
position: fixed;
|
152
153
|
bottom: 0;
|
153
154
|
left: 0;
|
154
|
-
background: #
|
155
|
+
background: #bbb;
|
155
156
|
color: #fff;
|
156
157
|
width: 100%;
|
157
158
|
text-align: center;
|
158
159
|
padding: 10px 0 3px;
|
160
|
+
border-top: 1px solid #999;
|
161
|
+
@include box-shadow(rgba(#444, 0.9) 0 0 5px);
|
159
162
|
|
160
163
|
@media #{$iphone} {
|
161
164
|
padding: 2px 0;
|
@@ -205,6 +208,115 @@ code {
|
|
205
208
|
.sub-menu li {
|
206
209
|
margin: 0 0 15px 0;
|
207
210
|
}
|
211
|
+
|
212
|
+
.yaml-block {
|
213
|
+
display: inline-block;
|
214
|
+
|
215
|
+
.button {
|
216
|
+
cursor: pointer;
|
217
|
+
}
|
218
|
+
|
219
|
+
.arrow-box {
|
220
|
+
position: relative;
|
221
|
+
background: #aaa;
|
222
|
+
border: 2px solid #444444;
|
223
|
+
&:after, &:before {
|
224
|
+
top: 100%;
|
225
|
+
border: solid transparent;
|
226
|
+
content: " ";
|
227
|
+
height: 0;
|
228
|
+
width: 0;
|
229
|
+
position: absolute;
|
230
|
+
pointer-events: none;
|
231
|
+
}
|
232
|
+
&:after {
|
233
|
+
border-color: rgba(119, 119, 119, 0);
|
234
|
+
border-top-color: #aaa;
|
235
|
+
border-width: 10px;
|
236
|
+
left: 50%;
|
237
|
+
margin-left: -10px;
|
238
|
+
}
|
239
|
+
&:before {
|
240
|
+
border-color: rgba(68, 68, 68, 0);
|
241
|
+
border-top-color: #444444;
|
242
|
+
border-width: 13px;
|
243
|
+
left: 50%;
|
244
|
+
margin-left: -13px;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
.yaml-table {
|
249
|
+
position: absolute;
|
250
|
+
background-color: #fff;
|
251
|
+
bottom: 10px;
|
252
|
+
left: 20px;
|
253
|
+
float: left;
|
254
|
+
background-color: #aaa;
|
255
|
+
display: none;
|
256
|
+
|
257
|
+
@include border-radius(2px);
|
258
|
+
padding: 0px;
|
259
|
+
|
260
|
+
.yaml-table-inner {
|
261
|
+
background-color: #fff;
|
262
|
+
margin: 1px;
|
263
|
+
border: 1px solid rgba(#444, 0.4);
|
264
|
+
}
|
265
|
+
|
266
|
+
ul {
|
267
|
+
margin: 0;
|
268
|
+
padding: 0;
|
269
|
+
|
270
|
+
li {
|
271
|
+
.key input, .value input {
|
272
|
+
width: 90px;
|
273
|
+
border: 0 none;
|
274
|
+
margin: 0;
|
275
|
+
padding: 0;
|
276
|
+
color: #333;
|
277
|
+
font-family: 'Titillium Web', sans-serif;
|
278
|
+
font-size: 14px;
|
279
|
+
padding-left: 10px;
|
280
|
+
}
|
281
|
+
|
282
|
+
.key, .value {
|
283
|
+
border-bottom: 1px solid #777;
|
284
|
+
margin: 0;
|
285
|
+
padding: 0;
|
286
|
+
padding-bottom: 2px;
|
287
|
+
display: inline-block;
|
288
|
+
}
|
289
|
+
|
290
|
+
.key {
|
291
|
+
border-right: 1px solid #777;
|
292
|
+
}
|
293
|
+
|
294
|
+
.value {
|
295
|
+
margin-left: -3px;
|
296
|
+
}
|
297
|
+
|
298
|
+
&:last-child {
|
299
|
+
.key, .value {
|
300
|
+
border-bottom: 0 none;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
li.add-yaml-entry {
|
306
|
+
color: #fff;
|
307
|
+
text-shadow: 0px 0px 5px #000;
|
308
|
+
background-color: #aaa;
|
309
|
+
font-size: 14px;
|
310
|
+
line-height: 20px;
|
311
|
+
cursor: pointer;
|
312
|
+
|
313
|
+
&:hover {
|
314
|
+
text-shadow: 0px 0px 20px #000;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
}
|
208
320
|
}
|
209
321
|
|
210
322
|
#publish-bar input[type=submit],
|
@@ -284,11 +396,6 @@ label {
|
|
284
396
|
margin: 0 8px 0 0;
|
285
397
|
}
|
286
398
|
|
287
|
-
#post_draft {
|
288
|
-
position: relative;
|
289
|
-
margin: 0 20px 0 0;
|
290
|
-
}
|
291
|
-
|
292
399
|
.admin-links {
|
293
400
|
position: absolute;
|
294
401
|
text-align: right;
|
@@ -327,25 +434,34 @@ body.posts.new #admin {
|
|
327
434
|
|
328
435
|
.draft-options {
|
329
436
|
display: inline-block;
|
330
|
-
border: 3px solid #
|
331
|
-
border-radius:
|
332
|
-
padding:
|
437
|
+
border: 3px solid #000;
|
438
|
+
border-radius: 5px;
|
439
|
+
padding: 1px;
|
333
440
|
@media #{$iphone} { display: none; }
|
334
441
|
|
335
442
|
a {
|
336
|
-
font-size:
|
337
|
-
padding:
|
443
|
+
font-size: 15px;
|
444
|
+
padding: 4px 10px;
|
445
|
+
background-color: transparent;
|
446
|
+
color: #000;
|
447
|
+
border-radius: 4px;
|
338
448
|
}
|
339
449
|
|
340
|
-
a.selected {
|
341
|
-
background-color: #
|
450
|
+
a.selected, a:hover {
|
451
|
+
background-color: #000;
|
452
|
+
color: #fff;
|
342
453
|
}
|
343
454
|
|
344
|
-
|
345
|
-
|
455
|
+
a.override-select {
|
456
|
+
background-color: inherit;
|
457
|
+
color: #000;
|
346
458
|
}
|
347
459
|
}
|
348
|
-
|
460
|
+
|
461
|
+
#save-button {
|
462
|
+
width: 90px;
|
463
|
+
}
|
464
|
+
|
349
465
|
#save-button.saved {
|
350
466
|
color: #999;
|
351
467
|
|
@@ -677,7 +793,7 @@ body {
|
|
677
793
|
}
|
678
794
|
|
679
795
|
#publish-bar {
|
680
|
-
.delete-bar, #draft_label
|
796
|
+
.delete-bar, #draft_label {
|
681
797
|
@media #{$iphone} { display: none; }
|
682
798
|
}
|
683
799
|
}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
$(document).ready ->
|
2
2
|
|
3
|
-
# Keymaster doesn't allow INPUT, TEXTAREA to have shortcuts.
|
4
|
-
# Override it.
|
5
3
|
key.filter = (e)->
|
6
4
|
true
|
7
5
|
|
@@ -13,12 +11,12 @@ $(document).ready ->
|
|
13
11
|
|
14
12
|
set_save_button = (status)->
|
15
13
|
if(status == 'saving')
|
16
|
-
$('#save-button').val('
|
14
|
+
$('#save-button').val('SAVING')
|
17
15
|
$('#save-button').addClass('post-saving')
|
18
16
|
else if status == 'saved'
|
19
|
-
$('#save-button').val('
|
17
|
+
$('#save-button').val('SAVED')
|
20
18
|
setTimeout((->
|
21
|
-
$('#save-button').val('
|
19
|
+
$('#save-button').val('SAVE')
|
22
20
|
$('#save-button').removeClass('post-saving')
|
23
21
|
), 1000)
|
24
22
|
else if status == 'error'
|
@@ -27,31 +25,33 @@ $(document).ready ->
|
|
27
25
|
setTimeout((->set_save_button('saved')),2000)
|
28
26
|
|
29
27
|
draft_post = ->
|
30
|
-
$('#post_draft').prop('checked', true)
|
31
28
|
$('#draft-action').addClass('selected')
|
32
29
|
$('#publish-action').removeClass('selected')
|
30
|
+
$('.override-select').removeClass('override-select')
|
31
|
+
$('[name="yaml_value[published]"]').val("false")
|
33
32
|
save_post()
|
34
33
|
false
|
35
34
|
|
36
35
|
publish_post = ->
|
37
|
-
$('#post_draft').prop('checked', false)
|
38
36
|
$('#draft-action').removeClass('selected')
|
39
37
|
$('#publish-action').addClass('selected')
|
38
|
+
$('.override-select').removeClass('override-select')
|
39
|
+
$('[name="yaml_value[published]"]').val("true")
|
40
40
|
save_post()
|
41
41
|
false
|
42
42
|
|
43
43
|
|
44
44
|
# Save post
|
45
45
|
save_post = ->
|
46
|
+
clear_empty_yaml()
|
46
47
|
set_save_button('saving')
|
47
|
-
draft = if $('#post_draft').is(':checked') then 'on' else 'off'
|
48
48
|
|
49
49
|
post_obj =
|
50
50
|
post :
|
51
51
|
title : $('#post-title').val()
|
52
52
|
content : $('#post-content').val()
|
53
53
|
name : $('#post_name').val()
|
54
|
-
|
54
|
+
yaml : yaml_hash()
|
55
55
|
|
56
56
|
ajax : true
|
57
57
|
|
@@ -64,6 +64,50 @@ $(document).ready ->
|
|
64
64
|
)
|
65
65
|
.fail((->set_save_button('error')))
|
66
66
|
|
67
|
+
add_yaml_entry = ->
|
68
|
+
html = $('#add-yaml-template').html()
|
69
|
+
$(html).insertBefore($('.add-yaml-entry'))
|
70
|
+
$('.yaml-table-inner .key input').focus()
|
71
|
+
|
72
|
+
$('.yaml-table-inner input').unbind('keyup', yaml_table_set_data)
|
73
|
+
$('.yaml-table-inner input').bind('keyup', yaml_table_set_data)
|
74
|
+
|
75
|
+
clear_empty_yaml =->
|
76
|
+
rows = $('.yaml-table-inner input.yaml-value')
|
77
|
+
|
78
|
+
for row in rows
|
79
|
+
if $(row).val() == ''
|
80
|
+
$(row).parent().parent().remove()
|
81
|
+
|
82
|
+
yaml_hash =->
|
83
|
+
rows = $('.yaml-table-inner input.yaml-value')
|
84
|
+
hash = {}
|
85
|
+
for row in rows
|
86
|
+
name = $(row).attr('name').replace("yaml_value[", "").replace("]", "")
|
87
|
+
value = $(row).val()
|
88
|
+
hash[name] = value
|
89
|
+
|
90
|
+
hash
|
91
|
+
|
92
|
+
|
93
|
+
toggle_yaml_table = ->
|
94
|
+
console.log(yaml_hash())
|
95
|
+
$('.yaml-table').toggle()
|
96
|
+
|
97
|
+
yaml_table_set_data = ->
|
98
|
+
rows = $('.yaml-table-inner input')
|
99
|
+
for row in rows
|
100
|
+
if $(row).hasClass('yaml-key')
|
101
|
+
value = $(row).val()
|
102
|
+
value = value.replace(" ","-")
|
103
|
+
$(row).val(value)
|
104
|
+
name = "yaml_key[#{value}]"
|
105
|
+
$(row).attr('name', name)
|
106
|
+
else if $(row).hasClass('yaml-value')
|
107
|
+
key = $(row).parent().parent().find('.yaml-key').val()
|
108
|
+
name = "yaml_value[#{key}]"
|
109
|
+
$(row).attr('name', name)
|
110
|
+
|
67
111
|
# Dom invoked events
|
68
112
|
handle_events =->
|
69
113
|
$('#post-editor #post-title').autosize({append: "\n"})
|
@@ -71,6 +115,14 @@ $(document).ready ->
|
|
71
115
|
$("#fullscreen").click (e)->
|
72
116
|
screenfull.request();
|
73
117
|
|
118
|
+
$(".draft-options a").hover (->
|
119
|
+
if not $(this).hasClass('selected')
|
120
|
+
$(".draft-options a.selected").addClass('override-select')
|
121
|
+
),(->
|
122
|
+
if not $(this).hasClass('selected')
|
123
|
+
$(".draft-options a.selected").removeClass('override-select')
|
124
|
+
)
|
125
|
+
|
74
126
|
screenfull.onchange = ->
|
75
127
|
if screenfull.isFullscreen
|
76
128
|
$('#fullscreen').hide()
|
@@ -103,7 +155,9 @@ $(document).ready ->
|
|
103
155
|
|
104
156
|
$('#draft-action').click(draft_post)
|
105
157
|
$('#publish-action').click(publish_post)
|
106
|
-
|
158
|
+
$('.add-yaml-entry').click(add_yaml_entry)
|
159
|
+
$('.yaml-block .button').click(toggle_yaml_table)
|
160
|
+
$('.yaml-table-inner input').bind('keyup', yaml_table_set_data)
|
107
161
|
|
108
162
|
keyboard_events =->
|
109
163
|
key('⌘+enter, ctrl+enter', (e)->
|
@@ -146,7 +200,7 @@ $(document).ready ->
|
|
146
200
|
# Hide the address bar!
|
147
201
|
window.scrollTo 0, 1
|
148
202
|
), 0
|
149
|
-
|
203
|
+
$('.links').remove()
|
150
204
|
|
151
205
|
init =->
|
152
206
|
handle_events()
|
@@ -154,5 +208,6 @@ $(document).ready ->
|
|
154
208
|
show_shortcuts() if not is_iphone()
|
155
209
|
focus_to_type()
|
156
210
|
fullscreen_mobile()
|
211
|
+
yaml_table_set_data()
|
157
212
|
|
158
213
|
init()
|
@@ -2,7 +2,7 @@
|
|
2
2
|
(function() {
|
3
3
|
|
4
4
|
$(document).ready(function() {
|
5
|
-
var draft_post, focus_to_type, fullscreen_mobile, handle_events, init, is_edit_page, is_iphone, keyboard_events, publish_post, save_post, set_save_button, show_shortcuts;
|
5
|
+
var add_yaml_entry, clear_empty_yaml, draft_post, focus_to_type, fullscreen_mobile, handle_events, init, is_edit_page, is_iphone, keyboard_events, publish_post, save_post, set_save_button, show_shortcuts, toggle_yaml_table, yaml_hash, yaml_table_set_data;
|
6
6
|
key.filter = function(e) {
|
7
7
|
return true;
|
8
8
|
};
|
@@ -14,12 +14,12 @@
|
|
14
14
|
};
|
15
15
|
set_save_button = function(status) {
|
16
16
|
if (status === 'saving') {
|
17
|
-
$('#save-button').val('
|
17
|
+
$('#save-button').val('SAVING');
|
18
18
|
return $('#save-button').addClass('post-saving');
|
19
19
|
} else if (status === 'saved') {
|
20
|
-
$('#save-button').val('
|
20
|
+
$('#save-button').val('SAVED');
|
21
21
|
return setTimeout((function() {
|
22
|
-
$('#save-button').val('
|
22
|
+
$('#save-button').val('SAVE');
|
23
23
|
return $('#save-button').removeClass('post-saving');
|
24
24
|
}), 1000);
|
25
25
|
} else if (status === 'error') {
|
@@ -31,29 +31,31 @@
|
|
31
31
|
}
|
32
32
|
};
|
33
33
|
draft_post = function() {
|
34
|
-
$('#post_draft').prop('checked', true);
|
35
34
|
$('#draft-action').addClass('selected');
|
36
35
|
$('#publish-action').removeClass('selected');
|
36
|
+
$('.override-select').removeClass('override-select');
|
37
|
+
$('[name="yaml_value[published]"]').val("false");
|
37
38
|
save_post();
|
38
39
|
return false;
|
39
40
|
};
|
40
41
|
publish_post = function() {
|
41
|
-
$('#post_draft').prop('checked', false);
|
42
42
|
$('#draft-action').removeClass('selected');
|
43
43
|
$('#publish-action').addClass('selected');
|
44
|
+
$('.override-select').removeClass('override-select');
|
45
|
+
$('[name="yaml_value[published]"]').val("true");
|
44
46
|
save_post();
|
45
47
|
return false;
|
46
48
|
};
|
47
49
|
save_post = function() {
|
48
|
-
var
|
50
|
+
var post_obj;
|
51
|
+
clear_empty_yaml();
|
49
52
|
set_save_button('saving');
|
50
|
-
draft = $('#post_draft').is(':checked') ? 'on' : 'off';
|
51
53
|
post_obj = {
|
52
54
|
post: {
|
53
55
|
title: $('#post-title').val(),
|
54
56
|
content: $('#post-content').val(),
|
55
57
|
name: $('#post_name').val(),
|
56
|
-
|
58
|
+
yaml: yaml_hash()
|
57
59
|
},
|
58
60
|
ajax: true
|
59
61
|
};
|
@@ -71,6 +73,66 @@
|
|
71
73
|
return set_save_button('error');
|
72
74
|
}));
|
73
75
|
};
|
76
|
+
add_yaml_entry = function() {
|
77
|
+
var html;
|
78
|
+
html = $('#add-yaml-template').html();
|
79
|
+
$(html).insertBefore($('.add-yaml-entry'));
|
80
|
+
$('.yaml-table-inner .key input').focus();
|
81
|
+
$('.yaml-table-inner input').unbind('keyup', yaml_table_set_data);
|
82
|
+
return $('.yaml-table-inner input').bind('keyup', yaml_table_set_data);
|
83
|
+
};
|
84
|
+
clear_empty_yaml = function() {
|
85
|
+
var row, rows, _i, _len, _results;
|
86
|
+
rows = $('.yaml-table-inner input.yaml-value');
|
87
|
+
_results = [];
|
88
|
+
for (_i = 0, _len = rows.length; _i < _len; _i++) {
|
89
|
+
row = rows[_i];
|
90
|
+
if ($(row).val() === '') {
|
91
|
+
_results.push($(row).parent().parent().remove());
|
92
|
+
} else {
|
93
|
+
_results.push(void 0);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
return _results;
|
97
|
+
};
|
98
|
+
yaml_hash = function() {
|
99
|
+
var hash, name, row, rows, value, _i, _len;
|
100
|
+
rows = $('.yaml-table-inner input.yaml-value');
|
101
|
+
hash = {};
|
102
|
+
for (_i = 0, _len = rows.length; _i < _len; _i++) {
|
103
|
+
row = rows[_i];
|
104
|
+
name = $(row).attr('name').replace("yaml_value[", "").replace("]", "");
|
105
|
+
value = $(row).val();
|
106
|
+
hash[name] = value;
|
107
|
+
}
|
108
|
+
return hash;
|
109
|
+
};
|
110
|
+
toggle_yaml_table = function() {
|
111
|
+
console.log(yaml_hash());
|
112
|
+
return $('.yaml-table').toggle();
|
113
|
+
};
|
114
|
+
yaml_table_set_data = function() {
|
115
|
+
var key, name, row, rows, value, _i, _len, _results;
|
116
|
+
rows = $('.yaml-table-inner input');
|
117
|
+
_results = [];
|
118
|
+
for (_i = 0, _len = rows.length; _i < _len; _i++) {
|
119
|
+
row = rows[_i];
|
120
|
+
if ($(row).hasClass('yaml-key')) {
|
121
|
+
value = $(row).val();
|
122
|
+
value = value.replace(" ", "-");
|
123
|
+
$(row).val(value);
|
124
|
+
name = "yaml_key[" + value + "]";
|
125
|
+
_results.push($(row).attr('name', name));
|
126
|
+
} else if ($(row).hasClass('yaml-value')) {
|
127
|
+
key = $(row).parent().parent().find('.yaml-key').val();
|
128
|
+
name = "yaml_value[" + key + "]";
|
129
|
+
_results.push($(row).attr('name', name));
|
130
|
+
} else {
|
131
|
+
_results.push(void 0);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return _results;
|
135
|
+
};
|
74
136
|
handle_events = function() {
|
75
137
|
$('#post-editor #post-title').autosize({
|
76
138
|
append: "\n"
|
@@ -78,6 +140,15 @@
|
|
78
140
|
$("#fullscreen").click(function(e) {
|
79
141
|
return screenfull.request();
|
80
142
|
});
|
143
|
+
$(".draft-options a").hover((function() {
|
144
|
+
if (!$(this).hasClass('selected')) {
|
145
|
+
return $(".draft-options a.selected").addClass('override-select');
|
146
|
+
}
|
147
|
+
}), (function() {
|
148
|
+
if (!$(this).hasClass('selected')) {
|
149
|
+
return $(".draft-options a.selected").removeClass('override-select');
|
150
|
+
}
|
151
|
+
}));
|
81
152
|
screenfull.onchange = function() {
|
82
153
|
if (screenfull.isFullscreen) {
|
83
154
|
$('#fullscreen').hide();
|
@@ -110,7 +181,10 @@
|
|
110
181
|
return false;
|
111
182
|
});
|
112
183
|
$('#draft-action').click(draft_post);
|
113
|
-
|
184
|
+
$('#publish-action').click(publish_post);
|
185
|
+
$('.add-yaml-entry').click(add_yaml_entry);
|
186
|
+
$('.yaml-block .button').click(toggle_yaml_table);
|
187
|
+
return $('.yaml-table-inner input').bind('keyup', yaml_table_set_data);
|
114
188
|
}
|
115
189
|
};
|
116
190
|
keyboard_events = function() {
|
@@ -154,8 +228,8 @@
|
|
154
228
|
setTimeout((function() {
|
155
229
|
return window.scrollTo(0, 1);
|
156
230
|
}), 0);
|
231
|
+
return $('.links').remove();
|
157
232
|
}
|
158
|
-
return $('.links').remove();
|
159
233
|
};
|
160
234
|
init = function() {
|
161
235
|
handle_events();
|
@@ -164,7 +238,8 @@
|
|
164
238
|
show_shortcuts();
|
165
239
|
}
|
166
240
|
focus_to_type();
|
167
|
-
|
241
|
+
fullscreen_mobile();
|
242
|
+
return yaml_table_set_data();
|
168
243
|
};
|
169
244
|
return init();
|
170
245
|
});
|
@@ -2,7 +2,6 @@
|
|
2
2
|
<body class="admin posts edit">
|
3
3
|
<div id="admin">
|
4
4
|
<div id="save"></div>
|
5
|
-
|
6
5
|
<form accept-charset="UTF-8" action="{{base_url}}/save-post" class="edit_post" method="post">
|
7
6
|
{{>editor_area}}
|
8
7
|
<div id="publish-bar-hover">
|
@@ -10,14 +9,29 @@
|
|
10
9
|
<div class="contain">
|
11
10
|
<div class="left">
|
12
11
|
<a href="{{base_url}}/">« ADMIN</a>
|
13
|
-
|
12
|
+
{{alagu}}
|
13
|
+
<div class="yaml-block">
|
14
|
+
<div class="yaml-table arrow-box">
|
15
|
+
<div class="yaml-table-inner">
|
16
|
+
<ul>
|
17
|
+
{{#data_array}}
|
18
|
+
<li>
|
19
|
+
<div class="key"><input type="text" class="yaml-key" name="yaml_key[{{key}}]" value="{{key}}" /></div>
|
20
|
+
<div class="value"><input type="text" class="yaml-value" name="yaml_value[{{value}}]" value="{{value}}"/></div>
|
21
|
+
</li>
|
22
|
+
{{/data_array}}
|
23
|
+
<li class="add-yaml-entry"> Add new item </li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<a id="#" class="button">DATA</a>
|
28
|
+
</div>
|
14
29
|
</div>
|
15
30
|
<div class="right">
|
16
31
|
|
17
32
|
<div class="draft-options">
|
18
33
|
<a id="draft-action" class="button {{#draft}}selected{{/draft}}" href="#">DRAFT</a>
|
19
34
|
<a id="publish-action" class="button {{^draft}}selected{{/draft}}" href="#">DONE</a>
|
20
|
-
<input id="post_draft" name="post[draft]" type="checkbox" {{#draft}}checked{{/draft}} />
|
21
35
|
</div>
|
22
36
|
<input id="save-button" name="commit" type="submit" value="SAVE" />
|
23
37
|
</div>
|
@@ -25,6 +39,10 @@
|
|
25
39
|
</div>
|
26
40
|
</div>
|
27
41
|
</form>
|
42
|
+
<script type="text/template" id="add-yaml-template"><li>
|
43
|
+
<div class="key"><input type="text" class="yaml-key" value="" /></div>
|
44
|
+
<div class="value"><input type="text" class="yaml-value" value=""/></div>
|
45
|
+
</li></script>
|
28
46
|
</div>
|
29
47
|
|
30
48
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/pagoda.css" media="screen, projection">
|
8
8
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/tiptip.css" media="screen, projection">
|
9
|
-
<link href='http://fonts.googleapis.com/css?family=Lato:300,900|Asap' rel='stylesheet' type='text/css' />
|
9
|
+
<link href='http://fonts.googleapis.com/css?family=Lato:300,900|Asap|Titillium+Web' rel='stylesheet' type='text/css' />
|
10
10
|
<link rel="apple-touch-icon" href="{{base_url}}/images/apple-touch-icon.png" />
|
11
11
|
|
12
12
|
|
data/lib/pagoda/views/edit.rb
CHANGED
data/pagoda.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.required_ruby_version = ">= 1.8.7"
|
6
6
|
|
7
7
|
s.name = 'pagoda-jekyll'
|
8
|
-
s.version = '0.0.
|
9
|
-
s.date = '2013-
|
8
|
+
s.version = '0.0.10'
|
9
|
+
s.date = '2013-06-09'
|
10
10
|
s.rubyforge_project = 'pagoda-jekyll'
|
11
11
|
|
12
12
|
s.summary = "A simple admin for Jekyll"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagoda-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alagu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|