socialforge/app/views/users/_intro_content.html.erb

44 lines
1.8 KiB
Plaintext

<div class="homepagePostIntro break_word upload_img maxh360 table_maxWidth " id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe %>
</div>
<% if defined?(samples) && !samples.empty? %>
<div class="mt5 homeworkInfo">
<p>输入输出样例:<%= samples.count %>组</p>
<% samples.each_with_index do |sample, index| %>
<span class="fl mt10">#<%= index + 1 %></span>
<ul class="fl ml20 mt10 program_input_ul">
<li>
<span class="fl">样例输入:</span>
<div class="fl ml10">
<pre class="program_input_pre"><%=sample.input %></pre>
</div>
</li>
<div class="cl"></div>
<li class="mt5">
<span class="fl">样例输出:</span>
<div class="fl ml10">
<pre class="program_input_pre"><%=sample.output %></pre>
</div>
</li>
</ul>
<div class="cl"></div>
<% end %>
</div>
<% end %>
</div>
<script type="text/javascript">
$(function(){
$("#intro_content_<%= user_activity_id%> p,#intro_content_<%= user_activity_id%> span,#intro_content_<%= user_activity_id%> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$(this).html(postContent);
});
autoUrl('intro_content_<%= user_activity_id%>');
description_show_hide(<%=user_activity_id %>);
});
</script>