Skip to content

Commit

Permalink
Fixed bugs in prependArticle, issue #47
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjonsson committed Jul 16, 2014
1 parent 4ae6410 commit 6f849b3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion arlima.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://github.com/victorjonsson/Arlima
Description: Manage the order of posts on your front page, or any page you want. This is a plugin suitable for online newspapers that's in need of a fully customizable front page.
Author: VK (<a href="http://twitter.com/chredd">@chredd</a>, <a href="http://twitter.com/znoid">@znoid</a>, <a href="http://twitter.com/victor_jonsson">@victor_jonsson</a>, <a href="http://twitter.com/lefalque">@lefalque</a>)
Version: 3.0.beta.40
Version: 3.0.beta.41
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Expand Down
11 changes: 7 additions & 4 deletions classes/AdminAjaxManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,18 @@ function prependArticle()

$post = get_post($post_id);
setup_postdata($post);
$GLOBALS['post'] = $post; // Soemhting is removing post from global, even though we call setup_postdata
$GLOBALS['post'] = $post; // Something is removing post from global, even though we call setup_postdata

$list = $this->loadListFactory()->loadList($list_id, false, true);
$articles = $list->getArticles();
array_unshift($articles, $this->postToArlimaArticle($post));

array_unshift($articles, $this->postToArlimaArticle($post));
$this->saveAndOutputList($list, $articles);
die;

} else {
die(json_encode(array()));
}
die(json_encode(array()));
}

/**
Expand Down Expand Up @@ -448,7 +451,7 @@ private function saveAndOutputList($list_id, $articles, $preview = false)
$list_factory->saveNewListVersion($list, $articles, get_current_user_id(), $preview);

// Reload list to get latest version
$list = $list_factory->loadList($list_id, false, true);
$list = $list_factory->loadList($list->getId(), false, true);

$this->outputListData($list);
}
Expand Down
2 changes: 1 addition & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
or define('ARLIMA_COMPILE_LESS_IN_BROWSER', ARLIMA_DEV_MODE);

// Plugin version (only edit this via grunt!)
define('ARLIMA_FILE_VERSION', '3.0.beta.40' .(ARLIMA_DEV_MODE ? '__'.time():''));
define('ARLIMA_FILE_VERSION', '3.0.beta.41' .(ARLIMA_DEV_MODE ? '__'.time():''));

// Which type of tag to use for images in Arlima RSS feeds
defined('ARLIMA_RSS_IMG_TAG')
Expand Down
15 changes: 10 additions & 5 deletions js/admin-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ jQuery(document).ready(function($) {
_ajax_nonce : ArlimaJSAdmin.arlimaNonce
};

$.post( ajaxurl, data, function(json) {
$('.ajax-loader', $metabox).hide();
$('.inside', $metabox).append('<p>'+ArlimaJSAdmin.lang.wasSentTo+' &quot;'+ list + '&quot;</p>');
}, 'json');

$.ajax({
url : ajaxurl,
type : 'POST',
data : data,
dataType : 'json',
success : function(json) {
$('.ajax-loader', $metabox).hide();
$('.inside', $metabox).append('<p>'+ArlimaJSAdmin.lang.wasSentTo+' &quot;'+ list + '&quot;</p>');
}
});
});

//
Expand Down
2 changes: 1 addition & 1 deletion js/arlima/arlima.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: @chredd, @znoid, @victor_jonsson, @lefalque, @aaslun
Tags: CMS, e-paper, e-magazine, magazine, newspaper, front page, wysiwyg
Requires at least: 3.8
Tested up to: 3.9.1
Stable tag: 3.0.beta.40
Stable tag: 3.0.beta.41
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down

0 comments on commit 6f849b3

Please sign in to comment.