mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
URL can now be removed when editing a post
This commit is contained in:
parent
3141c204c2
commit
bf90eedf37
2 changed files with 10 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
* Updating to Iron Router 1.0.
|
* Updating to Iron Router 1.0.
|
||||||
* Adding view counter (thanks @steffenstraetz! See [PR #489](https://github.com/TelescopeJS/Telescope/pull/489))
|
* Adding view counter (thanks @steffenstraetz! See [PR #489](https://github.com/TelescopeJS/Telescope/pull/489))
|
||||||
* Splitting out `router.js` in multiple files.
|
* Splitting out `router.js` in multiple files.
|
||||||
|
* URL can now be removed when editing a post (thanks @massimilianomarini! See [PR 484](https://github.com/TelescopeJS/Telescope/pull/484)).
|
||||||
|
|
||||||
## v0.9.8
|
## v0.9.8
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ Template[getTemplate('post_edit')].events({
|
||||||
},
|
},
|
||||||
'click input[type=submit]': function(e, instance){
|
'click input[type=submit]': function(e, instance){
|
||||||
var post = this;
|
var post = this;
|
||||||
|
var updateObject = {};
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -107,6 +108,9 @@ Template[getTemplate('post_edit')].events({
|
||||||
var url = $('#url').val();
|
var url = $('#url').val();
|
||||||
if(!!url){
|
if(!!url){
|
||||||
properties.url = (url.substring(0, 7) == "http://" || url.substring(0, 8) == "https://") ? url : "http://"+url;
|
properties.url = (url.substring(0, 7) == "http://" || url.substring(0, 8) == "https://") ? url : "http://"+url;
|
||||||
|
} else {
|
||||||
|
// if URL is empty, unset it
|
||||||
|
updateObject.$unset = {url: ""};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShortURL
|
// ShortURL
|
||||||
|
@ -176,9 +180,10 @@ Template[getTemplate('post_edit')].events({
|
||||||
// ------------------------------ Update ------------------------------ //
|
// ------------------------------ Update ------------------------------ //
|
||||||
|
|
||||||
if (properties) {
|
if (properties) {
|
||||||
Posts.update(post._id,{
|
|
||||||
$set: properties
|
updateObject.$set = properties;
|
||||||
}, function(error){
|
|
||||||
|
Posts.update(post._id, updateObject, function(error){
|
||||||
if(error){
|
if(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
throwError(error.reason);
|
throwError(error.reason);
|
||||||
|
|
Loading…
Add table
Reference in a new issue