Skip to content
Snippets Groups Projects
Commit c9700678 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Fix likes feature

parent 21db728c
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
{namespace base=SGalinski\ProjectBase\ViewHelpers}
{namespace sg=SGalinski\SgNews\ViewHelpers}
{namespace sgajax=SGalinski\SgAjax\ViewHelpers}
<f:section name="main">
<f:alias map="{authorCount: '{newsMetaData.news.newsAuthor -> f:count()}'}">
......@@ -166,7 +167,7 @@
<div class="tx-sgnews-meta-bar">
<base:sharer />
<div class="tx-sgnews-likes" id="tx-sgnews-likes" data-uid="{newsMetaData.news.uid}">
<button class="tx-sgnews-like-buton btn btn-sm btn-info">
<button class="tx-sgnews-like-buton btn btn-sm btn-info" data-ajaxurl="{sgajax:uri.ajax(extensionName: 'SgNews', controller: 'Ajax\Like', action: 'addLike', format: 'json')}">
<span class="tx-sgnews-number-of-likes">
<span class="badge"><i class="fa fa-star-o" aria-hidden="true"></i>
<span class="tx-sgnews-number-of-likes-value">{newsMetaData.news.likes}</span>
......
......@@ -37,10 +37,10 @@ export default class Likes {
};
request.open(
'POST',
'?tx_sgajax[extensionName]=SgNews&tx_sgajax[controller]=Ajax\\Like&tx_sgajax[action]=addLike&tx_sgajax[format]=json'
this._likeButton.dataset['ajaxurl']
);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.send(`parameters[newsPid]=${this._newsId }`);
request.send(`tx_sgajax[parameters][newsPid]=${this._newsId }`);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment