<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% tip1 = (@bid.reward_type == 3) ? l(:label_student_response) : l(:label_user_response) %>
<p class="font_lighter" style="font-size: 15px; padding-left: 12px; ">
  <%=tip1%>
</p>

<div id='leave-message'>
	<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
</div>
<% label = ''
  case @bid.reward_type
    when 1
      label = l(:label_respond_requirement)
    when 2
      label = l(:label_contest_requirement)
    when 3
      label = l(:label_question_requirement)
    else
  end
%>  


<% if journals.size >0 %>
    <ul class="message-for-user">
      <% for journal in journals%>
        <li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
            <span class="portrait">
                <%= image_tag(url_to_avatar(journal.user), :class => "avatar") %>
            </span>
            <span class="body">
                <span class="user">
                  <%= link_to journal.user, user_path(journal.user)%>
                </span>
                <span class="font_lighter">
                  <%= label %>
                </span>
                <div>
                  <%= textilizable journal.notes%>
                </div>
                <span class="font_lighter">
                  <%= l(:label_bids_published) %>&nbsp;
                  <%= time_tag(journal.created_on).html_safe %>&nbsp;
                  <%= l(:label_bids_published_ago) %>
                </span>
                <% ids = 'project_respond_form_'+ journal.id.to_s%>
                <span>
                    <% if reply_allow %>
                      <%= link_to(l(:button_quote), {:controller => 'bids', :action => 'new', :id => bid, :journal_id => journal},
                                  :remote => true,:method => 'post', :title => l(:button_quote))%>
                       <%= link_to l(:label_bid_respond_quote),'',
                            {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.name}: '); $('##{ids} textarea') ;return false;"} %>
                    <% end %>
                    <% if @user==User.current|| User.current.admin? %>
                      <%= link_to(l(:label_bid_respond_delete),
                                  {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
                                  :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
                                  :class => "delete", :title => l(:button_delete))  %>
                    <% end %>
                </span>
            </span>
            <div style="clear: both;"></div>
          <% ids = 'project_respond_form_'+ journal.id.to_s%>
          <% if reply_allow %>
              <div id='<%= ids %>' class="respond-form">
                <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
              </div>
          <% end %>
          <div style="clear: both;"></div>
          <div>
            <%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => true } %>
          </div>
        </li>
      <% end %>
    </ul>
<% end %>
