socialforge/app/views/messages/_course_show.html.erb

220 lines
7.5 KiB
Plaintext

<style type="text/css">
.lz {
position: relative;
min-height: 200px;
margin: 10px 2px;
border-radius: 5px;
box-shadow: 1px 1px 6px #97EBF4;
}
.lz-left {
float: left;
margin: 2%;
padding: 0;
}
.memo-section {
width: auto;
margin-left: 15%;
padding-top: 1%;
border-left: 2px dotted #EEE;/*#8BE9F3;*/
}
.memo-title {
margin: 1em 0;
padding-left: 1%;
padding-bottom: 1%;
font-weight: bold;
border-bottom: 1px dashed rgb(204, 204, 204);
}
.memo-content {
padding: 1%;
margin: 1%;
margin-bottom: 40px;
background-color: #F6F6F6;
white-space: normal;
/*word-break: break-all; */
word-wrap: break-word;
}
.memo-timestamp {
position: absolute;
bottom: 0px;
/*right: 0;*/
left: 0;
margin: 20px;
}
.replies {
float: right;
/*max-width: 90%;*/
}
.reply-box {
float: right;
width: 640px;
padding: 3%;
/*border: 2px solid #C6F3F9;*/
border-top: 2px double #C6F3F9;
/*border-radius: 10px;*/
}
</style>
<div class="lz">
<!-- 在这里添加赞和踩-->
<span id="praise_tread" style="float: right">
<%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @topic,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%>
</span>
<div class="contextual">
<%= watcher_link(@topic, User.current) %>
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => @topic},
:remote => true,
:method => 'get',
:class => 'icon icon-comment',
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'icon icon-edit'
) if @message.course_editable_by?(User.current) %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del'
) if @message.course_destroyable_by?(User.current) %>
</div>
<div class="lz-left">
<div class="">
<%= link_to image_tag(url_to_avatar(@topic.author), :class => "avatar"), user_path(@topic.author) %>
</div>
<p class="">
<%= link_to @topic.author, user_path(@topic.author) %>
</p>
</div>
<div class="memo-section">
<div class="memo-title <%= @topic.sticky? ? 'sticky' : '' %> <%= @topic.locked? ? 'locked' : '' %>" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<% if @project %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, project_boards_path(@topic.project),title: @topic.subject.to_s %>
<% elsif @course %>
<%= label_tag l(:field_subject) %>: <%= link_to @topic.subject, course_boards_path(@topic.course),title: @topic.subject.to_s %>
<% end %>
</div>
<div class="memo-content">
<%= textilizable(@topic, :content) %>
<%= link_to_attachments @topic, :author => false %>
</div>
<div class="memo-timestamp">
<div style="float: left">
<%= authoring @topic.created_on, @topic.author %>
</div>
<div style="float: right">
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>
</div>
</div>
</div>
<br />
</div>
<% unless @replies.empty? %>
<br />
<br />
<br />
<br />
<h3 class="comments">
<%= l(:label_reply_plural) %>
(<%= @reply_count %>)
</h3>
<% reply_count = 0 %>
<% @replies.each do |message| %>
<div class="message reply" id="<%= "message-#{message.id}" %>">
<table class="borad-text-list">
<tr>
<td rowspan="3" valign="top" width="60px">
<%= link_to image_tag(url_to_avatar(message.author), :class => "avatar"), user_path(message.author) %>
</td>
<td>
<div class="contextual-borad">
<%= link_to(
l(:button_quote),
{:action => 'quote', :id => message},
:remote => true,
:method => 'get',
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => message},
:title => l(:button_edit)
) if message.course_editable_by?(User.current) %>
<%= link_to(
#image_tag('delete.png'),
l(:button_delete),
{:action => 'destroy', :id => message},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if message.course_destroyable_by?(User.current) %>
</div></td>
</tr>
<tr>
<td class="comments">
<div class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;">
<%= textilizable message,:content,:attachments => message.attachments %>
</div>
<%= link_to_attachments message, :author => false %>
</td>
</tr>
<tr>
<td class="font_lighter" style="float: left">
<%= authoring message.created_on, message.author %>
</td>
</tr>
</table>
</div>
<% end %>
<div class="pagination">
<%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false %>
</div>
<% end %>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div id="reply" style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
<input type="button" class="enterprise" value="<%=l(:button_submit) %>" onclick="submit_message_replay();" >
<% end %>
<div id="preview" class="wiki"></div>
</div>
<% end %>
<% html_title @topic.subject %>
<script type="text/javascript">
var flag = false;
jQuery(document).ready(function($) {
transpotUrl('#content');
});
function submit_message_replay()
{
if(flag)
{
$("#message-form").submit();
}
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
flag = false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
flag = true;
}
}
</script>