Browse Source

Feature: Use v2-api for pin-detail page

pull/139/head
winkidney 5 years ago
parent
commit
da8bac1491
3 changed files with 4 additions and 14 deletions
  1. +1
    -3
      core/drf_api.py
  2. +2
    -8
      pinry/static/js/helpers.js
  3. +1
    -3
      pinry/static/js/pin-form.js

+ 1
- 3
core/drf_api.py View File

@@ -92,10 +92,8 @@ class PinSerializer(serializers.HyperlinkedModelSerializer):
"image_by_id",
"tags",
)
extra_kwargs = {
"submitter": {"read_only": True},
}

submitter = UserSerializer(read_only=True)
tags = TagSerializer(
many=True,
source="tag_list",


+ 2
- 8
pinry/static/js/helpers.js View File

@@ -5,6 +5,7 @@
* Updated: Feb 26th, 2013
* Require: jQuery
*/
var API_BASE = "/api/v2/";


function _getCookie(name) {
@@ -60,15 +61,8 @@ function cleanTags(tags) {
return tags;
}


function getImageData(imageId) {
var apiUrl = '/api/v1/image/'+imageId+'/?format=json';
return $.get(apiUrl);
}


function getPinData(pinId) {
var apiUrl = '/api/v1/pin/'+pinId+'/?format=json';
var apiUrl = API_BASE + "pins/" + pinId + '/?format=json';
return $.get(apiUrl);
}



+ 1
- 3
pinry/static/js/pin-form.js View File

@@ -9,8 +9,6 @@


$(window).load(function() {
var api_base = "/api/v2/";

var uploadedImage = false;
var editedPin = null;

@@ -101,7 +99,7 @@ $(window).load(function() {
}
// Drag and drop upload
$('#pin-form-image-upload').dropzone({
url: api_base + "images/",
url: API_BASE + "images/",
paramName: 'image',
parallelUploads: 1,
uploadMultiple: false,


Loading…
Cancel
Save