Pārlūkot izejas kodu

Feature: Use v2-api for pin-detail page

pull/139/head
winkidney pirms 5 gadiem
vecāks
revīzija
da8bac1491
3 mainītis faili ar 4 papildinājumiem un 14 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

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


Notiek ielāde…
Atcelt
Saglabāt