mirror of
https://github.com/pinry/pinry.git
synced 2025-11-14 00:55:43 +01:00
Feature: Add referer field for Pin
This commit is contained in:
@@ -17,6 +17,7 @@ $(window).load(function() {
|
||||
return {
|
||||
submitter: currentUser,
|
||||
url: $('#pin-form-image-url').val(),
|
||||
referer: $('#pin-form-referer').val(),
|
||||
description: $('#pin-form-description').val(),
|
||||
tags: cleanTags($('#pin-form-tags').val())
|
||||
}
|
||||
@@ -26,6 +27,7 @@ $(window).load(function() {
|
||||
var context = {pins: [{
|
||||
submitter: currentUser,
|
||||
image: {thumbnail: {image: $('#pin-form-image-url').val()}},
|
||||
referer: $('#pin-form-referer').val(),
|
||||
description: $('#pin-form-description').val(),
|
||||
tags: cleanTags($('#pin-form-tags').val())
|
||||
}]},
|
||||
@@ -59,9 +61,14 @@ $(window).load(function() {
|
||||
function createPinForm(editPinId) {
|
||||
$('body').append(renderTemplate('#pin-form-template', ''));
|
||||
var modal = $('#pin-form'),
|
||||
formFields = [$('#pin-form-image-url'), $('#pin-form-description'),
|
||||
$('#pin-form-tags')],
|
||||
pinFromUrl = getUrlParameter('pin-image-url');
|
||||
formFields = [
|
||||
$('#pin-form-image-url'),
|
||||
$('#pin-form-referer'),
|
||||
$('#pin-form-description'),
|
||||
$('#pin-form-tags')
|
||||
],
|
||||
pinFromUrl = getUrlParameter('pin-image-url'),
|
||||
pinFromReferer = getUrlParameter('referer');
|
||||
// If editable grab existing data
|
||||
if (editPinId) {
|
||||
var promise = getPinData(editPinId);
|
||||
@@ -69,6 +76,7 @@ $(window).load(function() {
|
||||
editedPin = data;
|
||||
$('#pin-form-image-url').val(editedPin.image.thumbnail.image);
|
||||
$('#pin-form-image-url').parent().hide();
|
||||
$('#pin-form-referer').parent().hide();
|
||||
$('#pin-form-image-upload').parent().hide();
|
||||
$('#pin-form-description').val(editedPin.description);
|
||||
$('#pin-form-tags').val(editedPin.tags);
|
||||
@@ -113,6 +121,7 @@ $(window).load(function() {
|
||||
if (pinFromUrl) {
|
||||
$('#pin-form-image-upload').parent().css('display', 'none');
|
||||
$('#pin-form-image-url').val(pinFromUrl);
|
||||
$('#pin-form-referer').val(pinFromReferer);
|
||||
$('.navbar').css('display', 'none');
|
||||
modal.css({
|
||||
'margin-top': -35,
|
||||
@@ -155,6 +164,7 @@ $(window).load(function() {
|
||||
} else {
|
||||
var data = {
|
||||
submitter: '/api/v1/user/'+currentUser.id+'/',
|
||||
referer: $('#pin-form-referer').val(),
|
||||
description: $('#pin-form-description').val(),
|
||||
tags: cleanTags($('#pin-form-tags').val())
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user