Browse Source

fix sending category as array

pull/35/head
Aaron Parecki 9 years ago
parent
commit
bcfb8731ca
  1. 5
      public/js/script.js
  2. 12
      views/layout.php
  3. 8
      views/new-bookmark.php
  4. 3
      views/new-itinerary.php
  5. 10
      views/new-post.php

5
public/js/script.js

@ -5,6 +5,7 @@
var minutes = zero_pad(Math.floor(seconds / 60) % 60); var minutes = zero_pad(Math.floor(seconds / 60) % 60);
return (seconds < 0 ? '-' : '+') + hours + ":" + minutes; return (seconds < 0 ? '-' : '+') + hours + ":" + minutes;
} }
function zero_pad(num) { function zero_pad(num) {
num = "" + num; num = "" + num;
if(num.length == 1) { if(num.length == 1) {
@ -13,6 +14,10 @@
return num; return num;
} }
function csv_to_array(val) {
return val.split(/[, ]+/);
}
$(function(){ $(function(){

12
views/layout.php

@ -4,8 +4,8 @@
<title><?= $this->title ?></title> <title><?= $this->title ?></title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="pingback" href="http://webmention.io/aaronpk/xmlrpc" />
<link rel="webmention" href="http://webmention.io/aaronpk/webmention" />
<link rel="pingback" href="https://webmention.io/aaronpk/xmlrpc" />
<link rel="webmention" href="https://webmention.io/aaronpk/webmention" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<!-- standard viewport tag to set the viewport to the device's width <!-- standard viewport tag to set the viewport to the device's width
@ -28,10 +28,11 @@
<link rel="icon" href="/favicon.ico" type="image/x-icon"> <link rel="icon" href="/favicon.ico" type="image/x-icon">
<script src="/js/jquery-1.7.1.min.js"></script> <script src="/js/jquery-1.7.1.min.js"></script>
<script src="/js/script.js"></script>
</head> </head>
<body role="document"> <body role="document">
<?php
<?php
if(property_exists($this, 'include_facebook')) { if(property_exists($this, 'include_facebook')) {
# echo partial('partials/fb-script'); # echo partial('partials/fb-script');
} }
@ -67,7 +68,6 @@ if(property_exists($this, 'include_facebook')) {
<li><a href="/bookmark">Bookmark</a></li> <li><a href="/bookmark">Bookmark</a></li>
<li><a href="/favorite">Favorite</a></li> <li><a href="/favorite">Favorite</a></li>
<li><a href="/photo">Photo</a></li> <li><a href="/photo">Photo</a></li>
<li><a href="/email">Email</a></li>
<?php } ?> <?php } ?>
<li><a href="/docs">Docs</a></li> <li><a href="/docs">Docs</a></li>
@ -90,10 +90,10 @@ if(property_exists($this, 'include_facebook')) {
</div> </div>
<p class="credits">&copy; <?=date('Y')?> by <a href="http://aaronparecki.com">Aaron Parecki</a>. <p class="credits">&copy; <?=date('Y')?> by <a href="http://aaronparecki.com">Aaron Parecki</a>.
This code is <a href="https://github.com/aaronpk/Quill">open source</a>.
This code is <a href="https://github.com/aaronpk/Quill">open source</a>.
Feel free to send a pull request, or <a href="https://github.com/aaronpk/Quill/issues">file an issue</a>.</p> Feel free to send a pull request, or <a href="https://github.com/aaronpk/Quill/issues">file an issue</a>.</p>
</div> </div>
</div> </div>
</body> </body>
</html>
</html>

8
views/new-bookmark.php

@ -43,7 +43,7 @@
} }
echo '</ul>'; echo '</ul>';
} else { } else {
?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php
} }
?> ?>
@ -63,10 +63,10 @@
$(function(){ $(function(){
// ctrl-s to save // ctrl-s to save
$(window).on('keydown', function(e){
$(window).on('keydown', function(e){
if(e.keyCode == 83 && e.ctrlKey){ if(e.keyCode == 83 && e.ctrlKey){
$("#btn_post").click(); $("#btn_post").click();
}
}
}); });
$("#btn_post").click(function(){ $("#btn_post").click(function(){
@ -81,7 +81,7 @@ $(function(){
name: $("#note_name").val(), name: $("#note_name").val(),
content: $("#note_content").val(), content: $("#note_content").val(),
category: $("#note_category").val(), category: $("#note_category").val(),
'syndicate-to': syndications.join(',')
'syndicate-to': syndications
}, function(data){ }, function(data){
var response = JSON.parse(data); var response = JSON.parse(data);

3
views/new-itinerary.php

@ -105,7 +105,6 @@
} }
</style> </style>
<script src="/js/script.js"></script>
<script> <script>
$(function(){ $(function(){
@ -176,7 +175,7 @@ $(function(){
}); });
}); });
var category = $("#note_category").val().split(/[, ]+/)
var category = csv_to_array($("#note_category").val());
$.post("/itinerary", { $.post("/itinerary", {
data: JSON.stringify({ data: JSON.stringify({

10
views/new-post.php

@ -34,7 +34,7 @@
} }
echo '</ul>'; echo '</ul>';
} else { } else {
?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php You can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php
} }
?> ?>
@ -107,10 +107,10 @@
$(function(){ $(function(){
// ctrl-s to save // ctrl-s to save
$(window).on('keydown', function(e){
$(window).on('keydown', function(e){
if(e.keyCode == 83 && e.ctrlKey){ if(e.keyCode == 83 && e.ctrlKey){
$("#btn_post").click(); $("#btn_post").click();
}
}
}); });
$("#btn_post").click(function(){ $("#btn_post").click(function(){
@ -124,7 +124,7 @@ $(function(){
content: $("#note_content").val(), content: $("#note_content").val(),
'in-reply-to': $("#note_in_reply_to").val(), 'in-reply-to': $("#note_in_reply_to").val(),
location: $("#note_location").val(), location: $("#note_location").val(),
category: $("#note_category").val(),
category: csv_to_array($("#note_category").val()),
slug: $("#note_slug").val(), slug: $("#note_slug").val(),
'syndicate-to': syndications 'syndicate-to': syndications
}, function(data){ }, function(data){
@ -226,5 +226,3 @@ $(function(){
<?= partial('partials/syndication-js') ?> <?= partial('partials/syndication-js') ?>
</script> </script>
Loading…
Cancel
Save