#{param name=taskLogs/}
#{param name=userMap/}
#{param name=bundle/}

<%
import org.exoplatform.task.util.ResourceUtil;
import org.exoplatform.commons.utils.HTMLEntityEncoder;
import org.exoplatform.commons.utils.DateUtils;

def encoder = HTMLEntityEncoder.getInstance();
%>
<ul class="list-changes">
<%for (def log : taskLogs) {%>
    <li class="clearfix">
       <div class="pull-left">
            <%
                def user = userMap[log.author];
            	 def author = "<a href=\"${user.url}\">" + encoder.encode(user.displayName) + "</a>"; 
            	 def key = "log." + log.getActionName();
            %>
            <%
                def target = log.target == null ? "" : log.target;
            %>
            <% if (log.getActionName() == 'assign' || log.getActionName() == 'unassign') { %>
                <%
                    def href = '#';
                    if (target != null && userMap[target] != null) {
                        def u = userMap[target];
                        target = u.displayName;
                        href = u.url;
                    }
                    target = "<a href=\"${href}\">" + encoder.encode(target) + "</a>";  
                %>
            <% } else {
                if ("edit_status" == log.getActionName()) {
                    target = "<span>" + encoder.encode(ResourceUtil.resolveStatus(bundle, target)) + "</span>";
                }
					}%>
					${ResourceUtil.resolveMessage(bundle, key, author, target)}.
        </div>        
        <span class="date pull-right">
            <%= DateUtils.getRelativeTimeLabel(bundle.getLocale(), log.getCreatedTime())%>
        </span>
    </li>
<%} %>
</ul>