1. namtrankhanh
  2. davidtranZurmoFork

Commits

Jason Green  committed 9055b28

Adding more content into latest activity view for conversations

  • Participants
  • Parent commits 86a5910
  • Branches convoandmissions

Comments (0)

Files changed (2)

File app/protected/modules/conversations/rules/ConversationMashableActivityRules.php

View file
             {
                 if ($viewModuleClassName == 'HomeModule')
                 {
-                    return "<span>{modelStringContent}</span><br/><span>" .
-                           "{relatedModelsByImportanceContent} </span><span class='less-pronounced-text'>" .
-                           Yii::t('Default', 'owned by {ownerStringContent}') . "</span>";
+                    return "<span>{modelStringContent}</span><br/>" .
+                           "<span class='less-pronounced-text'>" .
+                           Yii::t('Default', 'created by {ownerStringContent}') . "</span>" .
+                           "<span>{extraContent}</span><span>{relatedModelsByImportanceContent} </span>";
                 }
                 else
                 {
                     return "<span>{modelStringContent} </span><span class='less-pronounced-text'>" .
-                           Yii::t('Default', 'owned by {ownerStringContent}') . "</span>";
+                           Yii::t('Default', 'created by {ownerStringContent}') . "</span><span>{extraContent}</span>";
                 }
             }
             else
             {
                 if ($viewModuleClassName == 'HomeModule' || $viewModuleClassName == 'UsersModule')
                 {
-                    return "<span>{modelStringContent}</span><br/><span>" .
-                           "{relatedModelsByImportanceContent} </span><span>{extraContent}</span>";
+                    return "<span>{modelStringContent}</span><br/><span>{extraContent}</span><span>" .
+                           "{relatedModelsByImportanceContent} </span>";
                 }
                 else
                 {
 
         public function getLatestActivityExtraDisplayStringByModel($model)
         {
+            assert('$model instanceof Conversation');
+            $content      = null;
+            $content     .= ConversationsUtil::renderDescriptionOrLatestCommentContent($model);
+            $filesContent =  FileModelDisplayUtil::renderFileDataDetailsWithDownloadLinksContent($model, 'files');
+            if($filesContent != null)
+            {
+                if($content != null)
+                {
+                    $content .= '<br/>';
+                }
+                $content .= $filesContent;
+            }
+            return $content;
         }
     }
 ?>

File app/protected/modules/conversations/utils/ConversationsUtil.php

View file
     {
         public static function renderSubjectAndLatestForDisplayView(Conversation $conversation)
         {
-            $url     = Yii::app()->createUrl('/conversations/default/details', array('id' => $conversation->id));
-            $content = $conversation->subject;
+            $url            = Yii::app()->createUrl('/conversations/default/details', array('id' => $conversation->id));
+            $content        = $conversation->subject;
+            $latestContent .= static::renderDescriptionOrLatestCommentContent($conversation);
+            if($latestContent != null)
+            {
+                $content .= '<BR/>';
+                $content .= $latestContent;
+            }
+            return $content = ZurmoHtml::link($content, $url);
+        }
+
+        public static function renderDescriptionOrLatestCommentContent(Conversation $conversation)
+        {
+            $content = null;
             if($conversation->comments->count() > 0)
             {
-                $content .= '<BR/>';
                 $position = $conversation->comments->count() - 1;
                 if($conversation->comments->offsetGet($position)->createdByUser == Yii::app()->user->userModel)
                 {
             }
             elseif($conversation->description != null)
             {
-                $content .= '<BR/>';
                 if($conversation->owner == Yii::app()->user->userModel)
                 {
                     $content .= Yii::t('Default', 'Me') . ': ';
                 }
                 $content .= $conversation->description;
             }
-            return $content = ZurmoHtml::link($content, $url);
+            return $content;
         }
     }
 ?>