优化页面代码

This commit is contained in:
sw 2014-10-11 15:48:51 +08:00
parent 9c3db03225
commit 75fb5a2cd3
2 changed files with 52 additions and 43 deletions

View File

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

View File

@ -1,13 +1,15 @@
<%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %> <%= form_tag({:controller => 'words', :action => 'create_reply'}, :remote => true) do %>
<%= text_area_tag 'user_notes', "", :class => 'noline', <%= text_area_tag 'user_notes', "", :class => 'noline',
:style => "resize: none;", :rows => 4, :style => "resize: none;", :rows => 4,
:placeholder => l(:label_projects_feedback_respond_content), :placeholder => l(:label_projects_feedback_respond_content),
:maxlength => 250 %> :maxlength => 250 %>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %>
<%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> <%= submit_tag l(:button_projects_feedback_respond), :name => nil ,
:class => "enterprise",
:style => "float: right; margin-top: 1px; margin-right: 4px;"%>
<% end %> <% end %>