mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge branch '0.3.3-wip'
Conflicts: core/client/views/blog.js core/server/api.js core/server/views/default.hbs package.json
This commit is contained in:
commit
30a20553ea
6 changed files with 38 additions and 5 deletions
|
@ -64,6 +64,9 @@
|
||||||
|
|
||||||
$dropzone.find('.js-fileupload').fileupload().fileupload("option", {
|
$dropzone.find('.js-fileupload').fileupload().fileupload("option", {
|
||||||
url: '/ghost/upload/',
|
url: '/ghost/upload/',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
add: function (e, data) {
|
add: function (e, data) {
|
||||||
$dropzone.find('.js-fileupload').removeClass('right');
|
$dropzone.find('.js-fileupload').removeClass('right');
|
||||||
$dropzone.find('.js-url, button.centre').remove();
|
$dropzone.find('.js-url, button.centre').remove();
|
||||||
|
|
|
@ -23,6 +23,16 @@
|
||||||
|
|
||||||
_.extend(Ghost, Backbone.Events);
|
_.extend(Ghost, Backbone.Events);
|
||||||
|
|
||||||
|
Backbone.oldsync = Backbone.sync;
|
||||||
|
// override original sync method to make header request contain csrf token
|
||||||
|
Backbone.sync = function (method, model, options, error) {
|
||||||
|
options.beforeSend = function (xhr) {
|
||||||
|
xhr.setRequestHeader('X-CSRF-Token', $("meta[name='csrf-param']").attr('content'));
|
||||||
|
};
|
||||||
|
/* call the old sync method */
|
||||||
|
return Backbone.oldsync(method, model, options, error);
|
||||||
|
};
|
||||||
|
|
||||||
Ghost.init = function () {
|
Ghost.init = function () {
|
||||||
Ghost.router = new Ghost.Router();
|
Ghost.router = new Ghost.Router();
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,9 @@
|
||||||
if (self.className.indexOf('notification-persistent') !== -1) {
|
if (self.className.indexOf('notification-persistent') !== -1) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
url: '/api/v0.1/notifications/' + $(self).find('.close').data('id')
|
url: '/api/v0.1/notifications/' + $(self).find('.close').data('id')
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
bbSelf.$el.slideUp(250, function () {
|
bbSelf.$el.slideUp(250, function () {
|
||||||
|
@ -231,6 +234,9 @@
|
||||||
bbSelf = this;
|
bbSelf = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
url: '/api/v0.1/notifications/' + $(self).data('id')
|
url: '/api/v0.1/notifications/' + $(self).data('id')
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
var height = bbSelf.$('.js-notification').outerHeight(true),
|
var height = bbSelf.$('.js-notification').outerHeight(true),
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
return Backbone.trigger('blog:activeItem', null);
|
return Backbone.trigger('blog:activeItem', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var id = this.collection.at(0).id;
|
var id = this.collection.at(0) ? this.collection.at(0).id : false;
|
||||||
if (id) {
|
if (id) {
|
||||||
Backbone.trigger('blog:activeItem', id);
|
Backbone.trigger('blog:activeItem', id);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,8 @@
|
||||||
// Load moar posts!
|
// Load moar posts!
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.collection.fetch({
|
this.collection.fetch({
|
||||||
|
update: true,
|
||||||
|
remove: false,
|
||||||
data: {
|
data: {
|
||||||
status: 'all',
|
status: 'all',
|
||||||
page: (self.collection.currentPage + 1),
|
page: (self.collection.currentPage + 1),
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/ghost/signin/',
|
url: '/ghost/signin/',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
email: email,
|
email: email,
|
||||||
password: password,
|
password: password,
|
||||||
|
@ -87,6 +90,9 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/ghost/signup/',
|
url: '/ghost/signup/',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
name: name,
|
name: name,
|
||||||
email: email,
|
email: email,
|
||||||
|
@ -136,6 +142,9 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/ghost/forgotten/',
|
url: '/ghost/forgotten/',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
email: email
|
email: email
|
||||||
},
|
},
|
||||||
|
|
|
@ -204,8 +204,8 @@
|
||||||
var self = this, upload = new Ghost.Models.uploadModal({'key': key, 'src': src, 'id': this.id, 'accept': {
|
var self = this, upload = new Ghost.Models.uploadModal({'key': key, 'src': src, 'id': this.id, 'accept': {
|
||||||
func: function () { // The function called on acceptance
|
func: function () { // The function called on acceptance
|
||||||
var data = {};
|
var data = {};
|
||||||
if (this.$('#uploadurl').val()) {
|
if (this.$('.js-upload-url').val()) {
|
||||||
data[key] = this.$('#uploadurl').val();
|
data[key] = this.$('.js-upload-url').val();
|
||||||
} else {
|
} else {
|
||||||
data[key] = this.$('.js-upload-target').attr('src');
|
data[key] = this.$('.js-upload-target').attr('src');
|
||||||
}
|
}
|
||||||
|
@ -266,8 +266,8 @@
|
||||||
var self = this, upload = new Ghost.Models.uploadModal({'key': key, 'src': src, 'id': this.id, 'accept': {
|
var self = this, upload = new Ghost.Models.uploadModal({'key': key, 'src': src, 'id': this.id, 'accept': {
|
||||||
func: function () { // The function called on acceptance
|
func: function () { // The function called on acceptance
|
||||||
var data = {};
|
var data = {};
|
||||||
if (this.$('#uploadurl').val()) {
|
if (this.$('.js-upload-url').val()) {
|
||||||
data[key] = this.$('#uploadurl').val();
|
data[key] = this.$('.js-upload-url').val();
|
||||||
} else {
|
} else {
|
||||||
data[key] = this.$('.js-upload-target').attr('src');
|
data[key] = this.$('.js-upload-target').attr('src');
|
||||||
}
|
}
|
||||||
|
@ -379,6 +379,9 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/ghost/changepw/',
|
url: '/ghost/changepw/',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||||
|
},
|
||||||
data: {
|
data: {
|
||||||
password: oldPassword,
|
password: oldPassword,
|
||||||
newpassword: newPassword,
|
newpassword: newPassword,
|
||||||
|
|
Loading…
Add table
Reference in a new issue