Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
commit
778ff80b55
@ -0,0 +1,34 @@
|
||||
class PrincipalActivity < ActiveRecord::Base
|
||||
attr_accessible :principal_act_id, :principal_act_type, :principal_id, :user_id
|
||||
#虚拟关联
|
||||
belongs_to :principal_act ,:polymorphic => true
|
||||
belongs_to :user
|
||||
validates :user_id,presence: true
|
||||
validates :principal_id,presence: true
|
||||
validates :principal_act_id,presence: true
|
||||
validates :principal_act_type, presence: true
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity
|
||||
before_destroy :destroy_user_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.principal_act_type.to_s}' and act_id = '#{self.principal_act_id}'").first
|
||||
if user_activity
|
||||
user_activity.save
|
||||
else
|
||||
user_activity = UserActivity.new
|
||||
user_activity.act_id = self.principal_act_id
|
||||
user_activity.act_type = self.principal_act_type
|
||||
user_activity.container_type = "Principal"
|
||||
user_activity.container_id = self.principal_id
|
||||
user_activity.user_id = self.user_id
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.principal_act_type.to_s}' and act_id = '#{self.principal_act_id}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
end
|
@ -0,0 +1,16 @@
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
编辑帖子
|
||||
</div>
|
||||
</div>
|
||||
<%= render :partial => 'boards/course_new',
|
||||
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic} %>
|
||||
</div>
|
@ -1,12 +1,67 @@
|
||||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||||
<%= error_messages_for 'message' %>
|
||||
<div class="resources mt10">
|
||||
<div id="new_course_topic">
|
||||
<div class="homepagePostBrief c_grey">
|
||||
<div>
|
||||
<input type="text" name="message[subject]" id="message_subject" class="InputBox w704" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div id="topic_editor" style="display: none;">
|
||||
<div class="mt10">
|
||||
<%= f.check_box :sticky, :value => topic.sticky%>
|
||||
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<%= f.check_box :locked, :value => topic.locked%>
|
||||
<%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
|
||||
<li>
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => topic.nil? ? 0: topic.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '100%',
|
||||
:height => 300,
|
||||
:minHeight=>300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<%if !edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %>
|
||||
<!--<li>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%#= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
|
||||
<%= l(:button_submit)%>
|
||||
<%#= l(:button_submit)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</li>-->
|
||||
</div>
|
||||
</div>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show',:locals => {:topics => @topics, :page => @page} )%>");
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,31 @@
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-outline{border:none;}
|
||||
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
|
||||
.ReplyToMessageInputContainer .ke-container{float:left;}
|
||||
</style>
|
||||
|
||||
<div class="ReplyToMessageContainer borderBottomNone" id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" value="<%= temp.content %>">
|
||||
<input type="hidden" name="reply[subject]" value="<%= subject %>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
@ -1,45 +1,38 @@
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_course_board) %></h2>
|
||||
</div>
|
||||
<% if @message.project %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_course_board) %></h2>
|
||||
</div>
|
||||
|
||||
|
||||
<% if @message.project %>
|
||||
<%#= board_breadcrumb(@message) %>
|
||||
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
|
||||
<div class="ml15">
|
||||
<ul>
|
||||
<%= form_for @message, { :as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<!--<h3><%#= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;word-wrap: break-word;"><%#=h @topic.subject %></span></h3>-->
|
||||
<div class="ml15">
|
||||
<ul>
|
||||
<%= form_for @message, {:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<%= render :partial => 'form_project',
|
||||
:locals => {:f => f, :replying => !@message.parent.nil?} %>
|
||||
<a href="#" onclick="submitProjectsBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
|
||||
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
:locals => {:f => f, :replying => !@message.parent.nil?} %>
|
||||
<a href="#" onclick="submitProjectsBoard();" class="blue_btn fl c_white"><%= l(:button_submit) %></a>
|
||||
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% elsif @message.course %>
|
||||
<%#= course_board_breadcrumb(@message) %>
|
||||
<div class="talk_new ml15">
|
||||
<ul>0
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<%= render :partial => 'form_course',
|
||||
:locals => {:f => f, :replying => !@message.parent.nil?} %>
|
||||
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
|
||||
<%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %>
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<%= render :partial => 'boards/course_message_edit',
|
||||
:locals => {:f => f, :edit_mode => true, :topic => @message} %>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div id="preview" class="wiki"></div>
|
||||
|
@ -1,8 +1,16 @@
|
||||
$('#message_subject').val("<%= raw escape_javascript(@subject) %>");
|
||||
$('#message_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
/*$('#message_subject').val("<%#= raw escape_javascript(@subject) %>");
|
||||
$('#message_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
|
||||
$('#quote_quote').html("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
$('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
|
||||
showAndScrollTo("reply", "message_content");
|
||||
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
|
||||
$("img").removeAttr("align");
|
||||
$("img").removeAttr("align");*/
|
||||
if($("#reply_message_<%= @message.id%>").length > 0) {
|
||||
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>");
|
||||
$(function(){
|
||||
init_activity_KindEditor_data(<%= @message.id%>,null,"85%");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @message.id%>").length >0) {
|
||||
$("#reply_to_message_<%= @message.id%>").replaceWith("<p id='reply_message_<%= @message.id%>'></p>");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue