Merge branch 'szzh' into cxt_course

This commit is contained in:
cxt 2015-12-31 09:23:14 +08:00
commit 16a6278b29
23 changed files with 572 additions and 42 deletions

View File

@ -75,7 +75,7 @@ class MessagesController < ApplicationController
@replies = paginateHelper messages_replies,10
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_courses"#by young
else
elsif @project
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
@ -86,6 +86,18 @@ class MessagesController < ApplicationController
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_projects"#by young
else
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
@reply = Message.new(:subject => "RE: #{@message.subject}")
@organization = @org_subfield.organization
render :action => "show", :layout => "base_org"#by young
end
end
@ -248,7 +260,14 @@ class MessagesController < ApplicationController
else
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
if @project
layout_file = 'base_projects'
elsif @course
layout_file = 'base_courses'
elsif @org_subfield
@organization = @org_subfield.organization
layout_file = 'base_org'
end
render :layout => layout_file
}
end
@ -287,6 +306,16 @@ class MessagesController < ApplicationController
redirect_to course_board_url(@course, @board)
end
end
elsif @org_subfield
if params[:is_board]
redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id)
else
if @message.parent
redirect_to board_message_url(@board, @message.parent, :r => r)
else
redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id)
end
end
end
end
@ -319,15 +348,25 @@ class MessagesController < ApplicationController
org_subfield_ids = params[:org_subfields]
@message = Message.find(params[:id])
# @message.update_attribute(:updated_on, Time.now)
type = @message.board.course_id.nil? ? "Project":"Course"
# type = @message.board.course_id.nil? ? "Project":"Course"
org_subfield_ids.each do |field_id|
OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => @message.id, :message_type => type)
org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id)
if org_acts.all.size() > 0
org_acts.first.update_attribute(:updated_at, Time.now)
else
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => @message.id, :user_id => User.current.id)
@message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1)
@message.save
board = OrgSubfield.find(field_id).boards.first
mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id,
:created_on => Time.now, :updated_on => Time.now, :locked => @message.locked, :sticky => @message.sticky)
@message.attachments.each do |attach|
mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
# OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => mes.id, :message_type => type)
# org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id)
# if org_acts.all.size() > 0
# org_acts.first.update_attribute(:updated_at, Time.now)
# else
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id)
# end
end
end
@ -347,6 +386,9 @@ class MessagesController < ApplicationController
@project = @board.project
elsif @board.course_id
@course = @board.course
else
@org_subfield = @board.org_subfield
@organization = @org_subfield
end
rescue ActiveRecord::RecordNotFound

View File

@ -14,7 +14,7 @@ class OrganizationsController < ApplicationController
include PollHelper
helper :user_score
helper :journals
helper :attachments
# added by liuping 关注
helper :watchers

View File

@ -23,8 +23,8 @@ class Message < ActiveRecord::Base
belongs_to :board,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_many :org_subfield_messages, :dependent => :destroy
has_many :org_subfields, :through => :org_subfield_messages
# has_many :org_subfield_messages, :dependent => :destroy
# has_many :org_subfields, :through => :org_subfield_messages
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
acts_as_attachable
@ -150,6 +150,10 @@ class Message < ActiveRecord::Base
usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course)))
end
def org_subfield_editable_by?(usr)
usr && usr.logged? && (usr.admin? || self.author == usr ||usr.admin_of_org?(self.board.org_subfield.organization))
end
def course_destroyable_by?(usr)
usr && usr.logged? && (usr.allowed_to?(:delete_messages, course) || (self.author == usr && usr.allowed_to?(:delete_own_messages, course)))
end
@ -192,7 +196,7 @@ class Message < ActiveRecord::Base
# Description
def act_as_forge_activity
# 如果project为空那么就是课程相关的消息
if !self.board.project.nil? && self.parent_id.nil?
if self.board.project_id != -1 && self.parent_id.nil?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.board.project.id)
end
@ -227,7 +231,7 @@ class Message < ActiveRecord::Base
end
end
end
else # 项目相关
elsif self.project # 项目相关
if self.parent_id.nil? # 主贴
self.project.members.each do |m|
if m.user_id != self.author_id

View File

@ -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/org_subfield_new',
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :org_subfield => org_subfield} %>
</div>

View File

@ -0,0 +1,74 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false) %>
<% end %>
<%= 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 w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_org?(org_subfield.organization)%>
<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>
<% end %>
<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' %>
<%= 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 },
at_id: topic.id, at_type: topic.class.to_s
%>
<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="submitbtn" class="blue_btn fr " style="margin-left: 55px">
<%#= l(:button_submit)%>
</a>
<div class="cl"></div>
</li>-->
</div>
</div>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','courses','org' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -57,7 +57,7 @@
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.course_destroyable_by?(User.current) %>
<%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
<%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
</li>
</ul>
</li>

View File

@ -0,0 +1,199 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function course_board_canel_message_replay()
{
message_content_editor.html("");
}
function course_board_submit_message_replay()
{
if(MessageReplayVevify())
{
message_content_editor.sync();//提交内容之前要sync不然服务器端取不到值
$("#message_form").submit();
}
}
function MessageReplayVevify() {
var content = message_content_editor.html();//$.trim($("#message_content").val());
if (message_content_editor.isEmpty()) {
$("#message_content_span").text("回复不能为空");
$("#message_content_span").css('color', '#ff0000');
return false;
}
else {
$("#message_content_span").text("填写正确");
$("#message_content_span").css('color', '#008000');
return true;
}
}
$(function() {
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
</script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
</div>
<div class="postThemeWrap">
<% if @topic.author.id == User.current.id%>
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'postOptionLink'
) if @message.org_subfield_editable_by?(User.current) %>
</li>
<li>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.org_subfield_editable_by?(User.current) %>
</li>
<!--<li> <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>-->
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @topic.try(:author).try(:realname) == ' ' %>
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @topic.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%= link_to_attachments_course @topic, :author => false %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<% unless @replies.empty? %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %></div>
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %>
</div>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.org_subfield_editable_by?(User.current) %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %>
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
</div>

View File

@ -112,8 +112,8 @@
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.destroyable_by?(User.current) %>
<%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
</li>
<li> <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>
</ul>
</li>
</ul>

View File

@ -2,10 +2,14 @@
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
<% if !org.nil? %>
<span class="fontBlue pl10">组织:<%= org.name %></span>
<% org.org_subfields.where("field_type='Post'").each do |subfield| %>
<li>
<label><input type="checkbox" name='org_subfields[]' value='<%= subfield.id %>' class="mt3 fl mr5"/><span><%= subfield.name %></span></label>
</li>
<% if org.org_subfields.where("field_type='Post'").count > 0 %>
<% org.org_subfields.where("field_type='Post'").each do |subfield| %>
<li>
<label><input type="checkbox" name='org_subfields[]' value='<%= subfield.id %>' class="mt3 fl mr5"/><span><%= subfield.name %></span></label>
</li>
<% end %>
<% else %>
<li><span class="mt3 fl mr5">暂无资源栏目</span></li>
<% end %>
<% else %>
<span class="fontBlue pl10">请在左侧选择组织</span>

View File

@ -22,6 +22,18 @@
<%= render :partial => 'boards/course_message_edit',
:locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %>
<% end %>
<% elsif @message.board.org_subfield %>
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
} do |f| %>
<%= render :partial => 'boards/org_subfield_message_edit',
:locals => {:f => f, :edit_mode => true, :topic => @message, :org_subfield => @message.board.org_subfield} %>
<% end %>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -2,5 +2,7 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");

View File

@ -2,4 +2,6 @@
<%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %>
<%= render :partial => 'course_show', locals: {course: @course} %>
<% else %>
<%= render :partial => 'org_subfield_show', :locals => {:org_subfield => @org_subfield} %>
<% end %>

View File

@ -50,31 +50,22 @@
<% end %>
<% end %>
<% if act.container_type == 'OrgSubfield' %>
<% if act.org_act_type == 'Message' %>
<% if act.org_act_type == 'Message' and act.org_act_id and Message.where("id=#{act.org_act_id}").count > 0 %>
<% message = Message.find(act.org_act_id) %>
<% if !message.board.course_id.nil? %>
<%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
<% else %>
<% elsif message.board.project_id != -1 %>
<%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
<% elsif message.board.org_subfield_id %>
<%= render :partial => 'organizations/org_subfield_message', :locals => {:activity => message, :user_activity_id => act.id} %>
<% end %>
<% end %>
<% end %>
<% end %>
<!--<ul class="wlist" style=" border:none; padding-top: 15px;">-->
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<!--</ul>-->
<% end %>
<% if org_act_count == 10 %>
<!--<div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>-->
<%= link_to "点击展开更多",organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>
<!--
<script>
$(function(){
$("#show_more_activities").mouseover(function(){
$("#more_org_activities_link").click();
})
})

View File

@ -0,0 +1,118 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.board.org_subfield.name.to_s+" | 资源栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%>
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.board.org_subfield.name %>(项目讨论区)</a>-->
</div>
<div class="homepagePostTitle break_word">
<% if activity.parent_id.nil? %>
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
%>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
%>
<% end %>
</div>
<div class="homepagePostDate">
时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %>
<%= activity.content.to_s.html_safe%>
<% else %>
<%= activity.parent.content.to_s.html_safe%>
<% end %>
</div>
</div>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% count = 0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<%=count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
<% end %>
</div>
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
});
</script>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(reply.created_on) %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
<%= reply.content.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -18,6 +18,9 @@
<%= document.content.html_safe %>
</div>
<% end %>
<div class=" fl" style="width: 600px">
<%= link_to_attachments_course document, :author => false %>
</div>
<!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>-->

View File

@ -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, :course => course} %>
</div>

View File

@ -69,10 +69,10 @@
<% end %>
<% if @org_activities %>
<%= render :partial => 'organizations/org_activities',
:locals => {:org_activities =>@org_activities,
:page=>@page,
:org => @organization,
:org_act_count=>@org_activities.count}%>
:locals => {:org_activities => @org_activities,
:page=> @page,
:org => @organization,
:org_act_count=> @org_activities.count} %>
<% end %>

View File

@ -25,7 +25,7 @@ else{
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: document.getElementById("work-src").innerText
value: $("#work-src").text()
}
);

View File

@ -62,6 +62,9 @@ RedmineApp::Application.routes.draw do
end
end
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
resources :org_member do
member do
@ -84,6 +87,7 @@ RedmineApp::Application.routes.draw do
match "quote_resource_show_org_subfield", :via => [:get]
end
end
resource :boards
end
resources :org_document_comments do

View File

@ -1,4 +1,5 @@
class AddQuotesToMessages < ActiveRecord::Migration
def change
add_column :messages, :quotes, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151230015904) do
ActiveRecord::Schema.define(:version => 20151229022049) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -198,7 +198,6 @@ ActiveRecord::Schema.define(:version => 20151230015904) do
t.integer "last_message_id"
t.integer "parent_id"
t.integer "course_id"
t.integer "org_subfield_id"
end
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
@ -1644,6 +1643,10 @@ ActiveRecord::Schema.define(:version => 20151230015904) do
t.string "extra"
end
create_table "temp", :id => false, :force => true do |t|
t.integer "id", :default => 0, :null => false
end
create_table "time_entries", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false

View File

@ -0,0 +1,39 @@
/**
* Created by ouyangxuhua on 2015/12/30.
*/
function submit_topic()
{
if(regexTopicSubject() && regexTopicDescription())
{
message_content_editor.sync();
$("#message-form").submit();
}
}
function regexTopicSubject() {
var name = $("#message_subject").val();
if(name.length ==0)
{
$("#subjectmsg").text("标题不能为空");
$("#subjectmsg").css('color','#ff0000');
$("#message_subject").focus();
return false;
}
else if(name.length <= 255)
{
$("#subjectmsg").text("填写正确");
$("#subjectmsg").css('color','#008000');
return true;
}
else
{
$("#subjectmsg").text("标题超过255个字符");
$("#subjectmsg").css('color','#ff0000');
$("#message_subject").focus();
return false;
}
}
function reset_topic(){
}