pagoda-jekyll 0.0.7 → 0.0.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWYwMTVlOGMwNjRjNTdlN2Q4MGI1ZmJkMDE2YmUxNTdlNDYwYjliNQ==
4
+ N2I4MzRlYTlhNDcyYjNjM2NhZWM4ZTljOWJmY2VmZTllOGRlMTU0YQ==
5
5
  data.tar.gz: !binary |-
6
- OGU0YTY4NTllYzE0MjNhYzQ5NGFhZDAyYjhmMDZkZDk4MzUyNTY2Nw==
6
+ Y2UwZTQ4ZTZkZTljNDdiYWJhNGZkZmVlNjQ5YTE5NjNkZDU0OTE3MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODYxZDU2NjUwZGQwN2M3MWIwOGY3YjJiNzE1NTUyYzUzYzcwYmRlMjBlYWZl
10
- OTdiMTU4MWI1ZWI4NTlhZWJkMWU4NTg3YmQ1ODIyZTAyNTQ1NGNjMjIyMjUw
11
- Y2M1Yzk1ZGVkY2NkMTcxM2Q1MDY1MzZlZmNkZGIxYjdlYWZmZDc=
9
+ OGNjNTJlNjZjNzQwODdlZWY1NTRkYjllNTFlNzViOTAwYzk0NGU5ODRjYjkx
10
+ ZGM3NmNiZjc1NjM0OTNiYWMzMWIzMTA5MzFmYzAzZDc1ZjY1NWQzNmQ0NmQ1
11
+ ZTIyOTk0MmE5NTAwZGE0OWExZTQwM2Q2NmU5Y2VmMWZiMTVkODQ=
12
12
  data.tar.gz: !binary |-
13
- ODIyZDkzY2Y4MjVkMGE1OWZmZDkxMzdkZjY5MjYwMjE0Y2U2NTQ0N2E2ZmRh
14
- MTlkODkxZGE2MjlkOTE5N2Y2YzYwYTY4MDU3MDA3OTk5ODY4Mjk1MzJmMmU5
15
- N2FkNWMwYTQwMTAzN2E4MzYzMGRiYjg4NzI3YWUzNjViNjQ1ZmM=
13
+ NjRiNWQ1YTU1ZGVmN2Q4NjgyZjcxZjE2NjFkMjk3YzMzNTBhMTY3MGNjMGFl
14
+ MzM4NjFiMDEyM2YxOWM2MmY4ZTQ4YjA3MTI1MDA2ZTI2ZDM0ZjFlN2YwNWVl
15
+ MzhjOTc5NGYyMjYyMzI5ZDAzN2Y0OTUzMDVlOGVjMmEzMGYwNjI=
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagoda-jekyll (0.0.5)
4
+ pagoda-jekyll (0.0.7)
5
5
  grit
6
6
  jekyll
7
7
  json
8
8
  sinatra
9
9
  sinatra-mustache
10
+ sinatra-reloader
10
11
  stringex
11
12
 
12
13
  GEM
@@ -35,7 +36,7 @@ GEM
35
36
  simplecov (>= 0.7)
36
37
  thor
37
38
  diff-lcs (1.2.2)
38
- directory_watcher (1.5.1)
39
+ directory_watcher (1.4.1)
39
40
  eventmachine (1.0.3)
40
41
  fast-stemmer (1.0.2)
41
42
  fssm (0.2.10)
@@ -132,4 +133,3 @@ DEPENDENCIES
132
133
  rake (~> 10.0.3)
133
134
  shoulda
134
135
  simplecov
135
- sinatra-reloader
data/config.ru CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  $:.unshift File.join(File.dirname(__FILE__), *%w[lib])
3
2
 
4
3
  require 'rubygems'
@@ -7,5 +6,5 @@ require 'pagoda/app'
7
6
 
8
7
  use Rack::ShowExceptions
9
8
 
10
- Shwedagon::App.set :blog, '../blog/'
11
- run Shwedagon::App.new
9
+ Shwedagon::App.set :blog, ENV['blog']
10
+ map ('/admin') { run Shwedagon::App.new }
@@ -13,10 +13,18 @@ require 'pagoda/helper'
13
13
  require 'pagoda/config'
14
14
  require 'pagoda/jekyll-mod'
15
15
 
16
+
17
+
16
18
  # Sinatra based frontend
17
19
  module Shwedagon
18
- class App < Sinatra::Base
19
20
 
21
+
22
+ class App < Sinatra::Base
23
+
24
+ before do
25
+ @base_url = url('/', false).chomp('/')
26
+ end
27
+
20
28
  # Create a new post from scratch. Return filename
21
29
  # This would not commit the file.
22
30
  def create_new_post(params)
@@ -79,7 +87,7 @@ module Shwedagon
79
87
  repo.remove([full_path])
80
88
  data = repo.commit_index "Deleted #{post_file}"
81
89
 
82
- redirect "/"
90
+ redirect @base_url
83
91
  end
84
92
 
85
93
  # Edit any post
@@ -142,7 +150,7 @@ module Shwedagon
142
150
  if params[:ajax]
143
151
  {:status => 'OK'}.to_json
144
152
  else
145
- redirect '/edit/' + filename
153
+ redirect @base_url + '/edit/' + filename
146
154
  end
147
155
  end
148
156
 
@@ -39,6 +39,10 @@ module Shwedagon
39
39
  # Gives out a sorted list of post template data
40
40
  # for a post or draft
41
41
  def posts_template_data(post_items)
42
+ if post_items.nil?
43
+ return []
44
+ end
45
+
42
46
  template_data = post_items.map do |post|
43
47
  {
44
48
  :title => post.data['title'],
@@ -156,16 +156,27 @@ code {
156
156
  position: fixed;
157
157
  bottom: 0;
158
158
  left: 0;
159
- background: #222;
159
+ background: #333;
160
160
  color: #fff;
161
161
  width: 100%;
162
162
  text-align: center;
163
163
  padding: 10px 0 3px;
164
164
  }
165
+ @media only screen and (max-device-width: 480px) {
166
+ #publish-bar {
167
+ padding: 2px 0;
168
+ }
169
+ }
165
170
  #publish-bar .contain {
166
171
  margin: 0 auto;
167
172
  width: 960px;
168
173
  }
174
+ @media only screen and (max-device-width: 480px) {
175
+ #publish-bar .contain {
176
+ width: 300px;
177
+ padding: 3px 10px;
178
+ }
179
+ }
169
180
  #publish-bar input[type=text] {
170
181
  border: none;
171
182
  border-bottom: 1px solid #333;
@@ -209,6 +220,23 @@ code {
209
220
  border-radius: 5px;
210
221
  -moz-border-radius: 5px;
211
222
  -webkit-border-radius: 5px;
223
+ -webkit-appearance: none;
224
+ }
225
+ @media only screen and (max-device-width: 480px) {
226
+ #publish-bar input[type=submit],
227
+ #publish-bar a,
228
+ .button {
229
+ padding: 2px 10px;
230
+ font-size: 12px;
231
+ }
232
+ }
233
+
234
+ @media only screen and (max-device-width: 480px) {
235
+ #publish-bar input[type=submit] {
236
+ padding-top: 5px;
237
+ padding-bottom: 5px;
238
+ margin-top: -1px;
239
+ }
212
240
  }
213
241
 
214
242
  .button.secondary {
@@ -301,6 +329,32 @@ body.posts.new #admin {
301
329
  margin: 0 auto;
302
330
  position: relative;
303
331
  }
332
+ @media only screen and (max-device-width: 480px) {
333
+ #admin {
334
+ width: 320px;
335
+ }
336
+ }
337
+ #admin .draft-options {
338
+ display: inline-block;
339
+ border: 3px solid #777;
340
+ border-radius: 10px;
341
+ padding: 4px;
342
+ }
343
+ @media only screen and (max-device-width: 480px) {
344
+ #admin .draft-options {
345
+ display: none;
346
+ }
347
+ }
348
+ #admin .draft-options a {
349
+ font-size: 12px;
350
+ padding: 2px 10px;
351
+ }
352
+ #admin .draft-options a.selected {
353
+ background-color: #00CDCD;
354
+ }
355
+ #admin .draft-options #post_draft {
356
+ display: none;
357
+ }
304
358
  #admin #save-button.saved {
305
359
  color: #999;
306
360
  }
@@ -320,13 +374,19 @@ body.posts.new #admin {
320
374
  padding: 0 0 0 20px;
321
375
  border-left: 4px solid lightblue;
322
376
  }
323
- #admin #drafts #post_title {
377
+ #admin #drafts #post-title {
324
378
  width: 350px;
325
379
  font-size: 16px;
326
380
  font-weight: 400;
327
381
  margin: 0;
328
382
  border-bottom: 1px solid #ddd;
329
383
  }
384
+ @media only screen and (max-device-width: 480px) {
385
+ #admin #drafts #post-title {
386
+ width: 260px;
387
+ margin-left: -5px;
388
+ }
389
+ }
330
390
  #admin #published {
331
391
  float: right;
332
392
  }
@@ -339,11 +399,22 @@ body.posts.new #admin {
339
399
  #admin #published h3 a {
340
400
  color: #999;
341
401
  }
402
+ @media only screen and (max-device-width: 480px) {
403
+ #admin #published {
404
+ float: none;
405
+ display: block;
406
+ }
407
+ }
342
408
  #admin .col h1,
343
409
  #admin .col h2 {
344
410
  position: relative;
345
411
  text-transform: uppercase;
346
412
  }
413
+ @media only screen and (max-device-width: 480px) {
414
+ #admin .col h1 {
415
+ margin-top: 0;
416
+ }
417
+ }
347
418
  #admin .col h1 a,
348
419
  #admin .col h2 a {
349
420
  position: absolute;
@@ -358,6 +429,11 @@ body.posts.new #admin {
358
429
  width: 360px;
359
430
  padding: 20px;
360
431
  }
432
+ @media only screen and (max-device-width: 480px) {
433
+ #admin .col {
434
+ width: 272px;
435
+ }
436
+ }
361
437
  #admin .col h2 a {
362
438
  background: #999;
363
439
  }
@@ -452,12 +528,23 @@ fieldset.markdown {
452
528
  width: 960px;
453
529
  float: left;
454
530
  }
531
+ @media only screen and (max-device-width: 480px) {
532
+ #split #post-editor {
533
+ width: 310px;
534
+ padding: 5px;
535
+ }
536
+ }
455
537
  #split #fullscreen {
456
538
  float: right;
457
539
  position: relative;
458
540
  top: 35px;
459
541
  border: 0 none;
460
542
  }
543
+ @media only screen and (max-device-width: 480px) {
544
+ #split #fullscreen {
545
+ display: none;
546
+ }
547
+ }
461
548
 
462
549
  .fullScreen #fullscreen {
463
550
  visibility: hidden;
@@ -477,15 +564,29 @@ fieldset.markdown {
477
564
  #text-title {
478
565
  margin: 23px 0 0 0;
479
566
  }
567
+ @media only screen and (max-device-width: 480px) {
568
+ #text-title {
569
+ margin: 0;
570
+ }
571
+ }
480
572
 
481
- #post_title {
573
+ #text-content {
574
+ margin-top: -25px;
575
+ }
576
+ @media only screen and (max-device-width: 480px) {
577
+ #text-content {
578
+ margin-top: -45px;
579
+ }
580
+ }
581
+
582
+ #post-title {
482
583
  width: 100%;
483
584
  border: none;
484
585
  background: none;
485
586
  line-height: 45px;
486
587
  }
487
588
 
488
- #post_content {
589
+ #post-content {
489
590
  border: none;
490
591
  width: 100%;
491
592
  position: relative;
@@ -494,13 +595,21 @@ fieldset.markdown {
494
595
  font-size: 20px;
495
596
  line-height: 30px;
496
597
  }
598
+ #post-content.scrolled {
599
+ border-top: 1px solid rgba(30, 30, 30, 0.1);
600
+ }
497
601
 
498
- textarea#post_title {
602
+ textarea#post-title {
499
603
  resize: none;
500
604
  font-family: 'Asap', sans-serif;
501
605
  font-size: 40px;
502
606
  font-weight: normal;
503
607
  }
608
+ @media only screen and (max-device-width: 480px) {
609
+ textarea#post-title {
610
+ font-size: 25px;
611
+ }
612
+ }
504
613
 
505
614
  form .permalink {
506
615
  position: absolute;
@@ -554,3 +663,9 @@ body {
554
663
  #publish-bar input[type=submit].post-saving {
555
664
  background: #40A4FB;
556
665
  }
666
+
667
+ @media only screen and (max-device-width: 480px) {
668
+ #publish-bar .delete-bar, #publish-bar #draft_label, #publish-bar #post_draft {
669
+ display: none;
670
+ }
671
+ }
@@ -1,6 +1,6 @@
1
-
2
1
  /* TODO: pull out coloring into variables */
3
2
  $linkhover: red;
3
+ $iphone: "only screen and (max-device-width : 480px)";
4
4
 
5
5
  div:before, div:after {content:''; display:table;}
6
6
 
@@ -151,15 +151,24 @@ code {
151
151
  position: fixed;
152
152
  bottom: 0;
153
153
  left: 0;
154
- background: #222;
154
+ background: #333;
155
155
  color: #fff;
156
156
  width: 100%;
157
157
  text-align: center;
158
158
  padding: 10px 0 3px;
159
+
160
+ @media #{$iphone} {
161
+ padding: 2px 0;
162
+ }
159
163
 
160
164
  .contain {
161
165
  margin: 0 auto;
162
166
  width: 960px;
167
+
168
+ @media #{$iphone} {
169
+ width: 300px;
170
+ padding: 3px 10px;
171
+ }
163
172
  }
164
173
 
165
174
  input[type=text] {
@@ -210,6 +219,20 @@ code {
210
219
  border-radius: 5px;
211
220
  -moz-border-radius: 5px;
212
221
  -webkit-border-radius: 5px;
222
+ -webkit-appearance: none;
223
+
224
+ @media #{$iphone} {
225
+ padding: 2px 10px;
226
+ font-size: 12px;
227
+ }
228
+ }
229
+
230
+ #publish-bar input[type=submit] {
231
+ @media #{$iphone} {
232
+ padding-top: 5px;
233
+ padding-bottom: 5px;
234
+ margin-top: -1px;
235
+ }
213
236
  }
214
237
 
215
238
  .button.secondary {
@@ -297,6 +320,31 @@ body.posts.new #admin {
297
320
  width: 808px;
298
321
  margin: 0 auto;
299
322
  position: relative;
323
+
324
+ @media #{$iphone} {
325
+ width: 320px;
326
+ }
327
+
328
+ .draft-options {
329
+ display: inline-block;
330
+ border: 3px solid #777;
331
+ border-radius: 10px;
332
+ padding: 4px;
333
+ @media #{$iphone} { display: none; }
334
+
335
+ a {
336
+ font-size: 12px;
337
+ padding: 2px 10px;
338
+ }
339
+
340
+ a.selected {
341
+ background-color: #00CDCD;
342
+ }
343
+
344
+ #post_draft {
345
+ display: none;
346
+ }
347
+ }
300
348
 
301
349
  #save-button.saved {
302
350
  color: #999;
@@ -320,12 +368,17 @@ body.posts.new #admin {
320
368
  border-left: 4px solid lightblue;
321
369
  }
322
370
 
323
- #post_title {
371
+ #post-title {
324
372
  width: 350px;
325
373
  font-size: 16px;
326
374
  font-weight: 400;
327
375
  margin: 0;
328
376
  border-bottom: 1px solid #ddd;
377
+
378
+ @media #{$iphone} {
379
+ width: 260px;
380
+ margin-left: -5px;
381
+ }
329
382
  }
330
383
  }
331
384
 
@@ -335,6 +388,11 @@ body.posts.new #admin {
335
388
  h2 {color: #999;}
336
389
  h2 a {margin-top: -2px;}
337
390
  h3 a {color: #999;}
391
+
392
+ @media #{$iphone} {
393
+ float: none;
394
+ display: block;
395
+ }
338
396
  }
339
397
 
340
398
  .col h1,
@@ -343,6 +401,12 @@ body.posts.new #admin {
343
401
  text-transform: uppercase;
344
402
  }
345
403
 
404
+ .col h1 {
405
+ @media #{$iphone} {
406
+ margin-top: 0;
407
+ }
408
+ }
409
+
346
410
  .col h1 a,
347
411
  .col h2 a {
348
412
  position: absolute;
@@ -357,6 +421,10 @@ body.posts.new #admin {
357
421
  .col {
358
422
  width: 360px;
359
423
  padding: 20px;
424
+
425
+ @media #{$iphone} {
426
+ width: 272px;
427
+ }
360
428
 
361
429
  h2 a {
362
430
  background: #999;
@@ -468,6 +536,11 @@ fieldset.markdown {
468
536
  #post-editor {
469
537
  width: 960px;
470
538
  float: left;
539
+
540
+ @media #{$iphone} {
541
+ width: 310px;
542
+ padding: 5px;
543
+ }
471
544
  }
472
545
 
473
546
  #fullscreen {
@@ -475,6 +548,8 @@ fieldset.markdown {
475
548
  position: relative;
476
549
  top: 35px;
477
550
  border: 0 none;
551
+
552
+ @media #{$iphone} { display: none;}
478
553
  }
479
554
 
480
555
  }
@@ -499,16 +574,23 @@ fieldset.markdown {
499
574
 
500
575
  #text-title {
501
576
  margin: 23px 0 0 0;
577
+
578
+ @media #{$iphone} { margin: 0;}
502
579
  }
503
580
 
504
- #post_title {
581
+ #text-content {
582
+ margin-top: -25px;
583
+ @media #{$iphone} { margin-top: -45px;}
584
+ }
585
+
586
+ #post-title {
505
587
  width: 100%;
506
588
  border: none;
507
589
  background: none;
508
590
  line-height: 45px;
509
591
  }
510
592
 
511
- #post_content {
593
+ #post-content {
512
594
  border: none;
513
595
  width: 100%;
514
596
  position: relative;
@@ -516,13 +598,20 @@ fieldset.markdown {
516
598
  resize: none;
517
599
  font-size: 20px;
518
600
  line-height: 30px;
601
+
602
+ &.scrolled {
603
+ border-top: 1px solid rgba(30,30,30,0.1);
604
+ }
519
605
  }
520
606
 
521
- textarea#post_title {
607
+
608
+ textarea#post-title {
522
609
  resize: none;
523
610
  font-family: 'Asap', sans-serif;
524
611
  font-size: 40px;
525
612
  font-weight: normal;
613
+
614
+ @media #{$iphone} { font-size: 25px;}
526
615
  }
527
616
 
528
617
  form .permalink {
@@ -580,4 +669,10 @@ body {
580
669
 
581
670
  #publish-bar input[type=submit].post-saving {
582
671
  background: #40A4FB;
672
+ }
673
+
674
+ #publish-bar {
675
+ .delete-bar, #draft_label, #post_draft {
676
+ @media #{$iphone} { display: none; }
677
+ }
583
678
  }
@@ -5,6 +5,9 @@ $(document).ready ->
5
5
  key.filter = (e)->
6
6
  true
7
7
 
8
+ is_iphone =->
9
+ /iPhone/i.test(navigator.userAgent)
10
+
8
11
  is_edit_page = ->
9
12
  window.location.pathname.indexOf('edit') != -1
10
13
 
@@ -23,6 +26,21 @@ $(document).ready ->
23
26
  $('#save-button').removeClass('post-saving')
24
27
  setTimeout((->set_save_button('saved')),2000)
25
28
 
29
+ draft_post = ->
30
+ $('#post_draft').prop('checked', true)
31
+ $('#draft-action').addClass('selected')
32
+ $('#publish-action').removeClass('selected')
33
+ save_post()
34
+ false
35
+
36
+ publish_post = ->
37
+ $('#post_draft').prop('checked', false)
38
+ $('#draft-action').removeClass('selected')
39
+ $('#publish-action').addClass('selected')
40
+ save_post()
41
+ false
42
+
43
+
26
44
  # Save post
27
45
  save_post = ->
28
46
  set_save_button('saving')
@@ -30,14 +48,14 @@ $(document).ready ->
30
48
 
31
49
  post_obj =
32
50
  post :
33
- title : $('#post_title').val()
34
- content : $('#post_content').val()
51
+ title : $('#post-title').val()
52
+ content : $('#post-content').val()
35
53
  name : $('#post_name').val()
36
54
  draft : draft
37
55
 
38
56
  ajax : true
39
57
 
40
- $.post('/save-post', post_obj, (data)->
58
+ $.post(baseUrl + '/save-post', post_obj, (data)->
41
59
  response = $.parseJSON(data)
42
60
  if response['status'] == 'OK'
43
61
  setTimeout((->set_save_button('saved')),1000)
@@ -48,7 +66,7 @@ $(document).ready ->
48
66
 
49
67
  # Dom invoked events
50
68
  handle_events =->
51
- $('#post-editor #post_title').autosize({append: "\n"})
69
+ $('#post-editor #post-title').autosize({append: "\n"})
52
70
 
53
71
  $("#fullscreen").click (e)->
54
72
  screenfull.request();
@@ -56,27 +74,37 @@ $(document).ready ->
56
74
  screenfull.onchange = ->
57
75
  if screenfull.isFullscreen
58
76
  $('#fullscreen').hide()
59
- $('#post_content').focus()
77
+ $('#post-content').focus()
60
78
 
61
79
  setTimeout( ->
62
- rows = Math.ceil($(window).height()/48)
63
- $('#post_content').attr('rows', rows)
80
+ rows = Math.ceil($(window).height()/40)
81
+ $('#post-content').attr('rows', rows)
64
82
  , 1000)
65
83
 
66
84
  else
67
85
  $('#fullscreen').show();
68
- $('#post_content').attr('rows', 15);
86
+ $('#post-content').attr('rows', 18);
69
87
 
70
88
  $('.delete-button').click ->
71
89
  if not confirm("Confirm delete?")
72
90
  return false
73
91
 
92
+ $('#post-content').bind 'scroll', (e)->
93
+ if $(this).scrollTop() > 10
94
+ $(this).addClass('scrolled')
95
+ else
96
+ $(this).removeClass('scrolled')
97
+
74
98
  if is_edit_page()
75
99
  $('#save-button').click( ->
76
100
  save_post()
77
101
  false
78
102
  )
79
103
 
104
+ $('#draft-action').click(draft_post)
105
+ $('#publish-action').click(publish_post)
106
+
107
+
80
108
  keyboard_events =->
81
109
  key('⌘+enter, ctrl+enter', (e)->
82
110
  screenfull.toggle()
@@ -106,17 +134,25 @@ $(document).ready ->
106
134
 
107
135
 
108
136
  focus_to_type =->
109
- if not is_edit_page() and ($('#post_title').val() == '')
110
- $('#post_title').focus()
137
+ if not is_edit_page() and ($('#post-title').val() == '')
138
+ $('#post-title').focus()
111
139
  else
112
- $('#post_content').focus()
140
+ $('#post-content').focus()
113
141
 
114
142
 
143
+ fullscreen_mobile =->
144
+ if(is_iphone())
145
+ setTimeout (->
146
+ # Hide the address bar!
147
+ window.scrollTo 0, 1
148
+ ), 0
149
+ $('.links').remove()
150
+
115
151
  init =->
116
152
  handle_events()
117
153
  keyboard_events()
118
- show_shortcuts()
154
+ show_shortcuts() if not is_iphone()
119
155
  focus_to_type()
120
-
156
+ fullscreen_mobile()
121
157
 
122
158
  init()
@@ -2,10 +2,13 @@
2
2
  (function() {
3
3
 
4
4
  $(document).ready(function() {
5
- var focus_to_type, handle_events, init, is_edit_page, keyboard_events, save_post, set_save_button, show_shortcuts;
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;
6
6
  key.filter = function(e) {
7
7
  return true;
8
8
  };
9
+ is_iphone = function() {
10
+ return /iPhone/i.test(navigator.userAgent);
11
+ };
9
12
  is_edit_page = function() {
10
13
  return window.location.pathname.indexOf('edit') !== -1;
11
14
  };
@@ -27,20 +30,34 @@
27
30
  }), 2000);
28
31
  }
29
32
  };
33
+ draft_post = function() {
34
+ $('#post_draft').prop('checked', true);
35
+ $('#draft-action').addClass('selected');
36
+ $('#publish-action').removeClass('selected');
37
+ save_post();
38
+ return false;
39
+ };
40
+ publish_post = function() {
41
+ $('#post_draft').prop('checked', false);
42
+ $('#draft-action').removeClass('selected');
43
+ $('#publish-action').addClass('selected');
44
+ save_post();
45
+ return false;
46
+ };
30
47
  save_post = function() {
31
48
  var draft, post_obj;
32
49
  set_save_button('saving');
33
50
  draft = $('#post_draft').is(':checked') ? 'on' : 'off';
34
51
  post_obj = {
35
52
  post: {
36
- title: $('#post_title').val(),
37
- content: $('#post_content').val(),
53
+ title: $('#post-title').val(),
54
+ content: $('#post-content').val(),
38
55
  name: $('#post_name').val(),
39
56
  draft: draft
40
57
  },
41
58
  ajax: true
42
59
  };
43
- return $.post('/save-post', post_obj, function(data) {
60
+ return $.post(baseUrl + '/save-post', post_obj, function(data) {
44
61
  var response;
45
62
  response = $.parseJSON(data);
46
63
  if (response['status'] === 'OK') {
@@ -55,7 +72,7 @@
55
72
  }));
56
73
  };
57
74
  handle_events = function() {
58
- $('#post-editor #post_title').autosize({
75
+ $('#post-editor #post-title').autosize({
59
76
  append: "\n"
60
77
  });
61
78
  $("#fullscreen").click(function(e) {
@@ -64,15 +81,15 @@
64
81
  screenfull.onchange = function() {
65
82
  if (screenfull.isFullscreen) {
66
83
  $('#fullscreen').hide();
67
- $('#post_content').focus();
84
+ $('#post-content').focus();
68
85
  return setTimeout(function() {
69
86
  var rows;
70
- rows = Math.ceil($(window).height() / 48);
71
- return $('#post_content').attr('rows', rows);
87
+ rows = Math.ceil($(window).height() / 40);
88
+ return $('#post-content').attr('rows', rows);
72
89
  }, 1000);
73
90
  } else {
74
91
  $('#fullscreen').show();
75
- return $('#post_content').attr('rows', 15);
92
+ return $('#post-content').attr('rows', 18);
76
93
  }
77
94
  };
78
95
  $('.delete-button').click(function() {
@@ -80,11 +97,20 @@
80
97
  return false;
81
98
  }
82
99
  });
100
+ $('#post-content').bind('scroll', function(e) {
101
+ if ($(this).scrollTop() > 10) {
102
+ return $(this).addClass('scrolled');
103
+ } else {
104
+ return $(this).removeClass('scrolled');
105
+ }
106
+ });
83
107
  if (is_edit_page()) {
84
- return $('#save-button').click(function() {
108
+ $('#save-button').click(function() {
85
109
  save_post();
86
110
  return false;
87
111
  });
112
+ $('#draft-action').click(draft_post);
113
+ return $('#publish-action').click(publish_post);
88
114
  }
89
115
  };
90
116
  keyboard_events = function() {
@@ -117,17 +143,28 @@
117
143
  });
118
144
  };
119
145
  focus_to_type = function() {
120
- if (!is_edit_page() && ($('#post_title').val() === '')) {
121
- return $('#post_title').focus();
146
+ if (!is_edit_page() && ($('#post-title').val() === '')) {
147
+ return $('#post-title').focus();
122
148
  } else {
123
- return $('#post_content').focus();
149
+ return $('#post-content').focus();
150
+ }
151
+ };
152
+ fullscreen_mobile = function() {
153
+ if (is_iphone()) {
154
+ setTimeout((function() {
155
+ return window.scrollTo(0, 1);
156
+ }), 0);
124
157
  }
158
+ return $('.links').remove();
125
159
  };
126
160
  init = function() {
127
161
  handle_events();
128
162
  keyboard_events();
129
- show_shortcuts();
130
- return focus_to_type();
163
+ if (!is_iphone()) {
164
+ show_shortcuts();
165
+ }
166
+ focus_to_type();
167
+ return fullscreen_mobile();
131
168
  };
132
169
  return init();
133
170
  });
@@ -3,19 +3,23 @@
3
3
  <div id="admin">
4
4
  <div id="save"></div>
5
5
 
6
- <form accept-charset="UTF-8" action="/save-post" class="edit_post" method="post">
6
+ <form accept-charset="UTF-8" action="{{base_url}}/save-post" class="edit_post" method="post">
7
7
  {{>editor_area}}
8
8
  <div id="publish-bar-hover">
9
9
  <div id="publish-bar">
10
10
  <div class="contain">
11
11
  <div class="left">
12
- <a href="/">&laquo; Admin</a>
13
- <a href="/delete/{{ name }}" class="delete-bar delete-button" >Delete</a>
12
+ <a href="{{base_url}}/">&laquo; ADMIN</a>
13
+ <a href="{{base_url}}/delete/{{ name }}" class="delete-bar delete-button" >DELETE</a>
14
14
  </div>
15
15
  <div class="right">
16
- <label for="post_draft">Draft</label>
17
- <input id="post_draft" name="post[draft]" type="checkbox" {{#draft}}checked{{/draft}} />
18
- <input id="save-button" name="commit" type="submit" value="Save" />
16
+
17
+ <div class="draft-options">
18
+ <a id="draft-action" class="button {{#draft}}selected{{/draft}}" href="#">DRAFT</a>
19
+ <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
+ </div>
22
+ <input id="save-button" name="commit" type="submit" value="SAVE" />
19
23
  </div>
20
24
  </div>
21
25
  </div>
@@ -1,13 +1,13 @@
1
1
  <div id="split">
2
2
  <div id="post-editor" class="split-section">
3
- <a href="#fullscreen" id="fullscreen"><img src="/images/fullscreen.png"></a>
3
+ <a href="#fullscreen" id="fullscreen"><img src="{{base_url}}/images/fullscreen.png"></a>
4
4
  <div id="text-title">
5
- <textarea cols="40" id="post_title" name="post[title]" placeholder="Title here" rows="1">{{#ptitle}}{{ ptitle }}{{/ptitle}}{{^ptitle}}{{ title }}{{/ptitle}}</textarea>
5
+ <textarea cols="40" id="post-title" name="post[title]" placeholder="Title here" rows="1">{{#ptitle}}{{ ptitle }}{{/ptitle}}{{^ptitle}}{{ title }}{{/ptitle}}</textarea>
6
6
  <input type="hidden" id="post_name" name="post[name]" value="{{ name }}">
7
7
  </div>
8
8
 
9
9
  <div id="text-content">
10
- <textarea cols="40" id="post_content" name="post[content]" placeholder="Write post here" rows="15">{{content}}</textarea>
10
+ <textarea cols="40" id="post-content" name="post[content]" placeholder="Write post here" rows="18">{{content}}</textarea>
11
11
  </div>
12
12
  </div>
13
13
  </div>
@@ -3,9 +3,9 @@
3
3
  <div id="save"></div>
4
4
 
5
5
  <div id="drafts" class="col">
6
- <h1>Drafts <a href="/new" class="button">New Draft</a></h1>
7
- <form accept-charset="UTF-8" action="/new" class="new_post" id="new_post" method="get">
8
- <input id = "post_title"
6
+ <h1>Drafts <a href="{{base_url}}/new" class="button">New Draft</a></h1>
7
+ <form accept-charset="UTF-8" action="{{base_url}}/new" class="new_post" id="new_post" method="get">
8
+ <input id = "post-title"
9
9
  name = "ptitle"
10
10
  autocomplete = "off"
11
11
  placeholder = "Start typing your title here..." size="30" type="text" />
@@ -15,10 +15,10 @@
15
15
  {{#drafts}}
16
16
  <li id="post-{{filename}}">
17
17
  <h3>
18
- <a href="/edit/{{filename}}">{{title}}</a>
18
+ <a href="{{base_url}}/edit/{{filename}}">{{title}}</a>
19
19
  <span class="links">
20
- <a href="/this-is-brilliant" class="admin-view">view</a>
21
- <a href="/delete/{{filename}}" class="delete-button admin-delete" rel="nofollow">x</a>
20
+ <a href="{{base_url}}/404" class="admin-view">view</a>
21
+ <a href="{{base_url}}/delete/{{filename}}" class="delete-button admin-delete" rel="nofollow">x</a>
22
22
  </span>
23
23
  </h3>
24
24
  </li>
@@ -28,15 +28,15 @@
28
28
 
29
29
  <div id="published" class="col">
30
30
  <h2>Published
31
- <a href="/settings" class="button">Settings</a></h2>
31
+ <a href="{{base_url}}/settings" class="button">Settings</a></h2>
32
32
  <ul>
33
33
  {{#published}}
34
34
  <li id="post-{{filename}}">
35
35
  <h3>
36
- <a href="/edit/{{filename}}">{{title}}</a>
36
+ <a href="{{base_url}}/edit/{{filename}}">{{title}}</a>
37
37
  <span class="links">
38
- <a href="/vniverse" class="admin-view">view</a>
39
- <a href="/delete/{{filename}}" class="delete-button admin-delete" rel="nofollow">x</a>
38
+ <a href="{{base_url}}/404" class="admin-view">view</a>
39
+ <a href="{{base_url}}/delete/{{filename}}" class="delete-button admin-delete" rel="nofollow">x</a>
40
40
  </span>
41
41
  </h3>
42
42
  </li>
@@ -2,16 +2,14 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="Content-type" content="text/html;charset=utf-8">
5
- <link rel="stylesheet" type="text/css" href="{{base_url}}/css/pagoda.css" media="all">
6
- <link rel="stylesheet" type="text/css" href="{{base_url}}/css/tiptip.css" media="all">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+
7
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/pagoda.css" media="screen, projection">
8
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/tiptip.css" media="screen, projection">
7
9
  <link href='http://fonts.googleapis.com/css?family=Lato:300,900|Asap' rel='stylesheet' type='text/css' />
8
- {{#css}}
9
- <link rel="stylesheet" type="text/css" href="{{base_url}}/custom.css" media="all">
10
- {{/css}}
10
+ <link rel="apple-touch-icon" href="{{base_url}}/images/apple-touch-icon.png" />
11
+
11
12
 
12
- <!--[if IE 7]>
13
- <link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
14
- <![endif]-->
15
13
 
16
14
  <script type="text/javascript" src="{{base_url}}/js/jquery.js"></script>
17
15
  <script type="text/javascript" src="{{base_url}}/js/screenfull.js"></script>
@@ -19,6 +17,9 @@
19
17
  <script type="text/javascript" src="{{base_url}}/js/keymaster.min.js"></script>
20
18
  <script type="text/javascript" src="{{base_url}}/js/jquery.tiptip.min.js"></script>
21
19
  <script type="text/javascript" src="{{base_url}}/js/editor.js"></script>
20
+ <script type="text/javascript">
21
+ var baseUrl = "{{base_url}}";
22
+ </script>
22
23
  <title>{{title}}</title>
23
24
  </head>
24
25
 
@@ -2,7 +2,7 @@
2
2
  <div id="admin">
3
3
  <div id="save"></div>
4
4
 
5
- <form accept-charset="UTF-8" action="/save-post" class="edit_post" method="post">
5
+ <form accept-charset="UTF-8" action="{{base_url}}/save-post" class="edit_post" method="post">
6
6
  <input type="hidden" name="method" value="put" />
7
7
 
8
8
  {{>editor_area}}
@@ -11,7 +11,7 @@
11
11
  <div id="publish-bar">
12
12
  <div class="contain">
13
13
  <div class="left">
14
- <a href="/">&laquo; Admin</a>
14
+ <a href="{{base_url}}/">&laquo; Admin</a>
15
15
  </div>
16
16
  <div class="right">
17
17
  <input id="save-button" name="commit" type="submit" value="Save" />
@@ -1,12 +1,12 @@
1
1
  <body class="settings">
2
2
 
3
3
  <div class="settings-bd">
4
- <a class="admin-btn button" href="/">« Admin</a>
4
+ <a class="admin-btn button" href="{{base_url}}/">« Admin</a>
5
5
  <h1>SETTINGS</h1>
6
6
 
7
7
  <ul>
8
- <li><h2 class="left-col"> Push to origin </h2><span class="right-col"><a class="button" href="/settings/push">Push</a></span></li>
9
- <li><h2 class="left-col"> Pull from origin/master </h2><span class="right-col"><a class="button" href="/settings/pull">Pull</a></span></li>
8
+ <li><h2 class="left-col"> Push to origin </h2><span class="right-col"><a class="button" href="{{base_url}}/settings/push">Push</a></span></li>
9
+ <li><h2 class="left-col"> Pull from origin/master </h2><span class="right-col"><a class="button" href="{{base_url}}/settings/pull">Pull</a></span></li>
10
10
 
11
11
  </ul>
12
12
  </div>
@@ -12,6 +12,10 @@ module Shwedagon
12
12
  "Home"
13
13
  end
14
14
 
15
+ def base_url
16
+ @base_url
17
+ end
18
+
15
19
  end
16
20
  end
17
21
  end
@@ -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.7'
9
- s.date = '2013-05-04'
8
+ s.version = '0.0.8'
9
+ s.date = '2013-05-13'
10
10
  s.rubyforge_project = 'pagoda-jekyll'
11
11
 
12
12
  s.summary = "A simple admin for Jekyll"
@@ -29,8 +29,8 @@ Gem::Specification.new do |s|
29
29
  s.add_dependency('stringex')
30
30
  s.add_dependency('sinatra-mustache')
31
31
  s.add_dependency('sinatra')
32
+ s.add_dependency('sinatra-reloader')
32
33
 
33
- s.add_development_dependency('sinatra-reloader')
34
34
  s.add_development_dependency('compass')
35
35
  s.add_development_dependency('fssm')
36
36
  s.add_development_dependency('rack-test')
data/unicorn.rb CHANGED
@@ -1 +1,2 @@
1
1
  pid "./tmp/pids/unicorn.pid"
2
+ listen "unix:./tmp/sock/unicorn.sock"
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alagu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-04 00:00:00.000000000 Z
11
+ date: 2013-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -101,7 +101,7 @@ dependencies:
101
101
  - - ! '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
- type: :development
104
+ type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
@@ -195,6 +195,7 @@ files:
195
195
  - lib/pagoda/public/css/pagoda.css
196
196
  - lib/pagoda/public/css/pagoda.scss
197
197
  - lib/pagoda/public/css/tiptip.css
198
+ - lib/pagoda/public/images/apple-touch-icon.png
198
199
  - lib/pagoda/public/images/fullscreen.png
199
200
  - lib/pagoda/public/js/editor.coffee
200
201
  - lib/pagoda/public/js/editor.js