Browse Source

fix sending category as array

pull/35/head
Aaron Parecki 8 years ago
parent
commit
bcfb8731ca
5 changed files with 20 additions and 18 deletions
  1. +5
    -0
      public/js/script.js
  2. +6
    -6
      views/layout.php
  3. +4
    -4
      views/new-bookmark.php
  4. +1
    -2
      views/new-itinerary.php
  5. +4
    -6
      views/new-post.php

+ 5
- 0
public/js/script.js View File

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

+ 6
- 6
views/layout.php View File

@ -4,8 +4,8 @@
<title><?= $this->title ?></title>
<meta charset="utf-8">
<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" />
<!-- 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">
<script src="/js/jquery-1.7.1.min.js"></script>
<script src="/js/script.js"></script>
</head>
<body role="document">
<?php
<?php
if(property_exists($this, 'include_facebook')) {
# 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="/favorite">Favorite</a></li>
<li><a href="/photo">Photo</a></li>
<li><a href="/email">Email</a></li>
<?php } ?>
<li><a href="/docs">Docs</a></li>
@ -90,10 +90,10 @@ if(property_exists($this, 'include_facebook')) {
</div>
<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>
</div>
</div>
</body>
</html>
</html>

+ 4
- 4
views/new-bookmark.php View File

@ -43,7 +43,7 @@
}
echo '</ul>';
} 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
}
?>
@ -63,10 +63,10 @@
$(function(){
// ctrl-s to save
$(window).on('keydown', function(e){
$(window).on('keydown', function(e){
if(e.keyCode == 83 && e.ctrlKey){
$("#btn_post").click();
}
}
});
$("#btn_post").click(function(){
@ -81,7 +81,7 @@ $(function(){
name: $("#note_name").val(),
content: $("#note_content").val(),
category: $("#note_category").val(),
'syndicate-to': syndications.join(',')
'syndicate-to': syndications
}, function(data){
var response = JSON.parse(data);

+ 1
- 2
views/new-itinerary.php View File

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

+ 4
- 6
views/new-post.php View File

@ -34,7 +34,7 @@
}
echo '</ul>';
} 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
}
?>
@ -107,10 +107,10 @@
$(function(){
// ctrl-s to save
$(window).on('keydown', function(e){
$(window).on('keydown', function(e){
if(e.keyCode == 83 && e.ctrlKey){
$("#btn_post").click();
}
}
});
$("#btn_post").click(function(){
@ -124,7 +124,7 @@ $(function(){
content: $("#note_content").val(),
'in-reply-to': $("#note_in_reply_to").val(),
location: $("#note_location").val(),
category: $("#note_category").val(),
category: csv_to_array($("#note_category").val()),
slug: $("#note_slug").val(),
'syndicate-to': syndications
}, function(data){
@ -226,5 +226,3 @@ $(function(){
<?= partial('partials/syndication-js') ?>
</script>

Loading…
Cancel
Save