瀏覽代碼

Feature: Use v2-api for pin-detail page

pull/139/head
winkidney 5 年之前
父節點
當前提交
da8bac1491
共有 3 個檔案被更改,包括 4 行新增14 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存