parent
8b22df1b6c
commit
257f33a3d3
@ -70,7 +70,7 @@ class ReactController extends Gdn_Controller {
|
|||||||
$Item = $Model->GetID($ID);
|
$Item = $Model->GetID($ID);
|
||||||
|
|
||||||
if($Item) {
|
if($Item) {
|
||||||
$Anchor = $AnchorID . $ID . ' .ReactMenu';
|
$Anchor = $AnchorID . $ID;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Gdn_UserException(T('Yaga.Action.InvalidTargetID'));
|
throw new Gdn_UserException(T('Yaga.Action.InvalidTargetID'));
|
||||||
@ -98,7 +98,8 @@ class ReactController extends Gdn_Controller {
|
|||||||
// It has passed through the gauntlet
|
// It has passed through the gauntlet
|
||||||
$this->ReactionModel->Set($ID, $Type, $ItemOwnerID, $UserID, $ActionID);
|
$this->ReactionModel->Set($ID, $Type, $ItemOwnerID, $UserID, $ActionID);
|
||||||
|
|
||||||
$this->JsonTarget($Anchor, RenderReactionList($ID, $Type, FALSE), 'ReplaceWith');
|
$this->JsonTarget($Anchor . ' .ReactMenu', RenderReactionList($ID, $Type, FALSE), 'ReplaceWith');
|
||||||
|
$this->JsonTarget($Anchor . ' .ReactionRecord', RenderReactionRecord($ID, $Type, FALSE), 'ReplaceWith');
|
||||||
|
|
||||||
// Don't render anything
|
// Don't render anything
|
||||||
$this->Render('Blank', 'Utility', 'Dashboard');
|
$this->Render('Blank', 'Utility', 'Dashboard');
|
||||||
|
@ -56,10 +56,11 @@ if(!function_exists('RenderReactionRecord')) {
|
|||||||
* @param int $ID
|
* @param int $ID
|
||||||
* @param string $Type 'discussion', 'activity', or 'comment'
|
* @param string $Type 'discussion', 'activity', or 'comment'
|
||||||
*/
|
*/
|
||||||
function RenderReactionRecord($ID, $Type) {
|
function RenderReactionRecord($ID, $Type, $Echo = TRUE) {
|
||||||
$Reactions = Yaga::ReactionModel()->GetRecord($ID, $Type);
|
$Reactions = Yaga::ReactionModel()->GetRecord($ID, $Type);
|
||||||
$Limit = C('Yaga.Reactions.RecordLimit');
|
$Limit = C('Yaga.Reactions.RecordLimit');
|
||||||
$ReactionCount = count($Reactions);
|
$ReactionCount = count($Reactions);
|
||||||
|
$RecordsString = '';
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($Reactions as $Reaction) {
|
foreach($Reactions as $Reaction) {
|
||||||
$i++;
|
$i++;
|
||||||
@ -80,13 +81,23 @@ if(!function_exists('RenderReactionRecord')) {
|
|||||||
'data-userid' => $User->UserID,
|
'data-userid' => $User->UserID,
|
||||||
'title' => $DateTitle
|
'title' => $DateTitle
|
||||||
);
|
);
|
||||||
echo Wrap($String, 'span', $Wrapttributes);
|
$RecordsString .= Wrap($String, 'span', $Wrapttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($Limit > 0 && $i >= $ReactionCount && $ReactionCount > $Limit) {
|
if($Limit > 0 && $i >= $ReactionCount && $ReactionCount > $Limit) {
|
||||||
echo Plural($ReactionCount - $Limit, 'Yaga.Reactions.RecordLimit.Single', 'Yaga.Reactions.RecordLimit.Plural');
|
$RecordsString .= Plural($ReactionCount - $Limit, 'Yaga.Reactions.RecordLimit.Single', 'Yaga.Reactions.RecordLimit.Plural');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$AllRecordsString = Wrap($RecordsString, 'div', array('class' => 'ReactionRecord'));
|
||||||
|
|
||||||
|
if($Echo) {
|
||||||
|
echo $AllRecordsString;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $AllRecordsString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user