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. 6
      views/layout.php
  3. 2
      views/new-bookmark.php
  4. 3
      views/new-itinerary.php
  5. 4
      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(){

6
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,6 +28,7 @@
<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">
@ -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>

2
views/new-bookmark.php

@ -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({

4
views/new-post.php

@ -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